本文整理汇总了Python中forcebalance.molecule.Molecule.xyzs[0][a:a+3]方法的典型用法代码示例。如果您正苦于以下问题:Python Molecule.xyzs[0][a:a+3]方法的具体用法?Python Molecule.xyzs[0][a:a+3]怎么用?Python Molecule.xyzs[0][a:a+3]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类forcebalance.molecule.Molecule
的用法示例。
在下文中一共展示了Molecule.xyzs[0][a:a+3]方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: prepare_temp_directory
# 需要导入模块: from forcebalance.molecule import Molecule [as 别名]
# 或者: from forcebalance.molecule.Molecule import xyzs[0][a:a+3] [as 别名]
def prepare_temp_directory(self, options, tgt_opts):
abstempdir = os.path.join(self.root,self.tempdir)
if self.FF.rigid_water:
self.optprog = "optrigid"
#LinkFile(os.path.join(self.root,self.tgtdir,"rigid.key"),os.path.join(abstempdir,"rigid.key"))
else:
self.optprog = "optimize"
# Link the necessary programs into the temporary directory
LinkFile(os.path.join(options['tinkerpath'],"analyze"),os.path.join(abstempdir,"analyze"))
LinkFile(os.path.join(options['tinkerpath'],self.optprog),os.path.join(abstempdir,self.optprog))
LinkFile(os.path.join(options['tinkerpath'],"superpose"),os.path.join(abstempdir,"superpose"))
# Link the run parameter file
# The master file might be unneeded??
for sysname,sysopt in self.sys_opts.items():
if self.FF.rigid_water:
# Make every water molecule rigid
# WARNING: Hard coded values here!
M = Molecule(os.path.join(self.root, self.tgtdir, sysopt['geometry']),ftype="tinker")
for a in range(0, len(M.xyzs[0]), 3):
flex = M.xyzs[0]
wat = flex[a:a+3]
com = wat.mean(0)
wat -= com
o = wat[0]
h1 = wat[1]
h2 = wat[2]
r1 = h1 - o
r2 = h2 - o
r1 /= Np.linalg.norm(r1)
r2 /= Np.linalg.norm(r2)
# Obtain unit vectors.
ex = r1 + r2
ey = r1 - r2
ex /= Np.linalg.norm(ex)
ey /= Np.linalg.norm(ey)
Bond = 0.9572
Ang = Np.pi * 104.52 / 2 / 180
cosx = Np.cos(Ang)
cosy = Np.sin(Ang)
h1 = o + Bond*ex*cosx + Bond*ey*cosy
h2 = o + Bond*ex*cosx - Bond*ey*cosy
rig = Np.array([o, h1, h2]) + com
M.xyzs[0][a:a+3] = rig
M.write(os.path.join(abstempdir,sysopt['geometry']),ftype="tinker")
else:
M = Molecule(os.path.join(self.root, self.tgtdir, sysopt['geometry']),ftype="tinker")
if 'select' in sysopt:
atomselect = Np.array(uncommadash(sysopt['select']))
#atomselect = eval("Np.arange(M.na)"+sysopt['select'])
M = M.atom_select(atomselect)
M.write(os.path.join(abstempdir,sysname+".xyz"),ftype="tinker")
write_key_with_prm(os.path.join(self.root,self.tgtdir,sysopt['keyfile']),os.path.join(abstempdir,sysname+".key"),ffobj=self.FF)