torchref.base.scattering.itc92 module
ITC92 atomic scattering factor calculations.
Functions for computing atomic scattering factors using the International Tables for Crystallography Volume C (1992) parameterization.
- torchref.base.scattering.itc92.get_scattering_factors_unique(atoms, s)[source]
Compute unique scattering factors for a set of atoms.
- Parameters:
atoms (DataFrame-like) – Atoms with ‘element’ and ‘charge’ attributes.
s (array-like) – Scattering vector magnitudes.
- Returns:
Dictionary mapping element symbols to scattering factors.
- Return type:
- torchref.base.scattering.itc92.get_scattering_factors(scattering_dict, elements)[source]
Get scattering factors from a pre-computed dictionary.
- Parameters:
- Returns:
Concatenated scattering factors.
- Return type:
- torchref.base.scattering.itc92.linear_interpolation(x, x0, x1, y0, y1)[source]
Perform linear interpolation.
- Parameters:
x (array-like) – Query points.
x0 (array-like) – Lower bound x values.
x1 (array-like) – Upper bound x values.
y0 (array-like) – Lower bound y values.
y1 (array-like) – Upper bound y values.
- Returns:
Interpolated y values.
- Return type:
array-like
- torchref.base.scattering.itc92.get_scattering_itc92(df, s)[source]
Get ITC92 scattering factors using gemmi.
- Parameters:
df (DataFrame) – DataFrame with ‘element’ column.
s (torch.Tensor) – Scattering vector magnitudes.
- Returns:
Scattering factors for all atoms.
- Return type:
- torchref.base.scattering.itc92.calc_scattering_factors_paramtetrization(parametrization, s, atom_list)[source]
Calculate scattering factors from ITC92 parametrization.
- Parameters:
parametrization (dict) – Dictionary of (A, B, C) tuples by element.
s (torch.Tensor) – Scattering vector magnitudes.
atom_list (list) – List of atom symbols.
- Returns:
Scattering factors.
- Return type:
- torchref.base.scattering.itc92.get_parameterization(df)[source]
Get ITC92 parametrization for atoms in a DataFrame.
- Parameters:
df (DataFrame) – DataFrame with ‘element’ and ‘charge’ columns.
- Returns:
Dictionary of parametrization by element.
- Return type:
- torchref.base.scattering.itc92.get_parameterization_extended(df)[source]
Extended parametrization function that handles all atoms in a DataFrame.
Creates a dictionary mapping element symbols (and optionally charges) to their ITC92 parameters (A, B, C). This is optimized for FT-based calculations where we need fast access to parametrization without scattering vectors.
- Parameters:
df (pandas.DataFrame) – DataFrame with ‘element’ and ‘charge’ columns
- Returns:
dict – A: torch.Tensor, shape (1, 4) - amplitude coefficients B: torch.Tensor, shape (1, 4) - width coefficients (Ų) C: torch.Tensor, shape (1,) - constant term
- Return type: