Wannierisation inside WannierBerri
Now WannierBerri can construct wannier functions on its own. Bith disentanglement and localisation.
Wannierisation can be performed with both sitesym=True and frozen window (this feature is currently not available in Wannier90).
see examples in examples/wannierise+sitesym-Fe and examples/wannierise+sitesym-diamond
- wannierise.wannierise(froz_min=inf, froz_max=-inf, num_iter=1000, conv_tol=1e-09, num_iter_converge=3, mix_ratio_z=0.5, mix_ratio_u=1, print_progress_every=10, sitesym=False, localise=True, kwargs_sitesym={}, init='amn', num_wann=None)
Performs disentanglement and maximal localization of the bands recorded in w90data. The disentanglement is done following the procedure described in Souza et al., PRB 2001. The localization is done following a simplified procedure, avoiding gradient descent of the spread functional.
At the end writes
w90data.chk.v_matrix
and setsw90data.wannierised = True
- Parameters:
w90data (
Wannier90data
) – the datafroz_min (float) – lower bound of the frozen window
froz_max (float) – upper bound of the frozen window
num_iter (int) – maximal number of iterations.
conv_tol (float) – tolerance for convergence of the spread functional (in \(\mathring{\rm A}^{2}\))
num_iter_converge (int) – the convergence is achieved when the standard deviation of the spread functional over the num_iter_converge*print_progress_every iterations is less than conv_tol
mix_ratio_z (float) – 0 <= mix_ratio_z <=1 - mixing the Z matrix (disentanglement) from previous itertions. 1 for max speed, smaller values are more stable
mix_ratio_u (float) – 0 <= mix_ratio_u <=1 - mixing the U matrix (localization) from previous itertions. 1 for max speed, smaller values are more stable WARNING : u<1 at the moment may lead to non-convergence. It is recommended to use mix_ratio_u=1 for now.
print_progress_every – frequency to print the progress
sitesym (bool) – whether to use the site symmetry (Symmetry-adapted Wannier Functions). If True, the dmn attribute should be present in the w90data (either from pw2wannier90 or generated by wabnnierberri see
DMN
,from_irrep()
andset_D_wann_from_projections()
localise (bool) – whether to perform the localization. If False, only disentanglement and roatation to projections are performed
kwargs_sitesym (dict) – additional the keyword arguments to be passed to the constructor of the
Symmetrizer
init (str) – the initialization of the U matrix. “amn” for the current state, “random” for random initialization, “restart” for restarting from the previous state
num_wann (int) – the number of Wannier functions. Required for random initialization only without sitesymmetry
- Returns:
w90data.chk.v_matrix – the optimized U matrices
- Return type:
numpy.ndarray
Note
- Also sets the following attributes of chk:
- w90data.chk.v_matrixnumpy.ndarray
the optimized U matrices
- w90data.wannierisedbool
True
- w90data.chk._wannier_centersnumpy.ndarray (nW,3)
the centers of the Wannier functions
- w90data.chk._wannier_spreadsnumpy.ndarray (nW)
the spreads of the Wannier functions
If the outer window is needed, use
apply_window()
of theWannier90data
before calling this function.The function is not parallelized yet
Disentanglement and localization are done in the irreducible BZ (if sitesym=True) and then symmetrized to the full BZ
Disentanglement and localization are done together, in the same loop. Therefore only one parameter num_iter is used for both
Example
# This tutorial shows how to generate a DMN file inside Wanier Berri code (without pw2wannier90)
# and then use it to generate a Wannier90 output.
# It may be used with any DFT code that is supported by IrRep (QE, VASP, AINIT, ...)
# the .dmn file is not needed before the calculation, it is generated on the fly
import wannierberri as wberri
from wannierberri.w90files import DMN
from irrep.bandstructure import BandStructure
# Create the dmn file
try:
dmn_new = DMN("mydmn")
except:
# see documentation of irrep for usage with other codes
bandstructure = BandStructure(code='espresso', prefix='di', Ecut=100,
normalize=False)
bandstructure.spacegroup.show()
dmn_new = DMN(empty=True)
dmn_new.from_irrep(bandstructure)
pos = [[0,0,0],[0,0,1/2],[0,1/2,0],[1/2,0,0]]
dmn_new.set_D_wann_from_projections(projections=[(pos, 's') ])
dmn_new.to_w90_file("mydmn")
# Read the data from the Wanier90 inputs
w90data = wberri.w90files.Wannier90data(seedname='diamond')
w90data.set_file("dmn", dmn_new)
#Now disentangle with sitesym and frozen window (the part that is not implemented in Wanier90)
w90data.wannierise(
froz_min=0,
froz_max=4,
num_iter=1000,
conv_tol=1e-6,
mix_ratio_z=1.0,
print_progress_every=20,
sitesym=True,
localise=True,
)
system = wberri.system.System_w90(w90data=w90data)
# Now do whatever you want with the system, as if it was created with Wannier90