-
Notifications
You must be signed in to change notification settings - Fork 26
Add TIP4P-EW #76
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
Merged
Merged
Add TIP4P-EW #76
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7ce11de
Add TIP4P-EW script and force fields
mattwthompson 3692ce6
Update test environments
mattwthompson f1c3b79
Merge remote-tracking branch 'upstream/main' into add-tip4p-ew
mattwthompson 36b8bc4
Update handler
mattwthompson f4e7ecc
Re-run generation script
mattwthompson 69aef5b
Update documentation
mattwthompson 2b71319
Merge remote-tracking branch 'upstream/main' into add-tip4p-ew
mattwthompson 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 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,5 +7,6 @@ dependencies: | |
| - openff-toolkit >=0.14.3 | ||
| - pytest | ||
| - pytest-cov | ||
| - pytest-xdist | ||
| - pandas | ||
| - click | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <SMIRNOFF version="0.3" aromaticity_model="OEAroModel_MDL"> | ||
| <vdW version="0.4" potential="Lennard-Jones-12-6" combining_rules="Lorentz-Berthelot" scale12="0.0" scale13="0.0" scale14="0.5" scale15="1.0" cutoff="9.0 * angstrom ** 1" switch_width="1.0 * angstrom ** 1" periodic_method="cutoff" nonperiodic_method="no-cutoff"> | ||
| <Atom smirks="[#1]-[#8X2H2+0:1]-[#1]" epsilon="0.680946 * kilojoule_per_mole ** 1" id="n-tip4p-ew-O" sigma="0.316435 * nanometer ** 1"></Atom> | ||
| <Atom smirks="[#1:1]-[#8X2H2+0]-[#1]" epsilon="0.0 * kilocalorie_per_mole ** 1" id="n-tip4p-ew-H" sigma="1.0 * nanometer ** 1"></Atom> | ||
| </vdW> | ||
| <LibraryCharges version="0.3"> | ||
| <LibraryCharge smirks="[#1]-[#8X2H2+0:1]-[#1]" charge1="0.0 * elementary_charge ** 1" id="q-tip4p-ew-O"></LibraryCharge> | ||
| <LibraryCharge smirks="[#1:1]-[#8X2H2+0]-[#1]" charge1="0.0 * elementary_charge ** 1" id="q-tip4p-ew-H"></LibraryCharge> | ||
| </LibraryCharges> | ||
| <Electrostatics version="0.4" scale12="0.0" scale13="0.0" scale14="0.8333333333" scale15="1.0" cutoff="9.0 * angstrom ** 1" switch_width="0.0 * angstrom ** 1" periodic_potential="Ewald3D-ConductingBoundary" nonperiodic_potential="Coulomb" exception_potential="Coulomb"></Electrostatics> | ||
| <Constraints version="0.3"> | ||
| <Constraint smirks="[#1:1]-[#8X2H2+0:2]-[#1]" id="c-tip4p-ew-H-O" distance="0.09572 * nanometer ** 1"></Constraint> | ||
| <Constraint smirks="[#1:1]-[#8X2H2+0]-[#1:2]" id="c-tip4p-ew-H-O-H" distance="0.15139006545247014 * nanometer ** 1"></Constraint> | ||
| </Constraints> | ||
| <VirtualSites version="0.3" exclusion_policy="parents"> | ||
| <VirtualSite smirks="[#1:2]-[#8X2H2+0:1]-[#1:3]" epsilon="0.0 * kilocalorie_per_mole ** 1" type="DivalentLonePair" match="once" distance="-0.0125 * nanometer ** 1" outOfPlaneAngle="0.0 * degree ** 1" inPlaneAngle="None" charge_increment1="0.0 * elementary_charge ** 1" charge_increment2="0.52422 * elementary_charge ** 1" charge_increment3="0.52422 * elementary_charge ** 1" sigma="1.0 * angstrom ** 1" name="EP"></VirtualSite> | ||
| </VirtualSites> | ||
| </SMIRNOFF> |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <SMIRNOFF version="0.3" aromaticity_model="OEAroModel_MDL"> | ||
| <vdW version="0.4" potential="Lennard-Jones-12-6" combining_rules="Lorentz-Berthelot" scale12="0.0" scale13="0.0" scale14="0.5" scale15="1.0" cutoff="9.0 * angstrom ** 1" switch_width="1.0 * angstrom ** 1" periodic_method="cutoff" nonperiodic_method="no-cutoff"> | ||
| <Atom smirks="[#1]-[#8X2H2+0:1]-[#1]" epsilon="0.680946 * kilojoule_per_mole ** 1" id="n-tip4p-ew-O" sigma="0.316435 * nanometer ** 1"></Atom> | ||
| <Atom smirks="[#1:1]-[#8X2H2+0]-[#1]" epsilon="0.0 * kilocalorie_per_mole ** 1" id="n-tip4p-ew-H" sigma="1.0 * nanometer ** 1"></Atom> | ||
| </vdW> | ||
| <LibraryCharges version="0.3"> | ||
| <LibraryCharge smirks="[#1]-[#8X2H2+0:1]-[#1]" charge1="0.0 * elementary_charge ** 1" id="q-tip4p-ew-O"></LibraryCharge> | ||
| <LibraryCharge smirks="[#1:1]-[#8X2H2+0]-[#1]" charge1="0.0 * elementary_charge ** 1" id="q-tip4p-ew-H"></LibraryCharge> | ||
| </LibraryCharges> | ||
| <Electrostatics version="0.4" scale12="0.0" scale13="0.0" scale14="0.8333333333" scale15="1.0" cutoff="9.0 * angstrom ** 1" switch_width="0.0 * angstrom ** 1" periodic_potential="Ewald3D-ConductingBoundary" nonperiodic_potential="Coulomb" exception_potential="Coulomb"></Electrostatics> | ||
| <Constraints version="0.3"> | ||
| <Constraint smirks="[#1:1]-[#8X2H2+0:2]-[#1]" id="c-tip4p-ew-H-O" distance="0.09572 * nanometer ** 1"></Constraint> | ||
| <Constraint smirks="[#1:1]-[#8X2H2+0]-[#1:2]" id="c-tip4p-ew-H-O-H" distance="0.15139006545247014 * nanometer ** 1"></Constraint> | ||
| </Constraints> | ||
| <VirtualSites version="0.3" exclusion_policy="parents"> | ||
| <VirtualSite smirks="[#1:2]-[#8X2H2+0:1]-[#1:3]" epsilon="0.0 * kilocalorie_per_mole ** 1" type="DivalentLonePair" match="once" distance="-0.0125 * nanometer ** 1" outOfPlaneAngle="0.0 * degree ** 1" inPlaneAngle="None" charge_increment1="0.0 * elementary_charge ** 1" charge_increment2="0.52422 * elementary_charge ** 1" charge_increment3="0.52422 * elementary_charge ** 1" sigma="1.0 * angstrom ** 1" name="EP"></VirtualSite> | ||
| </VirtualSites> | ||
| </SMIRNOFF> |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| """ | ||
| Write TIP3P-EW parameters into a SMIRNOFF force field. Based on | ||
| https://github.com/openmm/openmm/blob/116aed3927066b0a53eba929110d73f3daew64bd/wrappers/python/openmm/app/data/tip4pew.xml | ||
| """ | ||
| from pathlib import Path | ||
|
|
||
| import pandas | ||
| from openff.toolkit.typing.engines.smirnoff.forcefield import ForceField | ||
| from openff.toolkit.typing.engines.smirnoff.parameters import ( | ||
| ConstraintHandler, | ||
| ElectrostaticsHandler, | ||
| LibraryChargeHandler, | ||
| VirtualSiteHandler, | ||
| vdWHandler, | ||
| ) | ||
| from openff.units import unit | ||
| from packaging import version | ||
|
|
||
| VERSION = version.Version("1.0.0") | ||
| OFFXML_PATH = Path("openforcefields", "offxml") | ||
|
|
||
| tip4p_ew = ForceField() | ||
|
|
||
| tip4p_ew_electrostatics = ElectrostaticsHandler(version=0.4, scale14=0.8333333333) | ||
| tip4p_ew_library = LibraryChargeHandler(version=0.3) | ||
| tip4p_ew_vdw = vdWHandler(version=0.4) | ||
| tip4p_ew_constraints = ConstraintHandler(version=0.3) | ||
| tip4p_ew_virtual_sites = VirtualSiteHandler(version=0.3) | ||
|
|
||
| tip4p_ew_vdw.add_parameter( | ||
| { | ||
| "smirks": "[#1]-[#8X2H2+0:1]-[#1]", | ||
| "epsilon": unit.Quantity(0.680946, unit.kilojoule_per_mole), | ||
| "sigma": unit.Quantity(0.316435, unit.nanometer), | ||
| "id": "n-tip4p-ew-O", | ||
| } | ||
| ) | ||
| tip4p_ew_vdw.add_parameter( | ||
| { | ||
| "smirks": "[#1:1]-[#8X2H2+0]-[#1]", | ||
| "epsilon": unit.Quantity(0.0, unit.kilocalorie_per_mole), | ||
| "sigma": unit.Quantity(1.0, unit.nanometer), | ||
| "id": "n-tip4p-ew-H", | ||
| } | ||
| ) | ||
|
|
||
| tip4p_ew_library.add_parameter( | ||
| { | ||
| "smirks": "[#1]-[#8X2H2+0:1]-[#1]", | ||
| "charge1": unit.Quantity(0.0, unit.elementary_charge), | ||
| "id": "q-tip4p-ew-O", | ||
| } | ||
| ) | ||
| tip4p_ew_library.add_parameter( | ||
| { | ||
| "smirks": "[#1:1]-[#8X2H2+0]-[#1]", | ||
| "charge1": unit.Quantity(0.0, unit.elementary_charge), | ||
| "id": "q-tip4p-ew-H", | ||
| } | ||
| ) | ||
|
|
||
| # Virtual site distance = 0.08984267127345 * 2 * 0.09572 * cos(1.82421813418 / 2) | ||
| tip4p_ew_virtual_sites.add_parameter( | ||
| { | ||
| "type": "DivalentLonePair", | ||
| "smirks": "[#1:2]-[#8X2H2+0:1]-[#1:3]", | ||
| "match": "once", | ||
| "name": "EP", | ||
| "distance": unit.Quantity(-0.0125, unit.nanometer), | ||
| "sigma": unit.Quantity(1.0, unit.angstrom), | ||
| "epsilon": unit.Quantity(0.0, unit.kilocalorie_per_mole), | ||
| "outOfPlaneAngle": unit.Quantity(0.0, unit.degree), | ||
| "charge_increment1": unit.Quantity(0.0, unit.elementary_charge), | ||
| "charge_increment2": unit.Quantity(0.52422, unit.elementary_charge), | ||
| "charge_increment3": unit.Quantity(0.52422, unit.elementary_charge), | ||
| } | ||
| ) | ||
|
|
||
| tip4p_ew_constraints.add_parameter( | ||
| { | ||
| "smirks": "[#1:1]-[#8X2H2+0:2]-[#1]", | ||
| "id": "c-tip4p-ew-H-O", | ||
| "distance": unit.Quantity(0.09572, unit.nanometer), | ||
| } | ||
| ) | ||
| # H-H distance = 2 * 0.09572 * sin(1.82421813418 / 2) | ||
| tip4p_ew_constraints.add_parameter( | ||
| { | ||
| "smirks": "[#1:1]-[#8X2H2+0]-[#1:2]", | ||
| "id": "c-tip4p-ew-H-O-H", | ||
| "distance": unit.Quantity(0.15139006545247014, unit.nanometer), | ||
| } | ||
| ) | ||
|
|
||
| for handler in [ | ||
| tip4p_ew_vdw, | ||
| tip4p_ew_library, | ||
| tip4p_ew_electrostatics, | ||
| tip4p_ew_constraints, | ||
| tip4p_ew_virtual_sites, | ||
| ]: | ||
| tip4p_ew.register_parameter_handler(handler) | ||
|
|
||
| tip4p_ew.to_file(Path(OFFXML_PATH, "tip4p_ew.offxml")) | ||
| tip4p_ew.to_file(Path(OFFXML_PATH, f"tip4p_ew-{VERSION}.offxml")) |
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.
👍