-
Notifications
You must be signed in to change notification settings - Fork 467
More SCF Convergence Control for COSX Final Grid #2981
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
Conversation
d381344
to
4259de1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice additional flexibility
psi4/src/read_options.cc
Outdated
@@ -1681,6 +1681,8 @@ int read_options(const std::string &name, Options &options, bool suppress_printi | |||
options.add_int("COSX_RADIAL_POINTS_FINAL", 35); | |||
/*- Screening criteria for integrals and intermediates in COSX -*/ | |||
options.add_double("COSX_INTS_TOLERANCE", 1.0E-11); | |||
/*- Maximum number of SCF iterations to run on on larger (i.e., final) COSX grid -*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe be more expansive about the >1, ==1, ==0, <0 values here since this is what gets slurped for the docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's fair, since COSX_MAXITER_FINAL is a bit more complex than it appears at a first glance. I will do so!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also done! Hopefully, the new description in the code makes sense.
@@ -270,13 +270,16 @@ def scf_iterate(self, e_conv=None, d_conv=None): | |||
|
|||
# does the JK algorithm use severe screening approximations for early SCF iterations? | |||
early_screening = self.jk().get_early_screening() | |||
# maximum number of scf iterations to run after early screening is disabled | |||
scf_maxiter_post_screening = core.get_option('SCF', 'COSX_MAXITER_FINAL') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any practical difference between cosx_maxiter_final == -1 and -10? If the total total limit is still controlled by SCF_MAXITER, then no? If that's the case, maybe only allow -1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, there is no difference between -1 and -10 (or any other negative number) for COSX_MAXITER_FINAL. I will change this as you suggested!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done and done!
4259de1
to
a7931b8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See if you like the proposed changes.
Co-authored-by: Lori A. Burns <lori.burns@gmail.com>
Co-authored-by: Lori A. Burns <lori.burns@gmail.com>
Co-authored-by: Lori A. Burns <lori.burns@gmail.com>
I do! I accepted all of them. Thank you for the suggestions! |
Description
Currently, COSX in Psi4 uses a two-grid scheme to complete the SCF - the SCF is first converged on a smaller grid, and then a single iteration is performed on a larger grid, a scheme proposed by Neese. This scheme works quite well for energies; but since the SCF isn't converged on the larger grid, it may not be as ideal if wavefunction properties (e.g., gradients) are desired.
This PR fixes that by adding a new keyword,
COSX_MAXITER_FINAL
, an integer that determines the maximum number of SCF iterations to run on the final COSX grid. By default, this keyword is set to 1, mimicking the current behavior of the code. A more detailed description of behavior can be broken down as follows:COSX_MAXITER_FINAL
< 0; the SCF will attempt to fully converge on the final COSX grid (within the constraints provided byMAXITER
, of course).COSX_MAXITER_FINAL
== 0; the SCF will not run on the final grid at all, effectively turning the COSX algorithm into a single-grid implementation.COSX_MAXITER_FINAL
> 0; the SCF will run on the final grid for a maximum number of iterations specified by the keyword.COSX_MAXITER_FINAL
, the SCF will exit upon convergence.COSX_MAXITER_FINAL
is reached before the SCF is converged on the final grid, the SCF will exit, treated as a success.MAXITER
SCF iteration limit is hit before theCOSX_MAXITER_FINAL
limit is reached, the calculation will fail.Also of note, this PR changes CompositeJK so that early_screening is disabled for LinK-based composite methods. Practically, this means that LinK-based methods do not run the extra post-early-screening SCF iteration that is present in COSX-based methods.
User API & Changelog headlines
COSX_MAXITER_FINAL
, for controlling the maximum number of SCF iterations to run on the final COSX grid.Dev notes & details
COSX_MAXITER_FINAL
, for controlling the maximum number of SCF iterations to run on the final COSX grid. The keyword can be used to run a preset number of SCF iterations or fully converge the SCF on the final grid, or to skip the final grid entirely.Questions
Checklist
Status