shirtsgroup / InterMol

Conversion tool for molecular simulations
MIT License
186 stars 53 forks source link

GROMACS dihedraltype lookup appears to choose first successful lookup #309

Closed ctk3b closed 7 years ago

ctk3b commented 7 years ago

When looking up a GROMACS dihedral type, apparently GROMACS chooses the first entry that it finds, not the most specific (fewest wildcards).

[ dihedraltypes ]
  X      CT     OH     X       3      0.0      0.0     0.0      0.0     0.0 0.0
  HC     CT     OH     HO      3      1.0      0.0    -1.0      0.0     0.0 0.0

When looking up an HC CT OH HO, the first entry in dihedraltypes is chosen even though it is less specific.

An assumption that we baked into InterMol was that more specific dihedrals would be matched first. Attached is a minimal .gro/.top pair that replicates this issue using the above dihedraltype entry.

@dspoel @maaren any ideas if this is intended behavior or if the forcefields are required to be sorted in order from most to least specific entries in GROMACS?

cc @mrshirts

debug_dihedraltype_lookup.zip

dspoel commented 7 years ago

On 24/01/17 17:04, Christoph Klein wrote:

When looking up a GROMACS dihedral type, apparently GROMACS chooses the /first/ entry that it finds, not the most specific (fewest wildcards).

|[ dihedraltypes ] X CT OH X 3 0.0 0.0 0.0 0.0 0.0 0.0 HC CT OH HO 3 1.0 0.0 -1.0 0.0 0.0 0.0 |

When looking up an |HC CT OH HO|, the first entry in dihedraltypes is chosen even though it is less specific.

An assumption that we baked into InterMol was that more specific dihedrals would be matched first. Attached is a minimal .gro/.top pair that replicates this issue using the above dihedraltype entry.

@dspoel https://github.com/dspoel @maaren https://github.com/maaren any ideas if this is intended behavior or if the forcefields are required to be sorted in order from most to least specific entries in GROMACS?

cc @mrshirts https://github.com/mrshirts

debug_dihedraltype_lookup.zip https://github.com/shirtsgroup/InterMol/files/727172/debug_dihedraltype_lookup.zip

Your observations are correct, your gromacs version is not ;). Here's an excerpt from the latest manual:

For [ dihedraltypes ] wildcard atom type names can be specified with the letter X in one or more of the four positions. Thus one can for example assign proper dihedral parameters based on the types of the middle two atoms. The parameters for the entry with the most exact matches, i.e. the least wildcard matches, will be used. Note that GROMACS versions older than 5.1.3 used the first match, which means that a full match would be ignored if it is preceded by an entry that matches on wildcards.

This could imply differences in the results for OPLS before and after this version, which is not nice. Note though that in many cases the wildcards are listed after the specific cases.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/shirtsgroup/InterMol/issues/309, or mute the thread https://github.com/notifications/unsubscribe-auth/ADj_PtM3gRecJZQY2NwguKAoUv7xrVu1ks5rViELgaJpZM4Lscj6.

-- David van der Spoel, Ph.D., Professor of Biology Dept. of Cell & Molec. Biol., Uppsala University. Box 596, 75124 Uppsala, Sweden. Phone: +46184714205. spoel@xray.bmc.uu.se http://folding.bmc.uu.se

ctk3b commented 7 years ago

Ah great - that's clear then. Sorry for the mixup and thank you for the clarification!