Skip to content

Conversation

@obackhouse
Copy link
Collaborator

@obackhouse obackhouse commented Dec 17, 2025

  • Fixes Spectral.combine, which is now separated into Spectral.combine_for_self_energy and Spectral.combine_for_greens_function. The choice of functions depends on which quantity you want to exactly conserve when combining the Spectral objects, which may not allow conservation of both in many cases.
  • Fixes some non-Dyson classification, which I had confused myself about.
  • Removes GW expression. This is not rigorously wavefunction-based and breaks the Spectral logic. It should live in momentGW and combination handled there (as it already is).
  • Some typing improvements.

Copy link

Copilot AI commented Dec 17, 2025

@obackhouse I've opened a new pull request, #19, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI left a comment

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 fixes the Spectral.combine method to properly concatenate Dyson orbitals and handle the linear algebra for constructing full eigenvectors. It also removes the GW/TDAGW expression (which should live in momentGW instead), fixes non-Dyson classification for ADC expressions, and adds typing improvements.

Key changes:

  • Reimplements Spectral.combine to concatenate Dyson orbitals and use project_eigenvectors for proper eigenspace construction
  • Removes the TDAGW/GW expression from the codebase as it breaks Spectral logic
  • Fixes ADC non_dyson property from False to True and removes HF_Dyson class
  • Moves project_eigenvectors from exact.py to util/linalg.py with improved signature allowing eigvecs=None
  • Adds typing-extensions dependency and uses Self type for better type hints

Reviewed changes

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

Show a summary per file
File Description
dyson/representations/spectral.py Reimplements combine() method to concatenate Dyson orbitals and construct eigenvectors; fixes typo in error message
dyson/util/linalg.py Adds project_eigenvectors() function (moved from exact.py) with support for eigvecs=None parameter
dyson/util/init.py Exports new project_eigenvectors function
dyson/solvers/static/exact.py Removes project_eigenvectors() (moved to util/linalg.py) and updates import
dyson/solvers/static/davidson.py Updates import to use project_eigenvectors from util
dyson/solvers/static/mblse.py Updates return type annotations from MBLSE to MLSE for MLSE class methods
dyson/solvers/solver.py Adds Self type import and uses it for return type annotations
dyson/expressions/expression.py Removes "dyson"/"central" expression support from ExpressionCollection, adds Self type usage
dyson/expressions/hf.py Removes HF_Dyson class as it's no longer needed
dyson/expressions/adc.py Changes non_dyson property from False to True
dyson/expressions/gw.py File completely removed (TDAGW expression)
dyson/expressions/init.py Removes TDAGW import
dyson/init.py Removes TDAGW from public API and documentation
tests/test_expressions.py Removes TDAGW tests, adds comprehensive combine() tests for HF/CCSD/FCI/ADC2/ADC2x with both Exact and Davidson solvers, adds incomplete comment
tests/test_mblse.py Removes skip conditions for "Dyson only" expressions
tests/test_mblgf.py Removes skip conditions for "Dyson only" expressions
tests/test_exact.py Removes skip conditions for "Dyson only" expressions
tests/test_downfolded.py Removes skip conditions for "Dyson only" expressions
tests/test_density.py Removes skip conditions for "Dyson only" expressions
tests/test_davidson.py Removes skip conditions for "central Hamiltonian" and "Dyson only" expressions
tests/test_cpgf.py Removes skip conditions for "central Hamiltonian"
tests/test_corrvec.py Removes skip conditions for "central Hamiltonian"
tests/conftest.py Removes TDAGW from METHODS list and simplifies _get_central_result() by removing dyson-specific logic
pyproject.toml Adds typing-extensions>=4.0.0 to dev dependencies
Comments suppressed due to low confidence (1)

dyson/representations/spectral.py:288

  • This assignment to 'eigvecs' is unnecessary as it is redefined before this value is used.
        eigvecs = util.project_eigenvectors(

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

@obackhouse
Copy link
Collaborator Author

ok this has broken stuff for higher order moments after recombinations 😢

@codecov
Copy link

codecov bot commented Jan 27, 2026

Codecov Report

❌ Patch coverage is 79.24528% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.89%. Comparing base (76caa9a) to head (6a717da).
⚠️ Report is 20 commits behind head on master.

Files with missing lines Patch % Lines
dyson/representations/spectral.py 80.32% 5 Missing and 7 partials ⚠️
dyson/representations/lehmann.py 0.00% 5 Missing ⚠️
dyson/util/linalg.py 92.00% 1 Missing and 1 partial ⚠️
dyson/expressions/adc.py 0.00% 1 Missing ⚠️
dyson/expressions/expression.py 80.00% 1 Missing ⚠️
dyson/solvers/solver.py 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #18      +/-   ##
==========================================
- Coverage   72.37%   71.89%   -0.48%     
==========================================
  Files          38       37       -1     
  Lines        3873     3790      -83     
  Branches      494      493       -1     
==========================================
- Hits         2803     2725      -78     
+ Misses        869      859      -10     
- Partials      201      206       +5     

☔ 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
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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


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

obackhouse and others added 3 commits January 27, 2026 18:36
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@obackhouse obackhouse merged commit e79dbcd into master Jan 27, 2026
5 checks passed
@obackhouse obackhouse deleted the fix_dyson_combination branch January 27, 2026 18:46
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