Skip to content
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

Add Smarts Strings for Chlorobenzene and Benzonitrile #308

Merged
merged 16 commits into from
Feb 13, 2020

Conversation

Argon1999
Copy link
Contributor

PR Summary:

Added Smarts Strings for Chlorobenzene and Benzonitrile, they atom typed correctly. Tested Density and Self Diffusivity got decent results when comparing to literature values.

PR Checklist


  • Includes appropriate unit test(s)
  • Appropriate docstring(s) are added/updated
  • Code is (approximately) PEP8 compliant
  • Issue(s) raised/addressed?

@ahy3nz
Copy link
Contributor

ahy3nz commented Jan 25, 2020

Toluene, propanenitrile, o-xylene, 124-trimethylbenzene, 2-methylphenol, 3-methylphenol, 4-methylphenol, and ethyl benzene failed for testopls::test_atomtyping.

Atomtyping conflicts: 260 vs 145, 261 vs 754, 262 vs 753. Check back at the definitions for those atom types, it's possible your PR's definitions are too generic, or maybe those old atom-types need to be amended

@mattwthompson
Copy link
Member

Also please add some test molecules in MOL2 format and update the implemented_opls_tests.txt file. You can look through existing files in foyer/opls_validation/ or i.e. #278 for reference

@rmatsum836
Copy link
Contributor

Thanks for your feedback. @Argon1999 is currently running some simulations of bulk chlorobenzene and benzonitrile to verify several properties. Afterwards, we will add some molecules, update implemented_opls_test.txt, and check the atom typing conflicts.

@rmatsum836
Copy link
Contributor

I think tests will pass now. Should just need to add the mol2 files and update implemented_opls_tests.txt now.

@codecov
Copy link

codecov bot commented Jan 28, 2020

Codecov Report

Merging #308 into master will decrease coverage by 2.11%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master     #308      +/-   ##
==========================================
- Coverage   86.90%   84.78%   -2.12%     
==========================================
  Files          14       14              
  Lines        1252     1275      +23     
==========================================
- Hits         1088     1081       -7     
- Misses        164      194      +30     

@rmatsum836
Copy link
Contributor

Update on this: Benzonitrile is atom typing. We replaced the gro and top files in the opls_validation directory with a mol2 file, per #309. However we are now getting an error due to missing dihedral types. This also brings up the question of how we want to handle assert_dihedral_params for testing atom types.

One of the dihedral types we're missing is in the benonitrile ring (CA-CA-CA-CA), but we can't find it in the force field files in GROMACS. Searching other sources to see if we can find the parameters for this dihedral.

@mattwthompson
Copy link
Member

Normally I'd go to http://virtualchemistry.org/ (the companion to David van der Spoel's big JCTC paper: https://pubs.acs.org/doi/abs/10.1021/ct200731v) since I think many of our files originally came from there, but it seems to be offline ....

Copy link
Contributor

@justinGilmer justinGilmer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome additions! Thanks @Argon1999 and @rmatsum836 ! Just a comment/suggestion left below and after that, LGTM!

foyer/forcefields/xml/oplsaa.xml Outdated Show resolved Hide resolved
@rmatsum836
Copy link
Contributor

Thanks for fixing this @Argon1999. @mosdef-hub/mosdef-contributors I think this is good to go if I could get another pair of eyes on this.

@rmatsum836
Copy link
Contributor

JK, test_from_mbuild_customtype is failing for some reason on two of the AZP builds.

@daico007
Copy link
Member

daico007 commented Feb 6, 2020

This fail seems to relate to the new box class, so I am looking into this now

@rmatsum836
Copy link
Contributor

Tests are now passing. @mosdef-hub/mosdef-contributors this should be good to be reviewed now.

Copy link
Member

@mattwthompson mattwthompson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I missing chlorobenzene files? I don't see them in this PR or the opls_validation folder of the master branch

<Type name="opls_260" class="CA" element="C" mass="12.011" def="[C;X3;r6]([C;X2;%opls_261])" overrides = "opls_145" desc="Benzonitrile C(CN)" doi="10.1021/ja9621760"/>
<Type name="opls_261" class="CZ" element="C" mass="12.011" def="[C;X2]([C;X3;r6])" overrides = "opls_754" desc="Benzonitrile: carbon in nitrile group (CN) " doi="10.1021/ja9621760"/>
<Type name="opls_262" class="NZ" element="N" mass="14.0067" def="[N;X1][C;%opls_261]" overrides = "opls_753" desc="Benzonitrile Nitrogen(benzene-C)N" doi="10.1021/ja9621760"/>
<Type name="opls_263" class="CA" element="C" mass="12.011" def="[C;X3;r6]1(Cl)[C;X3;r6][C;X3;r6][C;X3;r6][C;X3;r6][C;X3;r6]1" overrides="opls_145" desc="Chlorobenzene C(Cl)" doi="10.1021/ja9621760"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<Type name="opls_263" class="CA" element="C" mass="12.011" def="[C;X3;r6]1(Cl)[C;X3;r6][C;X3;r6][C;X3;r6][C;X3;r6][C;X3;r6]1" overrides="opls_145" desc="Chlorobenzene C(Cl)" doi="10.1021/ja9621760"/>
<Type name="opls_263" class="CA" element="C" mass="12.011" def="[C;X3;r6](Cl)1[C;X3;r6][C;X3;r6][C;X3;r6][C;X3;r6][C;X3;r6]1" overrides="opls_145" desc="Chlorobenzene C(Cl)" doi="10.1021/ja9621760"/>

I am just curious if this works too, no need to make this change. I wonder if the branch can be defined both inside and outside the ring

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Argon1999 could you add gro and top files for chlorobenzene in a Chlorobenzene directory in opls_validation?

Copy link
Contributor

@justinGilmer justinGilmer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets shorten the amount of cholorbenzenes in the gro file from 200 -> 1, and then we can see if all the tests pass @Argon1999

@@ -0,0 +1,2403 @@
GROningen MAchine for Chemical Simulation
2400
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we update this file to just have 1 cholorobenzene? Will make the testing a bit faster.

@rmatsum836
Copy link
Contributor

Really went down a rabbit hole with this one. I think that we're much better off reading gro and top files compared to reading in a mol2. ParmEd assumes a certain naming convention to grab elements by name, and is unable to read in Chlorine by CL or Cl. However, if a ParmEd structure is initialized with a top file, then the element is read by mass and chlorine is read in correctly.

What caused us problems in this case is that we had both top and mol2 files. In test_atomtyping, we loop through the files in each directory. As a result, the ParmEd structure loaded in by a top file would get overwritten by a structure loaded in by a mol2file. I think we should change the structure of this code where the for loop is broken if we find a top file in the directory.

@daico007
Copy link
Member

@rmatsum836 I think use mb.load instead of pmd.load in the unit test for the mol2 case should fix this. We are having the same issues a while ago with this over mbuild, and we decided to enforce molecule's name capitalization before shipping to Parmed to fix that.

@rmatsum836
Copy link
Contributor

@rmatsum836 I think use mb.load instead of pmd.load in the unit test for the mol2 case should fix this. We are having the same issues a while ago with this over mbuild, and we decided to enforce molecule's name capitalization before shipping to Parmed to fix that.

I thought about that too, but wasn't sure if we wanted to go from mb.Compound to pmd.Structure for these tests. However, I don't really see any negatives to this fix.

@mattwthompson
Copy link
Member

My only (tiny) concern is that we're basing a Foyer test off of a quirk in mBuild. I'm fine preferring MDTraj over ParmEd since it seems like it has the better MOL2 reader. I'll raise an issue there to see if we can clear things up.

@rmatsum836
Copy link
Contributor

Regardless, the tests are passing so should be good to merge. Not sure why there is a drop in coverage though.

@ahy3nz
Copy link
Contributor

ahy3nz commented Feb 12, 2020

@rmatsum836 I think use mb.load instead of pmd.load in the unit test for the mol2 case should fix this. We are having the same issues a while ago with this over mbuild, and we decided to enforce molecule's name capitalization before shipping to Parmed to fix that.

I thought about that too, but wasn't sure if we wanted to go from mb.Compound to pmd.Structure for these tests. However, I don't really see any negatives to this fix.

The whole reason we use pmd.load_file is because the resultant pmd.Structure.atoms have both name(element) and type (atom-type). Going back to mbuild loses any atom type information, which is the "answer" used to validate the atom-typing. Similarly, I think mdtraj.load will only retain name information and nothing about atom types that we need to validate

Copy link
Member

@mattwthompson mattwthompson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests passing, LGTM

@rmatsum836 rmatsum836 merged commit 1e95f06 into mosdef-hub:master Feb 13, 2020
@Argon1999 Argon1999 deleted the benzo branch June 17, 2020 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants