3
0
mirror of https://github.com/triqs/dft_tools synced 2024-11-01 03:33:50 +01:00

Fix and wrap set_tail_from_fit

The c++ version of the tail fit is wrapped to python. I also changed
slightly the code so that when replace_by_fit is true the data is
changed all the way to the end of the Matsubara axis not only on the
interval where the fit was done.
This commit is contained in:
Michel Ferrero 2014-09-26 12:35:03 +02:00
parent b31f4a0a09
commit d73c1cf00c
2 changed files with 7 additions and 1 deletions

View File

@ -3,6 +3,7 @@ from wrap_generator import *
module = module_(full_name = "pytriqs.gf.local.gf", doc = "Local Green functions ...")
module.add_include("<triqs/gfs.hpp>")
module.add_include("<triqs/gfs/local/functions.hpp>")
module.add_include("<triqs/gfs/local/fit_tail.hpp>")
module.add_include("<triqs/gfs/local/pade.hpp>")
module.add_include("<triqs/gfs/local/legendre_matsubara.hpp>")
module.add_using("namespace triqs::arrays")
@ -367,6 +368,11 @@ g.add_method(name = "set_from_legendre",
signature = "void(gf_view<legendre> gl)",
calling_pattern = "self_c = legendre_to_imfreq(*gl)",
doc = """Fills self with the legendre transform of gl""")
g.add_method(name = "set_tail_from_fit",
signature = "void(tail_view known_moments, int n_moments, int n_min, int n_max, bool replace_by_fit = true)",
calling_pattern = "set_tail_from_fit(self_c, known_moments, n_moments, n_min, n_max, replace_by_fit)",
doc = """Set the tail by fitting""")
# Pure python methods
g.add_pure_python_method("pytriqs.gf.local._gf_imfreq.replace_by_tail")

View File

@ -92,7 +92,7 @@ namespace triqs { namespace gfs { namespace local {
if (replace_by_fit) { // replace data in the fitting range by the values from the fitted tail
int i = 0;
for (auto iw : gf.mesh()) { // (arrays::range(n_min,n_max+1)) {
if ((i >= n_min) && (i <= n_max)) gf[iw] = gf.singularity().evaluate(iw);
if (i >= n_min) gf[iw] = gf.singularity().evaluate(iw);
i++;
}
}