Repository navigation
Conversation
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #554.
The QM/MM cutoff and charge switching were applied per MM atom, using each atom's own distance to the nearest QM atom. A neutral molecule straddling the switching region therefore had a net effective charge, and the (correct) chain-rule forces for this energy pulled atoms with one sign of charge inwards and the other outwards. With a charged QM region this is strong: for chorismate (q = −2) in water, shell waters rotate their hydrogens towards the QM region and the net MM charge within the cutoff grows from +2.4 e to +44.6 e over 1 ps.
The cutoff and switching are now applied by MM residue, using the distance from each residue's centroid to the nearest QM atom. Whole residues are included or excluded, all of a residue's charges are scaled by the same switching value, and the switching force −(Σⱼ dE/dqⱼ q⁰ⱼ) ds/dr is shared equally over the residue's atoms, with the opposite force on the nearest QM atom. Neutral residues therefore remain neutral.
qmgroups.h), used by bothPyQMEngineandTorchQMEngine, replacing their duplicated per-atom code. Groups are made whole about their first atom before taking their centroid.getGroups/setGroups, set from the residues insire.qm.create_engineandsire.qm.emle. Atoms outside residues form their own groups, and forces streamed by older versions fall back to per-atom groups.mm_groupsargument, andemle_callbackforwards it toemle.models.preprocess, with a warning if the installed emle-engine doesn't support it (Add optional group-based cutoff and switching to preprocess chemle/emle-engine#122). As on the host, each link's MM1 and MM2 atoms and virtual charges form their own group.For ANI2x-EMLE on alanine dipeptide in water, the initial energy changes by −15.4 kJ/mol (only waters in the switching region contribute differently), the host and GPU-resident routes agree to 3×10⁻⁴ kJ/mol, and performance is unchanged.
Tests check that residues are included whole with a single switching factor and zero net switched charge, compare the switching forces on a water in the switching region and on all QM atoms with finite differences of the energy for a charged QM region, and check the groups passed to GPU-resident callbacks.
Checklist
develinto this branch before issuing this pull request (e.g. by runninggit pull origin devel): [y]LICENSEfile: [y]