feat: spin-orbit coupling for spin-flip TDDFT - #5
Merged
Merged
Conversation
wtpeter
commented
Jul 13, 2026
Collaborator
- Add AO SOC integrals and a shared SOC driver.
- Support SOC calculations for SF-TDA and SF-TDDFT with ROKS/UKS references.
- Add numerical tests and an example workflow.
There was a problem hiding this comment.
Pull request overview
This PR introduces spin–orbit coupling (SOC) support for spin-flip excited-state methods in NEST, including AO-basis SOC integral construction and a shared SOC Hamiltonian driver that works with SF-TDA and SF-TDDFT (ROKS/UKS references). It also adds numerical regression tests and an example script to demonstrate end-to-end usage.
Changes:
- Add AO SOC integral builders (1e, Zeff, SOMF, X2CAMF) and a symmetrization step to enforce tensor Hermiticity.
- Add a generic SOC Hamiltonian builder/diagonalizer and an SF-TDA/SF-TDDFT-specific SOC driver that constructs reduced transition densities.
- Add regression tests for AO SOC and SF-TDA/SF-TDDFT SOC outputs, plus a runnable example workflow.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/nest/soc/soc_ao.py | Implements AO-basis SOC integrals for multiple SOC types and returns a Hermitian spherical-tensor representation. |
| src/nest/soc/soc.py | Adds shared SOC Hamiltonian machinery (state representation, CG coefficients, block assembly, diagonalization, analysis). |
| src/nest/soc/sftda.py | Adds SOC driver for SF-TDA/SF-TDDFT objects, including reduced transition density construction. |
| src/nest/soc/init.py | Exposes SOC components from the new nest.soc package. |
| src/nest/sftda/uhf_sf.py | Adds a SOC() convenience method to SF-TDA/SF-TDDFT results to construct the SOC driver. |
| src/nest/soc/tests/test_soc_ao.py | Adds numerical regression tests for AO SOC integrals (1e, Zeff, SOMF; includes UKS case). |
| src/nest/soc/tests/test_sftda_soc.py | Adds regression tests for SF-TDA SOC (ROKS/UKS) and CG coefficient sanity checks. |
| src/nest/soc/tests/test_sftddft_soc.py | Adds regression tests for SF-TDDFT SOC (ROKS/UKS). |
| examples/soc/01_sftda_soc.py | Adds an example script demonstrating an SF-TDA SOC workflow and analysis output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1
to
+5
| # Copyright 2026 The NEST Developers. All Rights Reserved. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
|
|
Comment on lines
+1
to
+5
| # Copyright 2026 The NEST Developers. All Rights Reserved. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
|
|
Comment on lines
+24
to
+31
| def sozeff(atom, zeff_type="one"): | ||
| """ | ||
| Calculate effective nuclear charge for given atomic number | ||
| copied from: https://github.com/masaya0222/PyGraSO/blob/main/pygraso/calc_ao_element.py | ||
| Author: Masaya Hagai <hagai.masaya.v9@s.mail.nagoya-u.ac.jp> | ||
| """ | ||
| assert zeff_type in ["one", "orca", "pysoc"], f"{zeff_type=} is not valid" | ||
| neval = { |
Comment on lines
+173
to
+174
| except Exception as e: | ||
| print(f"Warning: failed to increase stack size: {e}") |
Comment on lines
+175
to
+180
| try: | ||
| from socutils.somf import somf_pt | ||
| except ImportError: | ||
| raise ImportError("Please install socutils package to use X2CAMF SOC integrals." \ | ||
| "https://github.com/wtpeter/socutils") | ||
| ao_soc = 2j * somf_pt.get_psoc_x2camf(mol, xresp=X2CAMF_XRESP) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.