本文整理汇总了Python中forcebalance.molecule.Molecule.qm_espvals方法的典型用法代码示例。如果您正苦于以下问题:Python Molecule.qm_espvals方法的具体用法?Python Molecule.qm_espvals怎么用?Python Molecule.qm_espvals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类forcebalance.molecule.Molecule
的用法示例。
在下文中一共展示了Molecule.qm_espvals方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: read_quantum
# 需要导入模块: from forcebalance.molecule import Molecule [as 别名]
# 或者: from forcebalance.molecule.Molecule import qm_espvals [as 别名]
def read_quantum():
Result = None
os.chdir('calcs')
for i in range(M.ns):
dnm = eval(formstr % i)
print("\rNow in directory %i" % i, end=' ')
if os.path.exists(dnm):
os.chdir(dnm)
if os.path.exists('qchem.out'):
Output = Molecule('qchem.out')
if os.path.exists('plot.esp'):
ESP = Molecule('plot.esp')
#print ESP.Data.keys()
Output.qm_espxyzs = list(ESP.qm_espxyzs)
Output.qm_espvals = list(ESP.qm_espvals)
#Output += Molecule('plot.esp')
if Result == None:
Result = Output
else:
Result += Output
else:
raise Exception("The output file %s doesn't exist." % os.path.abspath('qchem.out'))
os.chdir('..')
else:
raise Exception("The subdirectory %s doesn't exist." % os.path.abspath(dnm))
os.chdir('..')
return Result
示例2: gather_generations
# 需要导入模块: from forcebalance.molecule import Molecule [as 别名]
# 或者: from forcebalance.molecule.Molecule import qm_espvals [as 别名]
def gather_generations():
shots = Molecule('shots.gro')
qdata = Molecule('qdata.txt')
A1 = np.array(shots.xyzs)
A2 = np.array(qdata.xyzs)
if A1.shape != A2.shape:
raise Exception('shots.gro and qdata.txt appear to contain different data')
elif np.max(np.abs((A1 - A2).flatten())) > 1e-4:
raise Exception('shots.gro and qdata.txt appear to contain different xyz coordinates')
shots.qm_energies = qdata.qm_energies
shots.qm_forces = qdata.qm_forces
shots.qm_espxyzs = qdata.qm_espxyzs
shots.qm_espvals = qdata.qm_espvals
First = True
if First:
All = shots
else:
All += shots
return All
示例3: len
# 需要导入模块: from forcebalance.molecule import Molecule [as 别名]
# 或者: from forcebalance.molecule.Molecule import qm_espvals [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)