/* * ************************************************ * Denoting 2e integrals (ij|kl), * transform ij for ksh_start <= k shell < ksh_end. * The transformation C_pi C_qj (pq|k*) coefficients are stored in * mo_coeff, C_pi and C_qj are offset by i_start and i_count, j_start and j_count * * The output eri is an 2D array, ordered as (kl-AO-pair,ij-MO-pair) in * C-order. Transposing is needed before calling AO2MOnr_e2_drv. * eri[ncomp,nkl,mo_i,mo_j] */ void AO2MOnr_e1_drv(int (*intor)(), int (*cgto_in_shell)(), void (*fill)(), void (*ftrans)(), int (*fmmm)(), double *eri, double *mo_coeff, int klsh_start, int klsh_count, int nkl, int i_start, int i_count, int j_start, int j_count, int ncomp, CINTOpt *cintopt, CVHFOpt *vhfopt, int *atm, int natm, int *bas, int nbas, double *env) { int *ao_loc = malloc(sizeof(int)*(nbas+1)); int ish; int nao = 0; for (ish = 0; ish < nbas; ish++) { ao_loc[ish] = nao; nao += (*cgto_in_shell)(ish, bas); } ao_loc[nbas] = nao; double *eri_ao = malloc(sizeof(double) * nao*nao*nkl*ncomp); AO2MOnr_e1fill_drv(intor, cgto_in_shell, fill, eri_ao, klsh_start, klsh_count, nkl, ncomp, cintopt, vhfopt, atm, natm, bas, nbas, env); AO2MOnr_e2_drv(ftrans, fmmm, eri, eri_ao, mo_coeff, nkl*ncomp, nao, i_start, i_count, j_start, j_count, ao_loc, nbas); free(eri_ao); free(ao_loc); }
/* * ************************************************ * Denoting 2e integrals (ij|kl), * transform ij for ksh_start <= k shell < ksh_end. * The transformation C_pi C_qj (pq|k*) coefficients are stored in * mo_coeff, C_pi and C_qj are offset by i_start and i_count, j_start and j_count * * The output eri is an 2D array, ordered as (kl-AO-pair,ij-MO-pair) in * C-order. Transposing is needed before calling AO2MOnr_e2_drv. * eri[ncomp,nkl,mo_i,mo_j] */ void AO2MOnr_e1_drv(int (*intor)(), void (*fill)(), void (*ftrans)(), int (*fmmm)(), double *eri, double *mo_coeff, int klsh_start, int klsh_count, int nkl, int ncomp, int *orbs_slice, int *ao_loc, CINTOpt *cintopt, CVHFOpt *vhfopt, int *atm, int natm, int *bas, int nbas, double *env) { int nao = ao_loc[nbas]; double *eri_ao = malloc(sizeof(double) * nao*nao*nkl*ncomp); assert(eri_ao); AO2MOnr_e1fill_drv(intor, fill, eri_ao, klsh_start, klsh_count, nkl, ncomp, ao_loc, cintopt, vhfopt, atm, natm, bas, nbas, env); AO2MOnr_e2_drv(ftrans, fmmm, eri, eri_ao, mo_coeff, nkl*ncomp, nao, orbs_slice, ao_loc, nbas); free(eri_ao); }
/* * ************************************************ * Denoting 2e integrals (ij|kl), * transform ij for ksh_start <= k shell < ksh_end. * The transformation C_pi C_qj (pq|k*) coefficients are stored in * mo_coeff, C_pi and C_qj are offset by i_start and i_count, j_start and j_count * * The output eri is an 2D array, ordered as (kl-AO-pair,ij-MO-pair) in * C-order. Transposing is needed before calling AO2MOnr_e2_drv. * eri[ncomp,nkl,mo_i,mo_j] */ void AO2MOnr_e1_drv(int (*intor)(), void (*fill)(), void (*ftrans)(), int (*fmmm)(), double *eri, double *mo_coeff, int klsh_start, int klsh_count, int nkl, int i_start, int i_count, int j_start, int j_count, int ncomp, CINTOpt *cintopt, CVHFOpt *vhfopt, int *atm, int natm, int *bas, int nbas, double *env) { int *ao_loc = malloc(sizeof(int)*(nbas+1)); CINTshells_spheric_offset(ao_loc, bas, nbas); ao_loc[nbas] = ao_loc[nbas-1] + CINTcgto_spheric(nbas-1, bas); int nao = ao_loc[nbas]; double *eri_ao = malloc(sizeof(double) * nao*nao*nkl*ncomp); AO2MOnr_e1fill_drv(intor, fill, eri_ao, klsh_start, klsh_count, nkl, ncomp, cintopt, vhfopt, atm, natm, bas, nbas, env); AO2MOnr_e2_drv(ftrans, fmmm, eri, eri_ao, mo_coeff, nkl*ncomp, nao, i_start, i_count, j_start, j_count, ao_loc, nbas); free(eri_ao); free(ao_loc); }