torchref.base.targets.bond module
Bond-length restraint NLL.
- torchref.base.targets.bond.bond_math(xyz, idx, references, sigmas)[source]
Bond NLL: gather, distance, Gaussian NLL, sum.
Mirrors
BondTarget.forward(geometry/bond) including the bond-length computation fromRestraints.bond_lengths.On CUDA float32 inputs this dispatches to
torchref.base.targets.triton.bond_math_triton()(~2.5× faster fwd+bw on A100). All other inputs use the eager implementation.- Parameters:
xyz (torch.Tensor) – (N_atoms, 3) Cartesian coordinates.
idx (torch.Tensor) – (N, 2) integer indices into
xyz.references (torch.Tensor) – (N,) target bond lengths.
sigmas (torch.Tensor) – (N,) standard deviations.