本文整理汇总了Python中htmd.molecule.molecule.Molecule._readTraj方法的典型用法代码示例。如果您正苦于以下问题:Python Molecule._readTraj方法的具体用法?Python Molecule._readTraj怎么用?Python Molecule._readTraj使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类htmd.molecule.molecule.Molecule
的用法示例。
在下文中一共展示了Molecule._readTraj方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _processSimOld
# 需要导入模块: from htmd.molecule.molecule import Molecule [as 别名]
# 或者: from htmd.molecule.molecule.Molecule import _readTraj [as 别名]
def _processSimOld(obj, i, updList, uniqueMol, uqMol, skip, deleteSims, metrics, ref, fstep):
pieces = updList[i].trajectory
try:
if uniqueMol:
mol = uqMol.copy()
else:
mol = Molecule(updList[i].molfile)
logger.debug(pieces[0])
mol._readTraj(pieces, skip=skip)
except Exception as e:
logger.warning('Error in simulation with id: ' + str(updList[i].simid) + ' ' + e.__str__())
#deleteSims[i] = True
return None, None, None, True, i
#fstep[i] = mol.fstep
#metrics[i] = obj._processTraj(mol)
#ref[i] = obj._calcRef(pieces, mol.fileloc)
return obj._processTraj(mol), obj._calcRef(pieces, mol.fileloc), mol.fstep, False, i
示例2: _processSim
# 需要导入模块: from htmd.molecule.molecule import Molecule [as 别名]
# 或者: from htmd.molecule.molecule.Molecule import _readTraj [as 别名]
def _processSim(sim, projectionlist, uqmol, skip):
pieces = sim.trajectory
try:
if uqmol is not None:
mol = uqmol.copy()
else:
mol = Molecule(sim.molfile)
logger.debug(pieces[0])
mol._readTraj(pieces, skip=skip)
data = []
for p in projectionlist:
pj=p.project(mol)
if pj.ndim==1:
pj=np.atleast_2d(pj).T
data.append(pj)
data = np.hstack(data)
except Exception as e:
logger.warning('Error in simulation with id: ' + str(sim.simid) + ' ' + e.__str__())
return None, None, None, True
return data, _calcRef(pieces, mol.fileloc), mol.fstep, False
示例3: viewStates
# 需要导入模块: from htmd.molecule.molecule import Molecule [as 别名]
# 或者: from htmd.molecule.molecule.Molecule import _readTraj [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')