torchref.refinement.targets.geometry.non_bonded_h module
Non-bonded target with transient riding hydrogen VDW contacts.
Inherits from NonBondedTarget — all heavy-heavy VDW logic is unchanged.
On each forward() call, riding hydrogen positions are generated from
the current heavy-atom coordinates, and VDW repulsion is computed on
precomputed candidate H-heavy pairs.
Candidate pairs are derived at restraint-build time from the heavy-atom VDW pair list, so the forward pass only computes distances and energy on a fixed set of candidates — no spatial hashing at evaluation time.
Hydrogen atoms are never stored in the model; they exist only during this evaluation step and are discarded immediately after.
- class torchref.refinement.targets.geometry.non_bonded_h.NonBondedHTarget(model=None, mode='prolsq', sigma=0.3, r_exp=4.0, c_rep=None, buffer=0.0, rebuild_threshold=1.0, verbose=0)[source]
Bases:
NonBondedTargetNon-bonded target with transient riding hydrogen VDW contacts.
Drop-in replacement for
NonBondedTarget. The heavy-heavy VDW loss is computed by the parent class; this subclass adds an H-VDW term from precomputed candidate H-heavy pairs.Candidate pairs are derived at build time from the heavy-heavy VDW pair list. At forward time, only H placement + vectorized distance computation is needed — no spatial hashing.
Uses the same generalized-Gaussian NLL as the parent class; see
NonBondedTargetfor the sigma calibration.- Parameters:
model (Model, optional) – Reference to Model object.
mode (str, optional) – Repulsion function type. Default
'prolsq'.sigma (float, optional) – Effective tolerance on the overlap (Å). Default 0.3.
r_exp (float, optional) – Repulsion exponent. Default 4.0.
c_rep (float or None, optional) – Legacy coefficient override; derived from
sigmawhen None.buffer (float, optional) – Distance buffer (Å). Default 0.0.
verbose (int, optional) – Verbosity level. Default 0.
- __init__(model=None, mode='prolsq', sigma=0.3, r_exp=4.0, c_rep=None, buffer=0.0, rebuild_threshold=1.0, verbose=0)[source]
Initialize non-bonded target.
- Parameters:
model (Model, optional) – Reference to Model object.
mode (str, optional) – Repulsion function type (‘prolsq’, ‘gaussian’, ‘soft’). Default is ‘prolsq’.
sigma (float, optional) – Effective tolerance on the overlap (Å). Default 0.3. Only used when
c_repis None.r_exp (float, optional) – Repulsion exponent. Default is 4.0.
c_rep (float or None, optional) – Legacy coefficient override. If None (default), derived from
sigmaas1 / (r_exp * sigma ** r_exp).buffer (float, optional) – Distance buffer in Angstroms added to VDW radii sum. Default is 0.0.
rebuild_threshold (float, optional) – Maximum ASU atom displacement in Angstroms since the last VDW pair-list build before
maintenance()triggers a rebuild. Default is 1.0 Å — well inside the ~2.4 Å safety margin of the default 6.0 Å cutoff, so newly-formed contacts cannot slip through the list.verbose (int, optional) – Verbosity level. Default is 0.