Skip to content

Commit

Permalink
add occupancy to structure factors
Browse files Browse the repository at this point in the history
  • Loading branch information
sezelt committed Dec 12, 2023
1 parent 7f7cf46 commit 924f0e1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
12 changes: 8 additions & 4 deletions py4DSTEM/process/diffraction/crystal.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,10 +662,14 @@ def calculate_structure_factors(
# Calculate structure factors
self.struct_factors = np.zeros(np.size(self.g_vec_leng, 0), dtype="complex64")
for a0 in range(self.positions.shape[0]):
self.struct_factors += f_all[:, a0] * np.exp(
(2j * np.pi * self.occupancy[a0])
* np.sum(
self.hkl * np.expand_dims(self.positions[a0, :], axis=1), axis=0
self.struct_factors += (
f_all[:, a0]
* self.occupancy[a0]
* np.exp(
(2j * np.pi)
* np.sum(
self.hkl * np.expand_dims(self.positions[a0, :], axis=1), axis=0
)
)
)

Expand Down
5 changes: 2 additions & 3 deletions py4DSTEM/process/diffraction/crystal_bloch.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ def calculate_dynamical_structure_factors(
tol_structure_factor: float = 0.0,
recompute_kinematic_structure_factors=True,
g_vec_precision=None,
verbose=True,
):
"""
Calculate and store the relativistic corrected structure factors used for Bloch computations
Expand Down Expand Up @@ -92,7 +91,7 @@ def calculate_dynamical_structure_factors(

# Calculate the reciprocal lattice points to include based on k_max

k_max = np.asarray(k_max)
k_max: np.ndarray = np.asarray(k_max)

if recompute_kinematic_structure_factors:
if hasattr(self, "struct_factors"):
Expand Down Expand Up @@ -215,7 +214,7 @@ def get_f_e(q, Z, thermal_sigma, method):

# Calculate structure factors
struct_factors = np.sum(
f_e * np.exp(2.0j * np.pi * np.squeeze(self.positions[:, None, :] @ hkl)),
f_e * self.occupancy[:,None] * np.exp(2.0j * np.pi * np.squeeze(self.positions[:, None, :] @ hkl)),
axis=0,
)

Expand Down

0 comments on commit 924f0e1

Please sign in to comment.