diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7651699..f3bb010 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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 diff --git a/dyson/representations/spectral.py b/dyson/representations/spectral.py index a02c2bb..3f069ba 100644 --- a/dyson/representations/spectral.py +++ b/dyson/representations/spectral.py @@ -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. @@ -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: diff --git a/pyproject.toml b/pyproject.toml index d5b864e..1b145e4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", ]