def test_lateral_dims_near_x_y_spec(self):
     from dropletbuilder.dropletbuilder import GrapheneDroplet
     water = mbuild.load(get_fn('tip3p.mol2'))
     x = 4
     y = 4
     droplet = GrapheneDroplet(radius=1, angle=90.0, fluid=water, density=997, x=x, y=y)
     assert (abs(droplet.boundingbox.lengths[0] - x) < 0.5 
                 and abs(droplet.boundingbox.lengths[1] - y) < 0.5)
 def test_init_with_too_large_y(self):
     from dropletbuilder.dropletbuilder import GrapheneDroplet
     water = mbuild.load(get_fn('tip3p.mol2'))
     with pytest.raises(ValueError, match="y .* 100"):
         GrapheneDroplet(radius=1, angle=90.0, fluid=water, density=997, x=4, y=101)
 def test_init_with_too_small_x(self):
     from dropletbuilder.dropletbuilder import GrapheneDroplet
     water = mbuild.load(get_fn('tip3p.mol2'))
     with pytest.raises(ValueError, match="x .* at least"):
         GrapheneDroplet(radius=1, angle=90.0, fluid=water, density=997, x=1, y=4)
 def test_init_with_lattice_without_lattice_compound(self, GoldLattice):
     from dropletbuilder.dropletbuilder import GrapheneDroplet
     water = mbuild.load(get_fn('tip3p.mol2'))
     with pytest.raises(ValueError, match="Lattice compounds"):
         GrapheneDroplet(radius=1, angle=90.0, fluid=water, density=997, x=4, y=4, lattice=GoldLattice)
 def test_init_without_lattice_with_lattice_compound(self):
     lattice_compound = mbuild.Compound(name='Au')
     from dropletbuilder.dropletbuilder import GrapheneDroplet
     water = mbuild.load(get_fn('tip3p.mol2'))
     with pytest.raises(ValueError, match="do not specify lattice_compound"):
         GrapheneDroplet(radius=1, angle=90.0, fluid=water, density=997, x=4, y=4, lattice_compound=lattice_compound)
 def test_init_with_missing_density(self):
     from dropletbuilder.dropletbuilder import GrapheneDroplet
     water = mbuild.load(get_fn('tip3p.mol2'))
     with pytest.raises(ValueError, match="Fluid density"):
         GrapheneDroplet(radius=1, angle=90.0, fluid=water)
 def GrapheneDropletWithDims(self):
     from dropletbuilder.dropletbuilder import GrapheneDroplet
     water = mbuild.load(get_fn('tip3p.mol2'))
     return GrapheneDroplet(radius=1, angle=90.0, fluid=water, density=997, x=4, y=4)
Пример #8
0
 def Droplet(self):
     from dropletbuilder.dropletbuilder import Droplet
     water = mbuild.load(get_fn('tip3p.mol2'))
     return Droplet(radius=1, angle=90.0, fluid=water, density=997)
Пример #9
0
 def test_lateral_dims_near_y_spec(self):
     from dropletbuilder.dropletbuilder import Droplet
     water = mbuild.load(get_fn('tip3p.mol2'))
     y = 4
     droplet = Droplet(radius=1, angle=90.0, fluid=water, density=997, y=y)
     assert abs(droplet.boundingbox.lengths[1] - y) < 0.5
                              lattice_points=basis)

# hexane compound
hexane = Alkane(n=6)
hexane.name = 'HEX'

# build the system
system = GrapheneDroplet(radius=3,
                         angle=90,
                         fluid=hexane,
                         density=655,
                         lattice=gold_lattice,
                         lattice_compound=lattice_compound)

# get and apply forcefields
AU = Forcefield(get_fn('heinz2008.xml'))
OPLSAA = Forcefield(name='oplsaa')

for child in system.children:
    if child.name == 'LAT':
        lattice_pmd = AU.apply(child.to_parmed(residues='HEX'))
    elif child.name == 'FLD':
        hex_pmd = OPLSAA.apply(child.to_parmed(residues='Au'))
    else:
        continue

periodicity = system.periodicity
system = lattice_pmd + hex_pmd
system.box[2] = periodicity[2] * 100
system.save('hexane_gold_drop.gro', overwrite=True, combine='all')
system.save('hexane_gold_drop.top', overwrite=True, combine='all')
Пример #11
0
from dropletbuilder.dropletbuilder import Droplet
import mbuild
from dropletbuilder.utils.io_tools import get_fn
from foyer import Forcefield

# water compound
water = mbuild.load(get_fn('tip3p.mol2'))
water.name = 'H2O'

# build the system
system = Droplet(radius=2, angle=110.0, fluid=water, density=997)

# get and apply forcefields
GPH = Forcefield(get_fn('graphene.xml'))
TIP3P = Forcefield(get_fn('tip3p.xml'))

for child in system.children:
    if child.name == 'LAT':
        lattice_pmd = GPH.apply(child.to_parmed(residues='C'))
    elif child.name == 'FLD':
        water_pmd = TIP3P.apply(child.to_parmed(residues='H2O'))
    else:
        continue

periodicity = system.periodicity
system = lattice_pmd + water_pmd 
system.box[2] = periodicity[2] * 100
system.save('water_graphene_drop.gro', overwrite=True, combine='all')
system.save('water_graphene_drop.top', overwrite=True, combine='all')