Skip to content

Conversation

@DanPorter
Copy link
Owner

Significant feature update! Adding custom form factors, new magnetic form factors and other fixes.

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
  • add new magnetic form factor functions:
    • magnetic_ff_symbol
    • magnetic_ff_coefs
    • print_magnetic_ff_coefs
    • last_df_orbital
    • magnetic_ff_g_factor
    • magnetic_ff_j2j0_ratio
  • changed input of magnetic_form_factor to *elements.
  • added custom form factor coefficients 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
  • added scattering_type function

classes_crystal.py

  • Add method scattering_factor_coefficients to Atoms.

classes_properties.py

  • Add scattering factors method to Properties

classes_scattering.py

  • add atom scattering factor methods
  • add use_waaskirf and use_sears to setup_scatter
  • added energy_mev to setup_scatter for neutron energy
  • setup_scatter option wavelength_a changed to check scatteing_type, now updates energy correctly for neutron and electron wavelengths.
  • new version of magnetic_form_factor function that includes elements with oxidations states
  • 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
  • added test cases for magnetic form factors
  • added test cases for magnetic scattering

DanPorter added 7 commits May 21, 2025 20:53
functions_crystallography.py
 - added keywords for properties files
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
classes_atoms.py
 - removed

functions_crystallography.py
 - added more documentation
 - added more searches to find_spacegroup
 - moved some functions around

functions_lattice.py
 - removed assignment expression
functions_scattering.py
 - added scattering_type function

classes_scattering.py
 - added energy_mev to setup_scatter for neutron energy
 - setup_scatter option wavelength_a changed to check scatteing_type, now updates energy correctly for neutron and electron wavelengths.
 - new version of magnetic_form_factor function that includes elements with oxidations states

 TODO:
  - add test cases for magnetic form factors
functions_scattering.py
 - changed method of structure factor calculation in 'magnetic neutron' and 'magnetic xray' to give unpolarised structure factor

functions_crystallography.py
 - Changed input of magnetic_form_factor to *elements.
 - add new magnetic form factor functions:
   - magnetic_ff_symbol
   - magnetic_ff_coefs
   - print_magnetic_ff_coefs
   - last_df_orbital
   - magnetic_ff_g_factor
   - magnetic_ff_j2j0_ratio

classes_crystal.py
 - Add method scattering_factor_coefficients to Atoms.

classes_properties.py
 - Add scattering factors method to Properties

classes_scattering.py
 - add atom scattering factor methods
 - add use_waaskirf and use_sears to setup_scatter

test_data_tables.py
 - added test cases for magnetic form factors

test_structure_factors.py
 - added test cases for magnetic scattering

All tests pass.
@DanPorter DanPorter linked an issue Aug 22, 2025 that may be closed by this pull request
Additional updates for plotting and display of custom scattering factors.

classes_crystal.py
 - Change Atoms.type to always be array type with <U8

classes_scattering.py
 - update scattering_factors

classes_plotting.py
 - added plot_scattering_factors

All tests pass.
@DanPorter DanPorter merged commit ab7ee22 into master Sep 15, 2025
6 checks passed
@DanPorter DanPorter deleted the 32-feature-request-custom-atom-form-factors branch September 15, 2025 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: Custom atom form factors

2 participants