Skip to content

Commit adbeb52

Browse files
committed
add custom atomic scattering factors
classes_atoms.py - new classes defined, may not be used - code is incomplete functions_crystallography.py - added new functions: - read_waaskirf_scattering_factor_coefs - scattering_factor_coefficients_neutron_ndb - scattering_factor_coefficients_neutron_sears - scattering_factor_coefficients_xray_itc - scattering_factor_coefficients_xray_waaskirf - scattering_factor_coefficients_electron_peng - scattering_factor_coefficients - analytical_scattering_factor - add_custom_form_factor_coefs - scattering_factor_coefficients_custom - xray_dispersion_table_custom - custom_scattering_factor - added custom form factor efficients and dispersion table - Added McPhase magnetic form factors - added load_magnetic_ff_coefs() and changed magnetic_form_factor() to use McPhase magnetic form factors - added hunds_rule(), glande() and atom_valence_state() - corrected xray_dispersion_corrections() to allow energy_kev=None functions_scattering.py - added custom scattering type classes_scattering.py - added custom scattering type in docs classes_plotting.py - fixed label issue functions_general.py - added liststr() examples - added example_custom_scattering_factors.py tests - added test_data_tables.py - all tests pass
1 parent 6f11257 commit adbeb52

8 files changed

Lines changed: 1417 additions & 43 deletions

Dans_Diffraction/classes_atoms.py

Lines changed: 774 additions & 0 deletions
Large diffs are not rendered by default.

Dans_Diffraction/classes_plotting.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def plot_distance(self, min_d=0.65, max_d=3.20, labels=None,
175175
axs[i].hist(dist[site]['dist'], range=ranges,
176176
bins=int((ranges[1] - ranges[0]) / step))
177177
axs[i].set(ylabel='n. Atoms')
178-
axs[-1].set(xlabel='$\AA$')
178+
axs[-1].set(xlabel=r'$\AA$')
179179
if len(dist) > 1:
180180
for ax in axs.flat:
181181
ax.label_outer()

Dans_Diffraction/classes_scattering.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,13 @@ class Scattering:
6767
print(xtl.Scatter.print_all_refelctions()) # Returns formated string of all allowed reflections
6868
6969
Allowed radiation types:
70-
'xray','neutron','xray magnetic','neutron magnetic','xray resonant'
70+
'xray','neutron','xray magnetic','neutron magnetic','xray resonant', 'custom'
7171
"""
7272

7373
#------Options-------
7474
# Standard Options
7575
_hkl = None # added so recalculation not required
76-
_scattering_type = 'xray' # 'xray','neutron','xray magnetic','neutron magnetic','xray resonant'
76+
_scattering_type = 'xray' # 'xray','neutron','xray magnetic','neutron magnetic','xray resonant', 'custom'
7777
_scattering_specular_direction = [0, 0, 1] # reflection
7878
_scattering_parallel_direction = [0, 0, 1] # transmission
7979
_scattering_theta_offset = 0.0
@@ -527,9 +527,9 @@ def structure_factor(self, hkl=None, scattering_type=None, int_hkl=None, **kwarg
527527
if nenergy == 1 and npsi == 1:
528528
sf = sf[:, 0, 0] # shape(nref)
529529
elif nenergy == 1:
530-
sf = sf[:, 0, :] # shape(nref, nenergy)
530+
sf = sf[:, 0, :] # shape(nref, npsi)
531531
elif npsi == 1:
532-
sf = sf[:, :, 0] # shape(nref, npsi)
532+
sf = sf[:, :, 0] # shape(nref, nenergy)
533533
if 'save' in kwargs:
534534
np.save(kwargs['save'], sf, allow_pickle=True)
535535
print("Saved %d structure factors to '%s'" % (sf.size, kwargs['save']))

0 commit comments

Comments
 (0)