-
Notifications
You must be signed in to change notification settings - Fork 8
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
Cross-check SMIRFF parm@frosst energies against parm@frosst energies from AMBER files #38
Conversation
…t least temporarily.
…o README.md and install.sh
… than in a test module, as it's more generally useful.
Well, I checked the |
Is the amber force constant in units of kcal/mol/angstrom or does it use nanometers? The factor of 2 is probably because Amber uses a silly definition of harmonic energies: K r^2 instead of (K/2) r^2 or something. I would prefer if we keep the standard (K/2) harmonic convention and convert the numbers in the XML file, or add an option to the XML HarmonicBondForce block to select between standard and weird amber conventions. |
I'm trying to find the place in the docs where it describes that and this:
as both are consistent with my theory. But, I have a meeting in five minutes so I'll probably have to get back to this, @jchodera .
Yes, agreed. |
@jchodera : Bond force constant is kcal/(mol angstrom^2). http://ambermd.org/formats.html see parm format. But, er, note that your file says "kilocalories_per_mole/angstrom"; if these text strings are parsed automatically (?? I haven't checked that) then missing the square might cause problems...? Off for my meeting, will investigate factor of 2 later. |
@swails - do you happen to know off the top of your head whether AMBER uses |
Whoops! Change angstrom to angstrom**2 to fix the factor of ten issue then. |
Thanks, @jchodera . Fixing a similar typo regarding radians as well. |
@jchodera : The GAFF page (http://ambermd.org/antechamber/gaff.html) and Wikipedia (https://en.wikipedia.org/wiki/AMBER#Functional_form) both drop the 2 in the equation for the force field functional form, which I think confirms this is the origin of the issue. I'll convert all of the spring constants. @cbayly13 will need to be reminded of this for the record. :) |
AMBER also drops the factor of 2 from angles, so I'll fix that as well. |
OK, bonds and angles are fixed but now I have an issue with sigma:
I'll investigate. |
Hmm, the ratio of 0.1908/0.339967 is 0.561. That doesn't mean anything to me, and the only thing I can think of it's even vaguely close to is related to k_B*T at 300K, but it's not exactly that. And there's no reason I can think of that would show up here... @jchodera , ideas? |
That's the conversion factor between
OpenMM uses the effective |
Ha, this is awesome. One of my old physics profs said "physicists carry minus signs and factors of two in their back pockets", and this exponentiates that maxim. :) What's your preference on handling this one? Handle it in the XML file or internally? Seems like XML file is probably preferable again. I'm still looking at the docs on this one. http://ambermd.org/formats.html#frcmod says this cryptic thing about NONB parameters:
10A translates to something irrelevant, 10B is r and epsilon, and 10C is LJ coefficients for r6 and r12. I don't know where 10A-10C is specified, but since these definitely aren't 10A or 10C, that puts us in category 10B. It says that the |
Ahha, confirmed what you were thinking by looking for the "MOD4" flag via Google, which turns up info from Swails: https://www.researchgate.net/post/Where_are_the_charge_sigma_epsilon_parameters_in_GAFF Specifically:
|
I would really like to keep "standard" forms for spring constants and Lennard-Jones <Atom smirks="[#8:1]" sigma="1.6837" epsilon="0.1700"/> <!-- making OS the generic oxygen -- we support reading of <Atom smirks="[#8:1]" rmin_half="1.6837" epsilon="0.1700"/> <!-- making OS the generic oxygen -- as well. |
@jchodera : Is that a one-line change somewhere? I haven't closely looked at that part of the code yet. Certainly it would simplify things, as I imagine Chris is going to be staring at these files in some viewer at some point and is going to want to compare them to the AMBER values he's got stuck in his head, so the |
Yup, I'm working on that now. Obviously it should have been coded that way to begin with. :) |
It's nice it's there, it just doesn't provide enough info now. I have a small bit of it working to print out detailed info now, but am still working. |
OK, here's what I have now, which is slightly more info, @jchodera :
Have to backtrack to figure out what the keys are supposed to be. :) I do know that Chris mentioned that his recent work uncovered a bug in parm@frosst somewhere where this implementation and parm@frosst SHOULD disagree (but I don't have the details of this written down - I'll have to re-ask tomorrow) so at SOME point we'll run into that, but it's unlikely we'd run into it on the second molecule we look at, as it was a small corner case. |
OK, periodicity and phase. Looking back to check files... |
The issue involves an O-C-C-H torsion involving the hydroxyl at the top of the attached image, the attached tetrahedral carbon, and one of the methyls, i.e. OH-CT-CT-H* where I'd have to look at the typing to see what that last proton is (it's part of a methyl). I'm drilling down into SMARTS matching to figure out what term is being applied and check details. |
Looks like good progress! I'm also wondering if there will be a difference in how AMBER and OpenMM specify torsion barriers. I vaguely recall that OpenMM just adds all the torsions up, while AMBER---at the time torsions are applied in LEaP---averages them in some way dependent on how many torsions are present for a given bond. But I might be totally mistaken there. |
@jchodera : OK, so I almost have this tracked down, in that it seems to PARTLY originate from the fact that we don't yet have all the torsions typed into the XML file. Tangentially, did you end up implementing the (There was an earlier version of this file which asked about multiple parameter specifications for a particular SMARTS, but I answered this question myself. Sorry.) |
@jchodera - updated the comment above. Sorry for the confusion. |
My example from openforcefield/open-forcefield-data#9 shows that this is handled as a single XML <Proper smirks="[#6X4]-[#6X4]-[#8X2]-[#1]" periodicity1="3" phase1="0.0" k1="0.16" periodiity2="1" phase2="0.0" k2="0.25"/> <!-- HO-OH-CT-CT from frcmod.Frosst_AlkEthOH -->
<Proper smirks="[#6X4]-[#6X4]-[#6X4]-[#6X4]" periodicity1="3" phase1="0.0" k1="0.18" periodicity2="2" phase2="180.0" k2="0.25" periodicity3="1" phase3="180.0" k3="0.20"/> <!-- CT-CT-CT-CT from frcmod.Frosst_AlkEthOH -->
The |
@jchodera : One other point of confusion. Bayly's file has lines like this:
Notice that the first entry in the torsional parameters is different for the two. What does this entry mean? It's in the AMBER formats. But I'm not seeing how it makes it into your XML file, which only has periodicity, phase, and k: <Proper smirks="[a,A:1]-[#6X4:2]-[#8X2:3]-[!#1:4]" periodicity1="3" phase1="00" k1="1.15"/> <!-- X -CT-OS-X from frcmod.Frosst_AlkEthOH -->
<Proper smirks="[#1:1]-[#6X4:2]-[#6X4:3]-[#1:4]" periodicity1="3" phase1="0.0" k1="0.15"/> <!-- HC-CT-CT-HC from frcmod.Frosst_AlkEthOH --> |
OK, I fixed THAT issue by adding the rest of the contents to the XML file. Onwards and upwards to the next issue, but first I have to continue to add more useful output to |
OK, so now I'm getting issues with torsional spring constants, which possibly could be unit issues or something. I'll have to investigate; however, I have to take a break to write a grant progress report, etc. So I'll just leave this here:
|
@jchodera : This comment could still use your attention when you have a moment. #38 (comment) |
That's the periodicity, which corresponds to |
Can you clarify what your error string means?
What does |
Whatever it is, it's off by a factor of 3. For an |
If true, fixing that would first require a philosophical discussion with @cbayly13: Do we want to adopt this behavior during torsion assignment in SMIRFF forcefields, or do we want to apply torsions additively, so that each torsion term always contributes the true barrier height in the parameter? |
@jchodera : There are several issues here and I'm going to go from most important to least important.
OK, so the point I'm making here is that there are FOUR parameters for each line - there is the periodicity, the force constant, the phase, and (some other number). You've implemented these in a file which only gives THREE parameters for each line. Specifically: <Proper smirks="[a,A:1]-[#6X4:2]-[#8X2:3]-[!#1:4]" periodicity1="3" phase1="0.0" k1="1.15"/> <!-- X -CT-OS-X from frcmod.Frosst_AlkEthOH -->
<Proper smirks="[#1:1]-[#6X4:2]-[#6X4:3]-[#1:4]" periodicity1="3" phase1="0.0" k1="0.15"/> <!-- HC-CT-CT-HC from frcmod.Frosst_AlkEthOH --> So, if the FIRST parameter is the periodicity, then you've implemented these incorrectly, since you've said in the XML that the periodicity is 3 for both of the above, but the first parameter is 3 for one of them and 1 for the other. On the other hand, if the FOURTH parameter is the periodicity then they are implemented correctly, and the question is: what's the first parameter? Regarding the error string:
This is NOT my error string. It's what was already in Also, it particularly bothered me that these provide no information whatsoever about which atoms these actually are aside from their numbers. I've now got it so it prints that info out, but I'll have to get back to the other parts later. |
It's also worth noting that the distinction between |
Ahh, @jchodera , from the AMBER documentation (http://ambermd.org/formats.html):
So I think that first number in the files is That would explain the factor of 3, as in this set IDIVF is always 1 or 3, it seems. |
Thanks for the clarification! I can implement an optional idivf attribute for torsion XML tags---no problem! Create an issue and tag me? I can also take a look at making the feedback for that system comparison code more informative if you can create an issue in openmoltools and tag me, ideally pointing out where that function is located in the codebase. Thanks again for digging into the details here, and apologies for the bugs! |
I'll create an issue and tag you. I don't think you need to work on making the system comparison code more informative. I can sort it out eventually. I just have to change gears for the rest of today. I'd rather have you work on the stuff I can't do. :) |
Merged this so that @jchodera can implement the IDIVF flag. I will start a new PR to continue with related testing once that flag is in. |
Working to address #37 by cross-comparing energies for OpenMM Systems/Topologies created from both starting points.
I have this working in
examples/SMIRFF_comparison
for a single molecule as a first attempt, and have coopted thesystem_checker
functionality fromopenmoltools
in order to do this.Currently, I'm getting a force constant error on the first force parameter check I run:
AssertionError: Error: Harmonic Bond (0, 1) has k0 values of 284512.000000 and 14225.600000, respectively.
*This is exactly a factor of 20 error, so I'm expecting we DO have a units error somewhere (a factor of two from a
k
vsk/2
convention, maybe, and a factor of 10 from a typing error?)This is for
examples/SMIRFF_comparison/AlkEthOH_inputfiles/AlkEthOH_chain_filt1/AlkEthOH_c0
. I'll attempt to troubleshoot, though it's unclear how much more time I'll have today.@bannanc , take a quick look for the factor of 10 issue? I can see if I can sort out the factor of 2.