3
#include <libciomr/libciomr.h>
11
extern unsigned char ***Occs;
13
extern void b2brepl(unsigned char **occs, int *Jcnt, int **Jij, int **Joij,
14
int **Jridx, signed char **Jsgn, struct olsen_graph *Graph,
15
int Ilist, int Jlist, int len);
16
void s2_block_vfci_pthread(void *threadarg);
17
void s2_block_vras_pthread(void *threadarg);
19
#define INDEX(i,j) ((i>j) ? (ioff[(i)]+(j)) : (ioff[(j)]+(i)))
24
** Calculate the sigma_2 vector as described by
25
** equation (20) of RAS Paper (Olsen, Roos, Jorgensen, Aa. Jensen JCP 1988)
27
** This sigma1 routine is for Full CI's only, assumes (ij|ij)'s have not
28
** been halved, and attempts to follow Olsen's vectorized algorithm more
29
** closely than previous versions, using sparsity of F.
31
** David Sherrill, 18 April 1996
32
** Based on many previous versions by David Sherrill 1994-5
34
void s2_block_vfci(struct stringwr **alplist, struct stringwr **betlist,
35
double **C, double **S, double *oei, double *tei, double *F,
36
int nlists, int nas, int nbs, int Ia_list, int Ja_list,
39
struct stringwr *Ia, *Ka;
40
unsigned int Ia_idx, Ib_idx, Ka_idx, Ja_idx;
41
unsigned int Iacnt, Kacnt, Ka_list, Ia_ex, Ka_ex;
42
unsigned int *Iaridx, *Karidx;
44
signed char *Iasgn, *Kasgn;
46
double Ka_sgn, Ja_sgn;
52
for (Ia=alplist[Ia_list], Ia_idx=0; Ia_idx < nas; Ia_idx++, Ia++) {
55
zero_arr(F, Ja_list_nas);
57
/* loop over excitations E^a_{kl} from |A(I_a)> */
58
for (Ka_list=0; Ka_list < nlists; Ka_list++) {
59
Iacnt = Ia->cnt[Ka_list];
60
Iaridx = Ia->ridx[Ka_list];
61
Iasgn = Ia->sgn[Ka_list];
62
Iaij = Ia->ij[Ka_list];
63
for (Ia_ex=0; Ia_ex < Iacnt; Ia_ex++) {
66
Ka_sgn = (double) *Iasgn++;
68
/* A(K_a) = sgn(kl) * E^a_{kl} |A(I_a)> */
69
Ka = alplist[Ka_list] + Ka_idx;
70
if (Ka_list == Ja_list) F[Ka_idx] += Ka_sgn * oei[kl];
72
/* loop over excitations E^a_{ij} from |A(K_a)> */
73
/* Ja_list pre-determined because of C blocking */
74
Kacnt = Ka->cnt[Ja_list];
75
Karidx = Ka->ridx[Ja_list];
76
Kasgn = Ka->sgn[Ja_list];
77
Kaij = Ka->ij[Ja_list];
78
for (Ka_ex=0; Ka_ex < Kacnt; Ka_ex++) {
80
Ja_sgn = (double) *Kasgn++;
83
F[Ja_idx] += 0.5 * Ka_sgn * Ja_sgn * tei[ijkl] ;
85
} /* end loop over Ia excitations */
86
} /* end loop over Ka_list */
90
for (Ib_idx=0; Ib_idx < nbs; Ib_idx++) {
92
for (Ja_idx=0; Ja_idx < Ja_list_nas; Ja_idx++) {
93
tval += C[Ja_idx][Ib_idx] * F[Ja_idx];
95
S[Ia_idx][Ib_idx] += tval;
99
for (Ja_idx=0; Ja_idx < Ja_list_nas; Ja_idx++) {
100
if ((tval=F[Ja_idx]) == 0.0) continue;
104
C_DAXPY(nbs, tval, Cptr, 1, Sptr, 1);
106
for (Ib_idx=0; Ib_idx < nbs; Ib_idx++) {
107
Sptr[Ib_idx] += tval * Cptr[Ib_idx];
112
} /* end loop over Ia */
118
** S2_BLOCK_VFCI_THREAD()
120
** Calculate the sigma_2 vector as described by
121
** equation (20) of RAS Paper (Olsen, Roos, Jorgensen, Aa. Jensen JCP 1988)
123
** This sigma1 routine is for Full CI's only, assumes (ij|ij)'s have not
124
** been halved, and attempts to follow Olsen's vectorized algorithm more
125
** closely than previous versions, using sparsity of F.
127
** David Sherrill, 18 April 1996
128
** Based on many previous versions by David Sherrill 1994-5
130
void s2_block_vfci_thread(struct stringwr **alplist, struct stringwr **betlist,
131
double **C, double **S, double *oei, double *tei, double *F,
132
int nlists, int nas, int nbs, int Ia_list, int Ja_list,
135
struct stringwr *Ia, *Ka;
136
unsigned int Ia_idx, Ib_idx, Ka_idx, Ja_idx;
137
unsigned int Iacnt, Kacnt, Ka_list, Ia_ex, Ka_ex;
138
unsigned int *Iaridx, *Karidx;
140
signed char *Iasgn, *Kasgn;
142
double Ka_sgn, Ja_sgn;
145
struct pthreads_s2vfci **thread_info;
148
thread_info = (struct pthreads_s2vfci **)
149
malloc(sizeof(struct pthreads_s2vfci *) * nas);
150
for (i=0; i<nas; i++) {
151
thread_info[i] = (struct pthreads_s2vfci *)
152
malloc(sizeof(struct pthreads_s2vfci));
155
tpool_queue_open(thread_pool);
157
detci_time.s2_mt_before_time = wall_time_new();
159
for (Ia=alplist[Ia_list], Ia_idx=0; Ia_idx < nas; Ia_idx++, Ia++) {
160
thread_info[Ia_idx]->alplist=alplist;
161
thread_info[Ia_idx]->betlist=betlist;
162
thread_info[Ia_idx]->C=C;
163
thread_info[Ia_idx]->S=S;
164
thread_info[Ia_idx]->oei=oei;
165
thread_info[Ia_idx]->tei=tei;
166
thread_info[Ia_idx]->nlists=nlists;
167
thread_info[Ia_idx]->nas=nas;
168
thread_info[Ia_idx]->nbs=nbs;
169
thread_info[Ia_idx]->Ia_list=Ia_list;
170
thread_info[Ia_idx]->Ja_list=Ja_list;
171
thread_info[Ia_idx]->Ja_list_nas=Ja_list_nas;
172
thread_info[Ia_idx]->Ia=Ia;
173
thread_info[Ia_idx]->Ia_idx=Ia_idx;
174
tpool_add_work(thread_pool, s2_block_vfci_pthread, (void *) thread_info[Ia_idx]);
175
} /* end loop over Ia */
176
tpool_queue_close(thread_pool, 1);
178
detci_time.s2_mt_after_time = wall_time_new();
179
detci_time.s2_mt_total_time += detci_time.s2_mt_after_time - detci_time.s2_mt_before_time;
181
for (i=0; i<nas; i++) free(thread_info[i]);
186
** S2_BLOCK_VFCI_PTHREAD()
188
** Calculate the sigma_2 vector as described by
189
** equation (20) of RAS Paper (Olsen, Roos, Jorgensen, Aa. Jensen JCP 1988)
191
** This sigma1 routine is for Full CI's only, assumes (ij|ij)'s have not
192
** been halved, and attempts to follow Olsen's vectorized algorithm more
193
** closely than previous versions, using sparsity of F.
195
** David Sherrill, 18 April 1996
196
** Based on many previous versions by David Sherrill 1994-5
198
void s2_block_vfci_pthread(void *threadarg)
200
struct stringwr *Ia, *Ka, **alplist, **betlist;
201
unsigned int Ia_idx, Ib_idx, Ka_idx, Ja_idx;
202
unsigned int Iacnt, Kacnt, Ka_list, Ia_ex, Ka_ex;
203
unsigned int *Iaridx, *Karidx;
205
signed char *Iasgn, *Kasgn;
207
double Ka_sgn, Ja_sgn;
209
double *Sptr, *Cptr, *oei, *tei;
211
struct pthreads_s2vfci *thread_info;
212
int nlists, nas, nbs, Ia_list, Ja_list, Ja_list_nas;
214
thread_info = (struct pthreads_s2vfci *) threadarg;
215
alplist = thread_info->alplist;
216
betlist = thread_info->betlist;
219
oei = thread_info->oei;
220
tei = thread_info->tei;
221
nlists = thread_info->nlists;
222
nas = thread_info->nas;
223
nbs = thread_info->nbs;
224
Ia_list = thread_info->Ia_list;
225
Ja_list = thread_info->Ja_list;
226
Ja_list_nas = thread_info->Ja_list_nas;
227
Ia = thread_info->Ia;
228
Ia_idx = thread_info->Ia_idx;
230
F = init_array(Ja_list_nas);
232
zero_arr(F, Ja_list_nas);
234
/* loop over excitations E^a_{kl} from |A(I_a)> */
235
for (Ka_list=0; Ka_list < nlists; Ka_list++) {
236
Iacnt = Ia->cnt[Ka_list];
237
Iaridx = Ia->ridx[Ka_list];
238
Iasgn = Ia->sgn[Ka_list];
239
Iaij = Ia->ij[Ka_list];
240
for (Ia_ex=0; Ia_ex < Iacnt; Ia_ex++) {
243
Ka_sgn = (double) *Iasgn++;
245
/* A(K_a) = sgn(kl) * E^a_{kl} |A(I_a)> */
246
Ka = alplist[Ka_list] + Ka_idx;
247
if (Ka_list == Ja_list) F[Ka_idx] += Ka_sgn * oei[kl];
249
/* loop over excitations E^a_{ij} from |A(K_a)> */
250
/* Ja_list pre-determined because of C blocking */
251
Kacnt = Ka->cnt[Ja_list];
252
Karidx = Ka->ridx[Ja_list];
253
Kasgn = Ka->sgn[Ja_list];
254
Kaij = Ka->ij[Ja_list];
255
for (Ka_ex=0; Ka_ex < Kacnt; Ka_ex++) {
257
Ja_sgn = (double) *Kasgn++;
260
F[Ja_idx] += 0.5 * Ka_sgn * Ja_sgn * tei[ijkl] ;
262
} /* end loop over Ia excitations */
263
} /* end loop over Ka_list */
267
for (Ib_idx=0; Ib_idx < nbs; Ib_idx++) {
269
for (Ja_idx=0; Ja_idx < Ja_list_nas; Ja_idx++) {
270
tval += C[Ja_idx][Ib_idx] * F[Ja_idx];
272
S[Ia_idx][Ib_idx] += tval;
276
for (Ja_idx=0; Ja_idx < Ja_list_nas; Ja_idx++) {
277
if ((tval=F[Ja_idx]) == 0.0) continue;
281
C_DAXPY(nbs, tval, Cptr, 1, Sptr, 1);
283
for (Ib_idx=0; Ib_idx < nbs; Ib_idx++) {
284
Sptr[Ib_idx] += tval * Cptr[Ib_idx];
294
** Calculate the sigma_2 vector as described by
295
** equation (20) of RAS Paper (Olsen, Roos, Jorgensen, Aa. Jensen JCP 1988)
297
** This sigma2 routine is for RAS CI's.
298
** currently assumes that (ij|ij)'s have not been halved!!
300
** David Sherrill, 10 May 1996
301
** Based on previous code by David Sherrill, 1994-5
303
** Updated 3/27/94 to include g matrix for RAS
304
** Modified 4/8/94 to make C and s one-dimensional
305
** Modified 4/10/94 to make FCI-only (for now) and use new string structs
306
** Modified 6/21/95 for use in new RAS program
307
** Obtained 7/22/95 from s1 routine by changing a's to b's and vice versa
308
** Modified 5/10/96 for more vectorized approach
310
void s2_block_vras(struct stringwr **alplist, struct stringwr **betlist,
311
double **C, double **S, double *oei, double *tei, double *F,
312
int nlists, int nas, int nbs, int Ia_list, int Ja_list,
315
struct stringwr *Ia, *Ka;
316
unsigned int Ia_idx, Ib_idx, Ka_idx, Ja_idx;
317
unsigned int Iacnt, Kacnt, Ka_list, Ia_ex, Ka_ex;
318
unsigned int *Iaridx, *Karidx;
319
int nirreps, *Iaij, *Kaij, *Iaoij, *Kaoij;
320
signed char *Iasgn, *Kasgn;
321
int ij,kl,ijkl,oij,okl;
322
double Ka_sgn, Ja_sgn;
326
nirreps = CalcInfo.nirreps;
329
for (Ia=alplist[Ia_list], Ia_idx=0; Ia_idx < nas; Ia_idx++, Ia++) {
332
zero_arr(F, Ja_list_nas);
334
/* loop over excitations E^a_{kl} from |A(I_a)> */
335
for (Ka_list=0; Ka_list < nlists; Ka_list++) {
336
Iacnt = Ia->cnt[Ka_list];
337
Iaridx = Ia->ridx[Ka_list];
338
Iasgn = Ia->sgn[Ka_list];
339
Iaij = Ia->ij[Ka_list];
340
Iaoij = Ia->oij[Ka_list];
341
for (Ia_ex=0; Ia_ex < Iacnt; Ia_ex++) {
345
Ka_sgn = (double) *Iasgn++;
347
/* A(K_a) = sgn(kl) * E^a_{kl} |A(I_a)> */
348
Ka = alplist[Ka_list] + Ka_idx;
349
/* note okl on next line, not kl */
350
if (Ka_list == Ja_list) F[Ka_idx] += Ka_sgn * oei[okl];
352
/* loop over excitations E^a_{ij} from |A(K_a)> */
353
/* Ja_list pre-determined because of C blocking */
354
Kacnt = Ka->cnt[Ja_list];
355
Karidx = Ka->ridx[Ja_list];
356
Kasgn = Ka->sgn[Ja_list];
357
Kaij = Ka->ij[Ja_list];
358
Kaoij = Ka->oij[Ja_list];
359
for (Ka_ex=0; Ka_ex < Kacnt; Ka_ex++) {
361
Ja_sgn = (double) *Kasgn++;
366
F[Ja_idx] += Ka_sgn * Ja_sgn * tei[ijkl] ;
368
F[Ja_idx] += 0.5 * Ka_sgn * Ja_sgn * tei[ijkl] ;
370
} /* end loop over Ia excitations */
371
} /* end loop over Ka_list */
374
for (Ib_idx=0; Ib_idx < nbs; Ib_idx++) {
376
for (Ja_idx=0; Ja_idx < Ja_list_nas; Ja_idx++) {
377
tval += C[Ja_idx][Ib_idx] * F[Ja_idx];
379
S[Ia_idx][Ib_idx] += tval;
383
for (Ja_idx=0; Ja_idx < Ja_list_nas; Ja_idx++) {
384
if ((tval=F[Ja_idx]) == 0.0) continue;
387
C_DAXPY(nbs, tval, Cptr, 1, Sptr, 1);
389
for (Ib_idx=0; Ib_idx < nbs; Ib_idx++) {
390
Sptr[Ib_idx] += tval * Cptr[Ib_idx];
395
} /* end loop over Ia */
401
** S2_BLOCK_VRAS_THREAD()
403
** Calculate the sigma_2 vector as described by
404
** equation (20) of RAS Paper (Olsen, Roos, Jorgensen, Aa. Jensen JCP 1988)
406
** This sigma2 routine is for RAS CI's.
407
** currently assumes that (ij|ij)'s have not been halved!!
409
** David Sherrill, 10 May 1996
410
** Based on previous code by David Sherrill, 1994-5
412
** Updated 3/27/94 to include g matrix for RAS
413
** Modified 4/8/94 to make C and s one-dimensional
414
** Modified 4/10/94 to make FCI-only (for now) and use new string structs
415
** Modified 6/21/95 for use in new RAS program
416
** Obtained 7/22/95 from s1 routine by changing a's to b's and vice versa
417
** Modified 5/10/96 for more vectorized approach
419
void s2_block_vras_thread(struct stringwr **alplist, struct stringwr **betlist,
420
double **C, double **S, double *oei, double *tei, double *F,
421
int nlists, int nas, int nbs, int Ia_list, int Ja_list,
426
struct pthreads_s2vfci **thread_info;
429
thread_info = (struct pthreads_s2vfci **)
430
malloc(sizeof(struct pthreads_s2vfci *) * nas);
431
for (i=0; i<nas; i++) {
432
thread_info[i] = (struct pthreads_s2vfci *)
433
malloc(sizeof(struct pthreads_s2vfci));
436
tpool_queue_open(thread_pool);
437
detci_time.s2_mt_before_time = wall_time_new();
441
for (Ia=alplist[Ia_list], Ia_idx=0; Ia_idx < nas; Ia_idx++, Ia++) {
442
thread_info[Ia_idx]->alplist=alplist;
443
thread_info[Ia_idx]->betlist=betlist;
444
thread_info[Ia_idx]->C=C;
445
thread_info[Ia_idx]->S=S;
446
thread_info[Ia_idx]->oei=oei;
447
thread_info[Ia_idx]->tei=tei;
448
thread_info[Ia_idx]->nlists=nlists;
449
thread_info[Ia_idx]->nas=nas;
450
thread_info[Ia_idx]->nbs=nbs;
451
thread_info[Ia_idx]->Ia_list=Ia_list;
452
thread_info[Ia_idx]->Ja_list=Ja_list;
453
thread_info[Ia_idx]->Ja_list_nas=Ja_list_nas;
454
thread_info[Ia_idx]->Ia=Ia;
455
thread_info[Ia_idx]->Ia_idx=Ia_idx;
456
tpool_add_work(thread_pool, s2_block_vras_pthread, (void *) thread_info[Ia_idx]);
457
} /* end loop over Ia */
459
tpool_queue_close(thread_pool, 1);
460
detci_time.s2_mt_after_time = wall_time_new();
461
detci_time.s2_mt_total_time += detci_time.s2_mt_after_time - detci_time.s2_mt_before_time;
464
for (i=0; i<nas; i++) free(thread_info[i]);
470
** S2_BLOCK_VRAS_PTHREAD()
472
** Calculate the sigma_2 vector as described by
473
** equation (20) of RAS Paper (Olsen, Roos, Jorgensen, Aa. Jensen JCP 1988)
475
** This sigma2 routine is for RAS CI's.
476
** currently assumes that (ij|ij)'s have not been halved!!
478
** David Sherrill, 10 May 1996
479
** Based on previous code by David Sherrill, 1994-5
481
** Updated 3/27/94 to include g matrix for RAS
482
** Modified 4/8/94 to make C and s one-dimensional
483
** Modified 4/10/94 to make FCI-only (for now) and use new string structs
484
** Modified 6/21/95 for use in new RAS program
485
** Obtained 7/22/95 from s1 routine by changing a's to b's and vice versa
486
** Modified 5/10/96 for more vectorized approach
488
void s2_block_vras_pthread(void *threadarg)
490
struct stringwr *Ia, *Ka, **alplist, **betlist;
491
unsigned int Ia_idx, Ib_idx, Ka_idx, Ja_idx;
492
unsigned int Iacnt, Kacnt, Ka_list, Ia_ex, Ka_ex;
493
unsigned int *Iaridx, *Karidx;
494
int nirreps, *Iaij, *Kaij, *Iaoij, *Kaoij;
495
signed char *Iasgn, *Kasgn;
496
int ij,kl,ijkl,oij,okl;
497
double Ka_sgn, Ja_sgn;
499
double *Sptr, *Cptr, *oei, *tei, **C, **S, *F;
500
struct pthreads_s2vfci *thread_info;
501
int nlists, nas, nbs, Ia_list, Ja_list, Ja_list_nas;
503
thread_info = (struct pthreads_s2vfci *) threadarg;
504
alplist = thread_info->alplist;
505
betlist = thread_info->betlist;
508
oei = thread_info->oei;
509
tei = thread_info->tei;
510
nlists = thread_info->nlists;
511
nas = thread_info->nas;
512
nbs = thread_info->nbs;
513
Ia_list = thread_info->Ia_list;
514
Ja_list = thread_info->Ja_list;
515
Ja_list_nas = thread_info->Ja_list_nas;
516
Ia = thread_info->Ia;
517
Ia_idx = thread_info->Ia_idx;
519
F = init_array(Ja_list_nas);
521
zero_arr(F, Ja_list_nas);
523
nirreps = CalcInfo.nirreps;
525
/* loop over excitations E^a_{kl} from |A(I_a)> */
526
for (Ka_list=0; Ka_list < nlists; Ka_list++) {
527
Iacnt = Ia->cnt[Ka_list];
528
Iaridx = Ia->ridx[Ka_list];
529
Iasgn = Ia->sgn[Ka_list];
530
Iaij = Ia->ij[Ka_list];
531
Iaoij = Ia->oij[Ka_list];
532
for (Ia_ex=0; Ia_ex < Iacnt; Ia_ex++) {
536
Ka_sgn = (double) *Iasgn++;
538
/* A(K_a) = sgn(kl) * E^a_{kl} |A(I_a)> */
539
Ka = alplist[Ka_list] + Ka_idx;
540
/* note okl on next line, not kl */
541
if (Ka_list == Ja_list) F[Ka_idx] += Ka_sgn * oei[okl];
543
/* loop over excitations E^a_{ij} from |A(K_a)> */
544
/* Ja_list pre-determined because of C blocking */
545
Kacnt = Ka->cnt[Ja_list];
546
Karidx = Ka->ridx[Ja_list];
547
Kasgn = Ka->sgn[Ja_list];
548
Kaij = Ka->ij[Ja_list];
549
Kaoij = Ka->oij[Ja_list];
550
for (Ka_ex=0; Ka_ex < Kacnt; Ka_ex++) {
552
Ja_sgn = (double) *Kasgn++;
557
F[Ja_idx] += Ka_sgn * Ja_sgn * tei[ijkl] ;
559
F[Ja_idx] += 0.5 * Ka_sgn * Ja_sgn * tei[ijkl] ;
561
} /* end loop over Ia excitations */
562
} /* end loop over Ka_list */
565
for (Ib_idx=0; Ib_idx < nbs; Ib_idx++) {
567
for (Ja_idx=0; Ja_idx < Ja_list_nas; Ja_idx++) {
568
tval += C[Ja_idx][Ib_idx] * F[Ja_idx];
570
S[Ia_idx][Ib_idx] += tval;
574
for (Ja_idx=0; Ja_idx < Ja_list_nas; Ja_idx++) {
575
if ((tval=F[Ja_idx]) == 0.0) continue;
578
C_DAXPY(nbs, tval, Cptr, 1, Sptr, 1);
580
for (Ib_idx=0; Ib_idx < nbs; Ib_idx++) {
581
Sptr[Ib_idx] += tval * Cptr[Ib_idx];
590
** S2_BLOCK_VRAS_ROTF()
592
** s2_block_vras_rotf(): Calculate the sigma_2 vector as described by
593
** equation (20) of RAS Paper (Olsen, Roos, Jorgensen, Aa. Jensen JCP 1988)
595
** String replacements on-the-fly version
596
** currently assumes that (ij|ij)'s have not been halved!!
598
** This sigma2 routine is for RAS CI's.
600
** David Sherrill, 13 May 1996
601
** Based on previous code by David Sherrill, 1994-5
603
** Updated 3/27/94 to include g matrix for RAS
604
** Modified 4/8/94 to make C and s one-dimensional
605
** Modified 4/10/94 to make FCI-only (for now) and use new string structs
606
** Modified 6/21/95 for use in new RAS program
607
** Obtained 7/22/95 from s1 routine by changing a's to b's and vice versa
608
** Modified 5/13/96 for new sparse-F vectorized version
611
void s2_block_vras_rotf(int *Cnt[2], int **Ij[2], int **Oij[2],
612
int **Ridx[2], signed char **Sgn[2], unsigned char **Toccs,
613
double **C, double **S,
614
double *oei, double *tei, double *F, int nlists, int nas, int nbs,
615
int Ia_list, int Ja_list, int Ja_list_nas)
617
int Ia_idx, Ib_idx, Ka_idx, Ja_idx;
618
int Iacnt, Kacnt, Ka_list, Ia_ex, Ka_ex;
619
int *Iaridx, *Karidx;
620
int nirreps, *Iaij, *Kaij, *Iaoij, *Kaoij;
621
signed char *Iasgn, *Kasgn;
622
int i,ij,kl,ijkl,oij,okl;
623
double Ka_sgn, Ja_sgn;
624
double tval, *Cptr, *Sptr;
626
nirreps = CalcInfo.nirreps;
628
for (Ka_list=0; Ka_list < nlists; Ka_list++) {
629
b2brepl(Occs[Ia_list], Cnt[0], Ij[0], Oij[0], Ridx[0],
630
Sgn[0], BetaG, Ia_list, Ka_list, nas);
633
for (Ia_idx=0; Ia_idx < nas; Ia_idx++) {
635
if ((Iacnt = Cnt[0][Ia_idx]) < 0) continue;
637
zero_arr(F, Ja_list_nas);
639
/* loop over excitations E^a_{kl} from |A(I_a)> */
640
Iaridx = Ridx[0][Ia_idx];
641
Iasgn = Sgn[0][Ia_idx];
642
Iaij = Ij[0][Ia_idx];
643
Iaoij = Oij[0][Ia_idx];
645
for (i=0; i<Iacnt; i++)
646
Toccs[i] = Occs[Ka_list][Iaridx[i]];
648
b2brepl(Toccs, Cnt[1], Ij[1], Oij[1], Ridx[1], Sgn[1],
649
AlphaG, Ka_list, Ja_list, Iacnt);
651
for (Ia_ex=0; Ia_ex < Iacnt; Ia_ex++) {
655
Ka_sgn = (double) *Iasgn++;
657
/* A(K_a) = sgn(kl) * E^a_{kl} |A(I_a)> */
658
/* note okl on next line, not kl */
659
if (Ka_list == Ja_list) F[Ka_idx] += Ka_sgn * oei[okl];
661
/* loop over excitations E^a_{ij} from |A(K_a)> */
662
/* Ja_list pre-determined because of C blocking */
663
Kacnt = Cnt[1][Ia_ex];
664
Karidx = Ridx[1][Ia_ex];
665
Kasgn = Sgn[1][Ia_ex];
667
Kaoij = Oij[1][Ia_ex];
668
for (Ka_ex=0; Ka_ex < Kacnt; Ka_ex++) {
670
Ja_sgn = (double) *Kasgn++;
675
F[Ja_idx] += Ka_sgn * Ja_sgn * tei[ijkl] ;
677
F[Ja_idx] += 0.5 * Ka_sgn * Ja_sgn * tei[ijkl] ;
679
} /* end loop over Ia excitations */
682
for (Ib_idx=0; Ib_idx < nbs; Ib_idx++) {
684
for (Ja_idx=0; Ja_idx < Ja_list_nas; Ja_idx++) {
685
tval += C[Ja_idx][Ib_idx] * F[Ja_idx];
687
S[Ia_idx][Ib_idx] += tval;
691
for (Ja_idx=0; Ja_idx < Ja_list_nas; Ja_idx++) {
692
if ((tval=F[Ja_idx]) == 0.0) continue;
694
for (Ib_idx=0; Ib_idx < nbs; Ib_idx++) {
695
Sptr[Ib_idx] += tval * Cptr[Ib_idx];
699
} /* end loop over Ia */
700
} /* end loop over Ka_list */