torchref.refinement.targets.adp.scaler_u module

class torchref.refinement.targets.adp.scaler_u.ScalerURegularizationTarget(scaler, n_reflections, verbose=0)[source]

Bases: Target

Pin the isotropic component of the scaler’s anisotropic U to zero.

F_scaled = scale · exp(-2π²·sᵀUs) · F_calc couples U into the same Debye-Waller slot as the atomic B-factors. The anisotropic deviatoric part of U encodes real directional attenuation in the data and should stay free. The isotropic part — the trace U11 + U22 + U33 — is a straight trade with a uniform atomic B shift and must be anchored so the atoms absorb the B-factor roll-off, not the scaler.

Penalty (tr U)² · N_ref / 6 — squared trace, scaled by the order of magnitude of the xray gradient on U. The / 6 matches the per-component gradient scaling the user originally requested.

name: str = 'adp/scaler_U'
__init__(scaler, n_reflections, verbose=0)[source]

Initialize target.

Parameters:

verbose (int, optional) – Verbosity level. Default is 0.

forward()[source]

Compute and return the loss. Override in subclasses.

stats()[source]