Open
Description
Hello OpenFermion developers
I need the method (can contribute code) for generation of initial amplitudes for UCCSD from MP2 amplitudes as formula is well known.
I do not quite understand what kind of class this should be, but if it would MolecularData
the next code is valid for closed shell system
@property
def mp2_computed_energy(self):
nocc = self.n_electrons // 2
orbe = self.orbital_energies
moints = self.two_body_integrals[:nocc, nocc:, :nocc, nocc:]
E_occ, E_virt = orbe[:nocc], orbe[nocc:]
denominator = 1/(
E_occ.reshape(-1, 1, 1, 1) -
E_virt.reshape(1, -1, 1, 1) +
E_occ.reshape(1, 1, -1, 1) -
E_virt.reshape(1, 1, 1, -1)
)
singlet = np.einsum(
'iajb,iajb,iajb->',
moints, moints, denominator
)
triplet = np.einsum(
'iajb,iajb,iajb->',
moints - moints.swapaxes(1, 3),
moints, denominator
)
return singlet + triplet
@property
def uccsd_initial_amplitudes(self):
nocc = self.n_electrons // 2
orbe = self.orbital_energies
moints = self.two_body_integrals[:nocc, nocc:, :nocc, nocc:]
E_occ, E_virt = orbe[:nocc], orbe[nocc:]
denominator = 1/(
E_occ.reshape(-1, 1, 1, 1) -
E_virt.reshape(1, -1, 1, 1) +
E_occ.reshape(1, 1, -1, 1) -
E_virt.reshape(1, 1, 1, -1)
)
return (moints.swapaxes(1, 3) - 2 * moints) * denominator
Also I've found that Powell minimization method is more stable than CG.
Best Vladimir.