Example #1
0
File: g1e.c Project: sunqm/libcint
void CINTg1e_index_xyz(FINT *idx, CINTEnvVars *envs)
{
        const FINT i_l = envs->i_l;
        const FINT j_l = envs->j_l;
        const FINT nfi = envs->nfi;
        const FINT nfj = envs->nfj;
        const FINT di = envs->g_stride_i;
        const FINT dj = envs->g_stride_j;
        FINT i, j, n;
        FINT ofx, ofjx;
        FINT ofy, ofjy;
        FINT ofz, ofjz;
        FINT i_nx[CART_MAX], i_ny[CART_MAX], i_nz[CART_MAX];
        FINT j_nx[CART_MAX], j_ny[CART_MAX], j_nz[CART_MAX];

        CINTcart_comp(i_nx, i_ny, i_nz, i_l);
        CINTcart_comp(j_nx, j_ny, j_nz, j_l);

        ofx = 0;
        ofy = envs->g_size;
        ofz = envs->g_size * 2;
        n = 0;
        for (j = 0; j < nfj; j++) {
                ofjx = ofx + dj * j_nx[j];
                ofjy = ofy + dj * j_ny[j];
                ofjz = ofz + dj * j_nz[j];
                for (i = 0; i < nfi; i++) {
                        idx[n+0] = ofjx + di * i_nx[i];
                        idx[n+1] = ofjy + di * i_ny[i];
                        idx[n+2] = ofjz + di * i_nz[i];
                        n += 3;
                }
        }
}
Example #2
0
File: g3c1e.c Project: wu82/libcint
void CINTg3c1e_index_xyz(FINT *idx, const CINTEnvVars *envs)
{
        const FINT i_l = envs->i_l;
        const FINT j_l = envs->j_l;
        const FINT k_l = envs->k_l;
        const FINT nfi = envs->nfi;
        const FINT nfj = envs->nfj;
        const FINT nfk = envs->nfk;
        const FINT dj = envs->g_stride_j;
        const FINT dk = envs->g_stride_k;
        FINT i, j, k, n;
        FINT ofx, ofjx, ofkx;
        FINT ofy, ofjy, ofky;
        FINT ofz, ofjz, ofkz;
        FINT i_nx[CART_MAX], i_ny[CART_MAX], i_nz[CART_MAX];
        FINT j_nx[CART_MAX], j_ny[CART_MAX], j_nz[CART_MAX];
        FINT k_nx[CART_MAX], k_ny[CART_MAX], k_nz[CART_MAX];

        CINTcart_comp(i_nx, i_ny, i_nz, i_l);
        CINTcart_comp(j_nx, j_ny, j_nz, j_l);
        CINTcart_comp(k_nx, k_ny, k_nz, k_l);

        ofx = 0;
        ofy = envs->g_size;
        ofz = envs->g_size * 2;
        n = 0;
        for (k = 0; k < nfk; k++) {
                ofkx = ofx + dk * k_nx[k];
                ofky = ofy + dk * k_ny[k];
                ofkz = ofz + dk * k_nz[k];
                for (j = 0; j < nfj; j++) {
                        ofjx = ofkx + dj * j_nx[j];
                        ofjy = ofky + dj * j_ny[j];
                        ofjz = ofkz + dj * j_nz[j];
                        for (i = 0; i < nfi; i++) {
                                idx[n+0] = ofjx + i_nx[i];
                                idx[n+1] = ofjy + i_ny[i];
                                idx[n+2] = ofjz + i_nz[i];
                                n += 3;
                        }
                }
        }
}
Example #3
0
void CINTg3c2e_index_xyz(FINT *idx, const CINTEnvVars *envs)
{
        const FINT i_l = envs->i_l;
        const FINT j_l = envs->j_l;
        const FINT k_l = envs->k_l;
        const FINT nfi = envs->nfi;
        const FINT nfj = envs->nfj;
        const FINT nfk = envs->nfk;
        const FINT di = envs->g_stride_i;
        const FINT dk = envs->g_stride_k;
        const FINT dj = envs->g_stride_j;
        FINT i, j, k, n;
        FINT ofx, ofkx;
        FINT ofy, ofky;
        FINT ofz, ofkz;
        FINT i_nx[CART_MAX], i_ny[CART_MAX], i_nz[CART_MAX];
        FINT j_nx[CART_MAX], j_ny[CART_MAX], j_nz[CART_MAX];
        FINT k_nx[CART_MAX], k_ny[CART_MAX], k_nz[CART_MAX];

        CINTcart_comp(i_nx, i_ny, i_nz, i_l);
        CINTcart_comp(j_nx, j_ny, j_nz, j_l);
        CINTcart_comp(k_nx, k_ny, k_nz, k_l);

        ofx = 0;
        ofy = envs->g_size;
        ofz = envs->g_size * 2;
        n = 0;
        for (j = 0; j < nfj; j++) {
                for (k = 0; k < nfk; k++) {
                        ofkx = ofx + dj * j_nx[j] + dk * k_nx[k];
                        ofky = ofy + dj * j_ny[j] + dk * k_ny[k];
                        ofkz = ofz + dj * j_nz[j] + dk * k_nz[k];
                        switch (i_l) {
                                case 0:
                                        idx[n+0] = ofkx;
                                        idx[n+1] = ofky;
                                        idx[n+2] = ofkz;
                                        n += 3;
                                        break;
                                case 1:
                                        idx[n+0] = ofkx + di;
                                        idx[n+1] = ofky;
                                        idx[n+2] = ofkz;
                                        idx[n+3] = ofkx;
                                        idx[n+4] = ofky + di;
                                        idx[n+5] = ofkz;
                                        idx[n+6] = ofkx;
                                        idx[n+7] = ofky;
                                        idx[n+8] = ofkz + di;
                                        n += 9;
                                        break;
                                case 2:
                                        idx[n+0 ] = ofkx + di*2;
                                        idx[n+1 ] = ofky;
                                        idx[n+2 ] = ofkz;
                                        idx[n+3 ] = ofkx + di;
                                        idx[n+4 ] = ofky + di;
                                        idx[n+5 ] = ofkz;
                                        idx[n+6 ] = ofkx + di;
                                        idx[n+7 ] = ofky;
                                        idx[n+8 ] = ofkz + di;
                                        idx[n+9 ] = ofkx;
                                        idx[n+10] = ofky + di*2;
                                        idx[n+11] = ofkz;
                                        idx[n+12] = ofkx;
                                        idx[n+13] = ofky + di;
                                        idx[n+14] = ofkz + di;
                                        idx[n+15] = ofkx;
                                        idx[n+16] = ofky;
                                        idx[n+17] = ofkz + di*2;
                                        n += 18;
                                        break;
                                default:
                                        for (i = 0; i < nfi; i++) {
                                                idx[n+0] = ofkx + di * i_nx[i]; //(:,ix,kx,jx,1)
                                                idx[n+1] = ofky + di * i_ny[i]; //(:,iy,ky,jy,2)
                                                idx[n+2] = ofkz + di * i_nz[i]; //(:,iz,kz,jz,3)
                                                n += 3;
                                        } // i
                        }
                } // k
        } // j
}