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

SCF_COSX_GUESS: COSX->DirectJK/LinK JK build #3158

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

davpoolechem
Copy link
Contributor

@davpoolechem davpoolechem commented Apr 22, 2024

Description

COSX has always been a bit... troublesome since its introduction to Psi4. The primary issue with it, is that it is VERY tricky finding grid settings that provide a satisfactory balance of performance and accuracy. To help alleviate this issue, COSX uses a two-grid scheme, converging the SCF on a small initial grid, then performing COSX_MAXITER_FINAL number of SCF iterations (generally 1) on a larger final grid. With the two-grid scheme, the performance is controlled mainly by the initial grid, while accuracy is controlled primarily by the final grid.

But this brings up an idea... instead of using a larger COSX grid, why not just use a 4-center K construction method for the final iteration(s) instead?

This PR introduces the SCF_COSX_GUESS keyword to Psi4. SCF_COSX_GUESS can be used in conjunction with either the DIRECT or DFDIRJ+LINK options for SCF_TYPE . When enabled, the calculation will first converge the SCF on a small COSX grid, followed by executing SCF using the specified SCF_TYPE. Another way of framing it, is that SCF_COSX_GUESS is similar to DF_SCF_GUESS, but uses COSX instead of DFJK for the initial SCF convergence process.

To support SCF_COSX_GUESS, some keyword functionality has been expanded. COSX_RADIAL_POINTS_INITIAL and COSX_SPHERICAL_POINTS_INITIAL can be used to control the COSX grid size for the SCF_COSX_GUESS, with the grid in this context defaulting to (20/50). COSX_MAXITER_FINAL can be used to control the number of DIRECT/DFDIRJ+LINK iterations to run after the COSX guess, defaulting to 2 in this context. Note that the grid for SCF_COSX_GUESS uses different defaults compared to the usual initial grid for DFDIRJ+COSX runs.

This PR also adds a fair bit of cleanup/QoL changes, as follows:

  • The early_screening variable in scf_iterator.py, and all related quantities, have been renamed for clarity.
  • DFDIRJ+LINK can now be used in conjunction with DF_SCF_GUESS.
  • Tests have been expanded.

User API & Changelog headlines

  • Adds the SCF_COSX_GUESS input keyword to Psi4, usable with SCF_TYPE=DIRECT and SCF_TYPE=DFDIRJ+LINK. When enabled, the calculation will first converge the SCF on a small COSX grid, and then execute COSX_MAXITER_FINAL number of SCF iterations using the specified SCF_TYPE. The grid used by the COSX guess can be controlled by the COSX_RADIAL_POINTS_INITIAL and COSX_SPHERICAL_POINTS_INITIAL keywords.
  • Expands the DF_SCF_GUESS keyword to work with SCF_TYPE=DFDIRJ+LINK.

Dev notes & details

  • Adds the SCF_COSX_GUESS input keyword to Psi4, usable with SCF_TYPE=DIRECT and SCF_TYPE=DFDIRJ+LINK. When enabled, the calculation will first converge the SCF on a small COSX grid, and then execute COSX_MAXITER_FINAL number of SCF iterations using the specified SCF_TYPE.
  • Expands the DF_SCF_GUESS keyword to work with SCF_TYPE=DFDIRJ+LINK.
  • Expands the use cases of the COSX_RADIAL_POINTS_INITIAL, COSX_SPHERICAL_POINTS_INITIAL, and COSX_MAXITER_FINAL keywords. COSX_RADIAL_POINTS_INITIAL and COSX_SPHERICAL_POINTS_INITIAL control the size of the grid used for the SCF_COSX_GUESS guess ( default: (20/50) ). COSX_MAXITER_FINAL controls how many DIRECT/DFDIRJ+LINK iterations to run after the converged COSX SCF (default: 2).
    -[X] Cleans up scf_iterator.py, renaming early_screening and all associated variables, and adding comments for cases where multi-stage SCF convergence procedures are used.
  • Adds testing for SCF_COSX_GUESS and COSX_MAXITER_FINAL.

Questions

  • I already know this will be brought up, so I'll start it off: what's the best name for this keyword? SCF_COSX_GUESS and DF_SCF_GUESS do very similar things, but have a different naming structure, i.e., SCF is located at a different point in the variable name. I intentionally picked SCF_COSX_GUESS because putting SCF at the front makes it clear that the option applies for the whole SCF rather than just COSX itself, which is exacerbated by the existence of other COSX_xxx variables that exist specifically for COSX. I actually wouldn't mind switching the name of DF_SCF_GUESS, too, to maintain consistency. But if COSX_SCF_GUESS is preferred by everyone else, I'll switch to that.

Checklist

Status

  • Ready for review
  • Ready for merge

@davpoolechem davpoolechem changed the title SCF_COSX_GUESS: COSX as a guess option for JK builds SCF_COSX_GUESS: COSX->DirectJK/LinK build progression Apr 22, 2024
@davpoolechem davpoolechem changed the title SCF_COSX_GUESS: COSX->DirectJK/LinK build progression SCF_COSX_GUESS: COSX->DirectJK/LinK JK build Apr 22, 2024
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.

None yet

1 participant