def get_grid_dP_aMix(spos_ac, wfs, q, timer=nulltimer): # XXXXXX q nao = wfs.setups.nao C_MM = np.identity(nao, dtype=wfs.dtype) # XXX In the future use the New Two-Center integrals # to evaluate this dP_aMix = {} for a, setup in enumerate(wfs.setups): ni = 0 dP_Mix = np.zeros((nao, setup.ni, 3)) pt = LFC(wfs.gd, [setup.pt_j], wfs.kd.comm, dtype=wfs.dtype, forces=True) spos1_ac = [spos_ac[a]] pt.set_k_points(wfs.ibzk_qc) pt.set_positions(spos1_ac) for b, setup_b in enumerate(wfs.setups): nao = setup_b.nao phi_MG = wfs.gd.zeros(nao, wfs.dtype) phi_MG = wfs.gd.collect(phi_MG, broadcast=False) wfs.basis_functions.lcao_to_grid(C_MM[ni:ni + nao], phi_MG, q) dP_bMix = pt.dict(len(phi_MG), derivative=True) pt.derivative(phi_MG, dP_bMix, q=q) dP_Mix[ni:ni + nao] = dP_bMix[0] ni += nao timer.write_now('projector grad. doing atoms (%s, %s) ' % (a, b)) dP_aMix[a] = dP_Mix return dP_aMix
def get_grid_dP_aMix(spos_ac, wfs, q, timer=nulltimer): # XXXXXX q nao = wfs.setups.nao C_MM = np.identity(nao, dtype=wfs.dtype) dP_aMix = {} # XXX In the future use the New Two-Center integrals # to evaluate this for a, setup in enumerate(wfs.setups): ni = 0 dP_Mix = np.zeros((nao, setup.ni, 3)) pt = LFC(wfs.gd, [setup.pt_j], wfs.kpt_comm, dtype=wfs.dtype, forces=True) spos1_ac = [spos_ac[a]] pt.set_k_points(wfs.ibzk_qc) pt.set_positions(spos1_ac) for b, setup_b in enumerate(wfs.setups): nao = setup_b.nao phi_MG = wfs.gd.zeros(nao, wfs.dtype) phi_MG = wfs.gd.collect(phi_MG, broadcast=False) wfs.basis_functions.lcao_to_grid(C_MM[ni:ni + nao], phi_MG, q) dP_bMix = pt.dict(len(phi_MG), derivative=True) pt.derivative(phi_MG, dP_bMix, q=q) dP_Mix[ni:ni + nao] = dP_bMix[0] ni += nao timer.write_now('projector grad. doing atoms (%s, %s) ' % (a, b)) dP_aMix[a] = dP_Mix return dP_aMix
def __init__(self, gd, spline_j, spos_c, index=None): rcut = max([spline.get_cutoff() for spline in spline_j]) corner_c = np.ceil(spos_c * gd.N_c - rcut / gd.h_c).astype(int) size_c = np.ceil(spos_c * gd.N_c + rcut / gd.h_c).astype(int) - corner_c smallgd = GridDescriptor(N_c=size_c + 1, cell_cv=gd.h_c * (size_c + 1), pbc_c=False, comm=mpi.serial_comm) lfc = LFC(smallgd, [spline_j]) lfc.set_positions((spos_c[np.newaxis, :] * gd.N_c - corner_c + 1) / smallgd.N_c) ni = lfc.Mmax f_iG = smallgd.zeros(ni) lfc.add(f_iG, {0: np.eye(ni)}) LocalizedFunctions.__init__(self, gd, f_iG, corner_c, index=index)
def get_grid2_dP_aMix(spos_ac, wfs, q, *args, **kwargs): # XXXXXX q nao = wfs.setups.nao C_MM = np.identity(nao, dtype=wfs.dtype) bfs = wfs.basis_functions phi_MG = wfs.gd.zeros(nao, wfs.dtype) bfs.lcao_to_grid(C_MM, phi_MG, q) setups = wfs.setups pt = LFC(wfs.gd, [setup.pt_j for setup in setups], wfs.kpt_comm, dtype=wfs.dtype, forces=True) pt.set_k_points(wfs.ibzk_qc) pt.set_positions(spos_ac) dP_aMix = pt.dict(len(phi_MG), derivative=True) pt.derivative(phi_MG, dP_aMix, q=q) return dP_aMix
def get_grid2_dP_aMix(spos_ac, wfs, q, *args, **kwargs): # XXXXXX q nao = wfs.setups.nao C_MM = np.identity(nao, dtype=wfs.dtype) bfs = wfs.basis_functions phi_MG = wfs.gd.zeros(nao, wfs.dtype) bfs.lcao_to_grid(C_MM, phi_MG, q) setups = wfs.setups pt = LFC(wfs.gd, [setup.pt_j for setup in setups], wfs.kd.comm, dtype=wfs.dtype, forces=True) pt.set_k_points(wfs.ibzk_qc) pt.set_positions(spos_ac) dP_aMix = pt.dict(len(phi_MG), derivative=True) pt.derivative(phi_MG, dP_aMix, q=q) return dP_aMix