Go to the documentation of this file.
35 template<
typename Matrix>
55 template<
typename Matrix>
58 int bllen,
int blstart,
int blend,
62 static const int isym = 0;
63 int jbl, j, ibl, i, k;
69 for(jbl=0; jbl<bl_cnt; jbl++) {
70 for(j=blocks[jbl][0]; j<blocks[jbl][1]; j++) {
72 for(k=blstart; k<blend; k++)
73 tmp[k] = aos[k+joff]*dR[k]*0.5;
75 for(ibl=0; ibl<bl_cnt; ibl++) {
76 int top = blocks[ibl][1] < j
78 for(i=blocks[ibl][0]; i<top; i++) {
81 for(k=blstart; k<blend; k++)
87 for(k=blstart; k<blend; k++)
88 s += aos[k+j*bllen]*tmp[k];
98 template<
typename Matrix,
typename LDADistributor>
101 int bllen,
int blstart,
int blend,
110 for(k=blstart; k<blend; k++) {
112 dp.
rhoa = dp. rhob = 0.5*grid->
r.
rho[k];
117 LDADistributor::distribute(grid, bllen, blstart, blend, tmp, dR,
125 template<
typename Matrix>
128 int bllen,
int blstart,
int blend,
133 static const int isym = 0;
134 int jbl, j, ibl, i, k;
140 const int (*blocks)[2] =
BASBLOCK(grid,isym);
142 for(jbl=0; jbl<nblocks; jbl++)
143 for(j=blocks[jbl][0]; j<blocks[jbl][1]; j++) {
145 for(k=blstart; k<blend; k++)
147 (dR[k]* aos[k+j*bllen] +
148 dZ[k]*(aox[k+j*bllen]*grid->
g.
rad.a[k][0]+
149 aoy[k+j*bllen]*grid->
g.
rad.a[k][1]+
150 aoz[k+j*bllen]*grid->
g.
rad.a[k][2]));
153 for(jbl=0; jbl<nblocks; jbl++) {
154 for(j=blocks[jbl][0]; j<blocks[jbl][1]; j++) {
155 const real * tmpj = tmp + j*bllen;
156 for(ibl=0; ibl<nblocks; ibl++) {
157 int top = blocks[ibl][1] < j
158 ? blocks[ibl][1] : j;
159 for(i=blocks[ibl][0]; i<top; i++) {
161 const real * tmpi = tmp + i*bllen;
162 for(k=blstart; k<blend; k++)
163 s += aos[k+i*bllen]*tmpj[k] +
164 aos[k+j*bllen]*tmpi[k];
169 for(k=blstart; k<blend; k++)
170 s += 2*aos[k+j*bllen]*tmpj[k];
180 template<
typename Matrix,
typename GGADistributor>
183 int bllen,
int blstart,
int blend,
193 for(k=blstart; k<blend; k++) {
198 dp. rhoa = dp.
rhob = 0.5*grid->
r.
rho[k];
212 GGADistributor::distribute(grid, bllen, blstart, blend, tmp, dR, dZ,
219 template<
typename Matrix>
232 delete []
dRa;
delete []
dRb;
237 template<
typename Matrix>
242 const real *dZ1,
const real (*grad1)[3],
243 const real *dZ2,
const real (*grad2)[3],
247 template<
typename Matrix>
250 int bllen,
int blstart,
int blend,
253 const real (*grad1)[3],
255 const real (*grad2)[3],
258 int isym, jbl, j, ibl, i, k;
264 for(isym=0; isym<grid->
nsym; isym++) {
267 for(jbl=0; jbl<nblocks; jbl++)
268 for(j=blocks[jbl][0]; j<blocks[jbl][1]; j++) {
270 for(k=blstart; k<blend; k++)
272 dR[k]* aos[k+j*bllen] +
273 dZ1[k]*(aox[k+j*bllen]*grad1[k][0]+
274 aoy[k+j*bllen]*grad1[k][1]+
275 aoz[k+j*bllen]*grad1[k][2])+
276 dZ2[k]*(aox[k+j*bllen]*grad2[k][0]+
277 aoy[k+j*bllen]*grad2[k][1]+
278 aoz[k+j*bllen]*grad2[k][2]);
281 for(jbl=0; jbl<nblocks; jbl++) {
282 for(j=blocks[jbl][0]; j<blocks[jbl][1]; j++) {
284 for(ibl=0; ibl<nblocks; ibl++) {
286 #if defined(FULL_ONLY)
287 for(i=blocks[ibl][0]; i<blocks[ibl][1]; i++) {
289 for(k=blstart; k<blend; k++)
290 s += aos[k+i*bllen]*tmpj[k];
294 int top = blocks[ibl][1] < j
295 ? blocks[ibl][1] : j;
296 for(i=blocks[ibl][0]; i<top; i++) {
298 const real * tmpi = tmp + i*bllen;
299 for(k=blstart; k<blend; k++)
300 s += aos[k+i*bllen]*tmpj[k] +
301 aos[k+j*bllen]*tmpi[k];
306 #if !defined(FULL_ONLY)
308 for(k=blstart; k<blend; k++)
309 s += 2*aos[k+j*bllen]*tmpj[k];
320 template<
typename Matrix,
typename LDADistributor>
323 int bllen,
int blstart,
int blend,
331 for(k=blstart; k<blend; k++) {
342 LDADistributor::distribute(grid, bllen, blstart, blend,
344 LDADistributor::distribute(grid, bllen, blstart, blend,
351 template<
typename Matrix,
typename GGADistributor>
354 int bllen,
int blstart,
int blend,
362 for(k=blstart; k<blend; k++) {
368 grid->
g.
rad.a[k][1]*grid->
g.
rad.a[k][1]+
369 grid->
g.
rad.a[k][2]*grid->
g.
rad.a[k][2]);
371 grid->
g.
rad.b[k][1]*grid->
g.
rad.b[k][1]+
372 grid->
g.
rad.b[k][2]*grid->
g.
rad.b[k][2]);
374 grid->
g.
rad.a[k][1]*grid->
g.
rad.b[k][1]+
375 grid->
g.
rad.a[k][2]*grid->
g.
rad.b[k][2];
394 GGADistributor::distribute(grid, bllen, blstart, blend, tmp, d->
dRa,
397 GGADistributor::distribute(grid, bllen, blstart, blend, tmp, d->
dRb,
Treal template_blas_sqrt(Treal x)
int bas_bl_cnt[8]
Definition: integrator.h:58
#define BASBLOCK(grid, isym)
Definition: integrator.h:61
Definition: functionals.h:375
real fZ
Definition: dft_common.h:62
Matrix * exca
Definition: xc_evaluators.h:221
distributes a LDA-type xc potential over the XC-matrix elements, with optimization for a closed shell...
Definition: xc_evaluators.h:56
void xcCallbackLdaU(DftIntegratorBl *grid, real *restrict tmp, int bllen, int blstart, int blend, UksData< Matrix > *d)
modifies data->excmat by adding LDA-type xc contributions, for a general unrestricted case.
Definition: xc_evaluators.h:322
real(* grad)[3]
Definition: integrator.h:82
#define restrict
Definition: config.h:283
static void xcCallbackGgaU(DftIntegratorBl *grid, real *restrict tmp, int bllen, int blstart, int blend, UksData< Matrix > *d)
modifes data->excmat by adding GGA-type xc contributions, for a general unrestricted case.
Definition: xc_evaluators.h:353
FirstOrderFun first
Definition: functionals.h:410
structure describing the data needed by distributors.
Definition: xc_evaluators.h:36
struct DftIntegratorBl_::@0::@2 ho
real rhoa
Definition: functionals.h:376
EXTERN_C void dftpot0_(FirstDrv *ds, const real *weight, const FunDensProp *dp)
Definition: dft_common.cc:766
real * dR
Definition: xc_evaluators.h:38
Definition: xc_evaluators.h:220
real energy
Definition: xc_evaluators.h:224
real df00001
Definition: functionals.h:124
EnergyFunc func
Definition: functionals.h:409
void drv1_clear(FunFirstFuncDrv *gga)
Definition: functionals.c:131
ergo_real real
Definition: test.cc:46
Matrix * excb
Definition: xc_evaluators.h:221
distributes a GGA-type xc potential over the XC-matrix elements.
Definition: xc_evaluators.h:126
A vector of first order derivatives with respect to two parameters: density rho and SQUARE of the gra...
Definition: dft_common.h:60
Definition: integrator.h:49
int curr_point
Definition: integrator.h:89
real * weight
Definition: integrator.h:52
real * dRb
Definition: xc_evaluators.h:222
real energy
Definition: xc_evaluators.h:40
union DftIntegratorBl_::@1 g
UksData(Matrix *a_, Matrix *b_, size_t s)
Definition: xc_evaluators.h:225
int ntypso
Definition: integrator.h:63
real * dRa
Definition: xc_evaluators.h:222
real rhob
Definition: functionals.h:376
union DftIntegratorBl_::@0 r
static void distribute(DftIntegratorBl *grid, int bllen, int blstart, int blend, real *restrict tmp, const real *dR, const real *dZ, Matrix &excmat)
Definition: xc_evaluators.h:127
real * dZb
Definition: xc_evaluators.h:223
~UksData()
Definition: xc_evaluators.h:231
struct DftIntegratorBl_::@1::@3 rad
real * dZab
Definition: xc_evaluators.h:223
real * dZa
Definition: xc_evaluators.h:223
Definition: functionals.h:119
Matrix * excmat
Definition: xc_evaluators.h:37
~KsData()
Definition: xc_evaluators.h:44
ergo_long_real long_real
Definition: grid_atomic.h:43
static void distribute(DftIntegratorBl *grid, int bllen, int blstart, int blend, real *restrict tmp, const real *dR, const real *dZ1, const real(*grad1)[3], const real *dZ2, const real(*grad2)[3], Matrix &excmat)
Definition: xc_evaluators.h:249
int nbast
Definition: integrator.h:72
Functional * selected_func
Definition: functionals.c:106
real * rho
Definition: integrator.h:76
real * atv
Definition: integrator.h:53
real gradab
Definition: functionals.h:378
Definition: xc_evaluators.h:238
real fR
Definition: dft_common.h:61
static void distribute(DftIntegratorBl *grid, int bllen, int blstart, int blend, real *restrict tmp, real *restrict dR, Matrix &excmat)
Definition: xc_evaluators.h:57
real grada
Definition: functionals.h:377
real df1000
Definition: functionals.h:120
#define THR
Definition: fun-cam.c:75
real gradb
Definition: functionals.h:377
void xcCallbackLdaR(DftIntegratorBl *grid, real *restrict tmp, int bllen, int blstart, int blend, KsData< Matrix > *data)
modifies data->excmat by adding LDA-type contributions from a given set of bllen grid points as saved...
Definition: xc_evaluators.h:100
KsData(Matrix *m_, size_t s)
Definition: xc_evaluators.h:41
int nsym
Definition: integrator.h:58
real df0100
Definition: functionals.h:121
real * dZ
Definition: xc_evaluators.h:39
real df0001
Definition: functionals.h:123
void xcCallbackGgaR(DftIntegratorBl *grid, real *restrict tmp, int bllen, int blstart, int blend, KsData< Matrix > *data)
modifies data->excmat by adding GGA-type contributions from a given set of bllen grid points as saved...
Definition: xc_evaluators.h:182
real df0010
Definition: functionals.h:122