Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
YannIntVeld opened this issue Jun 12, 2024 · 2 comments

Comments

@YannIntVeld
Copy link
Contributor

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
Copy link
Member

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.

@Wentzell Wentzell changed the title Interpolating on a constant DLR Gf gives large error In DLR Documentation, be more clear about which functions are representable. Jun 12, 2024
@YannIntVeld
Copy link
Contributor Author

Dear @Wentzell

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants