TRIQS / triqs

a Toolbox for Research on Interacting Quantum Systems
https://triqs.github.io
GNU General Public License v3.0
135 stars 71 forks source link

In DLR Documentation, be more clear about which functions are representable. #944

Open YannIntVeld opened 2 months ago

YannIntVeld commented 2 months ago

Description

When interpolating a constant Green's function (eg.. $G(i\omega_n) = U$) on a DLR mesh, the resulting error is larger than the representation accuracy given to the DLR mesh constructor.

This issue also occurs for DLR Green's functions which have frequency structure, but with a high-frequency offset.

Steps to Reproduce

The following minimal example will reproduce the problem

import numpy as np
from triqs.plot.mpl_interface import oplot,plt
from triqs.gf import *

U = 1.0
beta = 100.0
dlrwmax = 100.0
dlreps = 1e-10

wmeshdlr_f = MeshDLRImFreq(beta, 'Fermion', dlrwmax, dlreps)
G_w = Gf(mesh=wmeshdlr_f, target_shape=[1])
G_w.data[:] = U
G_c = make_gf_dlr(G_w)

wmesh_f = MeshImFreq(beta, "Fermion", n_iw=50)
G_interp_w = Gf(mesh=wmesh_f, target_shape=[1])
for w in wmesh_f:
    G_interp_w[w] = G_c(w)

fig = plt.figure(figsize=(5.0,3.0),dpi=300)
ax = fig.add_subplot(111)

oplot((G_interp_w - U).real, linewidth=1.0, linestyle='-', marker='.', name="Interpolated")
oplot((G_w - U).real, linewidth=1.0, linestyle='-', marker='.', name="DLR" )

ax.set_xlim(-4, 4)
ax.set_xlabel("$i\omega_m$")
ax.set_ylabel("$G(i\omega_{n}) - U$")
plt.show()

The resulting plot is

InterpolateConstantDLRGf(1)

Expected behavior: The error $G(i\omega_n) - U$ to be smaller than the value of dlreps.

Actual behavior: The error $G(i\omega_n) - U$ is larger than dlreps.

Wentzell commented 2 months ago

Dear @YannIntVeld

The behavior you describe is actually expected.

The DLR representation is not suited for Green functions that do not have a spectral representation, e.g. a constant function.

We should however make this more clear in our documentation.

YannIntVeld commented 2 months ago

Dear @Wentzell

Ah, I see that makes a lot of sense. Thanks a lot for the clarification.