psi4 / psi4numpy

Combining Psi4 and Numpy for education and development.
BSD 3-Clause "New" or "Revised" License
330 stars 151 forks source link

Problems about making intermediates in eom-ccsd #118

Closed DavidGoing closed 2 years ago

DavidGoing commented 2 years ago

I am an undergraduate from China. Recently I'm read your code in repo psi4/psi4numpy to learn how to implement eom-ccsd method in python. In the process of reading the code, I noticed that there are some small differences in making intermediates between code for ground state CCSD method and code for eom-ccsd method. For example, in Stanton's paper, equation(9) is: unnamed While in the code for ground state CCSD method(in repo psi4/psi4numpy/coupled cluster/spin_orbital/CCSD / CCSD.py), the part is implemented as: unnamed

However, in the code for eom-ccsd(in repo psi4/psi4numpy/coupled_cluster/RHF/helper_ccenergy.py), this part is implemented as: unnamed

Obviously in the latter case the minus term in the bracket has been neglected. This kind of problem happened in making other intermediates as well. However, the weird thing is that one will get very close output using two functions.

dgasmith commented 2 years ago

Hello, thank you for noticing this. It does indeed look like a mistake. The T1 cross terms are often very small for well converged wave functions. Would you mind opening a PR for a fix?

ashutoshvt commented 2 years ago

Hi Daniel @dgasmith , the EOM-CCSD code is spin-free while the CCSD code mentioned by @DavidMing-2001 is in spin-orbitals. You can see that in the spin-free case i.e for tau^{alpha, beta}_{alpha, beta}, only the first term would survive!

dgasmith commented 2 years ago

Ah, thanks @ashutoshvt! Makes perfect sense, is there a piece of documentation that alludes to this fact?

ashutoshvt commented 2 years ago

Actually, we put all the spin-adapted CC helper functions in the RHF folder: psi4/psi4numpy/coupled_cluster/RHF/. Also, in the eom class's docs, we mention it as spin-adapted:

class HelperCCEom(object):
    """
    EOMCCSD helper class for spin adapted EOMCCSD
    """
DavidGoing commented 2 years ago

Sorry, I haven't looked at github for a while, because recently I am preparing for final exam week, Now all of my exams have finished. I am very glad to help to fix this issue, but could you please tell me what is PR?

DavidGoing commented 2 years ago

I also have a small question about the code, but I don't know whether this is a issue(this also happen in making other equations as well), in stanon's paper, equation(3) is constructed as: image However, in your code, this part is implemented as(in repo psi4/psi4numpy/coupled_cluster/RHF/helper_ccenergy.py): image I notice there are coefficients difference and some extra term about exchange two body integral in your code. I am wondering about the reason of making this difference.

lothian commented 2 years ago

The difference between the published equation of Stanton and the code above is spin-adaptation. Stanton's equations are in the spin-orbital basis and thus applicable to a spin-restricted or -unrestricted representation. The specific code you quote assume a closed-shell reference determinant and a singlet target CC state.

DavidGoing commented 2 years ago

Oh, thanks for you reply, I notice that there is some difference between the CCSD energy calculated from Spin_orbital_CCSD and RHF. Is this difference also due to spin adaptation?

lothian commented 2 years ago

There should be essentially no difference between the spin-orbital and spin-adapted CCSD energies. Can you be more specific as to the magnitude of the difference you're seeing – perhaps provide an input?

DavidGoing commented 2 years ago

I just simply run EOM_CCSD.py in RHF and CCSD.py in Spin_Orbitals_CCSD. Then I compare the output of two programs. Since CCSD in folder Spin_Orbitals_CCSD is written in spin orbital basis and CCSD module in folder RHF is written in spin free form. For CCSD.py, I got the CCSD correlation energy equal to -0.1423eV image And for ccsd in RHF, I got the ccsd correlation energy equal to -0.2239eV image And I noticed that both RHF and CCSD are focus on H2O melocule.

lothian commented 2 years ago

Those aren't the same calculation because they use different basis sets. The EOM-CCSD test case uses the cc-pVDZ basis, and the spin-orbital CCSD test uses the 3-21G basis.

Also the units on the energies are Hartrees, not eV.

DavidGoing commented 2 years ago

Oh, I understand, many thanks. So this means I can use spin-orbital basis in eom-ccsd and I will get the same result.