diff --git a/mbuild/examples/pmpc/brush.py b/mbuild/examples/pmpc/brush.py index dd239617e..a50bf17ee 100755 --- a/mbuild/examples/pmpc/brush.py +++ b/mbuild/examples/pmpc/brush.py @@ -10,10 +10,10 @@ from initiator import Initiator -class PMPC(Compound): +class Brush(Compound): """ """ def __init__(self, chain_length=4, alpha=pi/4): - super(PMPC, self).__init__(self) + super(Brush, self).__init__(self) # Add parts self.add(Silane(), 'silane') @@ -30,5 +30,5 @@ def __init__(self, chain_length=4, alpha=pi/4): self.add(self.silane.down, label='down', containment=False) if __name__ == "__main__": - pmpc = PMPC(chain_length=1, alpha=pi/4) + pmpc = Brush(chain_length=1, alpha=pi/4) pmpc.visualize(show_ports=True) diff --git a/mbuild/examples/pmpc/initiator.py b/mbuild/examples/pmpc/initiator.py index fdadad8ab..110e591d4 100755 --- a/mbuild/examples/pmpc/initiator.py +++ b/mbuild/examples/pmpc/initiator.py @@ -10,7 +10,7 @@ def __init__(self): super(Initiator, self).__init__(self) # Look for data file in same directory as this python module. - self.append_from_file('initiator.pdb') + self.append_from_file('initiator.pdb', relative_to_module=self.__module__) # Transform the coordinate system such that the two carbon atoms # that are part of the backbone are on the y axis, C_1 at the origin. diff --git a/mbuild/examples/pmpc/mpc.py b/mbuild/examples/pmpc/mpc.py index 9c4218084..1eb94ebc6 100755 --- a/mbuild/examples/pmpc/mpc.py +++ b/mbuild/examples/pmpc/mpc.py @@ -9,7 +9,7 @@ def __init__(self, alpha=0): super(MPC, self).__init__(self) # Look for data file in same directory as this python module. - self.append_from_file('mpc.pdb') + self.append_from_file('mpc.pdb', relative_to_module=self.__module__) # Transform the coordinate system of mpc such that the two carbon atoms # that are part of the backbone are on the y axis, c_backbone at the origin. diff --git a/mbuild/examples/pmpc/pmpc_brush_layer.py b/mbuild/examples/pmpc/pmpc_brush_layer.py index 44aa80a9e..7ce55941d 100755 --- a/mbuild/examples/pmpc/pmpc_brush_layer.py +++ b/mbuild/examples/pmpc/pmpc_brush_layer.py @@ -7,9 +7,10 @@ from mbuild.tools.parameterize.atomtyper import find_atomtypes from mbuild.tools.tiled_compound import TiledCompound -from mbuild.components.surfaces.betacristobalite import Betacristobalite +from brush import Brush from mbuild.components.atoms.H import H -from pmpc import PMPC +from mbuild.components.surfaces.betacristobalite import Betacristobalite +from mpc import MPC class PMPCLayer(Compound): @@ -21,19 +22,20 @@ def __init__(self, mask, tile_x=1, tile_y=1, chain_length=4, alpha=pi/4): tc = TiledCompound(surface, tile_x, tile_y, 1, kind="tiled_surface") self.add(tc, 'tiled_surface') - pmpc = PMPC(chain_length=chain_length, alpha=alpha) + brush = Brush(chain_length=chain_length, alpha=alpha) hydrogen = H() - apply_mask(self.tiled_surface, pmpc, mask, backfill=hydrogen) + apply_mask(self.tiled_surface, brush, mask, backfill=hydrogen) +def main(): + mask = random_mask_2d(1) + return PMPCLayer(mask=mask, chain_length=3, alpha=pi/4, tile_x=1, tile_y=1) if __name__ == "__main__": - mask = random_mask_2d(1) - pmpc_layer = PMPCLayer(mask=mask, chain_length=3, alpha=pi/4, tile_x=1, tile_y=1) + pmpc_layer = main() pmpc_layer.visualize(show_ports=True) - # find_atomtypes(pmpc_layer) - # - # pmpc_layer = pmpc_layer.to_trajectory(chain_types=[Betacristobalite, PMPC], - # residue_types=[MPC]) - # pmpc_layer.topology.find_forcefield_terms() - # pmpc_layer.save(filename='brush_layer.top') + find_atomtypes(pmpc_layer) + pmpc_layer = pmpc_layer.to_trajectory(chain_types=[Betacristobalite, Brush], + residue_types=[MPC]) + pmpc_layer.topology.find_forcefield_terms() + pmpc_layer.save(filename='brush_layer.top') diff --git a/mbuild/examples/reload/reload.py b/mbuild/examples/reload/reload.py index 397409126..f3c0a10cd 100755 --- a/mbuild/examples/reload/reload.py +++ b/mbuild/examples/reload/reload.py @@ -2,7 +2,7 @@ from numpy import pi -from mbuild.examples.pmpc_brush_layer.brush import Brush +from mbuild.examples.pmpc.brush import Brush from mbuild.coordinate_transform import rotate_around_z diff --git a/mbuild/tests/test_examples.py b/mbuild/tests/test_examples.py index d328cb85a..74b6bc53f 100755 --- a/mbuild/tests/test_examples.py +++ b/mbuild/tests/test_examples.py @@ -38,8 +38,8 @@ def test_methane(self): import mbuild.examples.methane.methane as example example.main() - def test_pmpc_brush_layer(self): - import mbuild.examples.pmpc_brush_layer.pmpc_brush_layer as example + def test_pmpc(self): + import mbuild.examples.pmpc.pmpc_brush_layer as example example.main() def test_reload(self):