本文整理汇总了Python中forcebalance.molecule.Molecule.elem方法的典型用法代码示例。如果您正苦于以下问题:Python Molecule.elem方法的具体用法?Python Molecule.elem怎么用?Python Molecule.elem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类forcebalance.molecule.Molecule
的用法示例。
在下文中一共展示了Molecule.elem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: int
# 需要导入模块: from forcebalance.molecule import Molecule [as 别名]
# 或者: from forcebalance.molecule.Molecule import elem [as 别名]
from forcebalance.molecule import Molecule
from forcebalance.readfrq import read_frq_gen
# Frequency output file.
fout = sys.argv[1]
# Mode number, starting from 1.
modenum = int(sys.argv[2])
if modenum == 0:
raise RuntimeError("Start mode number from one, please")
frqs, modes, intens, elem, xyz = read_frq_gen(fout)
M = Molecule()
M.elem = elem[:]
M.xyzs = []
xmode = modes[modenum - 1]
xmode /= (np.linalg.norm(xmode)/np.sqrt(M.na))
xmode *= 0.3 # Reasonable vibrational amplitude
spac = np.linspace(0, 1, 101)
disp = np.concatenate((spac, spac[::-1][1:], -1*spac[1:], -1*spac[::-1][1:-1]))
for i in disp:
M.xyzs.append(xyz+i*xmode.reshape(-1,3))
M.comms = ['Vibrational Mode %i Frequency %.3f Displacement %.3f' % (modenum, frqs[modenum-1], disp[i]*(np.linalg.norm(xmode)/np.sqrt(M.na))) for i in range(len(M))]
M.write(os.path.splitext(fout)[0]+'.mode%03i.xyz' % modenum)
示例2: len
# 需要导入模块: from forcebalance.molecule import Molecule [as 别名]
# 或者: from forcebalance.molecule.Molecule import elem [as 别名]
espval.append(float(s[3]))
elif len(espxyz) > 0:
# After reading in a block of ESPs, don't read any more.
ESPMode = -1
if line.strip().startswith("Geometry (in Angstrom)"):
XMode = 1
EMode = len(elem) == 0
if 'Electrostatic Potential' in line.strip() and ESPMode == 0:
ESPMode = 1
if len(xyzs) == 0:
raise Exception('%s has length zero' % psiout)
return xyzs, elem, espxyz, espval
xyzs, elem, espxyz, espval = read_psi_xyzesp(sys.argv[1])
M = Molecule()
M.xyzs = xyzs
M.elem = elem
M.write('%s.xyz' % os.path.splitext(sys.argv[1])[0])
EM = Molecule()
EM.xyzs = [np.array(espxyz) * 0.52917721092]
EM.elem = ['H' for i in range(len(espxyz))]
EM.write('%s.espx' % os.path.splitext(sys.argv[1])[0], ftype="xyz")
M.qm_espxyzs = EM.xyzs
M.qm_espvals = [np.array(espval)]
M.write("qdata.txt")
np.savetxt('%s.esp' % os.path.splitext(sys.argv[1])[0], espval)