Skip to content

Refactor spin-flip TDDFT - #178

Merged
MatthewRHermes merged 2 commits into
pyscf:masterfrom
wtpeter:on_merlin
Feb 15, 2026
Merged

MatthewRHermes merged 2 commits into
pyscf:masterfrom
wtpeter:on_merlin

Conversation

@wtpeter

@wtpeter wtpeter commented Feb 12, 2026

Copy link
Copy Markdown
Contributor

This PR refactors the SF-TDDFT and SF-TDA modules to improve compatibility, functionality, and code structure.

Changes include:

  1. Fixed an incompatibility issue regarding the max_space parameter with recent PySCF versions.
  2. Added support for collinear functionals when collinear_samples < 0.
  3. Refactored SF-TDA and SF-TDDFT code to remove redundancies. The implementation now aligns better with current PySCF and GPU4PySCF conventions.
  4. Refined the pickeig function for SF-TDA and SF-TDDFT; the positive_eig_threshold parameter is no longer needed.
  5. Added support for ROKS reference states in SF-TDA and SF-TDDFT excitation energy calculations (note: analytic gradients are not yet supported).
  6. Relaxed test tolerances to 1e-4 to account for current instability in the diagonalization solver.
  7. Fixed errors in the spin square (<S^2>) calculation and added utility features, including oscillator strength, symmetry analysis, and transition mode analysis.

NOTE: It addresses the compatibility issue mentioned in #173 but with more modifications.

@jeanwsr

jeanwsr commented Feb 13, 2026

Copy link
Copy Markdown
Contributor

Thanks for the fix. For collinear functional, i think it may be easier to understand if using gpu4pyscf's definition: td.collinear = 'col'.

@wtpeter

wtpeter commented Feb 13, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the fix. For collinear functional, i think it may be easier to understand if using gpu4pyscf's definition: td.collinear = 'col'.

Thanks for the suggestion! That would indeed be more consistent with gpu4pyscf. For the current refactor, I would keep the collinear_samples < 0 logic for now, and I will refine the API definition in a follow-up update.

@sunqm sunqm mentioned this pull request Feb 14, 2026

def _gen_uhf_tda_response_sf(mf, mo_coeff=None, mo_occ=None, hermi=0, collinear_samples=200, max_memory=None):
'''Generate a function to compute the product of Spin Flip UKS response function
Generate a function to compute the product of Spin-flip UKS response function

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Generate a function to compute the product of Spin-flip UKS response function
Generate a function to compute the product of Spin-flip UHF/UKS response function

@MatthewRHermes
MatthewRHermes merged commit 0b42fcc into pyscf:master Feb 15, 2026
6 checks passed
@wtpeter
wtpeter deleted the on_merlin branch March 9, 2026 11:13
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