Skip to content

Commit

Permalink
Merge pull request #358 from shirtsgroup/bugfix_May20
Browse files Browse the repository at this point in the history
Bugfixes
  • Loading branch information
mrshirts authored Jul 11, 2019
2 parents 569e765 + 188c374 commit 23ef90c
Show file tree
Hide file tree
Showing 6 changed files with 444 additions and 220 deletions.
459 changes: 244 additions & 215 deletions intermol/desmond/desmond_parser.py

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions intermol/gromacs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
'CMAP': ['dihedral','cmap'],
'LJ (SR)': ['vdw total', 'vdw (SR)'],
'LJ-14': ['vdw total','vdw-14'],
'LJ recip.': ['vdw total', 'vdw (LR)'],
'Disper. corr.': ['vdw total', 'vdw (LR)'],
'Coulomb (SR)': ['coulomb total','coulomb (SR)'],
'Coulomb-14': ['coulomb total','coulomb-14'],
Expand Down
27 changes: 22 additions & 5 deletions intermol/lammps/lammps_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,8 @@ def read_data(self, data_file):
self.parse_box(line.split(), 1)
elif ('zlo' in line) and ('zhi' in line):
self.parse_box(line.split(), 2)
elif ('xy xz yz' in line):
self.parse_box(line.split(), 'tilt')
# Other headers.
else:
keyword = line.strip()
Expand Down Expand Up @@ -608,12 +610,23 @@ def parse_box(self, line, dim):
line (str): Current line in input file.
dim (int): Dimension specified in line.
"""
fields = [float(field) for field in line[:2]]
box_length = fields[1] - fields[0]
if box_length > 0:
self.system.box_vector[dim, dim] = box_length * self.DIST
if dim == 'tilt':
fields = [(float(field) * self.DIST) for field in line[:3]]
dirs = line[3:]
for f,d in zip(fields,dirs):
if d == 'xy':
self.system.box_vector[1,0] = f
elif d == 'xz':
self.system.box_vector[2,0] = f
elif d == 'yz':
self.system.box_vector[2,1] = f
else:
raise LammpsError("Negative box length specified in data file.")
fields = [float(field) for field in line[:2]]
box_length = fields[1] - fields[0]
if box_length > 0:
self.system.box_vector[dim, dim] = box_length * self.DIST
else:
raise LammpsError("Negative box length specified in data file.")

def parse_masses(self, data_lines):
"""Read masses from data file."""
Expand Down Expand Up @@ -1154,6 +1167,10 @@ def write(self, unit_set='real',nonbonded_style=None):
f.write('{0:11.7f} {1:11.7f} zlo zhi\n'.format(
z_min, z_min + self.system.box_vector[2][2].value_in_unit(
self.DIST)))
f.write('{0:11.7f} {1:11.7f} {2:11.7f} xy xz yz\n'.format(
self.system.box_vector[1][0].value_in_unit(self.DIST),
self.system.box_vector[2][0].value_in_unit(self.DIST),
self.system.box_vector[2][1].value_in_unit(self.DIST)))

for mass in mass_list:
f.write(mass)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
units real
atom_style full

dimension 3
boundary p p p

pair_style lj/cut/coul/cut 30.0 30.0
pair_modify mix geometric

bond_style hybrid harmonic morse
angle_style harmonic
special_bonds lj 0.0 0.0 0.5 coul 0.0 0.0 0.5

read_data box_vectors_vacuum.lmp

thermo_style custom ebond eangle edihed eimp epair evdwl ecoul elong etail pe

run 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
topol

9 atoms
8 bonds
13 angles
0 dihedrals
0 impropers

4 atom types
4 bond types
6 angle types

26.160000 46.266100 xlo xhi
28.470000 48.576100 ylo yhi
26.030000 46.136100 zlo zhi
0.0 -4.50000 0.0 xy xz yz

Masses

1 12.0110
2 1.0080
3 15.9994
4 1.0080

Pair Coeffs

1 0.0660 3.5000
2 0.0300 2.5000
3 0.1700 3.1200
4 0.0000 0.0000

Bond Coeffs

1 harmonic 340.00000000 1.09000000
2 harmonic 553.00000000 0.94500000
3 morse 320.00000000 1.41000000 1.2
4 morse 268.00000000 1.52900000 1.3

Angle Coeffs

1 50.00000000 109.50000000
2 37.50000000 110.70000000
3 37.50000000 110.70000000
4 33.00000000 107.80000000
5 35.00000000 109.50000000
6 55.00000000 108.50000000

Atoms

1 1 1 2.0 27.110 29.460 28.030
2 1 2 -2.0 27.090 28.470 27.570
3 1 2 2.0 26.160 29.540 28.550
4 1 3 -2.0 28.040 29.570 29.070
5 1 4 2.0 28.830 29.460 28.570
6 1 1 -2.0 27.320 30.480 26.870
7 1 2 2.0 28.330 30.640 26.490
8 1 2 -2.0 27.000 31.450 27.230
9 1 2 2.0 26.630 30.350 26.030

Velocities

1 0.0000 0.0000 0.0000
2 0.0000 0.0000 0.0000
3 0.0000 0.0000 0.0000
4 0.0000 0.0000 0.0000
5 0.0000 0.0000 0.0000
6 0.0000 0.0000 0.0000
7 0.0000 0.0000 0.0000
8 0.0000 0.0000 0.0000
9 0.0000 0.0000 0.0000

Bonds

1 1 1 2
2 1 6 9
3 1 1 3
4 1 6 7
5 1 6 8
6 2 4 5
7 3 1 4
8 4 1 6

Angles

1 1 4 1 6
2 2 3 1 6
3 3 1 6 9
4 4 8 6 9
5 4 7 6 9
6 5 2 1 4
7 5 3 1 4
8 3 1 6 7
9 4 7 6 8
10 2 2 1 6
11 6 1 4 5
12 4 2 1 3
13 3 1 6 8
62 changes: 62 additions & 0 deletions intermol/tests/lammps/unit_tests/box_vectors_vacuum/log.lammps
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
LAMMPS (1 Feb 2014)
units real
atom_style full

dimension 3
boundary p p p

pair_style lj/cut/coul/cut 30.0 30.0
pair_modify mix geometric

bond_style hybrid harmonic morse
angle_style harmonic
special_bonds lj 0.0 0.0 0.5 coul 0.0 0.0 0.5

read_data box_vectors.lmp
triclinic box = (26.16 28.47 26.03) to (46.2661 48.5761 46.1361) with tilt (0 -4.5 0)
1 by 1 by 1 MPI processor grid
reading atoms ...
9 atoms
reading velocities ...
9 velocities
scanning bonds ...
4 = max bonds/atom
scanning angles ...
6 = max angles/atom
reading bonds ...
8 bonds
reading angles ...
13 angles
4 = max # of 1-2 neighbors
4 = max # of 1-3 neighbors
7 = max # of 1-4 neighbors
8 = max # of special neighbors

thermo_style custom ebond eangle edihed eimp epair evdwl ecoul elong etail pe

run 0
WARNING: No fixes defined, atoms won't move (../verlet.cpp:54)
Memory usage per processor = 4.88161 Mbytes
E_bond E_angle E_dihed E_impro E_pair E_vdwl E_coul E_long E_tail PotEng
47.912249 4.808182 0 0 354.9457 -0.086795261 355.0325 0 0 407.66613
Loop time of 0 on 1 procs for 0 steps with 9 atoms

Pair time (%) = 0 (0)
Bond time (%) = 0 (0)
Neigh time (%) = 0 (0)
Comm time (%) = 0 (0)
Outpt time (%) = 0 (0)
Other time (%) = 0 (0)

Nlocal: 9 ave 9 max 9 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Nghost: 567 ave 567 max 567 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Neighs: 767 ave 767 max 767 min
Histogram: 1 0 0 0 0 0 0 0 0 0

Total # of neighbors = 767
Ave neighs/atom = 85.2222
Ave special neighs/atom = 7.33333
Neighbor list builds = 0
Dangerous builds = 0

0 comments on commit 23ef90c

Please sign in to comment.