Other functions¶
List of other functions in pyqcm¶
- exception OutOfBoundsError¶
- exception TooManyIterationsError(max_iteration)¶
- exception SolverError¶
- exception MissingArgError¶
- exception MinimizationError¶
- exception ParseError¶
- class double_counting(e, V, n, coeff, e0)¶
Class used to correct the value of band energies and chemical potential as a function of interaction strength
\[e = e_0 + c V \langle n\rangle\]- Parameters:
e (str) – name of the kinetic operator to shift (e.g. a band energy)
V (str) – name of the interaction operator causing the shift
n (str) – name of the operator whose average will cause the shift
coeff (float) – coefficient c in the correction formula above
e0 (float) – bare value of the kinetic operator (before correction)
- correction(I)¶
Applies the double counting corretion to the model instance I. Changes the parameter_set taking into account the average values within the instance I
- Parameters:
I – instance of the lattice model
- set_global_parameter(name, value=None)¶
Sets the value of a global parameter. If the global parameter is Boolean, then value is True by default and should not be specified.
- Parameters:
name (str) – name of the global option
value – value of that option (None, int, float or str)
- Returns:
None
- set_wavevector_grid(nkx, nky, nkz)¶
Sets the number of wavevectors along each direction of the fixed wavevector grid used by grid integration routines. If this function is never called, the grid defaults to (kgrid_side, kgrid_side, kgrid_side), where
kgrid_sideis a global parameter.
- get_global_parameter(name)¶
Gets the value of a global parameter.
- Parameters:
name (str) – name of the global option
- Returns:
the value, according to type
- wavevector_path(n=32, shape='triangle')¶
Builds a wavevector path and associated tick marks
- Parameters:
n (int) – number of wavevectors per segment
shape (str) – the geometry of the path, one of: line, halfline, triangle, diagonal, graphene, graphene2, tri, cubic, cubic2, tetragonal, tetragonal2 OR a tuple with two wavevectors for a straight path between the two OR a filename ending with “.tsv”. In the latter case, the file contains a tab-separated list of wavevectors (in units of pi) and tick marks: the first three columns are the x,y,z components of the wavevectors, and the last columns the strings (possibly latex) for the tick marks (write - in that column if you do not want a tick mark for a specific wavevector).
- Returns tuple:
a ndarray of wavevectors 2) a list of tick positions 3) a list of tick strings
- mdc_wavevector_grid(n=100, orig=[-1.0, -1.0], side=2, k_perp=0, plane='z')¶
Produces a set of wavevectors for a MDC
- Parameters:
- Returns:
ndarray of wavevectors (n*n x 3), in units of 2*pi
- orbital_manager(orbitals, from_zero=False, spin_split=False)¶
Returns a list of orbital indices into the Green function / dispersion matrix. With mixing == 2 (spin flip), the matrix is 2*nband x 2*nband, with both spin sectors entangled. By default, when orbitals=None this returns indices over the full 2*nband range so that callers summing diagonal elements pick up both spin sectors.
- print_options(opt=0)¶
Prints the list of global parameters on the screen
- Parameters:
opt (int) – 0 -> prints to screen. 1 -> prints to latex. 2 -> prints to RST
- frequency_array(wmax=6.0, eta=0.05, imaginary=False)¶
Returns an array of complex frequencies for plotting spectral quantities
- banner(s, c='-', skip=0)¶
Pretty-prints a banner (one line across) on the screen with a message
- varia_table(var, val)¶
Pretty prints a list of variational parameters and values in a table form, grouped by cluster. For screen output in CDMFT and VCA.
- epsilon(y, pr=False)¶
Performs the epsilon algorithm for accelerated convergence (e.g. in CDMFT)
- fixed_point_iteration(F, x0, xtol=1e-06, convergence_test=None, maxiter=32, miniter=0, alpha=0.0, eps_algo=0)¶
Performs the fixed point iteration algorithm for a set of nonlinear equations with customized convergence tests
- Parameters:
F (function) – vector-valued nonlinear function whose roots are desired
x0 ([float]) – initial point
xtol (float) – tolerance for convergence on the variables
convergence_test (function) – function called to perform custom convergence tests. Returns True if converged
maxiter (int) – maximum number of iterations
miniter (int) – minimum number of iterations
alpha (float) – damping coefficient
eps_algo (int) – number of elements in the epsilon algorithm convergence accelerator = 2*eps_algo + 1 (0 = no acceleration)
- Returns:
the solution, the number of iterations
- Return type:
- broyden(F, x0, iJ0=0.0, xtol=1e-06, convergence_test=None, maxiter=32, miniter=0)¶
Performs the Broyden algorithm with customized convergence tests
- Parameters:
F (function) – vector-valued nonlinear function whose roots are desired
x0 ([float]) – initial point
iJ0 (float) – initial guess for the inverse jacobian ((1+iJ0)*unit matrix if float, otherwise a matrix being the actual initial inverse Jacobian)
xtol (float) – tolerance for convergence on the variables
convergence_test (function) – function called to perform custom convergence tests. Returns True if converged
maxiter (int) – maximum number of iterations
miniter (int) – minimum number of iterations
- Returns:
the solution, the number of iterations needed, the concerged inverse Jacobian
- Return type:
- general_interaction_matrix_elements(e, n)¶
Translates a list of matrix elements (i,j,k,l,v) for a general interaction into a list of compound elements (I,J,v) where I = i+n*j and J = k+n*l and v is the value of the matrix element Also checks that only non redundant elements are given. A sum over spin for the Coulomb interaction est performed.
- is_sequence(obj)¶
Tests whether an object is a sequence (list, tuple or ndarray)
- read_model_instance(filename)¶
Reconstructs a model and its solved instance from an HDF5 file written by
model_instance.write_all_hdf5().The model definition stored in the file is executed as Python code in the caller’s global namespace (defining
model,clus0, … there). The parameters collected from all cluster groups are then passed tomodel.set_parameters(), a newmodel_instanceis created, and all cluster data are loaded from the file with their stored parameter values.- Parameters:
filename (str) – path to the HDF5 file
- Returns:
the reconstructed
model_instance
- reset_model()¶
Resets the lattice model. In other words, all cluster models, clusters and the content of the lattice_model object (including the parameter_set) are reset to void. Useful if one wants to conduct simulations with a new model without quitting Python.
- print_statistics()¶
Prints various internal statistics (number of evaluations of certains quantities, etc.)
- track_bands_with_overlaps(E, psi, diff_coeff=0.0)¶
Helper function used in plotting fat bands in order to identify band crossings
:para E[k, n] energies :param psi[k, n, :] eigenvectors (normalized)
- legendre_frequency_grid(w1, w2, n1, n2, n3)¶
returns a frequency grid (along the positive imaginary axis) tailored for integration. It is a Gauss-Legendre grid of n1, n2 and n3 points in each of the intervals [0,w1], [w1,w2] and [w2,infinity]
:param float w1 : low-frequency boundary :param float w2 : high-frequency boundary :param int n1: number of points from 0 to w1 :param int n2: number of points from w1 to w2 :param int n3: number of points from w2 to infinity
- regular_frequency_grid(wc, n1, n2)¶
returns a frequency grid (along the positive imaginary axis) tailored for integration. It is a uniform grid of n1 points in the interval [0,wc] and n2 points in the inverse interval [0,1/wc] for 1/w Uses the trapezoidal rule.
:param float wc : frequency boundary :param int n1 : number of points in the low-frequency interval :param int n2 : number of points in the high-frequency interval
- discrete_integration_grid(freqs, weights)¶
Defines a frequency grid and associated weights for fixed-grid integration instead of using cubature.
When set (i.e.
len(freqs) > 0), the following frequency-momentum integrals are evaluated on this discrete grid (and on the k-grid set byset_wavevector_gridor the globalkgrid_side) instead of via adaptive cubature:lattice averages (
averages())the Potthoff functional (
Potthoff_functional())
Pass empty arrays to clear the grid and revert to adaptive cubature.
- Parameters:
freqs (array) – array of frequencies along the Matsubara axis
weights (array) – associated weights (typically include the
1/pifactor from the standard imaginary-frequency integral)