psi4 / psi4numpy

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

reference of code block in psi4numpy/coupled_cluster/RHF/helper_cceom #129

Open DavidGoing opened 1 year ago

DavidGoing commented 1 year ago

Hi!

Recently I'm reading your code in repo psi4/psi4numpy and know how to implement eom-ccsd method in python.

In the process of reading the code, I'm confused about the code block where you make the sub-matrix of similarly transformed Hamiltonian. image As well for that build sigma2.

I have searched many materials (like origin paper of Stanton, many body method in chemistry and physics by Bartlett), but I still don't know how to derive these equations. I have read repo pyqchem written by jjgoing, where he constructs HSS, HSD, HDS and HDD them diagonalize it. This seems different from your method.

Could you tell me where to find the reference of these equations? I really appreciate your help.

lothian commented 1 year ago

For large molecular systems, building the complete Hamiltonian (or similarity-transformed Hamiltonian) and then diagonalizing it is not practical. The code in helper_cceom.py is based on the Davidson approach to computing a limited number of lowest eigenvalues of a large matrix.

These equations may be derived either using second-quantization methods or using diagrams (as described in the Bartlett-Shavitt book or here), but you can find the spin-orbital equations here.

pwborthwick commented 1 year ago

@DavidGoing I have two repo's that might help. cogus is an approach to evaluating coupled-cluster diagrams (including EOM) from a second-quantization viewpoint ie via Baker-Campbell-Hausdorff and Wick's theorems. The repo includes jupyter notebooks that attempt to explain the approach. A similar second-quantization (but more professional than my repo is pdaggerq). The second repo I have is cc-ade which is a diagrammatic approach. The repo is mainly directed at CCSDTQ but has an extension to EOM methods. Again there are jupyter notebooks which try to explain what I'm doing. Finally there is a concise version of the pyqchem EOM-CCSD (which I did some work on) using einsum and intermediates which may be of interest here - in the eom_ccsd class. As the EOM Hamiltonian is of dimension $(4*o*v)^2+(4*o*v)$ where o and v are occupied and virtual spatial orbitals you can see that for even $H_2O$ is STO-3G basis we have $(4.5.2)^2 + (4.5.2) = 1600 + 40$. So very quickly the pyqchem approach becomes a problem, hence the Davidson method where (Kronecker deltas are removed by multiplying by an arbitrary vector and) just the lowest n eigensolutions are determined. Hope something here helps.

DavidGoing commented 1 year ago

@pwborthwick Hello, Thank you for your information! I have read your code in https://github.com/pwborthwick/harpy/blob/48fc93344738a0746e01cf6fb3148a4d6a7c7a04/source/cc/fcc.py and code about eom-ccsd in https://github.com/pwborthwick/harpy/blob/48fc93344738a0746e01cf6fb3148a4d6a7c7a04/source/eom.py and notice that in eom.py you still select the output of eomMatrix to get agreement with Gaussian result: image While in the file fcc.py, it seems that this problem has been fixed. And there is no selection like eom.py. This problem also appreared in JJgoing's pyqchem repo.

I'm wondering do you know the reason behind the problem and could you tell me how do you fix that ? Thank you for your help.

pwborthwick commented 1 year ago

It's not a problem, Josh was just restricting the spectrum between those values for testing. Clearly with big Hamiltonians you get a large number of eigenvalues so for demonstration purposes you need to select a subset. It seemed like a sensible range so I have used it too.

DavidGoing commented 1 year ago

@pwborthwick Hi, I understand that we need to set a high energy cutoff and focus on low energy excitation states, thus there is an upper bound. However, what makes me confused is why these is a lower bound. When I remove the lower bound, some negative value appears. This negative eigenvalue should not appear in eom-ccsd.