-
Notifications
You must be signed in to change notification settings - Fork 578
OPC and OPC3 water #3654
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
OPC and OPC3 water #3654
Conversation
|
Thanks! Is it possible to add a test case that verifies these models? Something like this:
We also should add them to the list of water models in the manual. You'll find it in this file. |
|
@peastman I was thinking the density of an equilibrated box would be a pretty good test. I don't have a reference for the equilibrium geometry for a pair of molecules. Is there a specific way to compare energy amber <-> openmm? Also, how were the equilibrated water boxes eg openmm/app/data/tip3p.pdb made? Would OPC and OPC3 need their own? |
|
I suggest keeping it to just an energy comparison for a minimal system. Simulating a water box long enough to converge the density will take a while, and we want unit tests to be as fast as possible (preferably much less than a second for each one). And the result will be stochastic, so it might occasionally fail. Computing the energy of two molecules is fast and deterministic.
You can just compute the energy with sander and hardcode the result in the test case (with a comment saying where the value came from). |
|
@peastman I added an OPC water box and set up a unit test, the energies do match pretty closely. First, using ambertools-22.0-py38h6177452_1 installed from conda-forge, in tleap Then, get energy in sander (not super familiar with running sander so please let me know if there is a better way to just get energy without minimizing or running dynamics): mdin sander command and results Energy calculated in openmm with same PME cutoff using opcbox.pdb and opc.xml = Let me know if that looks okay and I'll do the same for OPC3. P.S. I ran the test in a notebook and then copied it to a unittest.TestCase. Could you please let me know how openmm unit tests are run usually? |
|
@peastman I serialized a system created from the opcbox.prmtop and opcbox.inpcrd, and kept modifying the opc.xml file until a system serialized from opcbox.pdb and opc.xml matched as closely as possible. However - that requires values which are slightly different from the ones described in ambertools's frcmod and lib files For example: Is a charge difference of 1.8e-09 something to worry about? Where does the difference come from? Which value should we use? There may be similar very slight differences in geometry - bond lengths and constraints are exact, but angles formed by the OW-HW and HW-HW triangle are not exactly the same as the specified HW-OW-HW angle of 103.6 degrees, rather the angle is 103.59892973636502 degrees. For this I matched the exact HW-HW length not the angle. Conversion code: |
|
OpenMM uses a different set of physical constants than Amber's As a result, I'd expect to see some differences on the order of 3e-5 in energies and forces. |
@jchodera Thanks! Which do you think is better: (a) have opc.xml use the same numerical values as leap/lib/opcbox.off and leap/parm/frcmod.opc, but have a system created from tleap -> prmtop -> openmm be different from a system created from pdb -> openmm, or I'm still not sure where the difference in numerical values comes from now, even though the unit definitions are different. Do we essentially convert units when reading prmtop files now? Ie, does reading a prmtop cause 1 prmtop-e charge to be converted to 1.000001 opemm-e charges or something similar? |
@peastman may have a more succinct statement of our philosophy on converting parameters developed with other packages, but I believe out approach to date has been to convert the parameters directly, even if the difference in physical constants causes a difference in potential energies between packages. More modern approaches for converting parameterized systems like openff-interchange from @mattwthompson may have a different philosophy here.
It's important to remember that Amber |
|
What currently happens in in OpenMM's infrastructure when Amber infrastructure reports a value using its unit definitions? I would be floored if this issue hasn't been run into years ago; as far as I can tell this isn't the first set of Amber parameters that are being ported into OpenMM code. Let me add that it's a difficult problem and I wouldn't at all blame people for sweeping under the rug in the past. |
|
Different values for fundamental constants is a problem through the whole community. I believe CHARMM uses yet another set of values which are different from either OpenMM or Amber. Still, when people convert force fields they generally use the exact parameter values. This means you shouldn't expect energies from different codes to match to more than about five significant digits. In practice that doesn't generally matter, since other uncertainties are much larger. |
|
@peastman Ready for review!
|
|
Aside from the minor comments above about the test case, this looks great. |
|
Thanks! |
Adding OPC and OPC3 water models, references:
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4226301/
For OPC, any parameters not directly copied from the paper were calculated as follows:
H-O-H angle:
deg2rad(103.6)O charge:
-2*0.6791Virtual site weight 2 and 3:
0.1594/(2*(cos(deg2rad(103.6)/2) * 0.8724))Virtual site weight 1:
1 - 2*weight2https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4991989/
For OPC3:
H-O-H angle:
deg2rad(109.47)O charge:
-2*0.447585In terms of xml file format, opc.xml was initially cloned from tip4pfb.xml, and opc3.xml from tip3p.xml.
The models are intended to be rigid, so the papers don't provide bond and angle force constants. The constants used here (only for convenience so flexible water simulations don't blow up) are also copied from TIP4FB / TIP3P.