Skip to content

MeshDLR interpolation using matsubara_freq - broken for Matsubara frequencies at different temperature #953

@HugoStrand

Description

@HugoStrand

Description

The interpolation of MeshDLR Green's functions in frequency space using Matsubara frequencies is broken when the Matsubara frequencies does not have the same inverse temperature $\beta$.

Steps to Reproduce

import numpy as np
from triqs.gf import Gf, iOmega_n, inverse, MeshDLRImFreq, make_gf_dlr

beta1, beta2 = 10., 5.

w_max, eps = 10., 1e-12
wm1 = MeshDLRImFreq(beta1, 'Fermion', w_max, eps)
wm2 = MeshDLRImFreq(beta2, 'Fermion', w_max, eps)

G1_iw = Gf(mesh=wm1, target_shape=[])
G1_iw << inverse(iOmega_n - 1.0)
G2_iw = Gf(mesh=wm2, target_shape=[])
G2_iw << inverse(iOmega_n - 1.0)

G1_c = make_gf_dlr(G1_iw)
G2_interp_iw = Gf(mesh=wm2, target_shape=[])
G2_interp_iw.data[:] = np.array([ G1_c(w) for w in wm2 ]) # * beta2 / beta1 # (scaling fixes prefactor)

diff = np.max(np.abs(G2_interp_iw.data - G2_iw.data))
print(diff)

from triqs.plot.mpl_interface import oplot, plt, oplotr
oplot(G2_iw)
oplot(G2_interp_iw)
plt.show()

Expected behavior: The two Green's functions should be equal, and diff <= 1e-12

Actual behavior: They differ by diff = 0.32143129179554025

Origin of the issue

The DLR theory allows for interpolation in the whole complex plane of frequencies. In Triqs we restrict this a bit by requiring that the input has the type matsubara_freq.

Currently the index of the Matsubara frequency is used to evaluate the interpolation, see
https://github.com/TRIQS/triqs/blob/3.3.x/c%2B%2B/triqs/mesh/dlr.hpp#L269
which only works for frequencies having the same inverse temperature. To make this work for any Matsubara we need to compute the complex value of the Matsubara frequency and use a DLR Matsubara kernel that allows for complex frequencies as input, extending the current cppdlr:k_if functionality that only takes an integer, see
https://github.com/flatironinstitute/cppdlr/blob/1.1.x/c%2B%2B/cppdlr/dlr_kernels.hpp#L113

Why this makes sense

Being able to interpolate using Matsubara frequencies at a different temperature is the golden door to generating an initial guess at some temperature using a self consistent solution at another (but not so different) temperature, when e.g. solving for a range of temperatures.

Versions

Triqs 3.3.x at 86a7993 on July 31, 2024

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions