Model

The model structure diverge_model_t represents the center of the divERGe library. Users typically allocate a model with diverge_model_init(). There are some required parameters that must be set, and thereafter one can generate common internal structures via diverge_model_internals_common() (see Internals). Finally, the model must be free’d using the diverge_model_free() function to appropriately release all allocated memory.

type internals_t
[source]

private structure, forward declared

typedef void (*hamiltonian_generator_t)(const diverge_model_t *model, complex128_t *buf)
[source]
typedef void (*hamiltonian_generator_t)(
    const diverge_model_t* model,
    complex128_t* buf );

may use the fine mesh generated by the code (can be accessed via model->kfmesh) buffer buf of size (prod(nk*nkf), n_spin,n_orb, n_spin,n_orb).

enum greensfunc_op_t
[source]

enumeration value that must be returned by greensfunc_generator_t.

enumerator greensfunc_op_cpu
[source]

buffer on CPU

enumerator greensfunc_op_gpu
[source]

buffer on GPU, this option is only supported in the patch backend, and then the greensfunc_generator_t must not do anything.

typedef enum greensfunc_op_t (*greensfunc_generator_t)(const diverge_model_t *model, complex128_t Lambda, gf_complex_t *buf)
[source]

Function pointer for Green’s function generators. Similar to hamiltonian_generator_t, but buffer must be double the size, i.e., (2, prod(nk*nkf), n_spin,n_orb, n_spin,n_orb).

typedef greensfunc_op_t (*greensfunc_generator_t)(
    const diverge_model_t* model,
    complex128_t Lambda,
    gf_complex_t* buf );
typedef int (*channel_vertex_generator_t)(diverge_model_t *model, char channel, complex128_t *buf)
[source]
typedef int (*channel_vertex_generator_t)(
    diverge_model_t* model,
    char channel,
    complex128_t* buf );

acts on the indices of the coarse mesh generated by the code (accessed via model->kmesh). returns whether the buffer has been touched (1) or not (0). The buffer buf must be of size (prod(nk), n_spin,n_spin,n_orb, n_spin,n_spin,n_orb)

typedef void (*full_vertex_generator_t)(const diverge_model_t *model, index_t k1, index_t k2, index_t k3, complex128_t *buf)
[source]
typedef void (*full_vertex_generator_t)(
    const diverge_model_t* model,
    index_t k1, index_t k2, index_t k3,
    complex128_t* buf );

acts on the indices of the coarse mesh generated by the code. (see channel_vertex_generator_t). The buffer buf must be of size (n_spin,n_orb, n_spin,n_orb, n_spin,n_orb, n_spin,n_orb)

struct rs_hopping_t
[source]

Hopping parameters in the spirit of Wannier90. For \(SU(2)\) symmetric models, s1 and s2 are ignored. In a Hamiltonian formulation, each hopping element refers to the (periodically repeated in each periodic dimension) term

\(t_{o_1,o_2,s_1,s_2,\boldsymbol{R}} = \langle \boldsymbol{R},o_2,s_2 | \hat{T} | \boldsymbol{0}, o_1, s_1 \rangle\),

with \(\hat{T}\) the kinetic energy operator. Notably, distance is measured as \(\boldsymbol{d} = \boldsymbol{r}_2 + \boldsymbol{R} - \boldsymbol{r}_1\).

index_t R[3]
[source]

oriented distance in units of lattice vectors.

index_t o1
[source]

orbital/spin configuration, first orbital index \(o_1\).

index_t o2
[source]

orbial/spin configuration, second orbital index \(o_2\)

index_t s1
[source]

orbial/spin configuration, first spin index \(s_1\)

index_t s2
[source]

orbial/spin configuration, second spin index \(s_2\)

complex128_t t
[source]

value of the hopping element \(t_{o_1,o_2,s_1,s_2,\boldsymbol{R}}\).

struct rs_vertex_t
[source]

Single vertex element in real space. Distance is measured in the same manner as for hopping parameters (rs_hopping_t). In case the model is non-\(SU(2)\) but still spin-1/2, i.e., has two spin indices, setting s1 = -1 allows to auto-generate all \(SU(2)\)-symmetry related components. Note that in this case, you must not double-count the interactions, i.e., still initialize, e.g., the Hubbard-U in only one of the channels. Useful for models where \(SU(2)\) is broken in the kinetic sector.

char chan
[source]

channel. can be ‘P’, ‘C’, or ‘D’.

index_t R[3]
[source]

real space indices corresponding to the oriented distance of the real space vertex element in units of lattice vectors

index_t o1
[source]

channel specific orbital and spin configuration, first orbital \(o_1\).

index_t o2
[source]

channel specific orbital and spin configuration, second orbital \(o_2\).

index_t s1
[source]

channel specific orbital and spin configuration, first spin index \(s_1\).

index_t s2
[source]

channel specific orbital and spin configuration, second spin index \(s_2\).

index_t s3
[source]

channel specific orbital and spin configuration, third spin index \(s_3\).

index_t s4
[source]

channel specific orbital and spin configuration, fourth spin index \(s_4\).

complex128_t V
[source]

value \(V_{o_1,o_2,s_1,s_2,s_3,s_4,\boldsymbol{R}}\) of the channel specific interaction element

struct mom_patching_t
[source]

See Patching for how to use this structure. Most probably, you won’t need to manually construct it. All allocations of arrays must be taken care of manually if you do want to manually construct it.

index_t n_patches
[source]

number of patches

index_t *patches
[source]

patch indices (n_patches,)

double *weights
[source]

patch weights (n_patches,)

index_t *p_count
[source]

size of refinement for each patch (n_patches,)

index_t *p_displ
[source]

displacement of refinement for each patch (n_patches,)

index_t *p_map
[source]

refinement index array. All refined points for a patch p are indexed by p_count, p_displ, such that p_map[p_displ[p]:p_count[p]+p_displ[p]] describes the refined points for patch p (in python slicing notation).

double *p_weights
[source]

refinement weight array, works the same way as p_map.

struct tu_formfactor_t
[source]

Formfactor storage for TUFRG calculations, usually filled automatically by calling diverge_model_internals_tu(). Can be filled manually for advanced formfactor setups, if that is the case the call to diverge_model_internals_tu() does not try to create formfactors but operates on the manually created ones.

index_t R[3]
[source]

integer lattice vector distance

index_t ofrom
[source]

orbitals corresponding to the bond, going from ofrom to oto.

index_t oto
[source]

orbitals corresponding to the bond, going from ofrom to oto.

double d
[source]

cartesian bond length

index_t ffidx
[source]

generated automatically (used internally to associate integer lattice vector distances with formfactors), no need to worry about it!

struct diverge_model_t
[source]

Central model structure that encodes kinetics and interactions. Some variables are required to be set by the user, others may be left to their default. Initialization via diverge_model_init().

char name[MAX_NAME_LENGTH]
[source]

optionally, you can name your model (also useful to, e.g., uniquely identify a model).

index_t nk[3]
[source]

number of k points in each direction. set to 0 to skip dimension. required.

index_t nkf[3]
[source]

number of refined k points (total k points in each direction nk[i]*nkf[i]). dimension must match that of nk. required.

Note

For npatch simulations, refinement must be turned off. That means that for those i where nk[i] is nonzero, nkf[i] must be one, and zero elsewhere.

mom_patching_t *patching
[source]

structure that holds the Fermi surface patching. Usually allocated with the help of other routines (e.g. diverge_patching_from_indices()), but in principle the user’s responsibility. Free’d by diverge_model_free() if set.

index_t n_ibz_path
[source]

In the output routine, band structures along a path are generated. This variable is used to set the number of high symmetry points of the path.

double ibz_path[MAX_N_ORBS][3]
[source]

path in crystal (relative to reciprocal lattice vectors) coordinates, relevant for output with diverge_model_to_file(). If diverge_model_output_conf_t contains npath=-1 (used via diverge_model_to_file_finegrained()), or diverge_model_output_set_npath() has been used to set npath=-1, only values within the first primitive zone (PZ) are allowed, i.e., floating point numbers in the range [0,1). It is possible to skip segments by setting the first value of a 3-dimensional element of the ibz_path array to the magic value returned from diverge_model_ibz_path_skip_segment() (nan with payload). Then, both the segment before and after the special value are skipped.

index_t n_orb
[source]

number of orbitals & sites. For example, a honeycomb lattice with three \(p\)-orbitals per site would have n_orb = 6. required

double lattice[3][3]
[source]

lattice vectors, given in cartesian coordinates. lattice[i][0,1,2] corresponds to the cartesian coordinates of the \(i\)-th lattice vector \(\boldsymbol l_i\) (C ordering). required.

double positions[MAX_N_ORBS][3]
[source]

positions of the orbitals/sites given in cartesian coordinates (not in crystal/relative coordinates!). required.

index_t n_sym
[source]

Symmetry setup. Use helper functions to easily generate symmetry operations (see Symmetries). If n_sym is negative, the Hamiltonian will be resymmetrized before diagonalization.

complex128_t *orb_symmetries
[source]

orbital/site/spin space symmetry matrices in C ordering. Must be user-allocated. Free’d by diverge_model_free(). shape: (n_sym, n_spin*n_orb, n_spin*n_orb)

double rs_symmetries[MAX_N_SYM][3][3]
[source]

real space symmetry matrices in C ordering. shape: (n_sym, 3, 3)

index_t n_hop
[source]

number of hopping parameters. required.

rs_hopping_t *hop
[source]

hopping parameter array (shape: (n_hop,)). user-allocated, free’d by diverge_model_free(). Must not be NULL (i.e. uninitialized). required.

hamiltonian_generator_t hfill
[source]

Function pointer that can be used to used to overwrite the default Hamiltonian generation. Useful if, e.g., momentum space focused models are used or if a model is built on top of other models.

int SU2
[source]

determines which flow equations are used. If SU2 > 0, use \(SU(2)\) symmetric flow equations. If SU2 == 0, use non-\(SU(2)\) flow equations and enforce exchange symmetric vertices. If SU2 < 0, use non-\(SU2\) flow equations and do not enforce exchange symmetric vertices. required.

index_t n_spin
[source]

must be set to 1 for \(SU(2)\) symmetric models (i.e. if SU2 > 0). Otherwise, the number of spin degrees of freedom. For a Fermion with spin \(S\), this amounts to \(n_\mathrm{spin} = 2S + 1\). required.

index_t n_vert
[source]

number of real space vertex elements. required.

rs_vertex_t *vert
[source]

real space vertex elements (shape (n_vert,)). user-allocated, free’d by diverge_model_free(). required.

tu_formfactor_t *tu_ff
[source]

formfactor array (shape (n_tu_ff,)). If allocated (!=NULL), do not auto-generate formfactors upon call to diverge_model_internals_tu().

index_t n_tu_ff
[source]

number of formfactors

index_t n_vert_chan[3]
[source]

either leave this set by the code, or sort the vertices in channels ‘CDP’ and give the lengths of these chunks.

channel_vertex_generator_t vfill
[source]

custom channel vertex generator. useful for, e.g., momentum-space native vertices

full_vertex_generator_t ffill
[source]

full vertex generator. useful if trivial formulation of full vertex exists that is inconvenient to port to TUFRG/channel notation

greensfunc_generator_t gfill
[source]

Green’s function generator. Useful subspace/advanced models and performance games.

greensfunc_generator_t gproj
[source]

Green’s function generator to select a correlated subspace for constrained FRG (cFRG). The projected loop is given by \(L_\mathrm{proj} = G*G - G_\mathrm{proj} * G_\mathrm{proj}\).

void *data
[source]

used to add additional information to the struct, useful to “hack” or pass user data to function calls like greensfunc_generator_t.

index_t nbytes_data
[source]

specify how much data is actually added to the struct. This amount of data is saved on calls to diverge_model_to_file().

void (*data_destructor)(void*)
[source]

set a nontrivial destructor for the optional data attached to the struct. ignored if left untouched (NULL)

internals_t *internals
[source]

handled by code itself. please do not alter.

void diverge_hamilton_generator_set_fftw_options(int flags)
[source]

set FFTW planner flags for the Hamiltonian generator (useful if the generator is called many times).

void diverge_hamilton_generator_default(const diverge_model_t *model, complex128_t *buf)
[source]

The standard hamiltonian_generator_t used by diverge_model_internals_common(). It takes the hopping elements diverge_model_t.hop and Fourier transforms them to momentum space.

void diverge_hamilton_generator_add(const diverge_model_t *model, complex128_t *buf)
[source]

A slightly modified hamiltonian_generator_t that works in exactly the same way as diverge_hamilton_generator_default() except for the fact that it adds the generated elements to buf instead of overwriting them. Useful for custom Hamiltonian generation.

greensfunc_op_t diverge_greensfunc_generator_default(const diverge_model_t *model, complex128_t Lambda, gf_complex_t *buf)
[source]

The standard greensfunc_generator_t.

int diverge_channel_vertex_generator_default(diverge_model_t *model, char channel, complex128_t *buf)
[source]

The standard channel_vertex_generator_t that reads real space vertex elements diverge_model_t.vert and Fourier transforms them to momentum space.

diverge_model_t *diverge_model_init(void)
[source]

initialize a diverge_model_t with sane defaults. Usage required.

void diverge_model_free(diverge_model_t *model)
[source]

clean up a diverge_model_t instance and all the attached arrays. Usage required, see diverge_model_free_set_options() for possible non-standard settings.

void diverge_model_free_set_options(diverge_model_t *model, int ignore_hop, int ignore_vert, int ignore_orb_symmetries)
[source]

set options in the model cleanup diverge_model_free(). For the members diverge_model_t.hop, diverge_model_t.vert, or diverge_model_t.orb_symmetries, the free() function is usually called, assuming allocation via malloc() (and friends). For stack allocated data, one can set to skip this call to free().

double diverge_model_ibz_path_skip_segment(void)
[source]

return special NaN that allows to skip segments in the IBZ path. The following example skips segments (1,2) and (2,3):

m->ibz_path[0][0] = 0.5;
m->ibz_path[1][0] = 0.0;
m->ibz_path[2][0] = diverge_model_ibz_path_skip_segment();
m->ibz_path[3][0] = 0.5;
m->ibz_path[4][0] = 0.0;
m->n_ibz_path = 5;