本文整理汇总了Python中htmd.molecule.molecule.Molecule.frame方法的典型用法代码示例。如果您正苦于以下问题:Python Molecule.frame方法的具体用法?Python Molecule.frame怎么用?Python Molecule.frame使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类htmd.molecule.molecule.Molecule
的用法示例。
在下文中一共展示了Molecule.frame方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _writeInputsFunction
# 需要导入模块: from htmd.molecule.molecule import Molecule [as 别名]
# 或者: from htmd.molecule.molecule.Molecule import frame [as 别名]
def _writeInputsFunction(i, f, epoch, inputpath, coorname):
regex = re.compile('(e\d+s\d+)_')
frameNum = f.frame
piece = f.piece
if f.sim.parent is None:
currSim = f.sim
else:
currSim = f.sim.parent
traj = currSim.trajectory[piece]
if currSim.input is None:
raise NameError('Could not find input folder in simulation lists. Cannot create new simulations.')
wuName = _simName(traj)
res = regex.search(wuName)
if res: # If we are running on top of adaptive, use the first name part for the next sim name
wuName = res.group(1)
# create new job directory
newName = 'e' + str(epoch) + 's' + str(i + 1) + '_' + wuName + 'p' + str(piece) + 'f' + str(frameNum)
newDir = path.join(inputpath, newName, '')
# copy previous input directory including input files
copytree(currSim.input, newDir, symlinks=False, ignore=ignore_patterns('*.coor', '*.rst', '*.out', *_IGNORE_EXTENSIONS))
# overwrite input file with new one. frameNum + 1 as catdcd does 1 based indexing
mol = Molecule()
mol.read(traj)
mol.frame = frameNum
mol.write(path.join(newDir, coorname))
示例2: _writeInputs
# 需要导入模块: from htmd.molecule.molecule import Molecule [as 别名]
# 或者: from htmd.molecule.molecule.Molecule import frame [as 别名]
def _writeInputs(self, simsframes, epoch=None):
if epoch is None:
epoch = self._getEpoch() + 1
test = glob(path.join(self.inputpath, 'e' + str(epoch) + '*'))
if len(test) != 0:
raise NameError('Input dirs of epoch ' + str(epoch) + ' already exists.')
if path.exists(path.join(self.inputpath, 'e' + str(epoch) + '_writeinputs.log')):
raise NameError('Epoch logfile already exists. Cant overwrite it.')
fid = open(path.join(self.inputpath, 'e' + str(epoch) + '_writeinputs.log'), 'w')
regex = re.compile('(e\d+s\d+)_')
for i, f in enumerate(simsframes):
frameNum = f.frame
piece = f.piece
#print(frameNum)
if f.sim.parent is None:
currSim = f.sim
else:
currSim = f.sim.parent
traj = currSim.trajectory[piece]
if currSim.input is None:
raise NameError('Could not find input folder in simulation lists. Cannot create new simulations.')
wuName = _simName(traj)
res = regex.search(wuName)
if res: # If we are running on top of adaptive, use the first name part for the next sim name
wuName = res.group(1)
# create new job directory
newName = 'e' + str(epoch) + 's' + str(i+1) + '_' + wuName + 'p' + str(piece) + 'f' + str(frameNum)
newDir = path.join(self.inputpath, newName, '')
# copy previous input directory including input files
copytree(currSim.input, newDir, symlinks=False, ignore=ignore_patterns('*.dcd', '*.xtc', '*.coor'))
# overwrite input file with new one. frameNum + 1 as catdcd does 1 based indexing
mol = Molecule()
mol.read(traj)
mol.frame = frameNum
mol.write(path.join(newDir, 'input.coor'))
# write nextInput file
fid.write('# {0} \n{1} {2}\n'.format(newName, traj, frameNum))
fid.close()