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 system 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 (or Hamiltonians, if there are more than one system per cluster). 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 system label (from 1 to the number of systems \(N_\mathrm{sys}\)). 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 (assuming one system per cluster). 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. If the trivial irrep R0 is desired, its presence is optional, so that R0:N4:S0 and N4:S0 are equivalent.

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 searched 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 or PRIMME method is used and the global parameter n_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 (bool) – True if the instance has a complex-valued state, as opposed to real

reset()

Resets the model instance to the current parameters, with the same label

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)

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

qmatrix(sys=0)

Returns the Lehmann representation of the Green function

Parameters:

sys (int) – label of the system (0-based)

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

combined_mcf(sys=0, k=None, pr=False)

Returns the combined matrix continued fraction (MCF) for the cluster Green function.

The combined MCF encodes G = G_e + G_h^T in a single object whose evaluate() gives the full Green function directly.

Only available when GF_method has been set to 'M' and the global parameter combine_mcf is True. Raises an exception otherwise.

Parameters:
  • sys (int) – label of the system (0-based)

  • k – wavevector (ndarray(3)). If None, cluster mfc is returned

  • pr (bool) – if True, prints the MCF blocks in addition to returning them

Returns:

3-tuple (W, A, B) where

  • W(L, L) complex ndarray, weight matrix

  • A – list of M (L, L) complex ndarrays, diagonal blocks

  • B – list of M (L, L) complex ndarrays, off-diagonal QR blocks

L is the dimension of the Green function, M is the number of floors.

write_hdf5(filename, sys=0)

Writes the solved cluster model instance to an HDF5 file.

The data for system sys is stored inside an HDF5 group named "cluster_{sys}" within filename. The file is created if it does not yet exist; if it does, the group is added to it.

Parameters:
  • filename (str) – path to the HDF5 file

  • sys (int) – label of the system (0-based)

Returns:

None

read_hdf5(filename, sys=0, set_parameters=False)

Reads the solved cluster model instance from an HDF5 file previously written by write_hdf5().

Parameters:
  • filename (str) – path to the HDF5 file

  • sys (int) – label of the system (0-based)

  • set_parameters (bool) – if True, update the model parameters to the values stored in the file before loading the solution.

Returns:

None

write_all_hdf5(filename)

Writes the solved model instance (all clusters) to a single HDF5 file.

Each cluster is stored in its own group "cluster_0", "cluster_1", … within filename. The full model definition (as executable Python code) is stored as the root attribute "model_definition" of the HDF5 file.

Parameters:

filename (str) – path to the HDF5 file

Returns:

None

read_all_hdf5(filename, set_parameters=False)

Reads the solved model instance (all clusters) from a single HDF5 file previously written by write_all_hdf5().

Parameters:
  • filename (str) – path to the HDF5 file

  • set_parameters (bool) – if True, update the model parameters to the values stored in the file before loading the solution.

Returns:

None

parameters(param=None)

Returns the values of the parameters of the instance (as opposed to the parameter_set object)

Returns:

a dict {string,float}

averages(ops=None, file='averages.tsv', pr=False)

Computes the lattice averages of the operators present in the model

Parameters:
  • ops ([str]) – list of operators to compute the average of. If empty, then computes the averages of all one-body operators.

  • 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}

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 (bool) – true is the spin down sector is to be computed (applies if mixing = 4)

  • blocks (bool) – true if returned in the basis of irreducible representations

Returns:

a complex-valued matrix

cluster_hopping_matrix(clus=0, spin_down=False)

Returns the one-body matrix of cluster no i

Parameters:
  • clus – label of the cluster (0 to the number of clusters - 1)

  • spin_down (bool) – True is the spin down sector is to be computed (applies if mixing = 4)

Returns:

a complex-valued matrix

write_impurity_problem(s=0, bath_diag=False, file='impurity.tsv')

Writes to a file the data defining the impurity problem

Parameters:
  • s – label of the system (starts at 0)

  • file – name of the output file

write_Green_function(sys=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

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 (bool) – true is the spin down sector is to be computed (applies if mixing = 4)

Returns:

a complex-valued matrix

Green_function_average(sys=0, spin_down=False)

Computes the cluster Green function average (integral over frequencies)

Parameters:
  • sys (int) – label of the system (0-based)

  • spin_down (bool) – true is the spin down sector is to be computed (applies if mixing = 4)

Returns:

a complex-valued matrix

interactions(sys=0)

returns the density-density interactions on a specific cluster

Parameters:

sys (int) – label of the system (0-based)

Returns:

a list of matrix elements tuples (i,j,v)

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 (bool) – 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_grid(iw, ik)

Computes the CPT Green function at a frequency and wavevector indexed in the external hybridization grids. Requires the model to have been created with a non-empty hybrid_file.

Parameters:
  • iw (int) – index of the frequency in the external hybridization frequency array

  • ik (int) – index of the wavevector in the external hybridization wavevector array

Returns:

a complex-valued matrix

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 (bool) – True is the spin down sector is to be computed (applies if mixing = 4)

Returns:

a single or an array of complex-valued matrices

Green_integral(spin_down=False, clus=0)

Computes the frequency-integrated Green function

Parameters:
  • spin_down (bool) – True is the spin down sector is to be computed (applies if mixing = 4)

  • clus (int) – label of the cluster (starts at 1). If clus > 0, integrates the cluster Green function for cluster ‘clus’. If clus = 0, then computes the integral over frequencies of the momentum-integrated CPT Green function. The momentum integration is done on the same regular grid as in CDMFT, as set by the global parameter “kgrid_side”.

Returns:

a complex-valued matrix

dispersion(k, spin_down=False)

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 \(2\pi\)

  • spin_down (bool) – 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.

epsilon(k, spin_down=False)

Computes the hopping matrix (orbital basis) 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 \(2\pi\)

  • spin_down (bool) – True is the spin down sector is to be computed (applies if mixing = 4)

Returns:

a single (ndarray(d,d)) or an array (ndarray(N,d,d)) of complex values. d is the reduced GF dimension.

dos(z, use_grid=False)

computes the density of states at a given frequency.

Parameters:
  • z (complex) – frequency

  • use_grid (bool) – if True, the wavevector integral is done on a fixed regular grid whose size is set by the global parameter “kgrid_side”; otherwise adaptive cubature is used (default).

Returns:

ndarray(d) of real values, d being the reduced GF dimension

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

ground_state(file=None, pr=False, var=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 (bool) – if True, prints the result on the screen

  • var (bool) – if True, prints the variances of the operators as well

Returns:

a list of pairs (float, str) of the ground state energy and sector string, for each cluster of the system

cluster_averages(sys=0, pr=False)

Computes the average and variance of all operators of the cluster model in the cluster ground state.

Parameters:

sys (int) – label of the system

Returns:

a dict str : (float, float) with the averages and variances as a function of operator name

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 (bool) – True is the spin down sector is to be computed (applies if mixing = 4)

Returns:

a pair {poles, residues}, each of poles and residues being itself a list.

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 (bool) – True is the spin down sector is to be computed (applies if mixing = 4)

Returns:

a complex-valued matrix

hybridization_function_sys(z, sys=0, spin_down=False)

Returns the hybridization function for system ‘sys’, relative to the current instance

Parameters:
  • sys (int) – label of the system, relative to the instance (0 to the number of systems-1)

  • z (complex) – frequency

  • spin_down (bool) – True is the spin down sector is to be computed (applies if mixing = 4)

Returns:

a complex-valued matrix

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

instance_parameters()

Returns the values of the parameters in a given instance

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 (bool) – 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 (bool) – true is the spin down sector is to be computed (applies if mixing = 4)

Returns:

a vector of complex numbers

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 (bool) – 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.

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 (bool) – 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.

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 (total for the unit cell, not per site)

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

Green_function_density(sys=0)

Computes the density from the Green function average

Parameters:

clus (int) – label of the cluster (0 to the number of clusters-1)

Returns:

the density

Return type:

float

density_matrix(sites, sys=0)

Computes the density matrix of subsystem A, defined by the array of site indices “sites”

Parameters:
  • sys (int) – label of the system (starts at 0)

  • 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]

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 (bool) – checks the consistency of the Green function

Returns:

the value of the self-energy functional

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

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

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 (bool) – 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

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 (bool) – 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.

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 (bool) – 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.

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 (bool) – True is the spin down sector is to be computed (applies if mixing = 4)

Returns:

a single or an array of complex-valued matrices

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 (bool) – True is the spin down sector is to be computed (applies if mixing = 4)

Returns:

a float

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)

write_summary(f, commented=False)

Writes a summary of the properties of the model instance in a file

Parameters:

f (str) – name of the output file

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.

GS_consistency(check_ground_state=False, threshold=0.0001)

compares the density from the wavefunction and from the Green function

Berry_curvature(nk=200, eta=0.0, period='G', range=None, orb=None, subdivide=False, plane='xy', k_perp=0.0, file=None, data_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.

  • data_file (str) – Name of the file to save the data.

  • plt_ax (matplotlib.axes.Axes) – 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 (matplotlib.axes.Axes) – 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) – number of points on each Berry flux loop

  • radius (float) – radius of the loop used to compute Berry flux at each grid point; defaults to 0.8/nk if None

  • file (str) – Name of the file to save the plot. If None, shows the plot on screen.

  • plt_ax (matplotlib.axes.Axes) – 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

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 ([float]) – wavevector offset of the computation grid (3-component list)

  • orb (int) – the orbital to use in the computation (1 to number of bands). None (default) means a sum over all occupied bands.

  • subdivide (bool) – recursivity flag (wavevector grid subdivision)

Returns float:

The Chern number

Fermi_surface(nk=64, orb=None, zone=((0, 0), 1), 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)

  • zone – origin and half-size of the plot, in multiples of pi. By default ((0,0),1)

  • 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 (matplotlib.axes.Axes) – 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 ‘contour’ function

Returns:

None

G_dispersion(nk=64, orb=None, period='G', contour=False, inv=False, zone=((0, 0), 1), 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 (bool) – True for a contour plot; otherwise a 3D plot.

  • inv (bool) – True if the inverse eigenvalues (inverse energies) are plotted instead

  • zone – origin and half-size of the plot, in multiples of pi. By default ((0,0),1)

  • 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 (matplotlib.axes.Axes) – 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

Luttinger_surface(nk=200, orb=1, zone=((0, 0), 1), 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)

  • zone – origin and half-size of the plot, in multiples of pi. By default ((0,0),1)

  • 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 (matplotlib.axes.Axes) – 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

cluster_spectral_function(w=6, eta=0.05, imaginary=False, clus=0, offset=2, full=False, opt=None, spin_down=False, blocks=False, file=None, plt_ax=None, orbs=None, real_part=False, color='b', **kwargs)

Plots the spectral function of the cluster in the site basis

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 (w[0], w[1]). w can also be an explicit list of real frequencies

  • eta (float) – Lorentzian broadening

  • imaginary (bool) – 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 (bool) – if True, plots off-diagonal components as well

  • self (bool) – 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 (bool) – if True, plots the spin down part, if different

  • blocks (bool) – 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 (matplotlib.axes.Axes) – optional matplotlib axis set, to be passed when one wants to collect a subplot of a larger set

  • orbs ([int]) – list of orbitals to plot (starts at 1). If None, all are included.

  • real_part (bool) – if True, plots the real part instead of the imaginary part.

  • color – matplotlib color of the curves

  • kwargs – keyword arguments passed to the matplotlib ‘plot’ function

Returns:

the array of frequencies, the spectral weight

compute_spectral_function_shared(irange, A_sh_name, A_down_sh_name, w=6.0, eta=0.05, path=None, nk=32, period='G', orb=None, opt='A', Nambu_redress=True, inverse_path=False, verb=False)

Computes 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. This is a shared-memory implementation. The arrays A and A_down are shared across multiple processes.

Parameters:
  • irange ((int,int)) – range of indices of the memory array to treat

  • A_sh_name – name of the memory buffer for the array A

  • A_down_sh_name – name of the memory buffer for the array A_down

  • w (float) – the frequency range is from -w to w if w is a float. If w is a tuple then the range is (w[0], w[1]). w 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

  • period (str) – periodization scheme (‘G’ - default, ‘M’, ‘S’, ‘C’, ‘N’). If ‘N’, deals with a bigger matrix (sites in the repeated unit).

  • nk (int) – the number of wavevectors along each segment of the path (passed to pyqcm.wavevector_path())

  • orb (int) – if not None, only plots the spectral function associated with this orbital number (starts at 1). If None, sums over all orbitals.

  • opt (str) – ‘A’ : spectral function, ‘self’ : self-energy

  • Nambu_redress (bool) – if True, evaluates the Nambu component at the opposite frequency

  • inverse_path (bool) – if True, inverts the path (k –> -k)

  • verb (bool) – if True, print progress report

Returns:

None

gap(k, orb=1, threshold=0.001)

Computes the spectral gap for a series of wavevectors

Parameters:
  • k – set of wavevectors

  • orb (int) – orbital number (starts at 1)

  • threshold (float) – weight below which a Lehmann contribution is deemed zero

Returns:

an array of gap values (or a single float if only one wavevector was given)

Return type:

list or float

mdc(nk=200, eta=0.1, orb=None, spin_down=False, zone=((0, 0), 1), opt='GF', k_perp=0, freq=0.0, max=None, plane='xy', band_basis=False, sym=None, file=None, plt_ax=None, data_file=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 (bool) – true is the spin down sector is to be computed (applies if mixing = 4)

  • zone – origin and half-size of the plot, in multiples of pi. By default ((0,0),1)

  • opt (str) – The quantity to plot. ‘GF’ = Green function, ‘self’ = self-energy, ‘Z’ = quasi-particle weight, ‘anom_phase’ = complex phase of the anomalous Green function element (requires mixing = 1 and orb as a tuple of two orbital indices)

  • 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 (bool) – uses the band basis instead of the orbital basis (for multiband models)

  • sym (str) – symmetrization option for the mdc

  • file (str) – if not None, saves the plot in a file with that name

  • plt_ax (matplotlib.axes.Axes) – optional matplotlib axis set, to be passed when one wants to collect a subplot of a larger set

  • data_file – file to save the data being plotted

  • 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, zone=((0, 0), 1), 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

  • selfenergy (bool) – if True, plots the anomalous self-energy instead of the spectral function

  • im_part (bool) – if True, plots the imaginary part instead of the real part

  • zone – origin and half-size of the plot, in multiples of pi. By default ((0,0),1)

  • 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 (matplotlib.axes.Axes) – 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

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 (bool) – True if subdivision is allowed (False by default)

Returns:

the monopole charge

Return type:

float

monopole_map(nk=40, nk_cube=5, 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

  • nk_cube (int) – number of wavevector grid points on each side of each cube around each point

  • 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 (matplotlib.axes.Axes) – 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

plot_dispersion(nk=64, spin_down=False, orb=None, contour=False, datafile=None, zone=((0, 0), 1), 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 (bool) – 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 (bool) – 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.

  • zone – origin and half-size of the plot, in multiples of pi. By default ((0,0),1)

  • 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 (matplotlib.axes.Axes) – 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_DoS(w, eta=0.1, sum=False, progress=True, labels=None, colors=None, file=None, data_file='dos.tsv', plt_ax=None, spin_up=False, use_grid=True, **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 (w[0], w[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 (bool) – if True, the sum of the DoS of all lattice orbitals is plotted in addition to each orbital individually

  • progress (bool) – 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

  • data_file (str) – saves the data in a file with that name

  • plt_ax (matplotlib.axes.Axes) – optional matplotlib axis set, to be passed when one wants to collect a subplot of a larger set

  • spin_up (bool) – only plots the spin up bands, even if mixing is nonzero

  • use_grid (bool) – if True, the wavevector integral is performed on a fixed regular grid (size set by global parameter “kgrid_side”) instead of adaptive cubature

  • kwargs – keyword arguments passed to the matplotlib ‘plot’ function

Returns:

w, A : the complex frequency array and the DoS array

plot_host_hybrid(w, e, clus=0, sys=None, file=None, plt_ax=None, title=None, ylim=None, **kwargs)

Plots a comparison between the host function and the hybridization function

Parameters:
  • w ([float]) – array of frequencies used

  • e ((int,int)) – matrix element to plot (zero based)

  • clus (int) – cluster label (starts at 0)

  • sys – if not None, lable of the specific system. If None, then used the remixed hybridization function

  • title (str) – optional title for the plot, displayed when plt_ax is None

  • file (str) – if not None, saves the plot in a file with that name

  • plt_ax (matplotlib.axes.Axes) – 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_hybridization_function(w=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:
  • w (float) – the frequency range is from -w to w if w is a float. If w is a tuple then the range is (w[0], w[1]). w can also be an explicit list of real frequencies

  • eta (float) – Lorentzian broadening

  • imaginary (bool) – If True, the frequency range is along the imaginary frequency axis

  • clus (int) – cluster index (starts at 0)

  • realpart (bool) – 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 (matplotlib.axes.Axes) – 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, zone=((0, 0), 1), 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

  • zone – origin and half-size of the plot, in multiples of pi. By default ((0,0),1)

  • 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 (matplotlib.axes.Axes) – 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)

plot_spectral_function(w, A, A_down, path=None, nk=32, offset=2, opt='A', inverse_path=False, title=None, file=None, plt_ax=None, style=None, **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:
  • w (ndarray) – array of complex frequencies, from ‘compute_spectral_function()’

  • A (ndarray) – spectral function data, from ‘compute_spectral_function()’

  • A_down (ndarray) – spectral function data (spin down), from ‘compute_spectral_function()’

  • 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_path())

  • offset (float) – vertical offset in the plot between the curves associated to successive wavevectors

  • opt (str) – ‘A’ : spectral function, ‘self’ : self-energy, ‘selfabs’ : module of the self-energy

  • inverse_path (bool) – 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 (matplotlib.axes.Axes) – optional matplotlib axis set, to be passed when one wants to collect a subplot of a larger set

  • style (str) – if None, draws the curves for different values of k offset by offset; if ‘3D’, draws a real 3D version of the plot; if ‘color’, draws a colorplot (wavevector on the horizontal axis).

  • kwargs – keyword arguments passed to the matplotlib ‘plot’ function

Returns:

None

segment_dispersion(path=None, nk=64, file=None, plt_ax=None, orb=None, band_assign=False, diff_coeff=0.0, colors=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 (matplotlib.axes.Axes) – 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.

  • band_assign (bool) – if True, assigns band by using the continuity of the eigenvectors

  • diff_coeff (float) – coefficient used to weight velocity differences when tracking bands with overlaps (used only if band_assign is True)

  • colors ([str]) – colors of the different orbitals

  • kwargs – keyword arguments passed to the matplotlib ‘plot’ function

Returns:

None

segment_dispersion_fat(orb, width=True, path=None, nk=64, band_assign=False, diff_coeff=0.0, file=None, data_file=None, plt_ax=None, scale=1, **kwargs)

Plots the dispersion relation in the Brillouin zone along a wavevector path

Parameters:
  • orb – orbital (or sequence of orbitals) to plot. Starts at 1.

  • width (bool) – if True, plots the fat bands with variable width (otherwise uses a gray scale)

  • 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

  • data_file (str) – if not None, saves the data in two files with that prefix

  • plt_ax (matplotlib.axes.Axes) – optional matplotlib axis set, to be passed when one wants to collect a subplot of a larger set

  • scale (float) – relative scale of the fat bands, multiplied by the default, which is one fifieth of the maximum range of vertical data.

  • kwargs – keyword arguments passed to the matplotlib ‘plot’ function

Returns:

None or LineCollection, depending on the value of width

spectral_function(w=6.0, eta=0.05, path=None, nk=32, period='G', orb=None, offset=2, opt='A', Nambu_redress=True, inverse_path=False, title=None, file=None, plt_ax=None, style=None, data_file='spectral_data', **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:
  • w (float) – the frequency range is from -w to w if w is a float. If w is a tuple then the range is (w[0], w[1]). w 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

  • period (str) – periodization scheme (‘G’ - default, ‘M’, ‘S’, ‘C’, ‘N’). If ‘N’, deals with a bigger matrix (sites in the repeated unit).

  • nk (int) – the number of wavevectors along each segment of the path (passed to pyqcm.wavevector_path())

  • 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, ‘selfabs’ : module of the self-energy

  • Nambu_redress (bool) – if True, evaluates the Nambu component at the opposite frequency

  • inverse_path (bool) – 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 (matplotlib.axes.Axes) – optional matplotlib axis set, to be passed when one wants to collect a subplot of a larger set

  • style (str) – if None, draws the curves for different values of k offset by offset; if ‘3D’, draws a real 3D version of the plot; if ‘color’, draws a colorplot (wavevector on the horizontal axis).

  • data_file (str) – name of file where spectral data is written (no extension; it will be added by the code)

  • kwargs – keyword arguments passed to the matplotlib ‘plot’ function

Returns:

None

spectral_function_Lehmann(path=None, 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 (matplotlib.axes.Axes) – 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, zone=((0, 0), 1), 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)

  • zone – origin and half-size of the plot, in multiples of pi. By default ((0,0),1)

  • 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). TODO: not yet implemented; argument currently has no effect.

  • file (str) – if not None, saves the plot in a file with that name

  • plt_ax (matplotlib.axes.Axes) – 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

wavevector_path_2_str(k)

Converts an array of wavevectors to a tab-separated string representation, formatted according to the spatial dimension of the model.

Parameters:

k (numpy.ndarray) – array of wavevectors, shape (N, 3), in units of 2*pi

Returns:

a tab-separated string of wavevector coordinates

Return type:

str