本文整理汇总了Python中htmd.molecule.molecule.Molecule.wrap方法的典型用法代码示例。如果您正苦于以下问题:Python Molecule.wrap方法的具体用法?Python Molecule.wrap怎么用?Python Molecule.wrap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类htmd.molecule.molecule.Molecule
的用法示例。
在下文中一共展示了Molecule.wrap方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _loadMols
# 需要导入模块: from htmd.molecule.molecule import Molecule [as 别名]
# 或者: from htmd.molecule.molecule.Molecule import wrap [as 别名]
def _loadMols(self, i, rel, molfile, wrapsel, alignsel, refmol):
frames = self.data.rel2sim(rel)
mol = Molecule(molfile)
trajs = np.empty(0, dtype=str)
frs = np.empty(0, dtype=int)
for f in frames:
trajs = np.append(trajs, f.sim.trajectory[f.piece])
frs = np.append(frs, f.frame)
mol.read(trajs, frames=frs)
if len(wrapsel) > 0:
mol.wrap(wrapsel)
if refmol is not None:
mol.align(alignsel, refmol=refmol)
return mol
示例2: viewStates
# 需要导入模块: from htmd.molecule.molecule import Molecule [as 别名]
# 或者: from htmd.molecule.molecule.Molecule import wrap [as 别名]
def viewStates(self, protein=None, ligand=None, nsamples=20):
from htmd.projections.metric import _singleMolfile
from htmd.molecule.molecule import Molecule
from htmd.vmdviewer import getCurrentViewer
(single, molfile) = _singleMolfile(self.data.simlist)
if not single:
raise RuntimeError('Can''t visualize states without unique molfile')
viewer = getCurrentViewer()
colors = [0, 1, 3, 4, 5, 6, 7, 9]
print('Active set includes macrostates: {}'.format(self.hmm.active_set))
# dtraj = np.vstack(self.hmm.discrete_trajectories_full)
res = self.hmm.sample_by_observation_probabilities(nsamples)
refmol = Molecule(molfile)
for i, s in enumerate(self.hmm.active_set):
mol = Molecule(molfile)
mol.coords = []
mol.box = []
# idx = np.where(dtraj == i)[0]
# samples = np.random.choice(idx, 20)
# frames = self.data.abs2sim(samples)
frames = self.data.rel2sim(res[i])
for f in frames:
mol._readTraj(f.sim.trajectory[f.piece], frames=[f.frame], append=True)
mol.wrap('protein')
mol.align('protein', refmol=refmol)
viewer.loadMol(mol, name='hmm macro ' + str(s))
if ligand is not None:
viewer.rep('ligand', sel=ligand, color=colors[np.mod(i, len(colors))])
if protein is not None:
viewer.rep('protein')
viewer.send('start_sscache')