@@ -31,6 +31,8 @@ def update_t1(cc, t1, t2, eris):
3131 Lov = eris .Lov
3232 Lvv = eris .Lvv
3333
34+ eia = mo_e_o [:,None ] - mo_e_v
35+
3436 # T1 equation
3537 t1new = - 2 * np .einsum ('kc,ka,ic->ia' , fov , t1 , t1 )
3638 t1new += np .einsum ('ac,ic->ia' , Fvv , t1 )
@@ -50,7 +52,6 @@ def update_t1(cc, t1, t2, eris):
5052 t1new += - 2 * lib .einsum ('Llc,Lki,lc,ka->ia' , Lov , Loo , t1 , t1 )
5153 t1new += lib .einsum ('Lkc,Lli,lc,ka->ia' , Lov , Loo , t1 , t1 )
5254
53- eia = mo_e_o [:,None ] - mo_e_v
5455 t1new /= eia
5556
5657 return t1new
@@ -112,9 +113,40 @@ def update_t2(cc, t1, t2, eris):
112113
113114 return t2new
114115
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+
115142def update_amps (cc , t1 , t2 , eris ):
143+ t2 = make_t2 (cc , t1 , eris )
116144 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)
118150 return t1new , t2new
119151
120152# t1: ia
0 commit comments