Parameter sets, Hilbert space sectors and model instances¶
Parameter sets¶
Each term in the lattice Hamiltonian is associated with a parameter \(h_a\), and each cluster of the super unit cell has an equal number of parameters, for the corresponding terms of its Hamiltonian. If a bath is added to a cluster, then even more parameters are necessary to specify the cluster Hamiltonian. By default, the values of the cluster parameters are inherited from those of the lattice parameters. But their values may be different if desired. In addition, even within the lattice or within a cluster, one may want to impose automatic constraints between parameters, such as between the Coulomb repulsion \(U\) and the chemical potential \(\mu\), or other constraints coming from accidental symmetries. The large number of parameters and this inheritance of values needs to be managed. This is done via a parameter set.
On a cluster, the name of the operator will received a suffix _i, i being the cluster label (from 1 to the number of clusters \(N_\mathrm{clus}\)). Thus, from a lattice operator t, an operator t_1 will be constructed on cluster #1, and an operator t_2 on cluster #2, and so on. The values of the coefficients of these operators will be designated by the same symbols. This suffix scheme will apply to all operators defined in the model and on the clusters.
The lattice_model object contains a single instance of a structure called parameter_set that can define equivalences between parameters beyond those imposed by default, or release the default constraints. This structure is defined in pyqcm through the member function set_parameters(str).
This may be the most important function of the library. It takes a single, long string argument, for instance:
model.set_parameters("""
t = 1
U = 8
mu = 0.5*U
M = 0
M_1 = 0.1
""")
The values of the parameters are set by the equal sign. Dependent parameters are specified by a multiple of another parameter and the multiplication (*) sign. Note that a prefactor is always required, even when it is unity. Thus, you should write M_2 = 1*M_1 and not M_2=M_1.
Notice that setting a parameter to 0 causes qcm to not create the operator in the model.
Hilbert space sectors¶
For each cluster in the super unit cell, one must specify in which Hilbert space sector to look for the ground state.
Each sector is specified by a Python string indicating which sectors of the Hilbert space must be considered in the exact diagonalization procedure. For instance, if the model conserves the number of particles and the z-component of the spin, the string R0:N4:S0 means that the ground state of the cluster must be looked for in the Hilbert space sector with N=4 electrons and S=0 spin projection. R0 means that the ground state should belong to the trivial representation (labeled 0) of the point group. The spin projection is expressed by an integer \(S = 2 S_z\). Thus, S1 means \(S_z=\frac12\) and S-2 means \(S_z=-1\).
The label of the irreducible representation is taken from the character table of the point group. For instance, in the important case of a \(C_{2v}\) symmetry, each irreducible representation is either even or odd with respect to horizontal and vertical reflections. The binary digits 0 and 1 are associated with even and odd symmetries, respectively. Thus, the binary number 10 = 2 labels a representation that is odd in y and even in x, 01 = 1 labels a representation that is even in y and odd in x, 11 = 3 is odd in both directions and 00=0 is even in both directions. These possibilities are thus represented by the strings R2, R1, R3 and R0, respectively.
Hilbert space sectors are a crucial element of the use of the library and may be the source of physical errors. Performance issues dictate that not all Hilbert space sectors should be checked for the true ground state for every calculation. Some judgement must be applied as to which sector or subset of sectors contains the true ground state. For a given cluster, a subset of sectors may be provided instead of a single one, by separating the sector keywords by slashes ( / ). For instance, the string indicating that the ground state should be search in the sectors of the trivial representation, with N=3 electrons and spin projection -1/2 or 1/2 is R0:N3:S-1/R0:N3:S1. Such a set of possible sectors is then specified with this call:
model.set_target_sectors(['R0:N3:S-1/R0:N3:S1'])
Note that the argument to that function is a list of strings, which in the above example contains a single element because the super unit cell contains a single cluster.
If spin is not conserved because of the presence of spin-flip terms, then the spin label must be omitted. For instance, the string “R0:N4” denotes the sector containing 4 electrons, in the trivial point group representation. An error message will be issued if the user specifies a spin sector in such cases, or inversely if the spin sector is not specified when spin is conserved.
The same is true in cases where particle number is not conserved (superconductivity): the number label must be omitted.
For instance, the string R0:S0 denotes the sector with zero spin, in the trivial point-group representation and an undetermined number of electrons.
When the target Hilbert space sector (or subset of sectors) specified in set_target_sectors(...) does not contain the true ground state, then the Green function computed thereafter will likely have the wrong normalization and analytic properties, because “excited states” obtained from the pseudo ground state by applying creation or annihilation operators may have a lower energy than the latter.
The ED solver has a global real-valued parameter called temperature which allows a certain mixtures of Hilbert space sectors in the density matrix of the system. This temperature must be low, as the ED solver is not a finite-temperature impurity solver. Only a few low-lying states may be computed. Within a Hilbert space sector, only the lowest-energy state will be found, unless the Davidson method is used and the global parameter Davidson_states is set to an integer value greater than one. A finite number of low-energy states will then be computed, and will contribute to the density matrix, provided their Boltzmann weight is larger than some minimum defined by the global parameter minimum_weight. The same applies to states coming from different sectors. This feature allows for a smoother transition between sectors when looping over chemical potential.
Model instances¶
Once a set of parameters has been recorded in the library’s parameter set, one may define an instance of the lattice model by creating an object of type model_instance
I = pyqcm.model_instance(model, lab)
Here model is the lattice model object and lab is a non-negative integer that defines a label for that instance. All computations from the qcm library are performed on a given model instance, associated with particular values of the lattice and cluster parameters. In most cases a single model instance is needed at a given time, so that the label lab is 0 by default. Another call to model_instance(lab) with the same label will erase any previous instance of the model with the same label. Alternately, the member function I.reset() can be called to reset the instance to a blank state with the current values of the parameters in the parameter_set` object.
Computations on a model instance are lazy. For instance, computing the ground state of the cluster is done only when needed, for instance when asking for the ground state averages or the Green function; computing the cluster Green function representation (either Lehmann or through continued fractions) is done only when a Green-function related quantity is needed, etc.
- class model_instance(model)¶
Describes a particular instance of the lattice model, i.e., for a given set of parameters
- Parameters:
model (lattice_model) – the (unique) lattice model
label (int) – a unique label for the model instance. Most of the time the default is fine. Exception when two concurrent instances are needed.
- Variables:
is_complex (boolean) – True if the instance has a complex-valued state, as opposed to real
- Berry_curvature(nk=200, eta=0.0, period='G', range=None, orb=None, subdivide=False, plane='xy', k_perp=0.0, file=None, plt_ax=None, **kwargs)¶
Draws a 2D density plot of the Berry curvature as a function of wavevector, on a square grid going from -pi to pi in each direction.
- Parameters:
nk (int) – number of wavevectors on the side of the grid
eta (float) – imaginary part of the frequency at zero, i.e., w = eta*1j
period (str) – type of periodization used (e.g. ‘G’, ‘M’, ‘None’)
range (list) – range of plot [originX, originY, side], in multiples of pi
orb (int) – the orbital to use in the computation (1 to number of bands). None (default) means a sum over all bands.
subdivide (int) – True if plaquette subdivision is used.
k_perp (float) – momentum component in the third direction (x pi)
plane (str) – momentum plane, ‘xy’=’z’, ‘yz’=’x’=’zy’ or ‘xz’=’zx’=’y’
file (str) – Name of the file to save the plot. If None, shows the plot on screen.
plt_ax – optional matplotlib axis set, to be passed when one wants to collect a subplot of a larger set
kwargs – keyword arguments passed to the matplotlib ‘plot’ function
- Returns:
the contourplot object of matplotlib
- Berry_field_map(nk=40, nsides=4, plane='z', k_perp=0.0, orb=None, file=None, plt_ax=None, **kwargs)¶
Creates a plot of the Berry flux as a function of wavevector
- Parameters:
nk (int) – number of wavevector grid points on each side
nsides (int) – number of sides of the polygon used to compute the circulation of the Berry field.
plane (str) – momentum plane, ‘xy’=’z’, ‘yz’=’x’=’zy’ or ‘xz’=’zx’=’y’
k_perp (str) – offset in wavevector in the direction perpendicular to the plane (x pi)
orb (int) – the orbital to use in the computation (1 to number of bands). None (default) means a sum over all bands.
file (str) – Name of the file to save the plot. If None, shows the plot on screen.
plt_ax – optional matplotlib axis set, to be passed when one wants to collect a subplot of a larger set
kwargs – keyword arguments passed to the matplotlib ‘plot’ function
- Returns:
the contourplot object of matplotlib, the quiver object of matplotlib
- Berry_flux(k0, R, nk=40, plane='xy', orb=None)¶
Computes the integral of the Berry connexion along a closed circle
- Parameters:
k0 (int) – center of the circle
R (float) – radius of the circle
nk (int) – number of wavevectors on the circle
plane (str) – momentum plane, ‘xy’=’z’, ‘yz’=’x’=’zy’ or ‘xz’=’zx’=’y’
orb (int) – the orbital to use in the computation (1 to number of bands). None (default) means a sum over all bands.
- Returns float:
the flux
- Berry_flux_map(nk=40, plane='z', dir='z', k_perp=0.0, orb=None, npoints=4, radius=None, file=None, plt_ax=None, **kwargs)¶
Creates a plot of the Berry flux as a function of wavevector
- Parameters:
nk (int) – number of wavevector grid points on each side
plane (str) – momentum plane, ‘xy’=’z’, ‘yz’=’x’=’zy’ or ‘xz’=’zx’=’y’
dir (str) – direction of flux, ‘xy’=’z’, ‘yz’=’x’=’zy’ or ‘xz’=’zx’=’y’
k_perp (str) – offset in wavevector in the direction perpendicular to the plane (x pi)
orb (int) – the orbital to use in the computation (1 to number of bands). None (default) means a sum over all bands.
npoints (int) – nombre de points sur chaque boucle
file (str) – Name of the file to save the plot. If None, shows the plot on screen.
plt_ax – optional matplotlib axis set, to be passed when one wants to collect a subplot of a larger set
kwargs – keyword arguments passed to the matplotlib ‘plot’ function
- Returns:
the contourplot object of matplotlib
- CPT_Green_function(z, k, spin_down=False)¶
Computes the CPT Green function at a given frequency
- Parameters:
z – complex frequency
k – single wavevector (ndarray(3)) or array of wavevectors (ndarray(N,3)) in units of \(2\pi\)
spin_down (boolean) – True is the spin down sector is to be computed (applies if mixing = 4)
- Returns:
a single or an array of complex-valued matrices
- CPT_Green_function_inverse(z, k, spin_down=False)¶
Computes the inverse CPT Green function at a given frequency
- Parameters:
z – complex frequency
k – array of wavevectors (ndarray(N,3)) in units of \(2\pi\)
spin_down (boolean) – True is the spin down sector is to be computed (applies if mixing = 4)
- Returns:
a single or an array of complex-valued matrices
- Chern_number(nk=100, eta=0.0, period='G', offset=[0.0, 0.0, 0.0], orb=None, subdivide=False)¶
Computes the Chern number by summing the Berry curvature over wavevectors on a square grid going from (0,0) to (pi,pi)
- Parameters:
nk (int) – number of wavevectors on the side of the grid
eta (float) – imaginary part of the frequency at zero, i.e., w = eta*1j
period (str) – type of periodization used (e.g. ‘G’, ‘M’, ‘None’)
offset (wavevector) – wavevector offset of the computation grid
orb (int) – the orbital to use in the computation (1 to number of bands). None (default) means a sum over all occupied bands.
subdivide (boolean) – recursivity flag (wavevector grid subdivision)
- Returns float:
The Chern number
- Fermi_surface(nk=64, orb=None, quadrant=False, plane='xy', k_perp=0.0, file=None, plt_ax=None, **kwargs)¶
Plots the Fermi surface of the non-interacting model (2D)
- Parameters:
nk (int) – number of wavevectors on each side of the grid
orb (int) – if None, plots all the orbitals. Otherwise just plots the FS for that orbital (starts at 1)
quadrant (boolean) – if True, plots the first quadrant of a square Brillouin zone only
plane (str) – momentum plane, ‘xy’=’z’, ‘yz’=’x’=’zy’ or ‘xz’=’zx’=’y’
k_perp (float) – momentum component in the third direction (in multiple of \(\pi\))
file (str) – if not None, saves the plot in a file with that name
plt_ax – optional matplotlib axis set, to be passed when one wants to collect a subplot of a larger set
kwargs – keyword arguments passed to the matplotlib ‘plot’ function
- Returns:
None
- GS_consistency(check_ground_state=False)¶
compares the density from the wavefunction and from the Green function
- G_dispersion(nk=64, orb=None, period='G', contour=False, inv=False, quadrant=False, datafile=None, max=None, k_perp=0.0, plane='xy', file=None, plt_ax=None, **kwargs)¶
Plots the eigenvalues of the inverse Green function at zero frequency
- Parameters:
nk (int) – number of wavevectors on each side of the grid
orb (int) – if 0, plots all the orbitals. Otherwise just shows the plot for that orbital (starts at 1)
period (str) – periodization scheme (‘G’, ‘M’)
contour (boolean) – True for a contour plot; otherwise a 3D plot.
inv (boolean) – True if the inverse eigenvalues (inverse energies) are plotted instead
quadrant (boolean) – if True, plots the first quadrant of a square Brillouin zone only
datafile (str) – if different from None, just writes the data in a file and does not plot
max (float) – energy range (from -max to max)
k_perp (float) – momentum component in the third direction (in multiple of \(pi\))
plane (str) – momentum plane, ‘xy’=’z’, ‘yz’=’x’=’zy’ or ‘xz’=’zx’=’y’
file (str) – if not None, saves the plot in a file with that name
plt_ax – optional matplotlib axis set, to be passed when one wants to collect a subplot of a larger set
kwargs – keyword arguments passed to the matplotlib ‘plot’ function
- Returns:
None
- Green_function_average(clus=0, spin_down=False)¶
Computes the cluster Green function average (integral over frequencies)
- Parameters:
clus (int) – label of the cluster (0 to the number of clusters-1)
spin_down (boolean) – true is the spin down sector is to be computed (applies if mixing = 4)
- Returns:
a complex-valued matrix
- Green_function_density(clus=0)¶
Computes the density from the Green function average
- Parameters:
clus (int) – label of the cluster (0 to the number of clusters-1)
- Return (float):
the density
- Green_function_solve()¶
Usually, the Green function representation is computed only when needed, in a just-in-time fashion (i.e. in a lazy way). This forces the computation of the Green function representation for the current instance (i.e. non lazy).
- Returns:
None
- Lehmann_Green_function(k, orb=1, spin_down=False)¶
Computes the Lehmann representation of the periodized Green function for a set of wavevectors
- Parameters:
k – single wavevector (ndarray(3)) or array of wavevectors (ndarray(N,3)) in units of \(2\pi\)
orb (int) – orbital index (starts at 1)
spin_down (boolean) – True is the spin down sector is to be computed (applies if mixing = 4)
- Returns:
a list of pairs {poles, residues}, each of poles and residues being itself a list.
- Luttinger_surface(nk=200, orb=1, quadrant=False, k_perp=0, plane='xy', file=None, plt_ax=None, **kwargs)¶
Plots the Luttinger surface (zeros of the Green function) in the Brillouin zone (2D)
- Parameters:
nk (int) – number of wavevectors on each side of the grid
orb (int) – orbital number (starts at 1)
quadrant (boolean) – if True, plots the first quadrant of a square Brillouin zone only
k_perp (float) – for 3D models, value of the component of k perpendicular to the plane
plane (str) – for 3D models, plane of the plot (‘z’=’xy’, ‘y’=’xz’, ‘x=’yz’)
file (str) – if not None, saves the plot in a file with that name
plt_ax – optional matplotlib axis set, to be passed when one wants to collect a subplot of a larger set
kwargs – keyword arguments passed to the matplotlib ‘plot’ function
- Returns:
None
- Potthoff_functional(hartree=None, file='sef.tsv', symmetrized_operator=None, consistency_check=False)¶
Computes the Potthoff functional for a given instance
- Parameters:
hartree ([hartree]) – Hartree approximation couplings (see pyqcm/hartree.py)
file (str) – name of the file to append with the result
symmetrized_operator (str) – name of an operator wrt which the functional must be symmetrized
consistency_check (boolean) – checks the consistency of the Green function
- Returns:
the value of the self-energy functional
- QP_weight(k, eta=0.01, orb=1, spin_down=False)¶
Computes the k-dependent quasi-particle weight from the self-energy derived from the periodized Green function
- Parameters:
k – single wavevector (ndarray(3)) or array of wavevectors (ndarray(N,3)) in units of \(2\pi\)
eta (float) – increment in the imaginary axis direction used to computed the derivative of the self-energy
orb (int) – orbital index (starts at 1)
spin_down (boolean) – True is the spin down sector is to be computed (applies if mixing = 4)
- Returns:
a single float or an array of floats, depending on the shape of k
- V_matrix(z, k, spin_down=False)¶
Computes the matrix \(V=G_0^{-1}-G^{c-1}_0\) at a given frequency and wavevectors, where \(G_0\) is the noninteracting Green function on the infinite lattice and \(G^c_0\) is the noninteracting Green function on the cluster.
- Parameters:
z (complex) – frequency
k (wavevector) – wavevector (ndarray(3)) in units of \(2\pi\)
spin_down (boolean) – True is the spin down sector is to be computed (applies if mixing = 4)
- Returns:
a single (d,d) or an array (N,d,d) of complex-valued matrices. d is the reduced GF dimension.
- averages(ops=[], file='averages.tsv', pr=False)¶
Computes the lattice averages of the operators present in the model
- Parameters:
file (str) – name of the file in which the information is appended
- Returns:
a dict giving the values of the averages for each parameter
- Return type:
{str,float}
- band_Green_function(z, k, spin_down=False)¶
Computes the periodized Green function at a given frequency and wavevectors, in the band basis (defined in the noninteracting model). It only differs from the periodized Green function in multi-band models.
- Parameters:
z (complex) – frequency
k – single wavevector (ndarray(3)) or array of wavevectors (ndarray(N,3)) in units of \(2\pi\)
spin_down (boolean) – true is the spin down sector is to be computed (applies if mixing = 4)
- Returns:
a single (d,d) or an array (N,d,d) of complex-valued matrices. d is the reduced GF dimension.
- cluster_Green_function(z, clus=0, spin_down=False, blocks=False)¶
Computes the cluster Green function at a given complex frequency
- Parameters:
z (complex) – frequency
clus (int) – label of the cluster (0 to the number of clusters-1)
spin_down (boolean) – true is the spin down sector is to be computed (applies if mixing = 4)
blocks (boolean) – true if returned in the basis of irreducible representations
- Returns:
a complex-valued matrix
- cluster_QP_weight(clus=0, eta=0.01, orb=1, spin_down=False)¶
Computes the cluster quasi-particle weight from the cluster self-energy
- Parameters:
clus (int) – cluster label (starts at 0)
eta (float) – increment in the imaginary axis direction used to computed the derivative of the self-energy
orb (int) – orbital index (starts at 1)
spin_down (boolean) – True is the spin down sector is to be computed (applies if mixing = 4)
- Returns:
a float
- cluster_averages(clus=0, pr=False)¶
Computes the average and variance of all operators of the cluster model in the cluster ground state.
- Parameters:
clus (int) – label of the cluster
- Returns:
a dict str : (float, float) with the averages and variances as a function of operator name
- cluster_hopping_matrix(clus=0, spin_down=False, full=0)¶
Returns the one-body matrix of cluster no i
- Parameters:
clus – label of the cluster (0 to the number of clusters - 1)
spin_down (boolean) – True is the spin down sector is to be computed (applies if mixing = 4)
full (boolean) – if True, returns the full hopping matrix, including bath
- Returns:
a complex-valued matrix
- cluster_self_energy(z, clus=0, spin_down=False)¶
Computes the cluster self-energy
- Parameters:
z (complex) – frequency
clus (int) – label of the cluster (0 to the number of clusters -1)
spin_down (boolean) – true is the spin down sector is to be computed (applies if mixing = 4)
- Returns:
a complex-valued matrix
- cluster_spectral_function(wmax=6, eta=0.05, imaginary=False, clus=0, offset=2, full=False, opt=None, spin_down=False, blocks=False, file=None, plt_ax=None, color='b', **kwargs)¶
Plots the spectral function of the cluster in the site basis
- Parameters:
wmax (float) – the frequency range is from -wmax to wmax if w is a float. If wmax is a tuple then the range is (wmax[0], wmax[1]). wmax can also be an explicit list of real frequencies
eta (float) – Lorentzian broadening
imaginary (boolean) – If True, the frequency range is along the imaginary frequency axis
clus (int) – label of the cluster within the super unit cell (starts at 0)
offset (float) – vertical offset in the plot between the curves associated to successive wavevectors
full (boolean) – if True, plots off-diagonal components as well
self (boolean) – if True, plots the self-energy instead of the spectral function
opt (str) – if None, G is computed. Other options are ‘self’ (self-energy) and ‘hyb’ (hybridization function)
spin_down (boolean) – if True, plots the spin down part, if different
blocks (boolean) – if True, gives the GF in the symmetry basis (block diagonal)
file (str) – if not None, saves the plot in a file with that name
plt_ax – optional matplotlib axis set, to be passed when one wants to collect a subplot of a larger set
color – matplotlib color of the curves
kwargs – keyword arguments passed to the matplotlib ‘plot’ function
- Returns:
the array of frequencies, the spectral weight
- density_matrix(sites, clus=0)¶
Computes the density matrix of subsystem A, defined by the array of site indices “sites”
- Parameters:
clus (int) – label of the cluster (0 to the number of clusters-1)
sites ([int]) – list of sites defining subsystem A
- Returns:
the density matrix, the left and right bases (spins up and down)
- Return type:
[complex], [int32], [int32]
- dispersion(k, spin_down=False, label=0)¶
Computes the dispersion relation for a single or an array of wavevectors
- Parameters:
k (wavevector) – single wavevector (ndarray(3)) or array of wavevectors (ndarray(N,3)) in units of \(\pi\)
spin_down (boolean) – True is the spin down sector is to be computed (applies if mixing = 4)
- Returns:
a single (ndarray(d)) or an array (ndarray(N,d)) of real values (energies). d is the reduced GF dimension.
- dos(z)¶
computes the density of states at a given frequency.
- Parameters:
z (complex) – frequency
- Returns:
ndarray(d) of real values, d being the reduced GF dimension
- double_counting_correct(DC)¶
Modifies some kinetic parameters in view of the presence of interactions and averages values, in order to account minimally for double counting.
- Parameters:
DC ([double_counting]) – list of recipes for the correction. Each member is an object of the double_counting type.
- gap(k, orb=1, threshold=0.001)¶
Computes the spectral gap for a series of wavevectors
:param k : set of wavevectors :param int orb : orbital number (starts at 1) :param float threshold : weight below which a Lehmann contribution is deemed zero returns: an array of gap values
- ground_state(file=None, pr=False)¶
Computes the ground state of the cluster(s).
- Parameters:
file (str) – name of the file in which the cluster averages are printed (if not None)
pr (boolean) – if True, prints the result on the screen
- Returns:
a list of pairs (float, str) of the ground state energy and sector string, for each cluster of the system
- hybridization_function(z, clus=0, spin_down=False)¶
Returns the hybridization function for cluster ‘cluster’ and instance ‘label’
- Parameters:
clus (int) – label of the cluster (0 to the number of clusters-1)
z (complex) – frequency
spin_down (boolean) – True is the spin down sector is to be computed (applies if mixing = 4)
- Returns:
a complex-valued matrix
- instance_parameters()¶
Returns the values of the parameters in a given instance
- Returns:
a dict {string,float}
- interactions(clus=0)¶
returns the density-density interactions on a specific cluster
- Parameters:
clus – label of the cluster (starts at 0)
- Returns:
a list of matrix elements tuples (i,j,v)
- mdc(nk=200, eta=0.1, orb=None, spin_down=False, quadrant=False, opt='GF', k_perp=0, freq=0.0, max=None, plane='xy', size=1.0, band_basis=False, sym=None, file=None, plt_ax=None, **kwargs)¶
Plots the spectral weight at zero frequency in the Brillouin zone (2D)
- Parameters:
nk (int) – number of wavevectors on each side of the grid
eta (float) – Lorentzian broadening
orb (int) – if None, sums all the orbitals. Otherwise just shows the weight for that orbital (starts at 1)
spin_down (boolean) – true is the spin down sector is to be computed (applies if mixing = 4)
quadrant (boolean) – if True, plots the first quadrant of a square Brillouin zone only
opt (str) – The quantity to plot. ‘GF’ = Green function, ‘self’ = self-energy, ‘Z’ = quasi-particle weight
k_perp (float) – momentum component in the third direction (in multiple of pi)
freq (float) – frequency at which the spectral function is computed (0 by default)
max (float) – maximum value of the plotting range (if None, maximum of the data)
plane (str) – momentum plane, ‘xy’=’z’, ‘yz’=’x’=’zy’ or ‘xz’=’zx’=’y’
band_basis (boolean) – uses the band basis instead of the orbital basis (for multiband models)
sym (str) – symmetrization option for the mdc
size (float) – size of the plot, in multiple of the default (2 pi on the side)
file (str) – if not None, saves the plot in a file with that name
plt_ax – optional matplotlib axis set, to be passed when one wants to collect a subplot of a larger set
kwargs – keyword arguments passed to the matplotlib ‘plot’ function
- Returns:
the contour plot object
- mdc_anomalous(nk=200, w=0.1j, orbitals=(1, 1), selfenergy=False, im_part=False, quadrant=False, k_perp=0.0, plane='xy', file=None, plt_ax=None, **kwargs)¶
Plots the anomalous Green function or self-energy (2D)
- Parameters:
nk (int) – number of wavevectors on each side of the grid
w (complex) – complex frequency at which the Green function is computed
orbitals (int) – shows the weight for orbitals (b1,b2) (starts at 1), or numpy array of spin-Nambu projection
self (boolean) – if True, plots the anomalous self-energy instead of the spectral function
im_part (boolean) – if True, plots the imaginary part instead of the real part
quadrant (boolean) – if True, plots the first quadrant of a square Brillouin zone only
k_perp (float) – for 3D models, value of the component of k perpendicular to the plane
plane (str) – for 3D models, plane of the plot (‘z’=’xy’, ‘y’=’xz’, ‘x=’yz’)
file (str) – if not None, saves the plot in a file with that name
plt_ax – optional matplotlib axis set, to be passed when one wants to collect a subplot of a larger set
kwargs – keyword arguments passed to the matplotlib ‘plot’ function
- Returns:
None
- momentum_profile(name, k)¶
Computes the momentum-resolved average of an operator
- Parameters:
name (str) – name of the lattice operator
k – array of wavevectors (ndarray(N,3)) in units of \(2\pi\)
- Returns:
an array of values
- monopole(k, a=0.01, nk=20, orb=None, subdivide=False)¶
computes the topological charge of a node in a Weyl semi-metal
- Parameters:
k ([double]) – wavevector, position of the node
a (float) – half-side of the cube surrounding the node
nk (int) – number of divisions along the side of the cube
orb (int) – orbital to compute the charge of (if None, sums over all bands)
subdivide (booleean) – True if subdivision is allowed (False by default)
- Returns:
the monopole charge
- Return type:
float
- monopole_map(nk=40, orb=None, plane='z', k_perp=0.0, file=None, plt_ax=None, **kwargs)¶
Creates a plot of the monopole density (divergence of B) as a function of wavevector
- Parameters:
nk (int) – number of wavevector grid points on each side
plane (str) – momentum plane, ‘xy’=’z’, ‘yz’=’x’=’zy’ or ‘xz’=’zx’=’y’
k_perp (str) – offset in wavevector in the direction perpendicular to the plane (x pi)
orb (int) – the orbital to use in the computation (1 to number of bands). None (default) means a sum over all bands.
file (str) – Name of the file to save the plot. If None, shows the plot on screen.
plt_ax – optional matplotlib axis set, to be passed when one wants to collect a subplot of a larger set
kwargs – keyword arguments passed to the matplotlib ‘plot’ function
- Returns:
the contourplot object of matplotlib
- parameters()¶
Returns the values of the parameters of the instance (as opposed to the parameter_set object)
- Returns:
a dict {string,float}
- periodized_Green_function(z, k, spin_down=False)¶
Computes the periodized Green function at a given frequency and wavevectors
- Parameters:
z (complex) – frequency
k – single wavevector (ndarray(3)) or array of wavevectors (ndarray(N,3)) in units of \(2\pi\)
spin_down (boolean) – true is the spin down sector is to be computed (applies if mixing = 4)
- Returns:
a single (d,d) or an array (N,d,d) of complex-valued matrices. d is the reduced GF dimension.
- periodized_Green_function_element(r, c, z, k, spin_down=False)¶
Computes the element (r,c) of the periodized Green function at a given frequency and wavevectors (starts at 0)
- Parameters:
r (int) – a row index (starts at 0)
c (int) – a column index (starts at 0)
z (complex) – frequency
k – array of wavevectors (ndarray(N,3)) in units of \(2\pi\)
spin_down (boolean) – true is the spin down sector is to be computed (applies if mixing = 4)
- Returns:
a vector of complex numbers
- plot_DoS(w, eta=0.1, sum=False, progress=True, labels=None, colors=None, file=None, data_file='dos.tsv', plt_ax=None, **kwargs)¶
Plots the density of states (DoS) as a function of frequency
- Parameters:
w (float) – the frequency range is from -w to w if w is a float. If w is a tuple then the range is (wmax[0], wmax[1]). w can also be an explicit list of real frequencies, or of complex frequencies (in which case eta is ignored)
eta (float) – Lorentzian broadening, if w is real
sum (boolean) – if True, the sum of the DoS of all lattice orbitals is plotted in addition to each orbital individually
progress (boolean) – if True, prints computation progress
labels ([str]) – labels of the different curves
colors ([str]) – colors of the different curves
file (str) – if not None, saves the plot in a file with that name
plt_ax – optional matplotlib axis set, to be passed when one wants to collect a subplot of a larger set
kwargs – keyword arguments passed to the matplotlib ‘plot’ function
- Returns:
None
- plot_dispersion(nk=64, spin_down=False, orb=None, contour=False, datafile=None, quadrant=False, k_perp=0, plane='xy', file=None, plt_ax=None, view_angle=None, **kwargs)¶
Plots the dispersion relation in the Brillouin zone (2D)
- Parameters:
nk (int) – number of wavevectors on each side of the grid
spin_down (boolean) – True is the spin down sector is to be computed (applies if mixing = 4)
orb (int) – if None, sums all the orbitals. Otherwise just shows the weight for that orbital (starts at 1)
contour (boolean) – True if a contour plot is produced instead of a 3D plot.
datafile (str) – if given, name of the data file (no extension please) in which the data is printed, for plotting with an external program. Does not plot. Will produce one file per orbital, with the .tsv extension.
quadrant (boolean) – if True, plots the first quadrant of a square Brillouin zone only
k_perp (float) – momentum component in the third direction (in multiple of pi)
plane (str) – momentum plane, ‘xy’=’z’, ‘yz’=’x’=’zy’ or ‘xz’=’zx’=’y’
file (str) – if not None, saves the plot in a file with that name
plt_ax – optional matplotlib axis set, to be passed when one wants to collect a subplot of a larger set
view_angle (tuple) – optional projection angle to pass to view_init() in the format of (elevation, azimuth) in degrees
kwargs – keyword arguments passed to the matplotlib ‘plot_surface’ function
- Returns:
None
- plot_host_hybrid(w, e, clus=0, file=None, plt_ax=None, **kwargs)¶
Plots a comparison between the host function and the hybridization function
:param [float] w : array of frequencies used :param (int,int) e: matrix element to plot (zero based) :param int clus: cluster label (starts at 0) :param str file: if not None, saves the plot in a file with that name :param plt_ax: optional matplotlib axis set, to be passed when one wants to collect a subplot of a larger set :param kwargs: keyword arguments passed to the matplotlib ‘plot’ function :return: None
- plot_hybridization_function(wmax=6, eta=0.01, imaginary=False, clus=0, realpart=False, file=None, plt_ax=None, **kwargs)¶
This function plots the imaginary part of the hybridization function Gamma as a function of frequency. Only the diagonal elements are plotted, but for all clusters if there is more than one. The arguments have the same meaning as in plot_spectrum, except ‘realpart’ which, if True, plots the real part instead of the imaginary part.
- Parameters:
wmax (float) – the frequency range is from -wmax to wmax if w is a float. If wmax is a tuple then the range is (wmax[0], wmax[1]). wmax can also be an explicit list of real frequencies
eta (float) – Lorentzian broadening
imaginary (boolean) – If True, the frequency range is along the imaginary frequency axis
clus (int) – cluster index (starts at 0)
realpart (boolean) – if True, the real part of the Green function is shown, not the imaginary part
file (str) – if not None, saves the plot in a file with that name
plt_ax – optional matplotlib axis set, to be passed when one wants to collect a subplot of a larger set
kwargs – keyword arguments passed to the matplotlib ‘plot’ function
- Returns:
None
- plot_momentum_profile(op, nk=50, quadrant=False, k_perp=0.0, plane='xy', file=None, plt_ax=None, **kwargs)¶
Plots the momentum-resolved average of operator op in the Brillouin zone (2D)
- Parameters:
op (str) – name of the lattice operator
nk (int) – number of wavevectors on each side of the grid
quadrant (boolean) – if True, plots the first quadrant of a square Brillouin zone only
k_perp (float) – momentum component in the third direction (in multiple of pi)
plane (str) – momentum plane, ‘xy’=’z’, ‘yz’=’x’=’zy’ or ‘xz’=’zx’=’y’
file (str) – if not None, saves the plot in a file with that name
plt_ax – optional matplotlib axis set, to be passed when one wants to collect a subplot of a larger set
kwargs – keyword arguments passed to the matplotlib ‘plot’ function
- Returns:
None
- plot_profile(n_scale=1, bond_scale=1, current_scale=1, spin_scale=1, spin_angle=0, bond_spin_scale=1, singlet_scale=1, triplet_scale=1, file=None, layer=0)¶
Produces a figure of various local quantities on the repeated unit, from averages computed in the ground state wavefunction
- Parameters:
n_scale (float) – scale factor applied to the density
bond_scale (float) – scale factor applied to the bond charge density
current_scale (float) – scale factor applied to the currents on the bonds
spin_scale (float) – scale factor applied to the spins on the sites
spin_angle (float) – angle at which to draw the spins, from their nominal direction
bond_spin_scale (float) – scale factor applied to the spins on the bonds
singlet_scale (float) – scale factor applied to the singlet pairing amplitudes
triplet_scale (float) – scale factor applied to the triplet pairing amplitudes
file (str) – name of the output file for the plot, if not None
layer (float) – layer number (z coordinate)
- potential_energy()¶
Computes the potential energy for a given instance, as the functional trace of Sigma x G
- Returns:
the value of the potential energy
- print_wavefunction(clus=0, pr=True)¶
Prints the ground state wavefunction(s) on the screen
- Parameters:
clus (int) – label of the cluster (0 to the number of clusters-1)
pr (bool) – prints wavefunction to screen if pr=True
- Returns:
the wavefunction
- Return type:
str
- projected_Green_function(z, spin_down=False)¶
Computes the projected Green function at a given frequency, as used in CDMFT.
- Parameters:
z (complex) – frequency
spin_down (boolean) – true is the spin down sector is to be computed (applies if mixing = 4)
- Returns:
the projected Green function matrix (d x d), d being the dimension of the CPT Green function.
- properties()¶
Returns two strings of properties of a model instance
- Returns:
a pair of strings (the description line and the data line).
- qmatrix(clus=0)¶
Returns the Lehmann representation of the Green function
- Returns:
2-tuple made of 1. the array of M real eigenvalues, M being the number of poles in the representation 2. a rectangular (L x M) matrix (real of complex), L being the dimension of the Green function
- read(S, clus=0)¶
Reads the solution from a string or a file. If the string is less than 32 characters long, it is interpreted as the name of a file in which the solution is read. Otherwise it is interpreted as the solution itself.
- Parameters:
clus – label of the cluster (0 to the number of clusters - 1)
S (str) – long string containing the solution
- Returns:
None
- reset()¶
Resets the model instance to the current parameters, with the same label
- segment_dispersion(path='triangle', nk=64, file=None, plt_ax=None, orb=None, **kwargs)¶
Plots the dispersion relation in the Brillouin zone along a wavevector path
- Parameters:
path (str) – wavevector path, as used by the function wavevector_path()
nk (int) – number of wavevectors on each side of the grid
file (str) – if not None, saves the plot in a file with that name
plt_ax – optional matplotlib axis set, to be passed when one wants to collect a subplot of a larger set
orb – orbital (or sequence of orbitals) to plot. None for all.
kwargs – keyword arguments passed to the matplotlib ‘plot’ function
- Returns:
None
- self_energy(z, k, spin_down=False)¶
Computes the self-energy associated with the periodized Green function at a given frequency and wavevectors
- Parameters:
z (complex) – frequency
k – single wavevector (ndarray(3)) or array of wavevectors (ndarray(N,3)) in units of \(2\pi\)
spin_down (boolean) – True is the spin down sector is to be computed (applies if mixing = 4)
- Returns:
a single (d,d) or an array (N,d,d) of complex-valued matrices. d is the reduced GF dimension.
- site_and_bond_profile()¶
Computes the site and bond profiles in all clusters of the repeated unit
- Returns:
A pair of ndarrays
site profile – the components are x y z n Sx Sy Sz psi.real psi.imag
bond profile – the components are x1 y1 z1 x2 y2 z2 b0 bx by bz d0.real dx.real dy.real dz.real d0.imag dx.imag dy.imag dz.imag
- spectral_average(name, z)¶
Returns the contribution of a frequency to the average of an operator
- Parameters:
name (str) – name of the operator
z (complex) – complex frequency
- Return float:
the contribution of frequency z to the average of the operator
- spectral_function(wmax=6.0, eta=0.05, path='triangle', nk=32, orb=None, offset=2, opt='A', Nambu_redress=True, inverse_path=False, title=None, file=None, plt_ax=None, threeD=False, **kwargs)¶
Plots the spectral function \(A(\mathbf{k},\omega)\) along a wavevector path in the Brillouin zone. This version plots the spin-down part with the correct sign of the frequency in the Nambu formalism.
- Parameters:
wmax (float) – the frequency range is from -wmax to wmax if w is a float. If wmax is a tuple then the range is (wmax[0], wmax[1]). wmax can also be an explicit list of real frequencies
eta (float) – Lorentzian broadening
path (str) – a keyword that is passed to pyqcm.wavevector_path() to produce a set of wavevectors along a path, or a tuple
nk (int) – the number of wavevectors along each segment of the path (passed to pyqcm.wavevector_grid())
orb (int) – if not None, only plots the spectral function associated with this orbital number (starts at 1). If None, sums over all orbitals.
offset (float) – vertical offset in the plot between the curves associated to successive wavevectors
opt (str) – ‘A’ : spectral function, ‘self’ : self-energy, ‘Sx’ : spin (x component), ‘Sy’ : spin (y component)
Nambu_redress (boolean) – if True, evaluates the Nambu component at the opposite frequency
inverse_path (boolean) – if True, inverts the path (k –> -k)
title (str) – optional title for the plot. If None, a string with the model parameters will be used.
file (str) – if not None, saves the plot in a file with that name
plt_ax – optional matplotlib axis set, to be passed when one wants to collect a subplot of a larger set
kwargs – keyword arguments passed to the matplotlib ‘plot’ function
- Returns:
None
- spectral_function_Lehmann(path='triangle', nk=32, orb=1, offset=0.1, lims=None, file=None, plt_ax=None, **kwargs)¶
Plots a Lehmann representation of the spectral function along a wavevector path in the Brillouin zone. Singularities are plotted as impulses with heights proportionnal to the residue.
- Parameters:
path – if a string, keyword passed to pyqcm.wavevector_path() to produce a set of wavevectors; else, explicit list of wavevectors (N x 3 numpy array).
nk (int) – the number of wavevectors along each segment of the path (passed to pyqcm.wavevector_path())
orb (int) – only plots the spectral function associated with this orbital number (starts at 1)
offset (float) – vertical offset in the plot between the curves associated to successive wavevectors
lims ((float,float)) – limits of the plot in frequency (2-tuple)
file (str) – if not None, saves the plot in a file with that name
plt_ax – optional matplotlib axis set, to be passed when one wants to collect a subplot of a larger set
kwargs – keyword arguments passed to the matplotlib ‘plot’ function
- Returns:
None
- spin_mdc(nk=200, eta=0.1, orb=None, quadrant=False, opt='spin', freq=0.0, max=None, k_perp=0, plane='xy', band_basis=False, file=None, plt_ax=None, **kwargs)¶
Plots the spin spectral weight at zero frequency in the Brillouin zone (2D)
- Parameters:
nk (int) – number of wavevectors on each side of the grid
eta (float) – Lorentzian broadening
orb (int) – if None, sums all the orbitals. Otherwise just shows the weight for that orbital (starts at 1)
quadrant (boolean) – if True, plots the first quadrant of a square Brillouin zone only
opt (str) – The quantity to plot. ‘spin’ = spin texture, ‘spins’ = spin texture (saturated), ‘sz’ = z-component, ‘spinp’ = modulus of xy-component
freq (float) – frequency at which the spectral function is computed (0 by default)
max (float) – maximum value of the plotting range (if None, maximum of the data)
k_perp (float) – momentum component in the third direction (in multiple of pi)
plane (str) – momentum plane, ‘xy’=’z’, ‘yz’=’x’=’zy’ or ‘xz’=’zx’=’y’
band_basis – uses the band basis instead of the orbital basis (for multiband models)
file (str) – if not None, saves the plot in a file with that name
plt_ax – optional matplotlib axis set, to be passed when one wants to collect a subplot of a larger set
kwargs – keyword arguments passed to the matplotlib ‘plot’ function
- Returns:
The contour plot object
- spin_spectral_function(freq, k, orb=None)¶
Computes the k-dependent spin-resolved spectral function
- Parameters:
freq – complex freqency
k – single wavevector (ndarray(3)) or array of wavevectors (ndarray(N,3)) in units of \(2\pi\)
orb (int) – if None, sums all the orbitals. Otherwise just shows the weight for that orbital (starts at 1)
- Returns:
depending on the shape of k, a nd.array(3) of nd.array(N,3)
- susceptibility(op_name, freqs, clus=0)¶
Computes the dynamic susceptibility of an operator point by point
- Parameters:
op_name (str) – name of the operator
freqs ([complex]) – array of complex frequencies
clus (int) – label of the cluster (starts at 0)
- Returns:
array of complex susceptibilities
- susceptibility_poles(op_name, clus=0)¶
Computes the Lehmann representation of the dynamic susceptibility of an operator
- Parameters:
name (str) – name of the operator
clus (int) – label of the cluster (starts at 0)
- Returns [(float,float)]:
array of 2-tuple (pole, residue)
- tk(k, spin_down=False)¶
Computes the k-dependent one-body matrix of the lattice model
- Parameters:
k – single wavevector (ndarray(3)) or array of wavevectors (ndarray(N,3)) in units of \(2\pi\)
spin_down (boolean) – True is the spin down sector is to be computed (applies if mixing = 4)
- Returns:
a single or an array of complex-valued matrices
- write(filename, clus=0)¶
Writes the solved cluster model instance to a text file
- Parameters:
filename (str) – name of the file
- Returns:
None
- write_Green_function(clus=0, file='GF.tsv')¶
Writes the Lehmann representation of the Green function to a file
- Parameters:
clus – label of the cluster (0 to the number of clusters - 1)
S (str) – long string containing the solution
clus – label of the cluster (0 to the number of clusters - 1)
file – name of the output file
- write_impurity_problem(clus=0, bath_diag=False, file='impurity.tsv')¶
Writes to a file the data defining the impurity problem
- Parameters:
clus – label of the cluster (0 to the number of clusters - 1)
file – name of the output file
- write_summary(f, suppl_descr=None, suppl_values=None, first_of_series=False)¶
Writes a summary of the properties of the model instance in a file
- Parameters:
f (str) – name of the output file
suppl_descr (str) – additional description fields compared to the standard ones
suppl_values (str) – additional values compared to the standard ones
first_of_series (boolean) – True if the header (description fields) are to be written