Defining a physical model #97
Replies: 8 comments 24 replies
-
Creating an empty modelCurrently, to create a phase it is necessary to import the EasyDiffraction Another suggestion is to use ⚙ Currentfrom easyDiffractionLib import Phase
job.phases.append(Phase(name='lbco')) 💡 Suggestedjob.add_phase(id='lbco') |
Beta Was this translation helpful? Give feedback.
-
Setting basic parametersOnce a phase has been created and added to Examples of one-to-one correspondence:
Examples of minimally modified names:
CIF syntax
⚙ Currentphase = job.phases['lbco']
phase.spacegroup.space_group_HM_name = "P m -3 m"
phase.cell.length_a = 3.8909 💡 Suggestedphase = job.phases['lbco']
phase.space_group.name_HM_alt = "P m -3 m"
phase.cell.length_a = 3.8909 |
Beta Was this translation helpful? Give feedback.
-
Setting tabular parametersCIF allows table parameters to be set using the TableParameters of the CIF category atom_site.
CIF syntax
⚙ Currentfrom easyCrystallography.Components.AtomicDisplacement import AtomicDisplacement
phase = job.phases['lbco']
phase.add_atom(label="La",
type_symbol="La",
occupancy=0.5,
adp=AtomicDisplacement("Biso", Biso=0.6))
phase.add_atom(label="Ba",
type_symbol="Ba",
occupancy=0.5,
adp=AtomicDisplacement("Biso", Biso=0.1))
phase.add_atom(label="Co",
type_symbol="Co",
fract_x=0.5,
fract_y=0.5,
fract_z=0.5,
adp=AtomicDisplacement("Biso", Biso=0.1))
phase.add_atom(label="O",
type_symbol="O",
fract_x=0.0,
fract_y=0.5,
fract_z=0.5,
adp=AtomicDisplacement("Biso", Biso=1.3)) 💡 Suggestedphase = job.phases['lbco']
phase.atom_site.append(label="La",
type_symbol="La",
occupancy=0.5,
b_iso_or_equiv=0.6)
phase.atom_site.append(label="Ba",
type_symbol="Ba",
occupancy=0.5,
b_iso_or_equiv=0.1)
phase.atom_site.append(label="Co",
type_symbol="Co",
fract_x=0.5,
fract_y=0.5,
fract_z=0.5,
b_iso_or_equiv=0.1)
phase.atom_site.append(label="O",
type_symbol="O",
fract_x=0.0,
fract_y=0.5,
fract_z=0.5,
b_iso_or_equiv=1.3) |
Beta Was this translation helpful? Give feedback.
-
Creating a model from CIFIn addition to defining a phase programmatically, one need to be able to create a phase from a CIF string or file and add it to a CIF stringphase_cif = '''
data_coo
_space_group.name_H-M_alt "F m -3 m"
_cell.length_a 4.263
_cell.length_b 4.263
_cell.length_c 4.263
_cell.angle_alpha 90.0
_cell.angle_beta 90.0
_cell.angle_gamma 90.0
loop_
_atom_site.label
_atom_site.type_symbol
_atom_site.fract_x
_atom_site.fract_y
_atom_site.fract_z
_atom_site.occupancy
_atom_site.ADP_type
_atom_site.B_iso_or_equiv
Co Co 0.0 0.0 0.0 1.0 Biso 0.509
O O 0.5 0.5 0.5 1.0 Biso 0.670
''' ⚙ Currentfrom easyDiffractionLib import Phases
phases = Phases.from_cif_string(phase_cif)
phase = phases['coo']
job.phases.append(phase) 💡 Suggestedjob.add_phase_from_cif(phase_cif) |
Beta Was this translation helpful? Give feedback.
-
Showing phase identifiersIt is suggested to make the ⚙ Currentprint(job.phases.phase_names) 💡 Suggestedprint(job.phase_ids) |
Beta Was this translation helpful? Give feedback.
-
Visualisation of crystal structureCurrently, the user needs to use an external library to plot crystal structures. It is suggested to add a simple method for the ⚙ Currentimport py3Dmol
structure_view = py3Dmol.view(linked=False)
structure_view.addModel(job.phases['lbco'].cif, 'cif')
structure_view.setStyle({'sphere':{'colorscheme':'Jmol','scale':.2},
'stick':{'colorscheme':'Jmol','radius': 0.1}})
structure_view.setBackgroundColor('#2b2b2b')
structure_view.addUnitCell()
structure_view.zoomTo() 💡 Suggestedjob.show_crystal_structure(phase_id='lbco') |
Beta Was this translation helpful? Give feedback.
-
Removal of phaseCurrently, phase is being removed on the ⚙ CurrentWe need to pass both the interface.remove_phase(phases_obj=phases, phase_obj=phases[0]) 💡 Suggestedjob.phases.remove_phase(phase_id) |
Beta Was this translation helpful? Give feedback.
-
Removal of atoms (and other tabular parameters)Suggestion: mimic the current behaviour for clarity and ease of use rather than add the ⚙ Currentphase.remove_atom(atom_label) 💡 Suggestedphase.remove_atom(atom_label)
# rather than
# phase.atom_site.remove_atom(atom_label) The follow-up suggestion is to simplify the access to atoms and their properties directly from phase.atom[atom_label].occupancy = 1.0 |
Beta Was this translation helpful? Give feedback.
-
Here I propose to discuss how the user creates a model (or phase) object in EasyDiffraction. This object is expected to contain all the parameters needed to define a crystal or crystallographic phase.
Beta Was this translation helpful? Give feedback.
All reactions