当前位置: 首页>>代码示例>>Python>>正文


Python mbuild.load函数代码示例

本文整理汇总了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])
开发者ID:tcmoore3,项目名称:mbuild,代码行数:7,代码来源:chol.py

示例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])
开发者ID:tcmoore3,项目名称:mbuild,代码行数:7,代码来源:ucer2.py

示例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])
开发者ID:ctk3b,项目名称:mbuild,代码行数:8,代码来源:ch3.py

示例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])
开发者ID:tcmoore3,项目名称:mbuild,代码行数:10,代码来源:ffac16.py

示例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])
开发者ID:tcmoore3,项目名称:mbuild,代码行数:10,代码来源:ecer2.py

示例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])
开发者ID:ctk3b,项目名称:mbuild,代码行数:11,代码来源:peg.py

示例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])
开发者ID:hainm,项目名称:mbuild,代码行数:11,代码来源:ch2.py

示例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])
开发者ID:Jonestj1,项目名称:mBuildPractice,代码行数:12,代码来源:_peg_monolayer.py

示例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]))
开发者ID:TengyuMaVandy,项目名称:mbuild,代码行数:13,代码来源:ester.py

示例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]))
开发者ID:ctk3b,项目名称:mbuild,代码行数:13,代码来源:ester.py

示例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))
开发者ID:lilywilliams,项目名称:mbuild,代码行数:15,代码来源:betacristobalite.py

示例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]))
开发者ID:ctk3b,项目名称:mbuild,代码行数:15,代码来源:silane.py

示例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)
开发者ID:tcmoore3,项目名称:mbuild,代码行数:15,代码来源:test_compound.py

示例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'}
开发者ID:iModels,项目名称:mbuild,代码行数:7,代码来源:test_xyz.py

示例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
开发者ID:ctk3b,项目名称:mbuild,代码行数:28,代码来源:base_test.py


注:本文中的mbuild.load函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。