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


Python Molecule.view方法代码示例

本文整理汇总了Python中htmd.molecule.molecule.Molecule.view方法的典型用法代码示例。如果您正苦于以下问题:Python Molecule.view方法的具体用法?Python Molecule.view怎么用?Python Molecule.view使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在htmd.molecule.molecule.Molecule的用法示例。


在下文中一共展示了Molecule.view方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _viewStatesNGL

# 需要导入模块: from htmd.molecule.molecule import Molecule [as 别名]
# 或者: from htmd.molecule.molecule.Molecule import view [as 别名]
    def _viewStatesNGL(self, states, statetype, protein, ligand, mols, numsamples):
        if states is None:
            states = range(self.macronum)
        if isinstance(states, int):
            states = [states]
        if mols is None:
            mols = self.getStates(states, statetype, numsamples=min(numsamples, 15))
        colors = [0, 1, 3, 4, 5, 6, 7, 9]
        if protein is None and ligand is None:
            raise NameError('Please provide either the "protein" or "ligand" parameter for viewStates.')
        if protein:
            mol = Molecule()
        if ligand:
            mol = mols[0].copy()
            mol.remove(ligand, _logger=False)
            mol.coords = np.atleast_3d(mol.coords[:, :, 0])
            mol.reps.add(sel='protein', style='NewCartoon', color='Secondary Structure')
        for i, s in enumerate(states):
            if protein:
                mol.reps.add(sel='segid ST{}'.format(s), style='NewCartoon', color='Index')
            if ligand:
                mol.reps.add(sel='segid ST{}'.format(s), style='Licorice', color=colors[np.mod(i, len(colors))])
                mols[i].filter(ligand, _logger=False)

            mols[i].set('segid', 'ST{}'.format(s))
            tmpcoo = mols[i].coords
            for j in range(mols[i].numFrames):
                mols[i].coords = np.atleast_3d(tmpcoo[:, :, j])
                mol.append(mols[i])

        w = mol.view(viewer='ngl')
        self._nglButtons(w, statetype, states)
        return w
开发者ID:PabloHN,项目名称:htmd,代码行数:35,代码来源:model.py

示例2: viewCrystalPacking

# 需要导入模块: from htmd.molecule.molecule import Molecule [as 别名]
# 或者: from htmd.molecule.molecule.Molecule import view [as 别名]
def viewCrystalPacking(mol, hexagonal=False, style_display='NewCartoon'):
    """ Views the crystal packing of a protein

    Parameters
    ----------
    pdbfile : str
        Path to the pdb file which to read. Can also be a 4-letter PDB ID
    """
    if mol.crystalinfo is None or 'numcopies' not in mol.crystalinfo:
        raise RuntimeError('No crystallography data found in Molecule.')
    ci = mol.crystalinfo

    alpha, beta, gamma, a, b, c = ci['alpha'], ci['beta'], ci['gamma'], ci['a'], ci['b'], ci['c']
    alpha = np.deg2rad(float(alpha))
    beta = np.deg2rad(float(beta))
    gamma = np.deg2rad(float(gamma))

    caux = (np.cos(alpha) - np.cos(beta) * np.cos(gamma)) / np.sin(gamma)
    axes = np.array([[a, 0, 0], [b * np.cos(gamma), b * np.sin(gamma), 0], [c * np.cos(beta), c * caux,
                           c * np.sqrt(1 - np.cos(beta) ** 2 - caux ** 2)]])
    size = np.array([axes[0][0], axes[1][1], axes[2][2]])

    molunit = Molecule()
    viewer = VMD()

    _draw_cell(axes, ci['sGroup'], viewer, hexagonal=hexagonal)

    # Creates copies of the molecule and places them correctly inside the complete Unit Cell
    hexagonal_molunit = None
    for i in range(ci['numcopies']):
        molecule = mol.copy()
        # apply SMTRY (Crystal Symmetry) operations
        molecule.rotateBy(ci['rotations'][i])
        molecule.moveBy(ci['translations'][i])
        # apply translation to inside of same Unit Cell.
        _place_crystal(molecule, size, [alpha, beta, gamma], axes)
        # pack copies to target Unit Cell
        molunit.append(molecule)
    if ci['sGroup'][0] == 'H' and hexagonal:
        hexagonal_molunit = Molecule()
        _build_hexagon(molunit, hexagonal_molunit)

    if hexagonal_molunit is not None:
        hexagonal_molunit.view(style=style_display, viewerhandle=viewer)
    else:
        molunit.view(style=style_display, viewerhandle=viewer)
开发者ID:jeiros,项目名称:htmd,代码行数:48,代码来源:crystalpacking.py

示例3: _viewSphere

# 需要导入模块: from htmd.molecule.molecule import Molecule [as 别名]
# 或者: from htmd.molecule.molecule.Molecule import view [as 别名]
def _viewSphere(spherecoor):
    spheremol = Molecule()
    spheremol.empty(spherecoor.shape[0])
    spheremol.coords = np.atleast_3d(spherecoor)
    spheremol.view(guessbonds=False)
开发者ID:jeiros,项目名称:htmd,代码行数:7,代码来源:pathplanning.py


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