本文整理汇总了Python中forcebalance.molecule.Molecule.xyzs方法的典型用法代码示例。如果您正苦于以下问题:Python Molecule.xyzs方法的具体用法?Python Molecule.xyzs怎么用?Python Molecule.xyzs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类forcebalance.molecule.Molecule
的用法示例。
在下文中一共展示了Molecule.xyzs方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from forcebalance.molecule import Molecule [as 别名]
# 或者: from forcebalance.molecule.Molecule import xyzs [as 别名]
def main():
M = Molecule(opts.coords)
if len(M.molecules) != 1:
raise RuntimeError('Input coordinates must be a single contiguous molecule')
if opts.phi1 == None:
raise RuntimeError('phi1 (the first quartet of atoms) must be provided')
xyzout = []
commout = []
xyzcsh = []
commcsh = []
if opts.phi2 != None: # Two dimensional scan
for inc1 in range(0, 360, opts.scan):
for inc2 in range(0, 360, opts.scan):
xyzrot, clash = get_rotated_xyz(M, [opts.phi1, opts.phi2], [inc1, inc2])
print(inc1, inc2, "Clash" if clash else "Ok")
comm = "Dihedrals %s, %s set to %i, %i" % (str(opts.phi1), str(opts.phi2), inc1, inc2)
if clash:
xyzcsh.append(xyzrot.copy())
commcsh.append(comm)
else:
xyzout.append(xyzrot.copy())
commout.append(comm)
else: # One dimensional scan
for inc1 in range(0, 360, opts.scan):
xyzrot, clash = get_rotated_xyz(M, [opts.phi1], [inc1])
print(inc1, "Clash" if clash else "Ok")
comm = "Dihedral %s set to %i" % (str(opts.phi1), inc1)
if clash:
xyzcsh.append(xyzrot.copy())
commcsh.append(comm)
else:
xyzout.append(xyzrot.copy())
commout.append(comm)
if len(xyzout) > 0:
M.xyzs = xyzout
M.comms = commout
M.write(os.path.splitext(opts.coords)[0]+"_out"+os.path.splitext(opts.coords)[1])
if len(xyzcsh) > 0:
M.xyzs = xyzcsh
M.comms = commcsh
M.write(os.path.splitext(opts.coords)[0]+"_clash"+os.path.splitext(opts.coords)[1])
示例2: int
# 需要导入模块: from forcebalance.molecule import Molecule [as 别名]
# 或者: from forcebalance.molecule.Molecule import xyzs [as 别名]
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)
示例3: len
# 需要导入模块: from forcebalance.molecule import Molecule [as 别名]
# 或者: from forcebalance.molecule.Molecule import xyzs [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)