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 ] for NORMAL bath, [ Nspin , Nbath ] for HYBRID bath

  • v (np.array(dtype=float)) – an array for the bath hybridizations ( ed_mode = NORMAL, NONSU2, SUPERC). It has dimension [ Nspin , Norb , Nbath ] for NORMAL and HYBRID bath. For REPLICA bath it has dimension [ Nbath ] and for GENERAL 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 ] for NORMAL bath, [ Nspin , Nbath ] for HYBRID bath

  • u (np.array(dtype=float)) – an array for the bath spin off-diagonal hybridization ( ed_mode = NONSU2). It has dimension [ Nspin , Norb , Nbath ] for NORMAL and HYBRID bath

  • l (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 among e,u,v,d,l are provided, none is provided, the shapes are inconsistent or the inputs are inconsistent with bath_type and ed_mode .

Returns:

  • if bath is provided, returns e,v, e,d,v, e,v,u or l,v depending on ed_mode

  • if e,v, e,d,v, e,v,u or l,v depending on ed_mode are provided, returns bath

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 or GENERAL bath types.

Parameters:
  • bath (np.array(dtype=float)) – The user-accessible bath array

  • field (float) – the magnitude of the symmetry-breaking shift

  • sign (float) – the sign of the symmetry-breaking shift

  • 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.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 or ed_mode = NONSU2) the argumens are

    • g: the function to fit

    • bath: the bath

    If the system is superconductive ( ed_mode = SUPERC) the arguments are

    • g: the normal function to fit

    • f: the anomalous function to fit

    • bath: the bath

    The dimensions of the previous arrays can vary:

    The dimension of bath can be

    • Nb: if single-impurity, the output of get_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 of bath 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() and chi2_fitgf(). Its elements are ordered differently depending on the bath geometry. They are (de)compactified for user interaction via bath_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:

int

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 with REPLICA or GENERAL bath types.

Parameters:
  • bath (np.array(dtype=float)) – The user-accessible bath array

  • iorb (int) – the orbital index to which every other will be set as equal

  • save (bool) – whether to save the symmetry-broken bath for reading

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 or GENERAL bath types.

Parameters:
  • bath (np.array(dtype=float)) – The user-accessible bath array

  • orb1 (int) – first orbital index

  • orb2 (int) – second orbital index

  • 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.ph_symmetrize_bath(bath, save)

This function enforces particle-hole symmetry of the bath hybridization function. Not compatible with REPLICA or GENERAL 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 of set_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 or GENERAL 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)