Skip to content

Commit

Permalink
Add typed water system as fixture and in parmed loop
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwthompson committed Mar 3, 2020
1 parent 626e74d commit 5088ea1
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
31 changes: 29 additions & 2 deletions gmso/tests/base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@

from gmso.core.box import Box
from gmso.core.topology import Topology
from gmso.core.element import Hydrogen
from gmso.core.element import Hydrogen, Oxygen
from gmso.core.site import Site
from gmso.core.angle import Angle
from gmso.core.atom_type import AtomType
from gmso.core.forcefield import ForceField
from gmso.external.convert_mbuild import from_mbuild
Expand Down Expand Up @@ -97,8 +98,34 @@ def water_system(self):

packed_system = mb.fill_box(
compound=water,
n_compounds=10,
n_compounds=2,
box=mb.Box([2, 2, 2])
)

return from_mbuild(packed_system)

@pytest.fixture
def typed_water_system(self, water_system):
top = water_system

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

element_map = {"O": "opls_111", "H": "opls_112"}

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

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

for subtop in top.subtops:
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_topology()

return top
8 changes: 4 additions & 4 deletions gmso/tests/test_top.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ def test_write_top(self, typed_ar_system):
write_top(top, 'ar.top')


def test_pmd_loop(self, typed_ar_system):
top = typed_ar_system
write_top(top, 'ar.top')
pmd.load_file('ar.top')
def test_pmd_loop(self, typed_ar_system, typed_water_system):
for top in [typed_ar_system, typed_water_system]:
write_top(top, 'system.top')
pmd.load_file('system.top')


def test_modified_potentials(self, ar_system):
Expand Down

0 comments on commit 5088ea1

Please sign in to comment.