Bath Manipulation
These functions manipulate the user-accessible bath array
- edipy2.global_env.bath_inspect(bath=None, e=None, v=None, d=None, u=None, l=None)
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
] forNORMAL
bath, [Nspin
,Nbath
] forHYBRID
bathv (np.array(dtype=float)) – an array for the bath hybridizations (
ed_mode
=NORMAL, NONSU2, SUPERC
). It has dimension [Nspin
,Norb
,Nbath
] forNORMAL
andHYBRID
bath. ForREPLICA
bath it has dimension [Nbath
] and forGENERAL
bath 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
] forNORMAL
bath, [Nspin
,Nbath
] forHYBRID
bathu (np.array(dtype=float)) – an array for the bath spin off-diagonal hybridization (
ed_mode
=NONSU2
). It has dimension [Nspin
,Norb
,Nbath
] forNORMAL
andHYBRID
bathl (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
bath
and some amonge,u,v,d,l
are provided, none is provided, the shapes are inconsistent or the inputs are inconsistent withbath_type
anded_mode
.- Returns:
- Return type:
np.array(dtype=float)
- edipy2.global_env.break_symmetry_bath(bath, field, sign, save=True)
This function breaks the spin symmetry of the bath, useful for magnetic calculations to incite symmetry breaking. Not compatible with
REPLICA
orGENERAL
bath types.- Parameters:
- Returns:
the modified bath array
- Return type:
np.array(dtype=float)
- edipy2.global_env.chi2_fitgf(*args, ispin=0, iorb=None, fmpi=True)
This function fits the Weiss field or Hybridization function (delta) with a discretized version. 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
=NORMAL
ored_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
bath
can 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
,Lfit
].3
: in the real-space DMFT case, an array of the shape [Nlat
\(\cdot\)Nspin
\(\cdot\)Norb
,Nlat
\(\cdot\)Nspin
\(\cdot\)Norb
,Lfit
]4
: in the real-space DMFT case, an array of the shape [Nlat
,Nspin
\(\cdot\)Norb
,Nspin
\(\cdot\)Norb
,Lfit
]5
: in the single-impurity case, an array of the shape [Nspin
,Nspin
,Norb
,Norb
,Lfit
]6
: in the real-space DMFT case, an array of the shape [Nlat
,Nspin
,Nspin
,Norb
,Norb
,Lfit
]
where
Lfit
is a given number of frequencies.ispin (int) – spin species to be fitted. For the normal and superconducting cases, if
Nspin
=2
, the fitting function needs to be called twice. Only the corresponding elements ofbath
will 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.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)
- edipy2.global_env.get_bath_dimension()
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:
- edipy2.global_env.orb_equality_bath(bath, indx, save=True)
This function sets every orbital component to be equal to the one of orbital
indx
. Not compatible withREPLICA
orGENERAL
bath types.- Parameters:
- Raises:
ValueError – if the orbital index is out of bounds
- Returns:
the modified bath array
- Return type:
np.array(dtype=float)
- edipy2.global_env.orb_symmetrize_bath(bath, orb1, orb2, save=True)
This function enforces equality of the different-orbital components of the bath array. Not compatible with
REPLICA
orGENERAL
bath types.
- edipy2.global_env.ph_symmetrize_bath(bath, save)
This function enforces particle-hole symmetry of the bath hybridization function. Not compatible with
REPLICA
orGENERAL
bath 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)
- edipy2.global_env.save_array_as_bath(bath)
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
- edipy2.global_env.set_hgeneral(hvec, lambdavec)
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
- edipy2.global_env.set_hreplica(hvec, lambdavec)
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
- edipy2.global_env.spin_symmetrize_bath(bath, save=True)
This function enforces equality of the opposite-spin components of the bath array. Not compatible with
REPLICA
orGENERAL
bath 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)