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

Lammps parser fix #379

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion intermol/forces/forcefunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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] = 0.0 * u[i]
else:
kwds[p] = float(entries[offset+i]) * u[i]
return kwds


Expand Down
3 changes: 3 additions & 0 deletions intermol/lammps/lammps_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

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

Could you either remove the converted_dihedral = dihedral # Default line above or move the convertfunc to the top as the base case and delete this branch?

converted_dihedral = TrigDihedral
# Now actually convert the dihedral.
params = convertfunc(params)

Expand Down
207 changes: 207 additions & 0 deletions intermol/test_convert_lammps/benzene.lmp
Original file line number Diff line number Diff line change
@@ -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

13 changes: 13 additions & 0 deletions intermol/test_convert_lammps/test_input.lammpsin
Original file line number Diff line number Diff line change
@@ -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