本文整理汇总了Python中molecule.Molecule.to_angstrom方法的典型用法代码示例。如果您正苦于以下问题:Python Molecule.to_angstrom方法的具体用法?Python Molecule.to_angstrom怎么用?Python Molecule.to_angstrom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类molecule.Molecule
的用法示例。
在下文中一共展示了Molecule.to_angstrom方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: solve
# 需要导入模块: from molecule import Molecule [as 别名]
# 或者: from molecule.Molecule import to_angstrom [as 别名]
def solve(mol_path, hess_path):
with open(mol_path, 'r') as f:
molecule = Molecule(f.read())
molecule.to_angstrom()
with open(hess_path, 'r') as f:
str = (f.read()).replace("\n",";")
while str[-1] == ';' :
str = str[:-1]
mat = matrix(str)
output_frequencies(molecule, mat)
示例2: Molecule
# 需要导入模块: from molecule import Molecule [as 别名]
# 或者: from molecule.Molecule import to_angstrom [as 别名]
#!/usr/bin/env python3
import numpy as np
import sys
sys.path.insert(0, '../extra-files')
sys.path.insert(0, '../../0/jevandezande')
from masses import get_mass
from molecule import Molecule
# Create a molecule
mol = Molecule(open('../extra-files/molecule.xyz').read(), 'Bohr')
mol.to_angstrom()
# Read the Hessian
H = np.genfromtxt('../extra-files/hessian.dat')
# Mass weight Hessian
# Build W = M^{-1/2}
weights = []
for atom in mol.atoms:
w = 1/np.sqrt(get_mass(atom))
weights += [w, w, w]
W = np.diag(weights)
# \Tilde H = M^{-1/2} H M^{-1/2}
Ht = W @ H @ W
# Diagonalize the Hessian
# \Tilde H = L \Lambda L^T
k, L = np.linalg.eigh(Ht)