• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python mbuild.load函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mbuild.load函数的典型用法代码示例。如果您正苦于以下问题:Python load函数的具体用法?Python load怎么用?Python load使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了load函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: test_topology_precedence

def test_topology_precedence():
    """Test to see if topology precedence is properly adhered to.

    This test uses a force field file where bond, angle, and dihedral
    parameters are present with different counts of `type` definitions.
    It checks that:
        1. The parameters with the higher number of `type` definitions
           are assigned (because they are given the highest precedence)
        2. That if multiple definitions exist with the same number of
           `type` definitions, that the convention from OpenMM is followed
           whereby the definitions that occurs earliest in the XML is
           assigned.
    """
    ethane = mb.load(get_fn('ethane.mol2'))
    ff = Forcefield(forcefield_files=get_fn('ethane-topo-precedence.xml'))
    typed_ethane = ff.apply(ethane)

    assert len([bond for bond in typed_ethane.bonds
                if round(bond.type.req, 2) == 1.15]) == 6
    assert len([bond for bond in typed_ethane.bonds
                if round(bond.type.req, 2) == 1.6]) == 1
    assert len([angle for angle in typed_ethane.angles
                if round(angle.type.theteq, 3) == 120.321]) == 6
    assert len([angle for angle in typed_ethane.angles
                if round(angle.type.theteq, 3) == 97.403]) == 6
    assert len([rb for rb in typed_ethane.rb_torsions
                if round(rb.type.c0, 3) == 0.287]) == 9
开发者ID:iModels,项目名称:foyer,代码行数:27,代码来源:test_forcefield.py


示例17: __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, orientation=[0, 0, 1], 
                               separation=0.1)
                self.add(port, 'port_{}'.format(count))
                particle.name = 'O'  # Strip numbers required in .mol2 files.
            elif particle.name.startswith('Si'):
                particle.name = 'Si'
开发者ID:ctk3b,项目名称:mbuild,代码行数:17,代码来源:betacristobalite.py


示例18: test_missing_topo_params

def test_missing_topo_params(ff_filename, kwargs):
    """Test that the user is notified if not all topology parameters are found."""
    ethane = mb.load(get_fn('ethane.mol2'))
    oplsaa_with_typo = Forcefield(forcefield_files=get_fn(ff_filename))
    with pytest.raises(Exception):
        ethane = oplsaa_with_typo.apply(ethane)
    with pytest.warns(UserWarning):
        ethane = oplsaa_with_typo.apply(ethane, **kwargs)
开发者ID:iModels,项目名称:foyer,代码行数:8,代码来源:test_forcefield.py


示例19: test_box_dimensions

 def test_box_dimensions(self, benzene):
     n_benzenes = 10
     filled = mb.fill_box(benzene,
                          n_compounds=n_benzenes,
                          box=[0, 0, 0, 4, 4, 4])
     filled.save(filename='benzene.hoomdxml')
     for atom in mb.load('benzene.hoomdxml'):
         assert atom.pos.max() < 20
         assert atom.pos.min() > -20
开发者ID:iModels,项目名称:mbuild,代码行数:9,代码来源:test_hoomdxml.py


示例20: __init__

    def __init__(self):
        super(Initiator, self).__init__()

        # Look for data file in same directory as this python module.
        mb.load('initiator.pdb', compound=self, 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.
        mb.y_axis_transform(self, new_origin=self[0], point_on_y_axis=self[21])

        # Add bottom port
        self.add(mb.Port(anchor=self[0]), 'down')
        # Place the port.
        mb.translate(self['down'], self[0].pos + np.array([0.0, -0.07, 0.0]))

        # Add top port.
        self.add(mb.Port(anchor=self[21]), 'up')
        # Place the port.
        mb.translate(self['up'], self[21].pos + np.array([0.0, 0.07, 0.0]))
开发者ID:TengyuMaVandy,项目名称:mbuild,代码行数:19,代码来源:initiator.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python mbwind.System类代码示例发布时间:2022-05-27
下一篇:
Python mbuild.fill_box函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap