mosdef-hub/foyer

Ambiguous SMARTS string for OPLS methoxy carbon?

mphoward opened this issue · 6 comments

I am getting an error where multiple types---opls_182 and opls_468---are found for the same atom. (Sorry, I don't have a minimum reproducer structure right now!). I looked at the forcefield file, and I was wondering if the SMARTS string for opls_468 is correct:

<Type name="opls_468" class="CT" element="C" mass="12.011" def="[C;X4]([O;%opls_467])" overrides='opls_181' desc="methoxy C in esters" doi="10.1021/ja9539195"/>

If this type is the carbon on a methoxy group as indicated in the description, it seems like it should have three hydrogens

[C;X4]([O;%opls_467])(H)(H)H

and not any 3 additional connections? However, I'm not 100% clear on this atom type.

Hi @mphoward, thank for spotting this! We agree that the SMARTS string for this methoxy carbon is not specific enough. We will have a PR to update the SMARTS string.

Thank you! I modified this xml file locally, and I confirmed I was able to get all my atoms to type after changing the SMARTS string as indicated above. However, my resulting compound is not charge neutral. I will investigate to see if this is just a mistake on my part, or if some other atom (possibly nearby the C that was triggering this issue) is incorrectly typed.

Thanks for checking this out and testing it as well @mphoward ! If you have a SMILES string of a minimal structure that exhibits this behavior as well as the lack of charge neutrality, we would be more than happy to take a look and maybe build some test cases around them!

@justinGilmer no problem, I will try to isolate it. I only noticed this issue after I built up a pretty big compound, so I need to find which piece is actually causing the issue. Happy to update / share as another issue once I do that!

@justinGilmer Opened up a separate issue #430 with an example structure that I think reproduces both the initial issue and the charge issue.

I noted another ambiguous SMARTS string while trying to combine oplsaa.xml with a water forcefield. The definition of opls_154 (oxygen in an alcohol) is not specific enough and will also match oxygen in water:

<Type name="opls_154" class="OH" element="O" mass="15.9994" def="[O;X2]H" desc="all-atom O: mono alcohols" doi="10.1021/ja9621760"/>

Without being able to specify H<n> in the SMARTS string, I think the following would work:

[O;X2](H)([!H])