Bath Manipulation
These functions manipulate the user-accessible bath array
- edipack2py.global_env.bath_inspect(bath=None, e=None, v=None, d=None, u=None, l=None)[source]
This function translates between the user-accessible continuous bath array and the bath components (energy level, hybridization and so on). It functions in both ways, given the array returns the components and vice-versa. It autonomously determines the type of bath and ED mode.
- Parameters:
bath (np.array(dtype=float)) – The user-accessible bath array
e (np.array(dtype=float)) – an array for the bath levels (
ed_mode=NORMAL, NONSU2, SUPERC). It has dimension [Nspin,Norb,Nbath] forNORMALbath, [Nspin,Nbath] forHYBRIDbathv (np.array(dtype=float)) – an array for the bath hybridizations (
ed_mode=NORMAL, NONSU2, SUPERC). It has dimension [Nspin,Norb,Nbath] forNORMALandHYBRIDbath. ForREPLICAbath it has dimension [Nbath] and forGENERALbath it has dimension [Nbath,Nspin\(\cdot\)Norb]d (np.array(dtype=float)) – an array for the bath anomalous enery levels(
ed_mode=SUPERC). It has dimension [Nspin,Norb,Nbath] forNORMALbath, [Nspin,Nbath] forHYBRIDbathu (np.array(dtype=float)) – an array for the bath spin off-diagonal hybridization (
ed_mode=NONSU2). It has dimension [Nspin,Norb,Nbath] forNORMALandHYBRIDbathl (np.array(dtype=float)) – an array for the linear coefficients of the Replica matrix linear combination (
bath_type=REPLICA,GENERAL). It has dimension [Nbath,Nsym], the latter being the number of terms on the linear combination
- Raises:
ValueError – if both
bathand some amonge,u,v,d,lare provided, none is provided, the shapes are inconsistent or the inputs are inconsistent withbath_typeanded_mode.- Returns:
- Return type:
np.array(dtype=float)
- edipack2py.global_env.break_symmetry_bath(bath, field, sign, save=True)[source]
This function breaks the spin symmetry of the bath, useful for magnetic calculations to incite symmetry breaking. Not compatible with
REPLICAorGENERALbath types.- Parameters:
bath (np.array(dtype=float)) – The user-accessible bath array
field (float) – the magnitude of the symmetry-breaking shift
sign (float or np.array(dtype=float)) – the sign of the symmetry-breaking shift. In the case of real-space DMFT, this function supports an array of floats of the same shape of bath along dimension 0. If a scalar is passed, it is automatically converted into a constant array of the appropriate dimension.
save (bool) – whether to save the symmetry-broken bath for reading
- Returns:
the modified bath array
- Return type:
np.array(dtype=float)
- edipack2py.global_env.chi2_fitgf(*args, ispin=0, iorb=None, fmpi=True)[source]
This function fits the Weiss field or Hybridization function (delta) with a discrete set of level. The fit parameters are the bath parameters contained in the user-accessible array. Depending on the type of system we are considering (normal, superconductive, non-SU(2)) a different set of inputs has to be passed. The specifics of the numerical fitting routines are controlled in the input file.
- Parameters:
args ([np.array(dtype=complex,np.array(dtype=complex), np.array(dtype=float)] or [np.array(dtype=complex, np.array(dtype=float)]) –
The positional arguments are the function(s) to fit and the bath array.
If the system is not superconductive (
ed_mode=NORMALored_mode=NONSU2) the argumens areg: the function to fitbath: the bath
If the system is superconductive (
ed_mode=SUPERC) the arguments areg: the normal function to fitf: the anomalous function to fitbath: the bath
The dimensions of the previous arrays can vary:
The dimension of
bathcan beNb: if single-impurity, the output ofget_bath_gimension()[Nlat ,Nb]: if real-space DMFT
Accordingly, the dimension of g (and f) can be:
3: in the single-impurity case, an array of the shape [Nspin\(\cdot\)Norb,Nspin\(\cdot\)Norb,Lmats].3: in the real-space DMFT case, an array of the shape [Nlat\(\cdot\)Nspin\(\cdot\)Norb,Nlat\(\cdot\)Nspin\(\cdot\)Norb,Lmats]4: in the real-space DMFT case, an array of the shape [Nlat,Nspin\(\cdot\)Norb,Nspin\(\cdot\)Norb,Lmats]5: in the single-impurity case, an array of the shape [Nspin,Nspin,Norb,Norb,Lmats]6: in the real-space DMFT case, an array of the shape [Nlat,Nspin,Nspin,Norb,Norb,Lmats]
ispin (int) – spin species to be fitted. For the normal case, if
Nspin=2, the fitting function needs to be called twice. Only the corresponding elements ofbathwill be updated each time. For the non-SU(2) case, this argument is irrelevant, since all the elements of the Weiss/Delta function need to be fitted. This is also the case ifbath_type=REPLICA, GENERAL.iorb (int) – the orbital to be fitted. If omitted, all orbitals will be fitted
fmpi (bool) – flag to automatically do and broadcast the fit over MPI, if defined
- Raises:
ValueError – if the shapes of the positional arguments are incompatible
ValueError – if a number of positional arguments different from 2 or 3 are passed
- Returns:
An array of floats that contains the bath parameters for the impurity problem. This is a required input of
solve()andchi2_fitgf(). Its elements are ordered differently depending on the bath geometry. They are (de)compactified for user interaction viabath_inspect(). Specific symmetrization operations are implemented and listed in the Bath Manipulation section.- Return type:
np.array(dtype=float)
- edipack2py.global_env.get_bath_dimension()[source]
This function returns the correct dimension for the bath to be allocated (for each impurity) given the parameters of the system.
- Returns:
a number which is the dimension of the bath array for each impurity.
- Return type:
- edipack2py.global_env.orb_equality_bath(bath, indx, save=True)[source]
This function sets every orbital component to be equal to the one of orbital
indx. Not compatible withREPLICAorGENERALbath types.- Parameters:
- Raises:
ValueError – if the orbital index is out of bounds
- Returns:
the modified bath array
- Return type:
np.array(dtype=float)
- edipack2py.global_env.orb_symmetrize_bath(bath, orb1, orb2, save=True)[source]
This function enforces equality of the different-orbital components of the bath array. Not compatible with
REPLICAorGENERALbath types.
- edipack2py.global_env.ph_symmetrize_bath(bath, save)[source]
This function enforces particle-hole symmetry of the bath hybridization function. Not compatible with
REPLICAorGENERALbath types.- Parameters:
bath (np.array(dtype=float)) – The user-accessible bath array
save (bool) – whether to save the symmetry-broken bath for reading
- Returns:
the modified bath array
- Return type:
np.array(dtype=float)
- edipack2py.global_env.save_array_as_bath(bath)[source]
This function takes the user-accessible array and saves it in the correct format for every bath type in the file
hamiltonian.restart- Parameters:
bath (np.array(dtype=float)) – The user-accessible bath array
- Returns:
Nothing
- Return type:
None
- edipack2py.global_env.set_hgeneral(hvec, lambdavec)[source]
This function is specific to
BATH_TYPE=GENERAL. It sets the basis of matrices and scalar parameters that, upon linear combination, make up the bath replica. The input is the same as that ofset_hreplica().- Parameters:
hvec (np.array(dtype=complex)) –
array of bath matrices. They decompose the nonzero part of the replica in a set. Each element of the set correspond to a variational parameter. That way the bath replica matrix is updated while preserving symmetries of the user’s choosing. The array can have the following shapes:
[
(Nnambu)\(\cdot\)Nspin\(\cdot\)Norb,(Nnambu)\(\cdot\)Nspin\(\cdot\)Norb,Nsym]: 3-dimensional, where Nnambu refers to the superconducting case and Nsym is the number of matrices that make up the linear combination[
(Nnambu)\(\cdot\)Nspin,(Nnambu)\(\cdot\)Nspin,Norb,Norb,Nsym]: 5-dimensional, where Nnambu refers to the superconducting case and Nsym is the number of matrices that make up the linear combination
lambdavec (np.array(dtype=float)) –
the array of coefficients of the linear combination. This, along with the hybridizations V, are the fitting parameters of the bath. The array has the following shape
[
Nbath,Nsym]: for single-impurity DMFT, 2-dimensional, where Nsym is the number of matrices that make up the linear combination[
Nlat,Nbath,Nsym]: for real-space DMFT, 3-dimensional, where Nlat is the number of inequivalent impurity sites and Nsym is the number of matrices that make up the linear combination
- Raises:
ValueError – if the shapes of the arrays are inconsistent
- Returns:
Nothing
- Return type:
None
- edipack2py.global_env.set_hreplica(hvec, lambdavec)[source]
This function is specific to
bath_type==replica. It sets the basis of matrices and scalar parameters that, upon linear combination, make up the bath replica.- Parameters:
hvec (np.array(dtype=complex)) –
array of bath matrices. They decompose the nonzero part of the replica in a set. Each element of the set correspond to a variational parameter. That way the bath replica matrix is updated while preserving symmetries of the user’s choosing. The array can have the following shapes:
[
(Nnambu)\(\cdot\)Nspin\(\cdot\)Norb,(Nnambu)\(\cdot\)Nspin\(\cdot\)Norb,Nsym]: 3-dimensional, where Nnambu refers to the superconducting case and Nsym is the number of matrices that make up the linear combination[
(Nnambu)\(\cdot\)Nspin,(Nnambu)Nspin,Norb,Norb,Nsym]: 5-dimensional, where Nnambu refers to the superconducting case and Nsym is the number of matrices that make up the linear combination
lambdavec (np.array(dtype=float)) –
the array of coefficients of the linear combination. This, along with the hybridizations V, are the fitting parameters of the bath. The array has the following shape
[
Nbath,Nsym]: for single-impurity DMFT, 2-dimensional, where Nsym is the number of matrices that make up the linear combination[
Nlat,Nbath,Nsym]: for real-space DMFT, 3-dimensional, where Nlat is the number of inequivalent impurity sites and Nsym is the number of matrices that make up the linear combination
- Raises:
ValueError – if the shapes of the arrays are inconsistent
- Returns:
Nothing
- Return type:
None
- edipack2py.global_env.spin_symmetrize_bath(bath, save=True)[source]
This function enforces equality of the opposite-spin components of the bath array. Not compatible with
REPLICAorGENERALbath types.- Parameters:
bath (np.array(dtype=float)) – The user-accessible bath array
save (bool) – whether to save the symmetry-broken bath for reading
- Returns:
the modified bath array
- Return type:
np.array(dtype=float)