def calc_e0(self):
"""
Compute the reference axis for adding dummy atoms.
Only used in the case of linear molecules.
We first find the Cartesian axis that is "most perpendicular" to the molecular axis.
Next we take the cross product with the molecular axis to create a perpendicular vector.
Finally, this perpendicular vector is normalized to make a unit vector.
"""
ysel = self.x0[self.a, :]
vy = ysel[-1]-ysel[0]
ev = vy / np.linalg.norm(vy)
# Cartesian axes.
ex = np.array([1.0,0.0,0.0])
ey = np.array([0.0,1.0,0.0])
ez = np.array([0.0,0.0,1.0])
self.e0 = np.cross(vy, [ex, ey, ez][np.argmin([np.dot(i, ev)**2 for i in [ex, ey, ez]])])
self.e0 /= np.linalg.norm(self.e0)
评论列表
文章目录