Yes, they’re related to UCC/VQE question, but a difference one. You are right that CCSD amplitudes is probably not enough for UCCSD, but it is the best I can do currently for my purpose.
So, I modified the code for CCSD (here) iteration a little bit by adding two lines, which sets some of t2 amplitudes zero whenever it is updated. The list of t2 that I wish to set to zero are selected from MP2 calculation. I selected double excitation terms to be dropped from MP2 correction energy from ~0 energy contribution to up to some threshold.
I was wondering what is the risk here? Can I simply set those selected t2 amplitudes to zero without making whole calculation invalid? After running this code I do get some sensible result that the more double excitation terms I drop, the higher the CCSD energy compared to un-modified one.
Here is the part that I modified (actually I only add two lines to set t2 to zero).
set_t2_zero(t2, zero_list) ### I added this line
for CCSD_iter in range(1, maxiter + 1):
### Build intermediates: [Stanton:1991:4334] Eqns. 3-8
Fae = build_Fae(t1, t2)
Fmi = build_Fmi(t1, t2)
Fme = build_Fme(t1, t2)
Wmnij = build_Wmnij(t1, t2)
Wabef = build_Wabef(t1, t2)
Wmbej = build_Wmbej(t1, t2)
#### Build RHS side of t1 equations, [Stanton:1991:4334] Eqn. 1
rhs_T1 = F[o, v].copy()
rhs_T1 += np.einsum('ie,ae->ia', t1, Fae)
rhs_T1 -= np.einsum('ma,mi->ia', t1, Fmi)
rhs_T1 += np.einsum('imae,me->ia', t2, Fme)
rhs_T1 -= np.einsum('nf,naif->ia', t1, MO[o, v, o, v])
rhs_T1 -= 0.5 * np.einsum('imef,maef->ia', t2, MO[o, v, v, v])
rhs_T1 -= 0.5 * np.einsum('mnae,nmei->ia', t2, MO[o, o, v, o])
### Build RHS side of t2 equations, [Stanton:1991:4334] Eqn. 2
rhs_T2 = MO[o, o, v, v].copy()
# P_(ab) t_ijae (F_be - 0.5 t_mb F_me)
tmp = Fae - 0.5 * np.einsum('mb,me->be', t1, Fme)
Pab = np.einsum('ijae,be->ijab', t2, tmp)
rhs_T2 += Pab
rhs_T2 -= Pab.swapaxes(2, 3)
# P_(ij) t_imab (F_mj + 0.5 t_je F_me)
tmp = Fmi + 0.5 * np.einsum('je,me->mj', t1, Fme)
Pij = np.einsum('imab,mj->ijab', t2, tmp)
rhs_T2 -= Pij
rhs_T2 += Pij.swapaxes(0, 1)
tmp_tau = build_tau(t1, t2)
rhs_T2 += 0.5 * np.einsum('mnab,mnij->ijab', tmp_tau, Wmnij)
rhs_T2 += 0.5 * np.einsum('ijef,abef->ijab', tmp_tau, Wabef)
# P_(ij) * P_(ab)
# (ij - ji) * (ab - ba)
# ijab - ijba -jiab + jiba
tmp = np.einsum('ie,ma,mbej->ijab', t1, t1, MO[o, v, v, o])
Pijab = np.einsum('imae,mbej->ijab', t2, Wmbej)
Pijab -= tmp
rhs_T2 += Pijab
rhs_T2 -= Pijab.swapaxes(2, 3)
rhs_T2 -= Pijab.swapaxes(0, 1)
rhs_T2 += Pijab.swapaxes(0, 1).swapaxes(2, 3)
Pij = np.einsum('ie,abej->ijab', t1, MO[v, v, v, o])
rhs_T2 += Pij
rhs_T2 -= Pij.swapaxes(0, 1)
Pab = np.einsum('ma,mbij->ijab', t1, MO[o, v, o, o])
rhs_T2 -= Pab
rhs_T2 += Pab.swapaxes(2, 3)
### Update t1 and t2 amplitudes
t1 = rhs_T1 / Dia
t2 = rhs_T2 / Dijab
set_t2_zero(t2, zero_list) . ### I added this line
### Compute CCSD correlation energy
CCSDcorr_E = np.einsum('ia,ia->', F[o, v], t1)
CCSDcorr_E += 0.25 * np.einsum('ijab,ijab->', MO[o, o, v, v], t2)
CCSDcorr_E += 0.5 * np.einsum('ijab,ia,jb->', MO[o, o, v, v], t1, t1)
### Print CCSD correlation energy
# print('CCSD Iteration %3d: CCSD correlation = %3.12f '\
# 'dE = %3.5E' % (CCSD_iter, CCSDcorr_E, (CCSDcorr_E - CCSDcorr_E_old)))
if (abs(CCSDcorr_E - CCSDcorr_E_old) < E_conv):
break
CCSDcorr_E_old = CCSDcorr_E