@@ -31,6 +31,8 @@ def update_t1(cc, t1, t2, eris):
31
31
Lov = eris .Lov
32
32
Lvv = eris .Lvv
33
33
34
+ eia = mo_e_o [:,None ] - mo_e_v
35
+
34
36
# T1 equation
35
37
t1new = - 2 * np .einsum ('kc,ka,ic->ia' , fov , t1 , t1 )
36
38
t1new += np .einsum ('ac,ic->ia' , Fvv , t1 )
@@ -50,7 +52,6 @@ def update_t1(cc, t1, t2, eris):
50
52
t1new += - 2 * lib .einsum ('Llc,Lki,lc,ka->ia' , Lov , Loo , t1 , t1 )
51
53
t1new += lib .einsum ('Lkc,Lli,lc,ka->ia' , Lov , Loo , t1 , t1 )
52
54
53
- eia = mo_e_o [:,None ] - mo_e_v
54
55
t1new /= eia
55
56
56
57
return t1new
@@ -112,9 +113,40 @@ def update_t2(cc, t1, t2, eris):
112
113
113
114
return t2new
114
115
116
+ def make_t2 (cc , t1 , eris ):
117
+ nocc = eris .nocc
118
+ nmo = eris .fock .shape [0 ]
119
+ nvir = nmo - nocc
120
+ naux = cc ._scf .with_df .get_naoaux ()
121
+ mo_e_o = eris .mo_energy [:nocc ]
122
+ mo_e_v = eris .mo_energy [nocc :] + cc .level_shift
123
+ eia = mo_e_o [:,None ] - mo_e_v
124
+ eijab = lib .direct_sum ('ia,jb->ijab' ,eia ,eia )
125
+ C = eris .mo_coeff .copy ()
126
+ X = C [:, nocc :] - lib .einsum ('ui,ia->ua' , C [:, :nocc ], t1 )
127
+ Y = C [:, :nocc ] + lib .einsum ('ua,ia->ui' , C [:, nocc :], t1 )
128
+ C [:, :nocc ] = Y
129
+ C [:, nocc :] = X
130
+ Lov = np .empty ((naux ,nocc ,nvir ))
131
+ ijslice = (0 , nmo , 0 , nmo )
132
+ Lpq = None
133
+ p1 = 0
134
+ for eri1 in cc ._scf .with_df .loop ():
135
+ Lpq = _ao2mo .nr_e2 (eri1 , C , ijslice , aosym = 's2' , out = Lpq ).reshape (- 1 ,nmo ,nmo )
136
+ p0 , p1 = p1 , p1 + Lpq .shape [0 ]
137
+ Lov [p0 :p1 ] = Lpq [:,:nocc ,nocc :]
138
+ t2 = lib .einsum ('Lia,Ljb->ijab' , Lov , Lov )
139
+ t2 /= eijab
140
+ return t2
141
+
115
142
def update_amps (cc , t1 , t2 , eris ):
143
+ t2 = make_t2 (cc , t1 , eris )
116
144
t1new = update_t1 (cc , t1 , t2 , eris )
117
- t2new = update_t2 (cc , t1 , t2 , eris )
145
+ t2new = make_t2 (cc , t1new , eris )
146
+ # Compare t2_t1 with t2
147
+ print ("T2 COMPARE" )
148
+ #print(np.allclose(t2_t1, t2))
149
+ #t2new = update_t2(cc, t1, t2, eris)
118
150
return t1new , t2new
119
151
120
152
# t1: ia
0 commit comments