Skip to content

Commit 7ed107e

Browse files
committed
Fix setLambda when no CMAPs are present in either state.
1 parent 6f6c7d6 commit 7ed107e

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

wrapper/Convert/SireOpenMM/sire_to_openmm_system.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1643,7 +1643,13 @@ OpenMMMetaData SireOpenMM::sire_to_openmm_system(OpenMM::System &system,
16431643
start_indicies.insert("bond", bondff->getNumBonds());
16441644
start_indicies.insert("angle", angff->getNumAngles());
16451645
start_indicies.insert("torsion", dihff->getNumTorsions());
1646-
start_indicies.insert("cmap", cmapff->getNumMaps());
1646+
1647+
// Only record a CMAP start index if this molecule actually has
1648+
// CMAP torsions. If we always insert here, start_index is never
1649+
// -1 in the lambda lever, and updateParametersInContext is called
1650+
// on an uninitialised GPU force for molecules with no CMAP terms.
1651+
if (not mol.cmap_params.isEmpty())
1652+
start_indicies.insert("cmap", cmapff->getNumMaps());
16471653

16481654
// we can now record this as a perturbable molecule
16491655
// in the lambda lever. The returned index is the

0 commit comments

Comments
 (0)