mbuild icon indicating copy to clipboard operation
mbuild copied to clipboard

Add Support for Periodic Impropers in LAMMPS datafile

Open rmatsum836 opened this issue 4 years ago • 4 comments

PR Summary:

This PR aims to add support for periodic improper dihedrals in the LAMMPS datafile writer. I ran into this issue trying to write out a system using ionic liquid parameters using the CL&P force field (https://link.springer.com/article/10.1007/s00214-012-1129-7) which uses RB torsions for proper dihedrals and periodic torsions for improper dihedrals. Since periodic improper dihedrals are stored in structure.dihedrals, this was causing an error because I had both RB and periodic torsions. Here, I attempt to fix this by looping through structure.dihedrals and separating out the proper and improper dihedrals. If any of the dihedrals in structure.dihedrals are propers and RB torsions also exist, this will error out as previously. However, if all of the structure.dihedrals are impropers then these will get written out. Now, the writer checks if the parmed structure contains both structure.improper and structure.dihedrals that are impropers. If this is the case, an error will get raised.

Need to test on some systems, clean up, and add unit tests before a proper review.

PR Checklist


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

rmatsum836 avatar Jul 17 '20 22:07 rmatsum836

I'm pretty sure CHARMM only uses harmonic impropers. AMBER is the one that uses periodic functional forms for both impropers and proper dihedrals. I couldn't find any good documentation though, so I might be wrong.

uppittu11 avatar Jul 30 '20 16:07 uppittu11

Am currently doing some energy comparisons between LAMMPS and GROMACS. The improper dihedral energies are not matching up so this is something else to look into.

rmatsum836 avatar Aug 13 '20 17:08 rmatsum836

Codecov Report

Merging #765 into master will increase coverage by 0.30%. The diff coverage is 40.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #765      +/-   ##
==========================================
+ Coverage   82.32%   82.63%   +0.30%     
==========================================
  Files          57       58       +1     
  Lines        4844     4935      +91     
==========================================
+ Hits         3988     4078      +90     
- Misses        856      857       +1     
Impacted Files Coverage Δ
mbuild/formats/lammpsdata.py 84.56% <40.00%> (-3.09%) :arrow_down:
mbuild/__init__.py 100.00% <0.00%> (ø)
mbuild/lib/moieties/silane.py 100.00% <0.00%> (ø)
mbuild/conversion.py 90.05% <0.00%> (ø)
mbuild/compound.py 97.41% <0.00%> (+2.87%) :arrow_up:
mbuild/utils/io.py 78.50% <0.00%> (+3.01%) :arrow_up:
mbuild/lattice.py 96.27% <0.00%> (+8.72%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 368236d...40f6450. Read the comment docs.

codecov[bot] avatar Aug 13 '20 18:08 codecov[bot]

The above issue I believe is due to the order of the atoms defining the improper dihedral. In GROMACS, the improper angle is defined by the user while in LAMMPS, the angle is determined from the planes of I,J,K and J,K,L atoms (ordered I,J,K,L).

rmatsum836 avatar Aug 13 '20 20:08 rmatsum836

Closed in favor of new lammps writer in GMSO

daico007 avatar Mar 12 '24 02:03 daico007