-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #882 #896
Closed
Closed
Fix #882 #896
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3603,7 +3603,7 @@ def check_handler_compatibility(self, other_handler): | |
""" | ||
float_attrs_to_compare = ["scale12", "scale13", "scale14", "scale15"] | ||
string_attrs_to_compare = ["potential", "combining_rules", "method"] | ||
unit_attrs_to_compare = ["cutoff"] | ||
unit_attrs_to_compare = ["cutoff", "switch_width"] | ||
|
||
self._check_attributes_are_equal( | ||
other_handler, | ||
|
@@ -3625,9 +3625,12 @@ def create_force(self, system, topology, **kwargs): | |
# "must be provided") | ||
else: | ||
force.setNonbondedMethod(openmm.NonbondedForce.LJPME) | ||
force.setCutoffDistance(9.0 * unit.angstrom) | ||
force.setCutoffDistance(self.cutoff) | ||
force.setEwaldErrorTolerance(1.0e-4) | ||
|
||
force.setSwitchingDistance(self.switch_width) | ||
force.setUseSwitchingFunction(self.switch_width < self.cutoff) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems to me that having a larger switch_width than the cutoff should raise an error -- Silently disabling the switching it would likely be the more surprising behavior. |
||
|
||
# If method is cutoff, then we currently support openMM's PME for periodic system and NoCutoff for nonperiodic | ||
elif self.method == "cutoff": | ||
# If we're given a nonperiodic box, we always set NoCutoff. Later we'll add support for CutoffNonPeriodic | ||
|
@@ -3638,6 +3641,9 @@ def create_force(self, system, topology, **kwargs): | |
force.setUseDispersionCorrection(True) | ||
force.setCutoffDistance(self.cutoff) | ||
|
||
force.setSwitchingDistance(self.switch_width) | ||
force.setUseSwitchingFunction(self.switch_width < self.cutoff) | ||
|
||
# Iterate over all defined Lennard-Jones types, allowing later matches to override earlier ones. | ||
atom_matches = self.find_matches(topology) | ||
|
||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SimonBoothroyd I think this is the only substantive question remaining before I can make this merge-ready. The use of "width" makes me think that this is the more correct interpretation, since the switching function applies between this distance and the cutoff. But since you're more on the physics side, I'll defer this decision to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The width would usually refer to the distance over which it is tapered, e.g. an angstrom or two or some such (e.g. switched between 8 and 10 angstroms) if that helps answer this question.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@j-wags is correct here: For OpenMM, you need to use
force.setSwitchingDistance(self.cutoff - self.switch_width)
.