示例#1
0
/*
 * The size of eri is ncomp*nkl*nao*nao, note the upper triangular part
 * may not be filled
 */
void AO2MOnr_e1fill_drv(int (*intor)(), void (*fill)(), double *eri,
                        int klsh_start, int klsh_count, int nkl,
                        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];
        struct _AO2MOEnvs envs = {natm, nbas, atm, bas, env, nao,
                                  klsh_start, klsh_count, 0, 0, 0, 0,
                                  ncomp, ao_loc, NULL, cintopt, vhfopt};
        int ish;
        int (*fprescreen)();
        if (vhfopt) {
                fprescreen = vhfopt->fprescreen;
        } else {
                fprescreen = CVHFnoscreen;
        }

#pragma omp parallel default(none) \
        shared(fill, fprescreen, eri, envs, intor, nkl, nbas) \
        private(ish)
#pragma omp for nowait schedule(dynamic)
        for (ish = 0; ish < nbas; ish++) {
                (*fill)(intor, fprescreen, eri, nkl, ish, &envs);
        }

        free(ao_loc);
}
示例#2
0
文件: nr_2c2e.c 项目: diradical/pyscf
void RInr_fill2c2e_sph(double *eri, int auxstart, int auxcount,
                       int *atm, int natm, int *bas, int nbas, double *env)
{
        const int nbasnaux = auxstart + auxcount;
        int *ao_loc = malloc(sizeof(int)*(nbasnaux+1));
        CINTshells_spheric_offset(ao_loc, bas, nbasnaux);
        ao_loc[nbasnaux] = ao_loc[nbasnaux-1] + CINTcgto_spheric(nbasnaux-1, bas);
        const int naoaux = ao_loc[nbasnaux] - ao_loc[auxstart];
        double *buf;

        int ish, jsh, di, dj;
        int i, j, i0, j0;
        int shls[2];
        CINTOpt *cintopt = NULL;
        cint2c2e_sph_optimizer(&cintopt, atm, natm, bas, nbas, env);

#pragma omp parallel default(none) \
        shared(eri, auxstart, auxcount, atm, natm, bas, nbas, env, \
               ao_loc, cintopt) \
        private(ish, jsh, di, dj, i, j, i0, j0, shls, buf)
#pragma omp for nowait schedule(dynamic)
        for (ish = auxstart; ish < nbasnaux; ish++) {
        for (jsh = auxstart; jsh <= ish; jsh++) {
                di = ao_loc[ish+1] - ao_loc[ish];
                dj = ao_loc[jsh+1] - ao_loc[jsh];
                shls[0] = ish;
                shls[1] = jsh;
                buf = (double *)malloc(sizeof(double) * di * dj);
                if (cint2c2e_sph(buf, shls, atm, natm, bas, nbas, env,
                                 cintopt)) {
                        for (i0 = ao_loc[ish]-ao_loc[auxstart], i = 0; i < di; i++, i0++) {
                        for (j0 = ao_loc[jsh]-ao_loc[auxstart], j = 0; j < dj; j++, j0++) {
                                eri[i0*naoaux+j0] = buf[j*di+i];
                        } }
                } else {
                        for (i0 = ao_loc[ish]-ao_loc[auxstart];
                             i0 < ao_loc[ish+1]-ao_loc[auxstart]; i0++) {
                        for (j0 = ao_loc[jsh]-ao_loc[auxstart];
                             j0 < ao_loc[jsh+1]-ao_loc[auxstart]; j0++) {
                                eri[i0*naoaux+j0] = 0;
                        } }
                }
                free(buf);
        } }

        for (i = 0; i < naoaux; i++) {
                for (j = 0; j < i; j++) {
                        eri[j*naoaux+i] = eri[i*naoaux+j];
                }
        }

        free(ao_loc);
        CINTdel_optimizer(&cintopt);
}
示例#3
0
/*
 * ************************************************
 * 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);
}
示例#4
0
文件: c2f.c 项目: BB-Goldstein/qcint
/* 
 * offset of each shell for real spheric GTOs
 */
void cintshells_spheric_offset_(FINT ao_loc[], const FINT *bas, const FINT *nbas)
{
        CINTshells_spheric_offset(ao_loc, bas, *nbas);
}