Maxent Utilities

This file defines a bunch of functions that facilitate the use of MaxEnt.

triqs_maxent.maxent_util.get_G_w_from_A_w(A_w, w_points, np_interp_A=None, np_omega=2000, w_min=-10, w_max=10, broadening_factor=1.0)[source]

Use Kramers-Kronig to determine the retarded Green function \(G(\omega)\)

This calculates \(G(\omega)\) from the spectral function \(A(\omega)\). A numerical broadening of \(bf * i\Delta\omega\) is used, with the adjustable broadening factor bf (default is 1). This function normalizes \(A(\omega)\). Use mpi to save time.

Parameters:
A_warray

Real-frequency spectral function.

w_pointsarray

Real-frequency grid points.

np_interp_Aint

Number of grid points A_w should be interpolated on before G_w is calculated. The interpolation is performed on a linear grid with np_interp_A points from min(w_points) to max(w_points).

np_omegaint

Number of equidistant grid points of the output Green function.

w_minfloat

Start point of output Green function.

w_maxfloat

End point of output Green function.

broadening_factorfloat

Factor multiplying the broadening \(i\Delta\omega\)

Returns:
G_wGfReFreq

TRIQS retarded Green function.

triqs_maxent.maxent_util.get_G_tau_from_A_w(A_w, w_points, beta, np_tau)[source]

Calculate \(G(\tau)\) for a given \(A(\omega)\).

Parameters:
A_warray

Real-frequency spectral function.

w_pointsarray or maxent mesh

Real-frequency grid points.

betafloat

Inverse Temperature.

np_tauint

Number of equidistant grid points of the output Green function. The tau grid runs from 0 to beta.

Returns:
G_tauGfImTime

TRIQS imaginary-time Green function.

triqs_maxent.maxent_util.numder(fun, x, delta=1e-06)[source]

Calculate the numerical derivative (i.e., Jacobian) of fun around x.

Parameters:
funfunction

a function \(\mathbb{R}^n \to \mathbb{R}\)

xarray

the function argument where the numerical derivative should be evaluated

deltafloat

the \(\Delta x\) that is used in the approximation of the derivative

triqs_maxent.maxent_util.check_der(f, d, around, renorm=False, prec=1e-08, name='')[source]

check whether d is the analytical derivative of f by comparing with the numerical derivative

Parameters:
ffunction

we want to calculate the derivative of this function; a function \(\mathbb{R}^n \to \mathbb{R}\) of \(x\)

dfunction

a function \(\mathbb{R}^n \to \mathbb{R}^n\) which gives the analytic derivative of \(f\) with respect to the elements of \(x\)

renormbool or float

if bool: if False, do not renormalize, if True: renormalize by the function value; if float, renormalize by the value of the float; this allows to get some kind of relative error

precfloat

the precision of the check, i.e. if the error is larger than prec, a warning will be issued

namestr

the name; this will be used in the error message if the derivatives are not equal to allow you to identify the culprit