pyscf / pyscf-forge

pyscf-forge is a staging ground for code that may be suitable for pyscf-core
Apache License 2.0
27 stars 23 forks source link

Energy Decomposition Analysis adopted for general MCSCF #64

Closed JangidBhavnesh closed 2 months ago

JangidBhavnesh commented 2 months ago

Previously EDA is hardcoded for the CASSCF wavefunction only. I added the functionality to do this analysis for the DMRG-PDFT as well.

matthew-hennefarth commented 2 months ago

LGTM. Do you know if any of the tests actually test this feature? Perhaps we could add one if not.

JangidBhavnesh commented 2 months ago

We don't have any test for this functionality.

I will add an unit test. Here, the sum of EDA components would be equal to the MCPDFT energy for the given state.

matthew-hennefarth commented 2 months ago

Here, the sum of EDA components would be equal to the MCPDFT energy for the given state.

Not necessarily, I believe. Doesn't it also include more than just the Coulomb interaction, such as CAS exchange? As in e_ncwfn includes full 2e active space contribution if I read the code correctly. Also, for hybrid funcs it might disagree.

JangidBhavnesh commented 2 months ago

Sorry, there is a test for energy_decomposition. Though, whatever I have changed is passing the test. https://github.com/pyscf/pyscf-forge/blob/master/pyscf/mcpdft/test/test_mcpdft.py

Also, energy_decomposition is not implemented for the hybrid functionals. https://github.com/pyscf/pyscf-forge/blob/master/pyscf/mcpdft/mcpdft.py#L274

However, it won't be that difficult to implement it. It can be represented as $E{OT} = \lambda (\frac{1}{2}g{pqrs}D_{pqrs}) + (1-\lambda ) E[\rho, \Pi]$ Where it can further be decomposed into exchange and correlation.

JangidBhavnesh commented 2 months ago

Not necessarily, I believe. Doesn't it also include more than just the Coulomb interaction, such as CAS exchange? As in e_ncwfn includes full 2e active space contribution if I read the code correctly. Also, for hybrid funcs it might disagree.

Yes, you are right. MCPDFT energy doesn't include the encwfn. $E{MCPDFT} = sum(E_{Decomposition}[:3 or :4])$ (depends on split_xc)

matthew-hennefarth commented 2 months ago

However, it won't be that difficult to implement it. It can be represented as E O T = λ ( 1 2 g p q r s D p q r s ) + ( 1 − λ ) E [ ρ , Π ] Where it can further be decomposed into exchange and correlation.

You don't have to even do that. The MC-PDFT energy should actually be $E^{PDFT} = E^{1e} + Coul + \lambda E^{ncwfn} + (1-\lambda)E^{ot}$. If $\lambda = 0$, it will still work.