evangelistalab / forte

http://www.evangelistalab.org
GNU Lesser General Public License v3.0
50 stars 28 forks source link

Add genuine analytic DF-MCSCF gradients #405

Closed lcyyork closed 1 week ago

lcyyork commented 2 weeks ago

Description

The previous version of analytic DF-MCSCF gradient code dumps 4-index 2-RDM elements via Psi4 IWL. This PR implements the genuine analytic DF-MCSCF gradients by saving the 3-index and 2-index 2-RDMs contributions to Psi4 PSIO.

There is also an algorithmic change of building the 3-active/1-general 2-electron integrals in DF-MCSCF. Previous implementation computes MO integrals (pu|xy) using JK builder for every xy slice, which turns out to be good for small active spaces. For the larger active space (NA > 20), this TEIALG::JK approach does not scale. This PR switches to the TEIALG::DF approach that relies on DFHelper of Psi4 to obtain (Q|pu) 3-index MO integrals.

Besides, MCSCF_FREEZE_CORE (default: False) is replaced by MCSCF_IGNORE_FROZEN_ORBS (default: True) because MCSCF can also freeze virtual orbitals.

User Notes

Checklist

fevangelista commented 1 week ago

Thanks for this PR. What type of speedup do you observe for regular systems (if any?). The renaming of the option is a great idea and better conveys what it controls. Thanks for making this change. I think it's important we have this reflected in the manual to avoid confusion.

fevangelista commented 1 week ago

Question: would you like to first merge this and then update PR #396?

lcyyork commented 1 week ago

Thanks for this PR. What type of speedup do you observe for regular systems (if any?). The renaming of the option is a great idea and better conveys what it controls. Thanks for making this change. I think it's important we have this reflected in the manual to avoid confusion.

Here are some timings (in s) for computing (pu|xy) integrals:

Butadiene CAS(4,4)/def2-TZVP Threads 1 2 4
DF 0.025 0.019 0.019
JK 0.037 0.020 0.019
Hexacene CAS(4,4)/def2-TZVP Threads 1 2 4
DF 0.864 0.647 0.598
JK 3.81 3.79 3.75
Hexacene CAS(26,26)/def2-TZVP Threads 1 2 4
DF 1.282 1.179 1.098
JK 130.0 131.0 131.0

When multiple Cl and Cr are passed into JK, each Cl/Cr pair is computed serially. Given that these integrals are recomputed for every orbital optimization step, using DFHelper is far superior than JK for large active spaces.

lcyyork commented 1 week ago

Question: would you like to first merge this and then update PR #396?

Yes, I prefer merge this first.