Meshing

divERGe strictly operates on regular momentum meshes along the reciprocal lattice vectors. In the Model, a coarse and a fine momentum mesh can be set (diverge_model_t.nk and diverge_model_t.nkf). To access the generated meshes, use the functions provided in the Internals section. To generate meshes or reciprocal lattice vectors, use the functions given here.

struct diverge_lattice_t
[source]

struct for lattice vectors, required only to be used as return value

double v[3][3]
[source]

the data, as 3x3 double array, with the first lattice vector being v[0] and so on.

diverge_lattice_t diverge_model_generate_meshes(double *kmesh, double *kfmesh, const index_t nk[3], const index_t nkf[3], double lattice[3][3])
[source]

mesh generation helper function, useful for your own models

Parameters:
  • kmesh (double*) – array to store the coarse momentum mesh in, dimension (nk[0],nk[1],nk[2],3).

  • kfmesh (double*) – array to store the fine momentum mesh in, dimension (nk[0]*nkf[0],nk[1]*nkf[1],nk[2]*nkf[2],3).

Reutrns diverge_lattice_t:

the reciprocal lattice vectors

void diverge_model_generate_mom_basis(double *lattice, double *kbasis)
[source]

use lattice vectors to generate reciprocal lattice vectors. corrects for left-handed coordinate systems.

Parameters:
  • lattice (double[3][3]) – lattice vectors in C ordering (see diverge_model_t.lattice), input & output.

  • kbasis (double[3][3]) – reciprocal lattice vectors in C ordering, output.

index_t *diverge_kmesh_to_bands(diverge_model_t *m, index_t **indices, index_t *n_indices)
[source]

finds fine mesh points (as indices) that lie on the segments that define the irreducible path. Useful for, e.g., generation of the Hamiltonian (or self-energy) along the irreducible path, or outputting a susceptibility. Written such that the runtime is O(nk * n_ibz_path). Requires a previous call to diverge_model_internals_common() in order to prepare the momentum meshes.

Parameters:
Returns:

The number of points per segment in an array. both the returned array as well as the *indices array must be free’d manually.

Example: diverge_kmesh_to_bands() or diverge_kmesh_to_bands_crs() can be used as follows:

diverge_model_t* m;
// fill m with appropriate content
diverge_model_internals_common( m );
index_t* pts;
index_t n_pts;
index_t* n_per_segment = diverge_kmesh_to_bands( m, &pts, &n_pts );
// do something with pts, n_pts, and n_per_segment.
free( pts );
free( n_per_segment );
index_t *diverge_kmesh_to_bands_crs(diverge_model_t *m, index_t **indices, index_t *n_indices)
[source]

same as diverge_kmesh_to_bands(), but for the coarse mesh.

double diverge_kmesh_to_bands_set_zero(double zero)
[source]

set floating point ‘zero’ value for kmesh to bands, defaults to DIVERGE_EPS_MESH. Returns previous value. Does not update value if qnan_isnan(zero) (cf. qnan_isnan()).