Skip to content

add AOCache for pbc fftdf dft gradient and response function#3256

Open
Warlocat wants to merge 2 commits into
pyscf:masterfrom
Warlocat:4pr_ao_cache
Open

add AOCache for pbc fftdf dft gradient and response function#3256
Warlocat wants to merge 2 commits into
pyscf:masterfrom
Warlocat:4pr_ao_cache

Conversation

@Warlocat

Copy link
Copy Markdown
Contributor

By profiling our recent implementation on post-scf gradient for PBC systems, I found a huge waste of time in re-evaluating the same AOs on the same grid many times. This includes

  1. the response function in CPKS iterations
  2. a redundant re-evaluation in hcore_deriv
  3. loop over aoR_loop/block_loop in fftdf

This PR added an AOCache to save the precomputed ao grid values which is a relatively small intermediate, and reuse it in pbc dft response functions and grad.krhf get_veff calculations.

Codes were written by AI and reviewed by myself.

@jeanwsr

jeanwsr commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator
  1. I think ao is not cached in most codes (like molecular dft) simply because the memory is insufficient to do so. Why it's "relatively small intermediate" in your implementation, on how large system can the cache survive with normal memory?
  2. Can we just register the ao cache under ni, or some pbc object, to avoid pass it in many functions.

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.

2 participants