本文整理汇总了Python中mbuild.load函数的典型用法代码示例。如果您正苦于以下问题:Python load函数的具体用法?Python load怎么用?Python load使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了load函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self):
"""Returns a CHOL with the head-to-tail vector pointing in +z.
"""
super(Chol, self).__init__(name='chol')
mb.load('chol.pdb', compound=self, relative_to_module=self.__module__)
mb.coordinate_transform.z_axis_transform(self,
new_origin=self[2], point_on_z_axis=self[63])
示例2: __init__
def __init__(self):
"""Returns a CER NS C24 with the head-to-tail vector pointing in +z.
"""
super(UCer2, self).__init__(name='ucer2')
mb.load('ucer2.pdb', compound=self, relative_to_module=self.__module__)
mb.coordinate_transform.z_axis_transform(self,
new_origin=self[2], point_on_z_axis=self[58])
示例3: __init__
def __init__(self):
super(CH3, self).__init__()
mb.load('ch3.pdb', compound=self, relative_to_module=self.__module__)
self.translate(-self[0].pos) # Move carbon to origin.
self.add(mb.Port(anchor=self[0]), 'up')
self['up'].translate([0, -0.07, 0])
示例4: __init__
def __init__(self):
"""Returns a CG FFA C16 with the head-to-tail vector pointing in -z.
"""
super(FFAC16, self).__init__()
mb.load('ffac16.hoomdxml', compound=self, relative_to_module=self.__module__)
self.periodicity = [0, 0, 0]
xx = list(self.particles())
mb.coordinate_transform.z_axis_transform(self,
new_origin=xx[5], point_on_z_axis=xx[0])
self.spin(np.pi, [1, 0, 0])
示例5: __init__
def __init__(self):
"""Returns a CG eCER2 with the head-to-tail vector pointing in -z.
"""
super(ECer2, self).__init__()
mb.load('ecer2.hoomdxml', compound=self, relative_to_module=self.__module__)
self.periodicity = [0, 0, 0]
xx = list(self.particles())
mb.coordinate_transform.z_axis_transform(self,
new_origin=xx[6], point_on_z_axis=xx[11])
self.rotate(np.pi, [1, 0, 0])
示例6: __init__
def __init__(self):
super(PegMonomer, self).__init__()
mb.load('peg_monomer.pdb', compound=self, relative_to_module=self.__module__)
self.translate(-self[0].pos)
self.add(mb.Port(anchor=self[0]), 'down')
self['down'].translate([0, -0.07, 0])
self.add(mb.Port(anchor=self[6]), 'up')
self['up'].translate([0, 0.073, 0])
示例7: __init__
def __init__(self):
super(CH2, self).__init__()
mb.load('ch2.pdb', compound=self, relative_to_module=self.__module__)
mb.translate(self, -self[0].pos) # Move carbon to origin.
self.add(mb.Port(anchor=self[0]), 'up')
mb.translate(self['up'], [0, 0.07, 0])
self.add(mb.Port(anchor=self[0]), 'down')
mb.translate(self['down'], [0, -0.07, 0])
示例8: __init__
def __init__(self):
super(PegMonomer, self).__init__()
mb.load('peg_monomer.pdb', compound=self, relative_to_module=self.__module__)
mb.translate(self, -self.C[0])
self.add(mb.Port(anchor=self.C[0]), 'down')
mb.translate(self.down, [0, -0.07, 0])
self.add(mb.Port(anchor=self.O[0]), 'up')
mb.translate(self.up, [0, 0.364, 0])
示例9: __init__
def __init__(self):
super(Ester, self).__init__()
mb.load('ester.pdb', compound=self, relative_to_module=self.__module__)
mb.translate(self, -self[0].pos)
self.add(mb.Port(anchor=self[2]), 'up')
mb.rotate_around_z(self['up'], np.pi / 2)
mb.translate_to(self['up'], self[2].pos + np.array([0.07, 0, 0]))
self.add(mb.Port(anchor=self[0]), 'down')
mb.rotate_around_z(self['down'], np.pi / 2)
mb.translate(self['down'], np.array([-0.07, 0, 0]))
示例10: __init__
def __init__(self):
super(Ester, self).__init__()
mb.load('ester.pdb', compound=self, relative_to_module=self.__module__)
self.translate(-self[0].pos)
self.add(mb.Port(anchor=self[2]), 'up')
self['up'].spin(np.pi / 2, [0, 0, 1])
self['up'].translate_to(np.array([0.07, 0, 0]))
self.add(mb.Port(anchor=self[0]), 'down')
self['down'].spin(np.pi / 2, [0, 0, 1])
self['down'].translate(np.array([-0.07, 0, 0]))
示例11: __init__
def __init__(self):
super(Betacristobalite, self).__init__()
mb.load('beta-cristobalite-expanded.mol2', compound=self,
relative_to_module=self.__module__)
self.periodicity = np.array([5.3888, 4.6669, 0.0])
count = 0
for particle in self.particles():
if particle.name.startswith('O') and particle.pos[2] > 1.0:
count += 1
port = mb.Port(anchor=particle)
mb.rotate_around_x(port, np.pi/2)
mb.translate(port, particle.pos + np.array([0, 0, .1]))
self.add(port, 'port_{}'.format(count))
示例12: __init__
def __init__(self, ):
super(Silane, self).__init__()
mb.load('silane.pdb', compound=self, relative_to_module=self.__module__)
# Transform the coordinate system such that the silicon atom is at the
# origin and the oxygen atoms are on the x axis.
mb.x_axis_transform(self, new_origin=self[0], point_on_x_axis=self[1])
# Add bottom port.
self.add(mb.Port(anchor=self[0]), 'down')
self['down'].translate(np.array([0, -.07, 0]))
# Add top port.
self.add(mb.Port(anchor=self[0]), 'up')
self['up'].translate(np.array([0, .07, 0]))
示例13: test_save_box
def test_save_box(self, ch3):
extensions = ['.mol2', '.pdb', '.hoomdxml', '.gro']
box_attributes = ['mins', 'maxs', 'lengths']
custom_box = mb.Box([.8, .8, .8])
for ext in extensions:
outfile_padded = 'padded_methyl' + ext
outfile_custom = 'custom_methyl' + ext
ch3.save(filename=outfile_padded, box=None, overwrite=True)
ch3.save(filename=outfile_custom, box=custom_box, overwrite=True)
padded_ch3 = mb.load(outfile_padded)
custom_ch3 = mb.load(outfile_custom)
for attr in box_attributes:
pad_attr = getattr(padded_ch3.boundingbox, attr)
custom_attr = getattr(custom_ch3.boundingbox, attr)
assert np.array_equal(pad_attr, custom_attr)
示例14: test_load_with_top
def test_load_with_top(self, ethane):
ethane.save(filename='ethane.xyz')
ethane.save(filename='ethane.mol2')
ethane_in = mb.load('ethane.xyz', top='ethane.mol2')
assert len(ethane_in.children) == 8
assert ethane_in.n_bonds == 7
assert set([child.name for child in ethane_in.children]) == {'C', 'H'}
示例15: benzene_from_parts
def benzene_from_parts(self):
ch = mb.load(get_fn('ch.mol2'))
ch.name = 'CH'
mb.translate(ch, -ch[0].pos)
ch.add(mb.Port(anchor=ch[0]), 'a')
mb.translate(ch['a'], [0, 0.07, 0])
mb.rotate_around_z(ch['a'], 120.0 * (np.pi/180.0))
ch.add(mb.Port(anchor=ch[0]), 'b')
mb.translate(ch['b'], [0, 0.07, 0])
mb.rotate_around_z(ch['b'], -120.0 * (np.pi/180.0))
benzene = mb.Compound(name='Benzene')
benzene.add(ch)
current = ch
for _ in range(5):
ch_new = mb.clone(ch)
mb.force_overlap(move_this=ch_new,
from_positions=ch_new['a'],
to_positions=current['b'])
current = ch_new
benzene.add(ch_new)
carbons = [p for p in benzene.particles_by_name('C')]
benzene.add_bond((carbons[0],carbons[-1]))
return benzene