Skip to content

Commit

Permalink
Modify opls_validation ".top" impropers (#506)
Browse files Browse the repository at this point in the history
* Modify opls_validation ".top" impropers

This PR aims to fix bugs in the opls_validation files. More
specifically, improper parameters that were added to those files
for testing do not using the correct "funct" value to designate
them as periodic impropers. They had previously all been given
the value of "1", which designates them as periodic propers. Parmed
doesn't treat periodic propers any differently than periodic impropers,
except to use a "dihedral.improper" boolean. They are still stored in
structure.dihedrals.

This is relevant when doing conversion from a parmed object to GMSO,
as GMSO has explicit container for impropers. This will be necessary
when parameterizing in GMSO as opposed to ParmEd, and testing that
the parameters are stored in this impropers container in GMSO.

See this link for more information about gromacs topology files.
https://manual.gromacs.org/current/reference-manual/topologies/topology-file-formats.html

    * Change funct values from "1" to "4" in opls_validation top files
    * Add test to "test_opls.py" to validate the correct number of
    impropers are found

* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
CalCraven and pre-commit-ci[bot] authored May 27, 2022
1 parent 24a5d5c commit 298b3c6
Show file tree
Hide file tree
Showing 19 changed files with 134 additions and 97 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,12 @@

[ dihedrals ]
; ai aj ak al funct c0 c1 c2 c3
2 1 3 7 1 180 4.6 2
3 2 4 9 1 180 4.6 2
4 3 5 13 1 180 4.6 2
5 4 6 8 1 180 4.6 2
6 5 7 14 1 180 4.6 2
7 2 6 15 1 180 4.6 2
2 1 3 7 4 180 4.6 2
3 2 4 9 4 180 4.6 2
4 3 5 13 4 180 4.6 2
5 4 6 8 4 180 4.6 2
6 5 7 14 4 180 4.6 2
7 2 6 15 4 180 4.6 2

[ system ]
124-trimethylbenzene GAS
Expand Down
12 changes: 6 additions & 6 deletions foyer/opls_validation/13-difluorobenzene/13-difluorobenzene.top
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@
10 9 11 12 3

; added, improper
1 11 3 2 1 180 4.6 2
3 1 5 4 1 180 4.6 2
5 3 7 6 1 180 4.6 2
7 5 9 8 1 180 4.6 2
9 7 11 10 1 180 4.6 2
11 9 1 12 1 180 4.6 2
1 11 3 2 4 180 4.6 2
3 1 5 4 4 180 4.6 2
5 3 7 6 4 180 4.6 2
7 5 9 8 4 180 4.6 2
9 7 11 10 4 180 4.6 2
11 9 1 12 4 180 4.6 2
; ring_180
1 3 5 7 1 180 4.6 2
3 5 7 9 1 180 4.6 2
Expand Down
12 changes: 6 additions & 6 deletions foyer/opls_validation/2-methylphenol/2-methylphenol.top
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,12 @@
12 14 15 16 3

; added, improper
5 14 6 1 1 180 4.6 2
6 5 8 7 1 180 4.6 2
8 6 10 9 1 180 4.6 2
10 8 12 11 1 180 4.6 2
12 10 14 13 1 180 4.6 2
14 12 5 15 1 180 4.6 2
5 14 6 1 4 180 4.6 2
6 5 8 7 4 180 4.6 2
8 6 10 9 4 180 4.6 2
10 8 12 11 4 180 4.6 2
12 10 14 13 4 180 4.6 2
14 12 5 15 4 180 4.6 2
; 1 3 5 7 1 0 4.6 2
; 3 5 7 9 1 0 4.6 2
; 5 7 9 11 1 0 4.6 2
Expand Down
24 changes: 12 additions & 12 deletions foyer/opls_validation/3-methylphenol/3-methylphenol.top
Original file line number Diff line number Diff line change
Expand Up @@ -143,19 +143,19 @@
12 14 15 16 3

; added, improper
5 12 6 1 1 180 4.6 2
6 5 8 7 1 180 4.6 2
8 6 10 9 1 180 4.6 2
10 8 14 11 1 180 4.6 2
14 10 12 15 1 180 4.6 2
12 14 5 13 1 180 4.6 2
5 12 6 1 4 180 4.6 2
6 5 8 7 4 180 4.6 2
8 6 10 9 4 180 4.6 2
10 8 14 11 4 180 4.6 2
14 10 12 15 4 180 4.6 2
12 14 5 13 4 180 4.6 2
; ring_180
5 6 8 10 1 180 4.6 2
6 8 10 14 1 180 4.6 2
8 10 14 12 1 180 4.6 2
10 14 12 5 1 180 4.6 2
14 12 5 6 1 180 4.6 2
12 5 6 8 1 180 4.6 2
; 5 6 8 10 1 180 4.6 2
; 6 8 10 14 1 180 4.6 2 This dihedral doesn't exist
; 8 10 14 12 1 180 4.6 2
; 10 14 12 5 1 180 4.6 2
; 14 12 5 6 1 180 4.6 2
; 12 5 6 8 1 180 4.6 2

[ system ]
3-methylphenol GAS
Expand Down
24 changes: 12 additions & 12 deletions foyer/opls_validation/4-methylphenol/4-methylphenol.top
Original file line number Diff line number Diff line change
Expand Up @@ -143,19 +143,19 @@
12 14 15 16 3

; added, improper
1 14 3 2 1 180 4.6 2
3 1 5 4 1 180 4.6 2
5 3 10 6 1 180 4.6 2
10 5 12 11 1 180 4.6 2
12 10 14 13 1 180 4.6 2
14 12 1 15 1 180 4.6 2
1 14 3 2 4 180 4.6 2
3 1 5 4 4 180 4.6 2
5 3 10 6 4 180 4.6 2
10 5 12 11 4 180 4.6 2
12 10 14 13 4 180 4.6 2
14 12 1 15 4 180 4.6 2
; ring_180
1 3 5 10 1 180 4.6 2
3 5 10 12 1 180 4.6 2
5 10 12 14 1 180 4.6 2
10 12 14 1 1 180 4.6 2
12 14 1 3 1 180 4.6 2
14 1 3 5 1 180 4.6 2
; 1 3 5 10 1 180 4.6 2
; 3 5 10 12 1 180 4.6 2
; 5 10 12 14 1 180 4.6 2
; 10 12 14 1 1 180 4.6 2
; 12 14 1 3 1 180 4.6 2
; 14 1 3 5 1 180 4.6 2

[ system ]
4-methylphenol GAS
Expand Down
4 changes: 2 additions & 2 deletions foyer/opls_validation/N-methylformamide/N-methylformamide.top
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ N-methylformamide 3
6 5 7 9 3

; Added DvdS 2010-12-21
7 9 5 8 1 180 4.6 2
5 1 7 6 1 180 4.6 2
7 9 5 8 4 180 4.6 2
5 1 7 6 4 180 4.6 2
[ system ]
N-methylformamide GAS
[ molecules ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ NN-dimethylacetamide 3
8 7 12 15 3

; Added DvdS 2010-12-21
5 1 7 6 1 180 4.6 2
5 8 12 7 1 180 4.6 2
5 1 7 6 4 180 4.6 2
5 8 12 7 4 180 4.6 2
[ system ]
NN-dimethylacetamide GAS
[ molecules ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ NN-dimethylformamide 3
6 5 10 12 3

; Added DvdS 2010-12-21
10 12 5 11 1 180 4.6 2
5 1 6 10 1 180 4.6 2
10 12 5 11 4 180 4.6 2
5 1 6 10 4 180 4.6 2
[ system ]
NN-dimethylformamide GAS
[ molecules ]
Expand Down
4 changes: 2 additions & 2 deletions foyer/opls_validation/dimethylformamide/dimethylformamide.top
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@
6 5 10 12 3

; Added DvdS 2010-12-21
10 12 5 11 1 180 4.6 2
5 1 6 10 1 180 4.6 2
10 12 5 11 4 180 4.6 2
5 1 6 10 4 180 4.6 2

[ system ]
dimethylformamide GAS
Expand Down
12 changes: 6 additions & 6 deletions foyer/opls_validation/ethylbenzene/ethylbenzene.top
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,12 @@ ethylbenzene 3
16 15 17 18 3

; added, improper
8 17 9 5 1 180 4.6 2
9 8 11 10 1 180 4.6 2
11 9 13 12 1 180 4.6 2
13 11 15 14 1 180 4.6 2
15 13 17 16 1 180 4.6 2
17 15 8 18 1 180 4.6 2
8 17 9 5 4 180 4.6 2
9 8 11 10 4 180 4.6 2
11 9 13 12 4 180 4.6 2
13 11 15 14 4 180 4.6 2
15 13 17 16 4 180 4.6 2
17 15 8 18 4 180 4.6 2
; 1 3 5 7 1 0 4.6 2
; 3 5 7 9 1 0 4.6 2
; 5 7 9 11 1 0 4.6 2
Expand Down
12 changes: 6 additions & 6 deletions foyer/opls_validation/fluorobenzene/fluorobenzene.top
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ fluorobenzene 3
7 9 11 1 3

; added, improper
1 11 3 2 1 180 4.6 2
3 1 5 4 1 180 4.6 2
5 3 7 6 1 180 4.6 2
7 5 9 8 1 180 4.6 2
9 7 11 10 1 180 4.6 2
11 9 1 12 1 180 4.6 2
1 11 3 2 4 180 4.6 2
3 1 5 4 4 180 4.6 2
5 3 7 6 4 180 4.6 2
7 5 9 8 4 180 4.6 2
9 7 11 10 4 180 4.6 2
11 9 1 12 4 180 4.6 2
; 1 3 5 7 1 0 4.6 2
; 3 5 7 9 1 0 4.6 2
; 5 7 9 11 1 0 4.6 2
Expand Down
4 changes: 2 additions & 2 deletions foyer/opls_validation/formamide/formamide.top
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ formamide 3
3 2 4 6 3

; Added DvdS 2010-12-21
2 1 4 3 1 180 4.6 2
4 5 6 2 1 180 4.6 2
2 1 4 3 4 180 4.6 2
4 5 6 2 4 180 4.6 2

[ system ]
formamide GAS
Expand Down
26 changes: 13 additions & 13 deletions foyer/opls_validation/nitrobenzene/nitrobenzene.top
Original file line number Diff line number Diff line change
Expand Up @@ -127,22 +127,22 @@ nitrobenzene 3
9 11 12 14 3

; added, improper
1 11 3 2 1 180 4.6 2
3 1 5 4 1 180 4.6 2
5 3 7 6 1 180 4.6 2
7 5 9 8 1 180 4.6 2
9 7 11 10 1 180 4.6 2
11 9 1 12 1 180 4.6 2
1 11 3 2 4 180 4.6 2
3 1 5 4 4 180 4.6 2
5 3 7 6 4 180 4.6 2
7 5 9 8 4 180 4.6 2
9 7 11 10 4 180 4.6 2
11 9 1 12 4 180 4.6 2
; ring_180
1 3 5 7 1 180 4.6 2
3 5 7 9 1 180 4.6 2
5 7 9 11 1 180 4.6 2
7 9 11 1 1 180 4.6 2
9 11 1 3 1 180 4.6 2
11 1 3 5 1 180 4.6 2
; 1 3 5 7 1 180 4.6 2
; 3 5 7 9 1 180 4.6 2
; 5 7 9 11 1 180 4.6 2
; 7 9 11 1 1 180 4.6 2
; 9 11 1 3 1 180 4.6 2
; 11 1 3 5 1 180 4.6 2

[ dihedrals ]
12 13 14 11 1 improper_X_NO_ON_NO
12 13 14 11 4 improper_X_NO_ON_NO
[ system ]
nitrobenzene GAS
[ molecules ]
Expand Down
2 changes: 1 addition & 1 deletion foyer/opls_validation/nitroethane/nitroethane.top
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ nitroethane 3
7 5 8 10 3

[ dihedrals ]
8 9 10 5 1 improper_X_NO_ON_NO
8 9 10 5 4 improper_X_NO_ON_NO
[ system ]
nitroethane GAS
[ molecules ]
Expand Down
2 changes: 1 addition & 1 deletion foyer/opls_validation/nitromethane/nitromethane.top
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ nitromethane 3
4 1 5 7 3

[ dihedrals ]
5 6 7 1 1 improper_X_NO_ON_NO
5 6 7 1 4 improper_X_NO_ON_NO

[ system ]
nitromethane GAS
Expand Down
12 changes: 6 additions & 6 deletions foyer/opls_validation/o-xylene/o-xylene.top
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,12 @@ o-xylene 3
12 14 15 18 3

; added, improper
5 14 6 1 1 180 4.6 2
6 5 8 7 1 180 4.6 2
8 6 10 9 1 180 4.6 2
10 8 12 11 1 180 4.6 2
12 10 14 13 1 180 4.6 2
14 12 5 15 1 180 4.6 2
5 14 6 1 4 180 4.6 2
6 5 8 7 4 180 4.6 2
8 6 10 9 4 180 4.6 2
10 8 12 11 4 180 4.6 2
12 10 14 13 4 180 4.6 2
14 12 5 15 4 180 4.6 2
; ring_180
5 6 8 10 1 180 4.6 2
6 8 10 12 1 180 4.6 2
Expand Down
12 changes: 6 additions & 6 deletions foyer/opls_validation/phenol/phenol.top
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ phenol 3
9 11 12 13 3

; added, improper
1 11 3 2 1 180 4.6 2
3 1 5 4 1 180 4.6 2
5 3 7 6 1 180 4.6 2
7 5 9 8 1 180 4.6 2
9 7 11 10 1 180 4.6 2
11 9 1 12 1 180 4.6 2
1 11 3 2 4 180 4.6 2
3 1 5 4 4 180 4.6 2
5 3 7 6 4 180 4.6 2
7 5 9 8 4 180 4.6 2
9 7 11 10 4 180 4.6 2
11 9 1 12 4 180 4.6 2
; 1 3 5 7 1 0 4.6 2
; 3 5 7 9 1 0 4.6 2
; 5 7 9 11 1 0 4.6 2
Expand Down
12 changes: 6 additions & 6 deletions foyer/opls_validation/toluene/toluene.top
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,12 @@ toluene 3
13 12 14 15 3

; added, improper
5 14 6 1 1 180 4.6 2
6 5 8 7 1 180 4.6 2
8 6 10 9 1 180 4.6 2
10 8 12 11 1 180 4.6 2
12 10 14 13 1 180 4.6 2
14 12 5 15 1 180 4.6 2
5 14 6 1 4 180 4.6 2
6 5 8 7 4 180 4.6 2
8 6 10 9 4 180 4.6 2
10 8 12 11 4 180 4.6 2
12 10 14 13 4 180 4.6 2
14 12 5 15 4 180 4.6 2
; 1 3 5 7 1 0 4.6 2
; 3 5 7 9 1 0 4.6 2
; 5 7 9 11 1 0 4.6 2
Expand Down
37 changes: 37 additions & 0 deletions foyer/tests/test_opls.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,43 @@ def test_full_parametrization(self, oplsaa):
assert all(x.type for x in parametrized.dihedrals)
assert parametrized.combining_rule == "geometric"

def test_improper_in_structure(self):
files_with_impropers = [
("o-xylene", 6),
("nitroethane", 1),
("fluorobenzene", 6),
("N-methylformamide", 2),
("formamide", 2),
("toluene", 6),
("3-methylphenol", 6),
("4-methylphenol", 6),
("2-methylphenol", 6),
("nitrobenzene", 7),
("dimethylformamide", 2),
("nitromethane", 1),
("NN-dimethylformamide", 2),
("124-trimethylbenzene", 6),
("phenol", 6),
("ethylbenzene", 6),
("NN-dimethylacetamide", 2),
("13-difluorobenzene", 6),
] # found in the "impropers" sections of molecule_name.top
for molecule, n_impropers in files_with_impropers:
top = os.path.join(
OPLS_TESTFILES_DIR, molecule + "/" + molecule + ".top"
)
gro = os.path.join(
OPLS_TESTFILES_DIR, molecule + "/" + molecule + ".gro"
)
structure = pmd.load_file(top, xyz=gro)
impropers = []
[
impropers.append(dihedral)
for dihedral in structure.dihedrals
if dihedral.improper
]
assert len(impropers) == n_impropers


if __name__ == "__main__":
TestOPLS().find_correctly_implemented()

0 comments on commit 298b3c6

Please sign in to comment.