From d709abe723c1024688c98ef2a9da04f303d61085 Mon Sep 17 00:00:00 2001 From: orioncohen Date: Fri, 15 Oct 2021 11:56:57 -0700 Subject: [PATCH 1/5] change lammps parser to not error if dihedral type is TrigDihedral, i.e. if improper_style is cvff --- intermol/lammps/lammps_parser.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/intermol/lammps/lammps_parser.py b/intermol/lammps/lammps_parser.py index b1b9a199..4482e77e 100644 --- a/intermol/lammps/lammps_parser.py +++ b/intermol/lammps/lammps_parser.py @@ -175,6 +175,9 @@ def canonical_dihedral(self, params, dihedral, direction='into'): elif dihedral == FourierDihedral: convertfunc = convert_dihedral_from_fourier_to_trig converted_dihedral = TrigDihedral + elif dihedral == TrigDihedral: + convertfunc = lambda x: x + converted_dihedral = TrigDihedral # Now actually convert the dihedral. params = convertfunc(params) From fc939c621dd4f07036ac215f1b4b7337cdba25c6 Mon Sep 17 00:00:00 2001 From: orioncohen Date: Fri, 15 Oct 2021 11:57:43 -0700 Subject: [PATCH 2/5] code copied from PR #349 to add 0s if coefficients in input file are left out --- intermol/forces/forcefunctions.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/intermol/forces/forcefunctions.py b/intermol/forces/forcefunctions.py index 08d158d3..382c0fc0 100644 --- a/intermol/forces/forcefunctions.py +++ b/intermol/forces/forcefunctions.py @@ -136,7 +136,10 @@ def create_kwds_from_entries(unitvars, paramlist, entries, force_type, offset=0) u = unitvars[typename] params = paramlist[typename] for i, p in enumerate(params): - kwds[p] = float(entries[offset+i]) * u[i] + if len(entries)<=(offset+i): + kwds[p] = float(0.0) + else: + kwds[p] = float(entries[offset+i]) * u[i] return kwds From bb0a7c0bc7c1f25edc0c002215c384c776f6ccd4 Mon Sep 17 00:00:00 2001 From: orioncohen Date: Fri, 15 Oct 2021 12:01:14 -0700 Subject: [PATCH 3/5] add units to 0 value when filling missing entry --- intermol/forces/forcefunctions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intermol/forces/forcefunctions.py b/intermol/forces/forcefunctions.py index 382c0fc0..5ec12b7a 100644 --- a/intermol/forces/forcefunctions.py +++ b/intermol/forces/forcefunctions.py @@ -137,7 +137,7 @@ def create_kwds_from_entries(unitvars, paramlist, entries, force_type, offset=0) params = paramlist[typename] for i, p in enumerate(params): if len(entries)<=(offset+i): - kwds[p] = float(0.0) + kwds[p] = float(0.0) * u[i] else: kwds[p] = float(entries[offset+i]) * u[i] return kwds From de50f8f15b18fa8a0e0332937ae3b83540c23a5a Mon Sep 17 00:00:00 2001 From: orioncohen Date: Fri, 15 Oct 2021 12:05:49 -0700 Subject: [PATCH 4/5] small stylistic changes --- intermol/forces/forcefunctions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/intermol/forces/forcefunctions.py b/intermol/forces/forcefunctions.py index 5ec12b7a..5594d5ec 100644 --- a/intermol/forces/forcefunctions.py +++ b/intermol/forces/forcefunctions.py @@ -136,8 +136,8 @@ def create_kwds_from_entries(unitvars, paramlist, entries, force_type, offset=0) u = unitvars[typename] params = paramlist[typename] for i, p in enumerate(params): - if len(entries)<=(offset+i): - kwds[p] = float(0.0) * u[i] + if len(entries) <= (offset+i): + kwds[p] = 0.0 * u[i] else: kwds[p] = float(entries[offset+i]) * u[i] return kwds From 1ce4f90493c3bf162dcabd90b75011b218600271 Mon Sep 17 00:00:00 2001 From: orioncohen Date: Wed, 20 Oct 2021 19:44:04 -0700 Subject: [PATCH 5/5] input files for lammps --- intermol/test_convert_lammps/benzene.lmp | 207 ++++++++++++++++++ .../test_convert_lammps/test_input.lammpsin | 13 ++ 2 files changed, 220 insertions(+) create mode 100644 intermol/test_convert_lammps/benzene.lmp create mode 100644 intermol/test_convert_lammps/test_input.lammpsin diff --git a/intermol/test_convert_lammps/benzene.lmp b/intermol/test_convert_lammps/benzene.lmp new file mode 100644 index 00000000..39f18ab8 --- /dev/null +++ b/intermol/test_convert_lammps/benzene.lmp @@ -0,0 +1,207 @@ +LAMMPS data file Created by LigParGen - (Written by Leela S. Dodda) + + 12 atoms + 12 bonds + 18 angles + 24 dihedrals + 6 impropers + + 12 atom types + 12 bond types + 18 angle types + 24 dihedral types + 6 improper types + + -2.177870 47.822130 xlo xhi + 0.998810 50.998810 ylo yhi + -0.941580 49.058420 zlo zhi + +Masses + + 1 12.011 + 2 12.011 + 3 12.011 + 4 12.011 + 5 12.011 + 6 12.011 + 7 1.008 + 8 1.008 + 9 1.008 + 10 1.008 + 11 1.008 + 12 1.008 + +Pair Coeffs + + 1 0.070 3.5500000 + 2 0.070 3.5500000 + 3 0.070 3.5500000 + 4 0.070 3.5500000 + 5 0.070 3.5500000 + 6 0.070 3.5500000 + 7 0.030 2.4200000 + 8 0.030 2.4200000 + 9 0.030 2.4200000 + 10 0.030 2.4200000 + 11 0.030 2.4200000 + 12 0.030 2.4200000 + +Bond Coeffs +#adlsfj + 1 469.0000 1.4000 + 2 469.0000 1.4000 + 3 469.0000 1.4000 + 4 469.0000 1.4000 + 5 469.0000 1.4000 + 6 367.0000 1.0800 + 7 367.0000 1.0800 + 8 367.0000 1.0800 + 9 367.0000 1.0800 + 10 367.0000 1.0800 + 11 367.0000 1.0800 + 12 469.0000 1.4000 + + Angle Coeffs + + 1 63.000 120.000 + 2 63.000 120.000 + 3 63.000 120.000 + 4 63.000 120.000 + 5 35.000 120.000 + 6 35.000 120.000 + 7 35.000 120.000 + 8 35.000 120.000 + 9 35.000 120.000 + 10 35.000 120.000 + 11 35.000 120.000 + 12 35.000 120.000 + 13 35.000 120.000 + 14 35.000 120.000 + 15 63.000 120.000 + 16 35.000 120.000 + 17 63.000 120.000 + 18 35.000 120.000 + +Dihedral Coeffs + + 1 0.000 7.250 0.000 0.000 0.0 + 2 0.000 7.250 0.000 0.000 0.0 + 3 0.000 7.250 0.000 0.000 0.0 + 4 0.000 7.250 0.000 0.000 0.0 + 5 0.000 7.250 0.000 0.000 0.0 + 6 0.000 7.250 0.000 0.000 0.0 + 7 0.000 7.250 0.000 0.000 0.0 + 8 0.000 7.250 0.000 0.000 0.0 + 9 0.000 7.250 0.000 0.000 0.0 + 10 0.000 7.250 0.000 0.000 0.0 + 11 0.000 7.250 0.000 0.000 0.0 + 12 0.000 7.250 0.000 0.000 0.0 + 13 0.000 7.250 0.000 0.000 0.0 + 14 0.000 7.250 0.000 0.000 0.0 + 15 0.000 7.250 0.000 0.000 0.0 + 16 0.000 7.250 0.000 0.000 0.0 + 17 0.000 7.250 0.000 0.000 0.0 + 18 0.000 7.250 0.000 0.000 0.0 + 19 0.000 7.250 0.000 0.000 0.0 + 20 0.000 7.250 0.000 0.000 0.0 + 21 0.000 7.250 0.000 0.000 0.0 + 22 0.000 7.250 0.000 0.000 0.0 + 23 0.000 7.250 0.000 0.000 0.0 + 24 0.000 7.250 0.000 0.000 0.0 + +Improper Coeffs + + 1 2.500 -1 2 + 2 2.500 -1 2 + 3 2.500 -1 2 + 4 2.500 -1 2 + 5 2.500 -1 2 + 6 2.500 -1 2 + +Atoms + + 1 1 1 -0.14740000 1.000 1.00000 0.00000 + 2 1 2 -0.14760000 -0.395 1.00000 0.00000 + 3 1 3 -0.14740000 -1.091 1.00000 1.20854 + 4 1 4 -0.14720000 -0.392 1.00000 2.41533 + 5 1 5 -0.14700000 1.003 1.00000 2.41180 + 6 1 6 -0.14700000 1.696 1.00000 1.20856 + 7 1 7 0.14740000 1.543 1.00119 -0.94158 + 8 1 8 0.14740000 -0.937 0.99881 -0.94157 + 9 1 9 0.14740000 -2.178 1.00119 1.20854 + 10 1 10 0.14740000 -0.934 1.00119 3.35699 + 11 1 11 0.14700000 1.548 0.99881 3.35208 + 12 1 12 0.14700000 2.783 1.00119 1.20856 + +Bonds + + 1 1 2 1 + 2 2 3 2 + 3 3 4 3 + 4 4 5 4 + 5 5 6 1 + 6 6 7 1 + 7 7 8 2 + 8 8 9 3 + 9 9 10 4 + 10 10 11 5 + 11 11 12 6 + 12 12 6 5 + +Angles + + 1 1 1 2 3 + 2 2 2 3 4 + 3 3 3 4 5 + 4 4 2 1 6 + 5 5 2 1 7 + 6 6 1 2 8 + 7 7 2 3 9 + 8 8 3 4 10 + 9 9 4 5 11 + 10 10 1 6 12 + 11 11 6 5 11 + 12 12 6 1 7 + 13 13 5 6 12 + 14 14 5 4 10 + 15 15 1 6 5 + 16 16 4 3 9 + 17 17 4 5 6 + 18 18 3 2 8 + +Dihedrals + + 1 1 4 3 2 1 + 2 2 5 4 3 2 + 3 3 6 1 2 3 + 4 4 10 4 3 9 + 5 5 8 2 3 4 + 6 6 10 4 3 2 + 7 7 6 5 4 3 + 8 8 5 6 1 2 + 9 9 8 2 1 6 + 10 10 7 1 2 3 + 11 11 9 3 2 1 + 12 12 12 6 5 4 + 13 13 11 5 4 3 + 14 14 10 4 5 6 + 15 15 11 5 6 1 + 16 16 12 6 1 7 + 17 17 12 6 5 11 + 18 18 9 3 2 8 + 19 19 8 2 1 7 + 20 20 7 1 6 5 + 21 21 12 6 1 2 + 22 22 4 5 6 1 + 23 23 11 5 4 10 + 24 24 9 3 4 5 + +Impropers + + 1 1 1 2 6 7 + 2 2 2 1 3 8 + 3 3 3 9 2 4 + 4 4 4 10 3 5 + 5 5 5 11 4 6 + 6 6 6 1 12 5 + diff --git a/intermol/test_convert_lammps/test_input.lammpsin b/intermol/test_convert_lammps/test_input.lammpsin new file mode 100644 index 00000000..7425a86f --- /dev/null +++ b/intermol/test_convert_lammps/test_input.lammpsin @@ -0,0 +1,13 @@ +# minimal input file only including parameters read by InterMol + +units real +atom_style full +#suffix opt +boundary p p p +pair_style lj/cut/coul/long 15 +special_bonds lj 0.000000 0.000000 0.500000 coul 0.000000 0.000000 0.500000 +bond_style harmonic +angle_style harmonic +dihedral_style opls +improper_style cvff +read_data benzene.lmp \ No newline at end of file