feat(nac): add SF-TDDFT nonadiabatic couplings#3
Merged
Conversation
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.
There was a problem hiding this comment.
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.nacand 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 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): |
| 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 on lines
+455
to
+458
| mo_coeff[0].shape[0] | ||
|
|
||
| nocca + nvira | ||
| noccb + nvirb |
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 | ||
|
|
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.
Summary
Migrate the SF-TDDFT nonadiabatic coupling (NAC) module from
pyscf-forge-nacinto NEST, so the README-advertised NAC functionality is available in-repo.Changes
nest/nac/tduks_sf.py— NAC algorithm adapted to NEST:nest.*namespace, directmf.get_jk/td_grad.get_jkintegral calls (matchinggrad/tduks_sf.py), andcollinear == 'mcol'interface. ExportsNAC/NonAdiabaticCouplings; registerstd.NAC()onTDA_SF/TDDFT_SF.nest/nac/__init__.py— exportsNACandNonAdiabaticCouplings.nest/__init__.py— registersnest.nac.nest/nac/tests/test_tduks_sf.py—unittest.TestCase(KnownValues) style aligned withgrad/tests: sharedsetUpClassmolecule, 4 independent reference benchmarks (HF/B3LYP × ETF/full, max abs err 4.7e-9) plusextype=0andextype=1smoke tests (6 tests total).Verification
ruff check .— cleanpytest src -q— 41 passedgit diff --check— cleannac_csf, flagged by ruff F841) removed.