rdkit/rdkit#9298 (merged into RDKit 2026.03) fixed a bug where a negative
energy value caused max(energy * gradScale, 1.0) to clamp to 1, artificially
tightening the gradient-tolerance convergence test mid-minimisation. Force
fields with stabilising electrostatic or dispersion terms (MMFF94, UFF) can
produce negative intermediate energies, so this affected real workloads.
Apply the same fix in both nvMolKit BFGS paths, gated on the linked RDKit
version so that behaviour is unchanged when built against older RDKit:
- src/minimizer/bfgs_minimize.cu (updateDGradKernel, batched path)
- src/minimizer/bfgs_minimize_permol_kernels.cu (updateDGrad, per-mol path)
Mirrors the version-conditional pattern already used for kRdkitHasGradScaleFix
in scaleGradKernel.
Signed-off-by: Clay Moore <claytonwaynemoore@gmail.com>
rdkit/rdkit#9298 (merged into RDKit 2026.03) fixed a bug where a negative energy value caused max(energy * gradScale, 1.0) to clamp to 1, artificially tightening the gradient-tolerance convergence test mid-minimisation. Force fields with stabilising electrostatic or dispersion terms (MMFF94, UFF) can produce negative intermediate energies, so this affected real workloads.
Apply the same fix in both nvMolKit BFGS paths, gated on the linked RDKit version so that behaviour is unchanged when built against older RDKit:
Mirrors the version-conditional pattern already used for kRdkitHasGradScaleFix in scaleGradKernel.