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: NonBondedTarget

Non-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 NonBondedTarget for 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 sigma when None.

  • buffer (float, optional) – Distance buffer (Å). Default 0.0.

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

name: str = 'geometry/nonbonded'
__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_rep is 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 sigma as 1 / (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.

forward()[source]

Compute and return the loss. Override in subclasses.

get_violations(threshold=0.0)[source]

Get violations including H-involving contacts.

stats()[source]

Get statistics including H-VDW contacts.