torchref.base.direct_summation.isotropic module
Isotropic structure factor calculations.
Functions for computing structure factors from atomic models with isotropic (spherical) atomic displacement parameters.
- torchref.base.direct_summation.isotropic.iso_structure_factor_torched(hkl, s, xyz_fractional, occ, scattering_factors, adp, spacegroup, max_memory_gb=None, A=None, B_coeff=None)[source]
Calculate isotropic structure factors using PyTorch.
- Parameters:
hkl (torch.Tensor) – Miller indices of shape (N_reflections, 3).
s (torch.Tensor) – Scattering vector magnitudes of shape (N_reflections,).
xyz_fractional (torch.Tensor) – Fractional coordinates of shape (N_atoms, 3).
occ (torch.Tensor) – Occupancies of shape (N_atoms,).
scattering_factors (torch.Tensor or None) – Atomic scattering factors of shape (N_reflections, N_atoms). If None, must provide A and B_coeff to compute them in batches.
adp (torch.Tensor) – Atomic displacement parameters (isotropic) of shape (N_atoms,).
spacegroup (callable) – Space group symmetry operator function.
max_memory_gb (float, optional) – Maximum memory to use in GB. If None, no batching is applied.
A (torch.Tensor, optional) – ITC92 A coefficients (N_atoms, 5) for computing scattering factors. Required if scattering_factors is None and batching is needed.
B_coeff (torch.Tensor, optional) – ITC92 B coefficients (N_atoms, 5) for computing scattering factors. Required if scattering_factors is None and batching is needed.
- Returns:
Complex structure factors of shape (N_reflections,).
- Return type:
- torchref.base.direct_summation.isotropic.iso_structure_factor_torched_no_complex(hkl, s, fractional_coords, occ, scattering_factors, tempfactor, space_group)[source]
Calculate isotropic structure factors without complex numbers.
Returns real and imaginary parts as separate rows.
- Parameters:
hkl (torch.Tensor) – Miller indices of shape (N_reflections, 3).
s (torch.Tensor) – Scattering vector magnitudes of shape (N_reflections,).
fractional_coords (torch.Tensor) – Fractional coordinates of shape (N_atoms, 3).
occ (torch.Tensor) – Occupancies of shape (N_atoms,).
scattering_factors (torch.Tensor) – Atomic scattering factors of shape (N_reflections, N_atoms).
tempfactor (torch.Tensor) – Isotropic temperature factors (B-factors) of shape (N_atoms,).
space_group (callable) – Space group symmetry operator function.
- Returns:
Structure factors as [real, imag] of shape (2, N_reflections).
- Return type: