torchref.base.direct_summation.corrections module
Structure factor correction terms.
Functions for applying various correction terms to structure factors, including anharmonic corrections and core deformation.
- torchref.base.direct_summation.corrections.core_deformation(core_correction, s)[source]
Apply core deformation correction to scattering.
- Parameters:
core_correction (float or torch.Tensor) – Core correction factor.
s (torch.Tensor) – Scattering vector magnitudes.
- Returns:
Core deformation correction factors.
- Return type:
- torchref.base.direct_summation.corrections.anharmonic_correction(hkl, c)[source]
Apply anharmonic (third-order) correction to structure factors.
- Parameters:
hkl (torch.Tensor) – Miller indices of shape (N_reflections, 3).
c (tuple or list) – Ten anharmonic coefficients (C111, C222, C333, C112, C122, C113, C133, C223, C233, C123).
- Returns:
Complex anharmonic correction factors of shape (N_reflections,).
- Return type:
- torchref.base.direct_summation.corrections.anharmonic_correction_no_complex(hkl, c)[source]
Apply anharmonic (third-order) correction without complex numbers.
Returns real and imaginary parts as separate rows.
- Parameters:
hkl (torch.Tensor) – Miller indices of shape (N_reflections, 3).
c (tuple or list) – Ten anharmonic coefficients (C111, C222, C333, C112, C122, C113, C133, C223, C233, C123).
- Returns:
Correction factors as [cos, sin] of shape (2, N_reflections).
- Return type:
- torchref.base.direct_summation.corrections.multiplication_quasi_complex_tensor(a, b)[source]
Multiply two quasi-complex tensors represented as [real, imag] rows.
- Parameters:
a (torch.Tensor) – First quasi-complex tensor of shape (2, N).
b (torch.Tensor) – Second quasi-complex tensor of shape (2, N).
- Returns:
Product as [real, imag] of shape (2, N).
- Return type: