Skip to content

Commit

Permalink
Add water test to check bonds and angles
Browse files Browse the repository at this point in the history
  • Loading branch information
rmatsum836 committed Mar 6, 2020
1 parent 46624d7 commit a6b3f1e
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions gmso/tests/test_lammps.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import gmso
from gmso.core.box import Box
from gmso.formats.lammpsdata import write_lammpsdata
from gmso.tests.base_test import BaseTest
from gmso.tests.utils import get_path


class TestLammpsWriter(BaseTest):
Expand All @@ -12,3 +14,33 @@ def test_write_lammps_triclinic(self, topology_site):
top = topology_site()
top.box = Box(lengths=[1,1,1], angles=[60,90,120])
write_lammpsdata(top, filename='data.triclinic')

def test_water_lammps(self, water_system):
top = water_system

ff = gmso.ForceField(get_path('tip3p.xml'))

for site in top.sites:
site.atom_type = ff.atom_types[site.name]

top.update_sites()
top.update_atom_types()

for bond in top.bonds:
bond.bond_type = bond.connection_type = ff.bond_types['opls_111~opls_112']

top.update_bonds()
top.update_bond_types()

for subtop in top.subtops:
angle = gmso.core.angle.Angle(
connection_members=[site for site in subtop.sites],
name="opls_112~opls_111~opls_112",
connection_type=ff.angle_types["opls_112~opls_111~opls_112"]
)
top.add_connection(angle)

top.update_angles()
top.update_angle_types()

write_lammpsdata(top, 'data.water')

0 comments on commit a6b3f1e

Please sign in to comment.