def add_extra_setup_data(self, dict): ae = self.ae njcore = ae.njcore w_ln = self.coefficients.get_coefficients_1d(smooth=True) w_j = [] for w_n in w_ln: for w in w_n: w_j.append(w) dict['w_j'] = w_j w_j = self.coefficients.get_coefficients_1d() x_g = np.dot(w_j[:njcore], safe_sqr(ae.u_j[:njcore])) x_g[1:] /= ae.r[1:]**2 * 4 * np.pi x_g[0] = x_g[1] dict['core_response'] = x_g # For debugging purposes w_j = self.coefficients.get_coefficients_1d() u2_j = safe_sqr(self.ae.u_j) v_g = self.weight * np.dot(w_j, u2_j) / (np.dot(self.ae.f_j, u2_j) + 1e-10) v_g[0] = v_g[1] dict['all_electron_response'] = v_g # Calculate Hardness of spherical atom, for debugging purposes l = [ np.where(f < 1e-3, e, 1000) for f, e in zip(self.ae.f_j, self.ae.e_j) ] h = [ np.where(f > 1e-3, e, -1000) for f, e in zip(self.ae.f_j, self.ae.e_j) ] lumo_e = min(l) homo_e = max(h) if lumo_e < 999: # If there is unoccpied orbital w_j = self.coefficients.get_coefficients_1d(lumo_perturbation=True) v_g = self.weight * np.dot( w_j, u2_j) / (np.dot(self.ae.f_j, u2_j) + 1e-10) e2 = [ e + np.dot(u2 * v_g, self.ae.dr) for u2, e in zip(u2_j, self.ae.e_j) ] lumo_2 = min( [np.where(f < 1e-3, e, 1000) for f, e in zip(self.ae.f_j, e2)]) print "New lumo eigenvalue:", lumo_2 * 27.2107 self.hardness = lumo_2 - homo_e print "Hardness predicted: %10.3f eV" % (self.hardness * 27.2107)
def add_smooth_xc_potential_and_energy_1d(self, vt_g): w_ln = self.coefficients.get_coefficients_1d(smooth=True) v_g = np.zeros(self.ae.N) n_g = np.zeros(self.ae.N) for w_n, f_n, u_n in zip(w_ln, self.ae.f_ln, self.ae.s_ln): # For each angular momentum u2_n = safe_sqr(u_n) v_g += np.dot(w_n, u2_n) n_g += np.dot(f_n, u2_n) vt_g += self.weight * v_g / (n_g + self.damp) return 0.0 # Response part does not contribute to energy
def add_smooth_xc_potential_and_energy_1d(self, vt_g): w_ln = self.coefficients.get_coefficients_1d(smooth=True) v_g = np.zeros(self.ae.N) n_g = np.zeros(self.ae.N) for w_n, f_n, u_n in zip(w_ln, self.ae.f_ln, self.ae.s_ln): # For each angular momentum u2_n = safe_sqr(u_n) v_g += np.dot(w_n, u2_n) n_g += np.dot(f_n, u2_n) vt_g += self.weight * v_g / (n_g + 1e-10) return 0.0 # Response part does not contribute to energy
def add_extra_setup_data(self, dict): ae = self.ae njcore = ae.njcore w_ln = self.coefficients.get_coefficients_1d(smooth=True) w_j = [] for w_n in w_ln: for w in w_n: w_j.append(w) dict['w_j'] = w_j w_j = self.coefficients.get_coefficients_1d() x_g = np.dot(w_j[:njcore], safe_sqr(ae.u_j[:njcore])) x_g[1:] /= ae.r[1:]**2 * 4*np.pi x_g[0] = x_g[1] dict['core_response'] = x_g # For debugging purposes w_j = self.coefficients.get_coefficients_1d() u2_j = safe_sqr(self.ae.u_j) v_g = self.weight * np.dot(w_j, u2_j) / (np.dot(self.ae.f_j, u2_j) +self.damp) v_g[0] = v_g[1] dict['all_electron_response'] = v_g # Calculate Hardness of spherical atom, for debugging purposes l = [ np.where(f<1e-3, e, 1000) for f,e in zip(self.ae.f_j, self.ae.e_j)] h = [ np.where(f>1e-3, e, -1000) for f,e in zip(self.ae.f_j, self.ae.e_j)] lumo_e = min(l) homo_e = max(h) if lumo_e < 999: # If there is unoccpied orbital w_j = self.coefficients.get_coefficients_1d(lumo_perturbation = True) v_g = self.weight * np.dot(w_j, u2_j) / (np.dot(self.ae.f_j, u2_j) +self.damp) e2 = [ e+np.dot(u2*v_g, self.ae.dr) for u2,e in zip(u2_j, self.ae.e_j) ] lumo_2 = min([ np.where(f<1e-3, e, 1000) for f,e in zip(self.ae.f_j, e2)]) print("New lumo eigenvalue:", lumo_2 * 27.2107) self.hardness = lumo_2 - homo_e print("Hardness predicted: %10.3f eV" % (self.hardness * 27.2107))
def add_xc_potential_and_energy_1d(self, v_g): w_i = self.coefficients.get_coefficients_1d() u2_j = safe_sqr(self.ae.u_j) v_g += self.weight * np.dot(w_i, u2_j) / (np.dot(self.ae.f_j, u2_j) + 1e-10) return 0.0 # Response part does not contribute to energy
def add_xc_potential_and_energy_1d(self, v_g): w_i = self.coefficients.get_coefficients_1d() u2_j = safe_sqr(self.ae.u_j) v_g += self.weight * np.dot(w_i, u2_j) / (np.dot(self.ae.f_j, u2_j) + self.damp) return 0.0 # Response part does not contribute to energy