torchref.base.targets.torsion module

Torsion restraint NLL: unimodal von Mises + omega cis/trans mixture.

torchref.base.targets.torsion.torsion_unimodal_math(deviations_rad, sigmas_deg)[source]

Unimodal von Mises NLL on already-wrapped deviations.

Mirrors targets.geometry.torsions._von_mises_nll. The caller is expected to compute wrapped angular deviations beforehand (currently done inside Restraints.torsion_deviations_with_sigmas).

No Triton dispatch yet — the periodic-wrap logic upstream is still in eager Python.

torchref.base.targets.torsion.torsion_omega_math(xyz, idx, sigmas_deg, is_proline, w_cis_proline=0.05, w_cis_general=0.0005)[source]

Omega cis/trans mixture NLL.

Mirrors targets.geometry.torsions._omega_mixture_nll plus the omega-angle computation. Models each ω as a 2-component mixture: w_trans VM(ω; π, κ) + w_cis VM(ω; 0, κ).

Dispatches to torchref.base.targets.triton.torsion_omega_math_triton() on CUDA float32 (~5.6× faster fwd+bw on A100). Falls back to eager otherwise.