dmft_tools.convergence

contain helper functions to check convergence

dmft_tools.convergence.calc_convergence_quantities(sum_k, general_params, conv_obs, observables, solvers, G0_old, G_loc_all, Sigma_freq_previous)[source]

Calculations convergence quantities, i.e. the difference in observables between the last and second to last iteration.

Parameters:
sum_kSumK Object instances
general_paramsdict

general parameters as a dict

conv_obslist of dicts

convergence observable arrays

observableslist of dicts

observable arrays

solverssolver objects
G0_oldlist of block Gf object

last G0_freq

G_loc_alllist of block Gf objects

G_loc extracted from before imp solver

Sigma_freq_previouslist of block Gf objects

previous impurity sigma to compare with

Returns:
conv_obslist of dicts

updated convergence observable arrays

dmft_tools.convergence.check_convergence(n_inequiv_shells, general_params, conv_obs)[source]

check last iteration for convergence

Parameters:
n_inequiv_shellsint

Number of inequivalent shells as saved in SumkDFT object

general_paramsdict

general parameters as a dict

conv_obslist of dicts

convergence observable arrays

Returns:
is_convergedbool

true if desired accuracy is reached. None if no convergence criterion is set

dmft_tools.convergence.max_G_diff(G1, G2, norm_temp=True)[source]

calculates difference between two block Gfs uses numpy linalg norm on the last two indices first and then the norm along the mesh axis. The result is divided by sqrt(beta) for MeshImFreq and by sqrt(beta/#taupoints) for MeshImTime.

1/ (2* sqrt(beta)) sqrt( sum_n sum_ij [abs(G1 - G2)_ij(w_n)]^2 )

this is only done for MeshImFreq Gf objects, for all other meshes the weights are set to 1

Parameters:
G1Gf or BlockGf to compare
G2Gf or BlockGf to compare
norm_temp: bool, default = True

divide by an additional sqrt(beta) to account for temperature scaling only correct for uniformly distributed error.

__Returns:__
difffloat

difference between the two Gfs

dmft_tools.convergence.prep_conv_file(general_params, sum_k)[source]

Writes the header to the conv files

Parameters:
general_paramsdict

general parameters as a dict

n_inequiv_shellsint

number of impurities for calculations

__Returns:__
nothing
dmft_tools.convergence.prep_conv_obs(h5_archive)[source]

prepares the conv arrays and files for the DMFT calculation

Parameters:
h5_archive: hdf archive instance

hdf archive for calculation

__Returns:__
conv_obsdict

conv array for calculation

dmft_tools.convergence.write_conv(conv_obs, sum_k, general_params)[source]

writes the last entries of the conv arrays to the files

Parameters:
conv_obslist of dicts

convergence observable arrays/dicts

sum_kSumK Object instances
general_paramsdict
__Returns:__
nothing