Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.timer.start('init')
V_rcc = np.zeros((self.ndof, 3, 3), dtype=complex)
pre = 1. / (2 * self.delta)
pre *= u.Hartree * u.Bohr # e^2Angstrom^2 / eV -> Angstrom^3
om = omega
if gamma:
om += 1j * gamma
self.timer.stop('init')
self.timer.start('alpha derivatives')
for i, r in enumerate(self.myr):
V_rcc[r] = pre * (
polarizability(self.exp_r[i], om,
form=self.dipole_form, tensor=True) -
polarizability(self.exm_r[i], om,
form=self.dipole_form, tensor=True))
self.timer.stop('alpha derivatives')
# map to modes
self.comm.sum(V_rcc)
V_qcc = (V_rcc.T * self.im).T # units Angstrom^2 / sqrt(amu)
V_Qcc = np.dot(V_qcc.T, self.modes.T).T
return V_Qcc