def expectation(self, rho, c_am): """ Args: rho: float or complex current MO density. c_am: float or complex Transformation Matrix |AO><MO| Returns: mu: float or complex dipole moment in |x y z| direction """ rhoAO = tdscf.transmat(rho,c_am,-1) mol_dip = np.einsum('xij,ji->x', self.dip_ints, rhoAO) if (np.any(self.dip0) != None): mu = mol_dip - self.dip0 return mu else: mu = mol_dip.copy() return mu
def applyfield(self, a_mat, c_am, tnow): """ Args: a_mat: float or complex an MO matrix c_am: float or complex Transformation Matrix |AO><MO| tnow: float current time. Returns: a_mat_field: float or complex an MO matrix with the field added ison: bool On whether field is on or off """ amp, ison = self.impulseamp(tnow) mpol = self.pert_xyz * amp if (ison): a_mat_field = a_mat + 2.0*tdscf.transmat(\ np.einsum("kij,k->ij",self.dip_ints,mpol),c_am) return a_mat_field, True else: a_mat_field = a_mat.copy() return a_mat, False