Bonded reference provenance

Upstream: https://github.com/openmm/openmm/tree/3153ffff84f59eb814173c7c945201c0e74f0646
License: MIT. Each source below contains the MIT permission notice.

Numerical evaluators in reference_terms.cuh are adaptations of these MIT
Reference-platform sources. CUDA scheduling, memory ownership, the C ABI and
the Python bindings were written new for cupo. No source of OpenMM's GPU
platforms is used in this backend.

Adaptations: template float/double evaluation; replace host vectors with
small CUDA-local vectors; return per-term forces/energy to a separate GPU
scheduler; use a six-double reduced lower-triangular box; omit class state.
Floating-point contraction is disabled.

Numerical stability changes added 2026-10-30:
The angle uses the standard half-angle identity
  theta = 2 atan2(|| |c| a - |a| c ||, || |c| a + |a| c ||)
instead of acos of the normalized dot product. Near pi the deviation from
equilibrium uses the complementary angle and a split pi constant, preserving
small deviations even when the angle itself rounds to pi. Angle forces retain the MIT
Reference gradients, normalize the plane normal before taking cross products,
and remove the old 1e-6 cross-norm floor, which changed forces without changing
energy. The torsion angle uses atan2 of the signed sine and cosine from unit
plane normals. Its MIT-derived force gradients are also factored through unit
normals to avoid products of small squared plane-normal lengths.

These standard mathematical identities were implemented here. During review,
the following Apache-2.0 TMD sources were inspected at commit
9fd1a155ba6270e735c6fb84fbde33de08a84d60:
https://github.com/tmd-industries/tmd/blob/9fd1a155ba6270e735c6fb84fbde33de08a84d60/tmd/cpp/src/kernels/k_harmonic_angle.cuh
https://github.com/tmd-industries/tmd/blob/9fd1a155ba6270e735c6fb84fbde33de08a84d60/tmd/cpp/src/kernels/k_periodic_torsion.cuh
TMD's use of half-angle and signed atan2 expressions informed the choice of
identities; no TMD source was copied or adapted. In particular, this backend
does not add TMD's fourth-coordinate angle regularization or its zero-gradient
convention at exactly collinear angles. Nonzero-strength angle and torsion
force evaluation requires nondegenerate defining geometry; no arbitrary
epsilon regularization assigns a gradient at a genuine singularity. Terms
with exactly zero force constants return zero before evaluating geometry.
Canonical logical atom order makes forward and reversed terms evaluate the
same arithmetic before any device atom permutation.

Physical pair replacement evaluator:
The Coulomb/Lennard-Jones pair energy and derivative were implemented directly
from U(r) = coulomb/r + 4*epsilon*((sigma/r)^12-(sigma/r)^6), independently of
OpenMM numerical source. These terms have no splitting, cutoff, or switching.
Powers are taken after forming sigma/r to avoid underflow of a precomputed
sigma^12. Terms with zero Coulomb and zero Lennard-Jones contribution skip
geometry and force accumulation. Parameter updates refresh device batch group
masks in place, including activation of initially zero terms during graph replay.

Grouped scheduling added 2026-10-23:
grouped.cuh builds bounded batches with compact dictionaries of the actual
atom IDs used, rather than contiguous atom-index windows. Each batch has
separate typed records for bonds, angles, torsions, and physical pairs. A CUDA block gathers
coordinates, runs four compile-time-specialized loops, accumulates fixed-point
forces in shared memory, and flushes per-atom totals. Shared accumulation uses
separate low/high 32-bit planes with explicit carries, implementing integer
addition modulo 2^64. Energy uses a separate fixed-order reduction.
The existing MIT-derived evaluator expressions are reused; their parameter
pointer type is templated to permit float records without changing arithmetic.
The grouped scheduler was written new for cupo and contains no upstream
source.

OpenMM integration added 2026-10-23:
plugins/openmm/cpp/platforms/cuda/src/bonded/GroupedBonded.cu is an Apache-2.0
adapter to the CUPO C ABI and installed OpenMM interfaces. It aggregates the
supported force objects, registers their topology, updates logical-to-device
atom mappings and contributes energies to OpenMM's buffer. Unsupported contexts
and periodic bonded force objects delegate to the installed CUDA factory.
No OpenMM GPU numerical routines are embedded in the adapter.

Pinned source files and SHA-256:
platforms/reference/src/SimTKReference/ReferenceHarmonicBondIxn.cpp
4e22b42016a3d2a36b61265e76ea2bce703faf5edd47d793bd359528b2bce1e1
platforms/reference/src/SimTKReference/ReferenceAngleBondIxn.cpp
8c6bd03b8fc81184752b5bfa6c7870611451d4f17e735fd95cb0c023c0e7fc8e
platforms/reference/src/SimTKReference/ReferenceProperDihedralBond.cpp
817fae480b628eb49b280ce8ffeffcb0ec69f188e162f86c04276d3d10ef1801
platforms/reference/src/SimTKReference/ReferenceBondIxn.cpp
e69a6836e9c620dadb105cf18350a4eb9f8090248606f3284e1bdae849522d8e
platforms/reference/src/SimTKReference/ReferenceForce.cpp
90792dc0c1f994dd3c1f397189f2676291a6867ac6b6fdacd174558dbb68c64a
