Skip to content

feat(nac): add SF-TDDFT nonadiabatic couplings#3

Merged
wtpeter merged 1 commit into
NonDFT:mainfrom
jingjjkk:feat/nac-tduks-sf
Jul 10, 2026
Merged

feat(nac): add SF-TDDFT nonadiabatic couplings#3
wtpeter merged 1 commit into
NonDFT:mainfrom
jingjjkk:feat/nac-tduks-sf

Conversation

@jingjjkk

Copy link
Copy Markdown
Collaborator

Summary

Migrate the SF-TDDFT nonadiabatic coupling (NAC) module from pyscf-forge-nac into NEST, so the README-advertised NAC functionality is available in-repo.

Changes

  • nest/nac/tduks_sf.py — NAC algorithm adapted to NEST: nest.* namespace, direct mf.get_jk/td_grad.get_jk integral calls (matching grad/tduks_sf.py), and collinear == 'mcol' interface. Exports NAC / NonAdiabaticCouplings; registers td.NAC() on TDA_SF/TDDFT_SF.
  • nest/nac/__init__.py — exports NAC and NonAdiabaticCouplings.
  • nest/__init__.py — registers nest.nac.
  • nest/nac/tests/test_tduks_sf.pyunittest.TestCase (KnownValues) style aligned with grad/tests: shared setUpClass molecule, 4 independent reference benchmarks (HF/B3LYP × ETF/full, max abs err 4.7e-9) plus extype=0 and extype=1 smoke tests (6 tests total).

Verification

  • ruff check . — clean
  • pytest src -q41 passed
  • git diff --check — clean
  • Dead code (4 unused vars in nac_csf, flagged by ruff F841) removed.

Migrate tduks_sf NAC from pyscf-forge-nac into NEST:
- nest.nac.tduks_sf: NAC algorithm with NEST namespace, direct
  integral calls, and collinear=='mcol' interface
- nest.nac.__init__: export NAC and NonAdiabaticCouplings
- nest.__init__: register nest.nac, enable td.NAC()
- nest.nac.tests.test_tduks_sf: unittest KnownValues with 4
  reference benchmarks (HF/B3LYP x ETF/full, max abs err 4.7e-9)
  plus extype=0 and extype=1 smoke tests

All 41 tests pass; ruff and git diff --check clean.
@wtpeter
wtpeter merged commit 4235c31 into NonDFT:main Jul 10, 2026
1 check passed
@wtpeter
wtpeter requested a review from Copilot July 13, 2026 06:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR brings the SF‑TDDFT nonadiabatic coupling (NAC) implementation into NEST so the advertised NAC capability is available directly in-repo and can be invoked via the existing TDDFT_SF/TDA_SF objects.

Changes:

  • Add the SF‑TDDFT NAC implementation and register td.NAC() for spin-flip TD objects.
  • Expose the NAC API via nest.nac and package exports.
  • Add regression + smoke tests covering HF/B3LYP and ETF/full variants.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/nest/nac/tduks_sf.py Adds the NAC computation implementation and registers NAC() onto SF TD objects.
src/nest/nac/__init__.py Exports NAC / NonAdiabaticCouplings from the NAC package.
src/nest/__init__.py Imports/exports nest.nac at top-level for discoverability.
src/nest/nac/tests/test_tduks_sf.py Adds benchmarks and smoke tests for the new NAC pathway.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/nest/nac/tduks_sf.py
Comment on lines +36 to +37
def get_Hellmann_Feymann(td_grad, x_y_I, x_y_J, atmlst=None, max_memory=6000, verbose=logger.INFO,
state_I=None, state_J=None):
Comment thread src/nest/nac/tduks_sf.py
raw_x_y_J = self._scale_vector(raw_x_y_J, -1.0)
self.x_y_J_prev = copy.deepcopy(raw_x_y_J)

hf_term = get_Hellmann_Feymann(self, raw_x_y_I, raw_x_y_J, atmlst=atmlst, state_I=state_I, state_J=state_J)
Comment thread src/nest/nac/tduks_sf.py
Comment on lines +455 to +458
mo_coeff[0].shape[0]

nocca + nvira
noccb + nvirb
Comment thread src/nest/nac/tduks_sf.py
Comment on lines +591 to +596
def compute_nac(self, state_I=None, state_J=None, atmlst=None, ediff=None, use_etfs=None, use_cache=True):
state_I = state_I if state_I is not None else self.state_I
state_J = state_J if state_J is not None else self.state_J
ediff = self.ediff if ediff is None else ediff
use_etfs = self.use_etfs if use_etfs is None else use_etfs

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.

3 participants