Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ jobs:
fail-fast: false
matrix:
include:
- {python-version: "3.10", os: ubuntu-latest}
- {python-version: "3.11", os: ubuntu-latest}
- {python-version: "3.12", os: ubuntu-latest}
- {python-version: "3.12", os: macos-latest}
- {python-version: "3.13", os: ubuntu-latest}
- {python-version: "3.14", os: ubuntu-latest}
- {python-version: "3.14", os: macos-latest}

steps:
- uses: actions/checkout@v2
Expand Down
27 changes: 23 additions & 4 deletions dyson/representations/spectral.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,13 +238,23 @@ def get_greens_function(self, chempot: float | None = None) -> Lehmann:
chempot = 0.0
return Lehmann(*self.get_dyson_orbitals(), chempot=chempot)

def combine(self, *args: Spectral, chempot: float | None = None) -> Spectral:
"""Combine multiple spectral representations.
def combine(
self,
*args: Spectral,
chempot: float | None = None,
overlap: Array | None = None,
static: Array | None = None,
) -> Spectral:
"""Combine multiple spectral representations by concatenating self-energies.

Args:
args: Spectral representations to combine.
chempot: Chemical potential to be used in the Lehmann representations of the self-energy
and Green's function.
overlap: Overlap matrix for the physical space. If ``None``, the overlap matrices of the
inputs are summed.
static: Static part of the self-energy. If ``None``, the static parts of the inputs are
summed.

Returns:
Combined spectral representation.
Expand All @@ -259,8 +269,17 @@ def combine(self, *args: Spectral, chempot: float | None = None) -> Spectral:

# Sum the overlap and static self-energy matrices -- double counting is not an issue
# with shared static parts because the overlap matrix accounts for the separation
static = sum([arg.get_static_self_energy() for arg in args], np.zeros((nphys, nphys)))
overlap = sum([arg.get_overlap() for arg in args], np.zeros((nphys, nphys)))
if overlap is None:
overlap = sum([arg.get_overlap() for arg in args], np.zeros((nphys, nphys)))

if static is None:
static = sum([arg.get_static_self_energy() for arg in args], np.zeros((nphys, nphys)))

# Orthogonalise under the metric of the overlap matrix
hermitian = all(arg.hermitian for arg in args)
orth, _ = util.matrix_power(overlap, -0.5, hermitian=hermitian, return_error=False)
static = orth @ static @ orth
overlap = orth @ overlap @ orth

# Check the chemical potentials
if chempot is None:
Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ classifiers = [
"Topic :: Scientific/Engineering",
"Topic :: Software Development",
"Programming Language :: Python",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX :: Linux",
]
Expand Down