31
31
** (all six contractions are unique for ROHF and UHF orbitals)
35
** For RHF contractions, we evaluate the contractions as follows:
37
** + L(jb,ME) W(IA,ME) + L(jb,me) W(IA,me) I
38
** + L(jA,Me) W(Ib,Me) + L(Ib,mE) W(jA,mE) II + III
39
** + L(IA,ME) W(jb,ME) + L(IA,me) W(jb,me) IV
41
** Similar to what we did in ccenergy/WmbejT2.c, the AB L2 terms labelled I and IV
42
** above may be written as (apart from index swapping):
44
** 1/2 [2 L(jb,ME) - L(jB,Me)] [2 W(me,IA) + W(Me,Ia)] + 1/2 L(jB,Me) W(Me,Ia)
46
** Terms II and III are exactly the same as the last term above, apart from the
47
** factor of 1/2 and index swapping. So, for RHF orbitals, we need to evaluate two
36
54
void WmbejL2(int L_irr)
38
56
dpdbuf4 newL2, L2, W, Z, Z2;
40
58
/* RHS += P(ij)P(ab)Limae * Wjebm */
41
if(params.ref == 0 || params.ref == 1) { /** RHF/ROHF **/
59
if(params.ref == 0) { /** RHF **/
61
dpd_buf4_init(&Z, CC_TMP0, L_irr, 10, 10, 10, 10, 0, "Z(Ib,jA)");
62
dpd_buf4_init(&W, CC_HBAR, 0, 10, 10, 10, 10, 0, "WMbeJ");
63
dpd_buf4_init(&L2, CC_LAMBDA, L_irr, 10, 10, 10, 10, 0, "LIbjA");
64
dpd_contract444(&W, &L2, &Z, 0, 1, 1, 0);
67
dpd_buf4_sort(&Z, CC_TMP0, psrq, 10, 10, "Z(IA,jb) III");
70
dpd_buf4_init(&Z, CC_TMP0, L_irr, 10, 10, 10, 10, 0, "Z(IA,jb) I");
72
dpd_buf4_init(&W, CC_HBAR, 0, 10, 10, 10, 10, 0, "2 W(ME,jb) + W(Me,Jb)");
73
dpd_buf4_init(&L2, CC_LAMBDA, L_irr, 10, 10, 10, 10, 0, "2 LIAjb - LIbjA");
74
dpd_contract444(&W, &L2, &Z, 0, 1, 0.5, 0);
78
dpd_buf4_init(&Z2, CC_TMP0, L_irr, 10, 10, 10, 10, 0, "Z(Ib,jA)");
79
dpd_buf4_axpy(&Z2, &Z, 0.5);
82
dpd_buf4_init(&Z2, CC_TMP0, L_irr, 10, 10, 10, 10, 0, "Z(IA,jb) III");
83
dpd_buf4_axpy(&Z2, &Z, 1);
86
dpd_buf4_sort_axpy(&Z, CC_LAMBDA, prqs, 0, 5, "New LIjAb", 1);
87
dpd_buf4_sort_axpy(&Z, CC_LAMBDA, rpsq, 0, 5, "New LIjAb", 1);
91
else if(params.ref == 1) { /** ROHF **/
43
93
dpd_buf4_init(&Z, CC_TMP0, L_irr, 10, 10, 10, 10, 0, "Z(IA,JB)");
44
94
dpd_buf4_init(&L2, CC_LAMBDA, L_irr, 10, 10, 10, 10, 0, "LIAJB");