本文整理汇总了Python中molecule.Molecule.bohr方法的典型用法代码示例。如果您正苦于以下问题:Python Molecule.bohr方法的具体用法?Python Molecule.bohr怎么用?Python Molecule.bohr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类molecule.Molecule
的用法示例。
在下文中一共展示了Molecule.bohr方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: grab_energy
# 需要导入模块: from molecule import Molecule [as 别名]
# 或者: from molecule.Molecule import bohr [as 别名]
h = disp_size
hessian = np.zeros((3*len(molecule), 3*len(molecule)))
E0 = grab_energy(e, directory + '/ref/output.dat')
for x in range(len(hessian)):
for y in range(len(hessian))[x:]:
if x == y: # Second derivative with respect to the same variable
Ep = grab_energy(e, directory + '/c{:d}p/output.dat'.format(x))
En = grab_energy(e, directory + '/c{:d}n/output.dat'.format(x))
hessian[x][y] = (Ep + En - 2*E0)/(h**2)
else: # Second derivative with respect to two different variables
Epx = grab_energy(e, directory + '/c{:d}p/output.dat'.format(x))
Epy = grab_energy(e, directory + '/c{:d}p/output.dat'.format(y))
Enx = grab_energy(e, directory + '/c{:d}n/output.dat'.format(x))
Eny = grab_energy(e, directory + '/c{:d}n/output.dat'.format(y))
Epp = grab_energy(e, directory + '/c{:d}c{:d}p/output.dat'.format(x, y))
Enn = grab_energy(e, directory + '/c{:d}c{:d}n/output.dat'.format(x, y))
hessian[x][y] = (Epp + Enn - Epx - Enx - Epy - Eny + 2*E0) / (2*h**2)
hessian[y][x] = hessian[x][y]
out = open('hessian.dat', 'w')
out.write(mwrite(hessian))
out.close()
water = Molecule('../../extra-files/molecule.xyz')
water.bohr()
generate_inputs(water, '../../extra-files/template.dat')
run_jobs(water)
build_hessian(water)
H = Hessian(water, 'hessian.dat')
H.output()
示例2: make_Hessian
# 需要导入模块: from molecule import Molecule [as 别名]
# 或者: from molecule.Molecule import bohr [as 别名]
def make_Hessian(self):
self.run_disps()
h, N = self.h, self.N
E0 = self.find_E(0,0,0,0)
self.H = np.zeros((3*self.N, 3*self.N))
for i in range(3*N):
for i in range(3*N):
self.H[i,i]= (self.find_E(i,0,1,0)+self.find_E(i,0,-1,0)-2*E0)/(h**2)
for j in range(0,i):
self.H[i,j] = (self.find_E(i,j,1,1)+self.find_E(i,j,-1,-1)-self.find_E(i,0,1,0)-self.find_E(j,0,1,0)-self.find_E(j,0,-1,0)-self.find_E(i,0,-1,0)+2*E0)
self.H[i,j] /= 2*h**2
self.H[j,i] = self.H[i,j]
def write_Hessian(self):
"""
write Hessian matrix to hessian.dat file
"""
self.make_Hessian()
np.savetxt("hessian.dat",self.H,"%15.7f"," ","\n")
if __name__ == "__main__":
mol = Molecule(open("/Users/avery/git/summer-program/extra-files/molecule.xyz","r").read() )
mol.bohr()
hessian = Hessian(mol,"template.dat")
hessian.write_Hessian()
示例3: open
# 需要导入模块: from molecule import Molecule [as 别名]
# 或者: from molecule.Molecule import bohr [as 别名]
#!/usr/bin/python
import sys
sys.path.append("/Users/avery/git/summer-program/extra-files/")
sys.path.insert(0,'/Users/avery/git/summer-program/0/aewiens/')
sys.path.insert(0,'/Users/avery/git/summer-program/1/aewiens/')
sys.path.insert(0,'/Users/avery/git/summer-program/2/aewiens/')
from molecule import Molecule
from hessian import Hessian
from frequencies import Frequencies
f = open("input.dat","r").read()
h2 = Molecule(f)
h2.bohr()
hessian = Hessian(h2,"template.dat")
#hessian.write_Hessian()
hessian = open("hessian.dat","r").read()
freq = Frequencies(h2,hessian)
freq.frequency_output("modes.xyz")