Wannier90

rs_hopping_t *diverge_read_W90_C(const char *fname, index_t n_spin, index_t *len, index_t *n_orb)
[source]

reads Wannier90’s *_hr.dat file into divERGe’s rs_hopping_t data structure.

Parameters:
  • fname (const char*) – /path/to/material_hr.dat

  • n_spin (index_t) – default value 0 amounts to \(SU(2)\) symmetric model. if \(n_\mathrm{spin} \neq 0\), \(|n_\mathrm{spin}| = 2S+1\) with \(S\) the physical spin (i.e., for \(S=1/2\) we have \(|n_\mathrm{spin}|=2\)). the sign determines whether the spin index is the one which increases memory slowly (negative) or fast (positive) in the W90 file. Note that the divERGe convention is always (s,o), i.e. spin indices increasing memory fast (‘outer indices’).

  • len (index_t*) – output for the number of hoppings that have been read.

  • n_orb (index_t*) – output for the maximum number of orbitals that were found in the hr.dat file. not considered if NULL. In case n_orb != NULL and *n_orb == DIVERGE_W90_READER_SWAP_ORBITALS, swap the orbital indices.

Note

In previous versions, setting ~(*n_orb) == 0 would swap the orbital ordering. Since we recently changed the default ordering of o1/o2 for the W90 reader, the magic number to get swapped ordering changed. In this way, previous codes that explicitly swapped the ordering are still correct. If you provide ~(*n_orb) == 0, a corresponding deprecation warning is issued.

Example:

diverge_model_t* model = diverge_model_init();
// set some model parameters...
model->SU2 = 1;
model->n_spin = 1;
model->hop = diverge_read_W90_C( "/path/to/material_hr.dat",
                                0, &model->n_hop, &model->n_orb );
// do something with the hoppings here!
rs_hopping_t *diverge_read_W90(const char *fname, index_t n_spin, index_t *len, index_t *n_orb)
[source]

We do not support the C++ interface any longer. Instead, this function just calls diverge_read_W90_C().

double *diverge_read_wout(const char *fname, double *lattice, index_t *n_wan)
[source]

read the lattice vectors and Wannier centers from a .wout file

Parameters:
  • fname (const char*) – prefix.wout filename

  • lattice (double*) – array of shape (3,3) that the lattice vectors are stored into

  • n_wan (index_t*) – pointer to an index_t where the number of WFs is stored on exit

Returns:

array of shape (*n_wan,3) with the Wannier centers. This array must be free’d by the user (call to free or diverge_mem_free())

diverge_model_t *diverge_read_W90_model(const char *hr_dat, const char *wout, index_t n_spin)
[source]

convenience combination of diverge_read_W90() and diverge_read_wout() to directly yield a diverge_model_t.