Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Implement a DeterminantVariationalState that computes expectations/gradients exactly#2181

Merged
PhilipVinc merged 1 commit into
netket:mainfrom
PhilipVinc:pv/mf
Dec 3, 2025
Merged

Implement a DeterminantVariationalState that computes expectations/gradients exactly#2181
PhilipVinc merged 1 commit into
netket:mainfrom
PhilipVinc:pv/mf

Conversation

@PhilipVinc
Copy link
Copy Markdown
Member

I needed something I understand to optimise determinant states easily, so I wrote it...

Uses the Wick theorem.
Super-inefficient implmentation. Can be improved by using the PNC operators that already store data as we want, but already handles 1000s of orbitals efficiently on a cpu (and probably better on a gpu) by batching the determinants so no need to push it.

Would be nice to derive the expression for the QGT so we can optimise with higher order optimisers as well...

@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 21, 2025

Codecov Report

❌ Patch coverage is 70.26022% with 80 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.65%. Comparing base (f9f97a0) to head (7245074).
⚠️ Report is 52 commits behind head on main.

Files with missing lines Patch % Lines
netket/models/slater.py 36.73% 29 Missing and 2 partials ⚠️
netket/_src/vqs/fermion_mf/expectation.py 72.34% 18 Missing and 8 partials ⚠️
netket/_src/vqs/fermion_mf/state.py 84.46% 10 Missing and 6 partials ⚠️
netket/_src/vqs/fermion_mf/qgt.py 64.28% 5 Missing ⚠️
netket/optimizer/qgt/default.py 50.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2181      +/-   ##
==========================================
- Coverage   82.79%   82.65%   -0.14%     
==========================================
  Files         371      375       +4     
  Lines       22271    22538     +267     
  Branches     2834     2868      +34     
==========================================
+ Hits        18439    18629     +190     
- Misses       2910     2970      +60     
- Partials      922      939      +17     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Member

@gcarleo gcarleo left a comment

Choose a reason for hiding this comment

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

nice, this is very helpful for debugging I guess!

@PhilipVinc PhilipVinc force-pushed the pv/mf branch 4 times, most recently from 47cb4d8 to 9569bb3 Compare November 23, 2025 23:45
This commit adds a new variational state for fermionic systems that
uses Slater determinants and computes expectation values exactly via
Wick's theorem.
@PhilipVinc PhilipVinc merged commit ca20c03 into netket:main Dec 3, 2025
9 of 12 checks passed
@PhilipVinc PhilipVinc deleted the pv/mf branch December 3, 2025 07:31
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