本文整理汇总了Python中molecule.Molecule.from_file方法的典型用法代码示例。如果您正苦于以下问题:Python Molecule.from_file方法的具体用法?Python Molecule.from_file怎么用?Python Molecule.from_file使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类molecule.Molecule
的用法示例。
在下文中一共展示了Molecule.from_file方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: open
# 需要导入模块: from molecule import Molecule [as 别名]
# 或者: from molecule.Molecule import from_file [as 别名]
path = directory + '/{:d}{:d}_{:d}{:d}'.format(coords, coordd, ks, kd)
lines = open(path + '/input.out').readlines()
energy = 0.0
for line in reversed(lines):
if line[:23] == ep:
energy = float(line.split()[-1])
return energy
raise Exception('Cannot find energy in ' + path)
H = np.zeros((3*natom, 3*natom))
for A in range(3*natom): # calculates matrix elements of hessian
for B in range(3*natom):
if A == B:
H[A,A] = (E(A,0,+1,0,ep) + E(A,0,-1,0,ep) - 2 * E(0,0,0,0,ep))/(disp_size**2)
else:
H[A,B] = (E(A,B,+1,+1,ep) + E(A,B,-1,-1,ep) - E(A,B,+1,0,ep) - E(A,B,-1,0,ep) \
- E(A,B,0,+1,ep) - E(A,B,0,-1,ep) + 2*E(0,0,0,0,ep))/(2*(disp_size**2))
np.savetxt('hessian.dat', H) # writes hessian to hessian.dat
return H
# testing
if __name__=='__main__':
mol = Molecule.from_file('../../extra-files/molecule.xyz') # building molecule from molecule.xyz
template = open('../../extra-files/template.dat').read() # reads initial template
generate_inputs(mol, template, 0.005, 'DISPS')
run_jobs(mol, '/Users/boyi/bin/psi4/obj/stage/usr/local/bin/psi4', 'DISPS')
build_hessian(mol,' @DF-RHF Final Energy:', 0.005, 'DISPS')
frequencies.get_freqs(mol, 'hessian.dat') # calling frequencies function
示例2:
# 需要导入模块: from molecule import Molecule [as 别名]
# 或者: from molecule.Molecule import from_file [as 别名]
# Tests molecule.py by calling static method on molecule.xyz
from molecule import Molecule
mol=Molecule.from_file('../../extra-files/molecule.xyz')
print(mol)