Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fci init_guess #85

Merged
merged 6 commits into from
Apr 19, 2023
Merged

Fix fci init_guess #85

merged 6 commits into from
Apr 19, 2023

Conversation

cjcscott
Copy link
Contributor

@cjcscott cjcscott commented Apr 13, 2023

This fixes the control of initial guesses within the FCI solver, which I came across in the process of trying to fix #84.
I would suggest we merge this after #69 for simplicity; it's not anything high priority.
8502952 added the function

    def get_init_guess(self):
        if self.opts.init_guess is None:
            return dict(ci0=None)
        if self.opts.init_guess == 'CISD':
            self.log.info("Generating intitial guess from CISD.")
            return dict(ci0=self.get_cisd_init_guess())
        raise ValueError

to control the generation of initial guesses for FCI wavefunctions. This seems to have intended passing solver_opts={"init_guess":None} to result in an initial guess of the HF determinant, rather than the CISD wavefunction. However, due to inheritance within the code interpreting None as the user not passing anything in this actually results in init_guess="default"(="CISD") by the time it gets into this function.

As a fix I've just changed this option to instead require "None" or "none". I've also added a test checking the energy of a prematurely terminated calculation correctly starting from the HF initial guess, which is hopefully OK so long as the first step of a davidson is deterministic (which I wouldn't be certain of, but seems OK in initial testing and we'll find out from the CI...).

@ghb24
Copy link
Contributor

ghb24 commented Apr 14, 2023

Happy to merge.

@maxnus
Copy link
Contributor

maxnus commented Apr 15, 2023

Hi Charlie, could we call this something more meaningful than "None"? Maybe we can try to understand what fci.get_init_guess() generates in PySCF?

Base automatically changed from v1.0.2a to master April 16, 2023 15:17
@cjcscott cjcscott force-pushed the fix_fci_initguess branch from f9d8e92 to ec70d79 Compare April 17, 2023 11:42
@cjcscott
Copy link
Contributor Author

The pyscf initial guess for nroots takes the states corresponding to the nroots lowest energies within hdiag as the initial guesses, so for the nth root the nth lowest energy slater determinant is the initial guess. I've updated this option to instead be meanfield or mf correspondingly.

@codecov-commenter
Copy link

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.03 ⚠️

Comparison is base (e5dc661) 71.72% compared to head (bb91a3c) 71.70%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #85      +/-   ##
==========================================
- Coverage   71.72%   71.70%   -0.03%     
==========================================
  Files         133      133              
  Lines       18460    18458       -2     
  Branches     2573     2514      -59     
==========================================
- Hits        13241    13235       -6     
- Misses       4486     4494       +8     
+ Partials      733      729       -4     
Impacted Files Coverage Δ
vayesta/solver/fci.py 75.63% <100.00%> (ø)

... and 11 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@ghb24 ghb24 merged commit be22731 into master Apr 19, 2023
@obackhouse obackhouse deleted the fix_fci_initguess branch April 19, 2023 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants