@@ -644,7 +644,9 @@ def allowed(self):
644644
645645 # ------------------------- Custom methods ----------------------- #
646646
647- def calculate_structure_factor (self , scattering_params = "xtables" ):
647+ def calculate_structure_factor (
648+ self , scattering_params = "xtables" , debye_waller_factors = None
649+ ):
648650 r"""Populate :attr:`structure_factor` with the complex
649651 kinematical structure factor :math:`F_{hkl}` for each vector.
650652
@@ -653,6 +655,8 @@ def calculate_structure_factor(self, scattering_params="xtables"):
653655 scattering_params : str
654656 Which atomic scattering factors to use, either ``"xtables"``
655657 (default) or ``"lobato"``.
658+ debye_waller_factors: dict
659+ Debye-Waller factors for atoms in the structure.
656660
657661 Examples
658662 --------
@@ -712,6 +716,7 @@ def calculate_structure_factor(self, scattering_params="xtables"):
712716 structure = self .phase .structure ,
713717 g_indices = hkl_unique ,
714718 g_hkls_array = self .phase .structure .lattice .rnorm (hkl_unique ),
719+ debye_waller_factors = debye_waller_factors ,
715720 scattering_params = scattering_params ,
716721 )
717722
@@ -933,6 +938,12 @@ def sanitise_phase(self):
933938 space_group = self .phase .space_group
934939 structure = self .phase .structure
935940
941+ # Lattice basis transform for hexagonal crystals can sometimes move atoms below 0
942+ for atom in structure :
943+ for i in range (3 ):
944+ if - 1e-6 < atom .xyz [i ] < 0 :
945+ atom .xyz [i ] = 0
946+
936947 new_structure = _expand_unit_cell (space_group , structure )
937948 for atom in new_structure :
938949 if np .issubdtype (type (atom .element ), np .integer ):
0 commit comments