JDFTx  1.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
WannierMinimizer Class Referenceabstract

Base class for different wannier minimizers: More...

#include <WannierMinimizer.h>

Inheritance diagram for WannierMinimizer:
Minimizable< WannierGradient > WannierMinimizerFD WannierMinimizerRS

Classes

struct  KmeshEntry
 Entry in the k-point mesh, including state of minimizer (subspace rotations) More...
 
struct  Kpoint
 Entries in the k-point mesh. More...
 

Public Member Functions

 WannierMinimizer (const Everything &e, const Wannier &wannier, bool needSuperOverride=false)
 
void initTransformDependent ()
 second half of common initialization that must happen after sub-class is fully initialized
 
void saveMLWF ()
 save wannier functions for all spins
 
void saveMLWF (int iSpin)
 save for specified spin
 
void step (const WannierGradient &grad, double alpha)
 Move the state in parameter space along direction dir with scale alpha.
 
double compute (WannierGradient *grad, WannierGradient *Kgrad)
 identity preconditioner, but impose hermiticity constraint
 
void constrain (WannierGradient &grad)
 enforce hermiticity
 
bool report (int iter)
 
double sync (double x) const
 All processes minimize together; make sure scalars are in sync to round-off error.
 
virtual void initialize (int iSpin)=0
 Prepare for minimization of spin channel iSpin.
 
virtual double getOmega (bool grad=false)=0
 
virtual double getOmegaI (bool grad=false)=0
 Like getOmega, but for the subspace-invariant OmegaI instead.
 
- Public Member Functions inherited from Minimizable< WannierGradient >
virtual double safeStepSize (const WannierGradient &dir) const
 Override to return maximum safe step size along a given direction. Steps can be arbitrarily large by default.
 
double minimize (const MinimizeParams &params)
 Minimize this objective function with algorithm controlled by params and return the minimized value.
 
void fdTest (const MinimizeParams &params)
 

Protected Member Functions

bool isMine (size_t ik) const
 
int whose (size_t ik) const
 
bool isMine_q (int ik, int iSpin) const
 
int whose_q (int ik, int iSpin) const
 
ColumnBundle getWfns (const Kpoint &kpoint, int iSpin, std::vector< matrix > *VdagResultPtr=0) const
 Get the wavefunctions for a particular k-point in the common basis (and optionally retrieve psp projections)
 
void axpyWfns (double alpha, const matrix &A, const Kpoint &kpoint, int iSpin, ColumnBundle &result, std::vector< matrix > *VdagResultPtr=0) const
 Like getWfns, but accumulate instead of setting, and with optional transformation matrix: result += alpha * wfns * A.
 
void axpyWfns_grad (double alpha, matrix &Omega_A, const Kpoint &kpoint, int iSpin, const ColumnBundle &Omega_result) const
 Gradient propagation corresponding to axpyWfns: from dOmega/d(result) to dOmega/dA.
 
ColumnBundle trialWfns (const Kpoint &kpoint) const
 Get the trial wavefunctions (hydrogenic, atomic or numerical orbitals) for the group of centers in the common basis.
 
matrix overlap (const ColumnBundle &C1, const ColumnBundle &C2, const std::vector< matrix > *VdagC1ptr=0, const std::vector< matrix > *VdagC2ptr=0) const
 
void dumpMatrix (const matrix &H, string varName, bool realPartOnly, int iSpin) const
 Dump a named matrix variable to file, optionally zeroing out the real parts.
 
virtual WannierGradient precondition (const WannierGradient &grad)
 Preconditioner for Wannier optimization: identity by default, override in derived class to change.
 

Static Protected Member Functions

static matrix fixUnitary (const matrix &U, bool *isSingular=0)
 

Protected Attributes

const Everythinge
 
const Wannierwannier
 
const std::vector< SpaceGroupOp > & sym
 
int nCenters
 
int nFrozen
 
int nBands
 number of Wannier centers (total and frozen) and source bands
 
int nSpins
 
int qCount
 number of spins, and number of states per spin
 
int nSpinor
 number of spinor components
 
std::vector< double > rSqExpect
 Expectation values for r^2 per center in current group.
 
std::vector< vector3<> > rExpect
 Expectation values for r per center in current group.
 
std::vector< bool > pinned
 Whether centers are pinned or free.
 
std::vector< vector3<> > rPinned
 Where centers are pinned to (if they are)
 
bool needSuper
 whether supercell is necessary
 
GridInfo gInfoSuper
 supercell grid
 
Basis basisSuper
 supercell wavefcuntion basis
 
QuantumNumber qnumSuper
 supercell k-point
 
int nPhononModes
 number of phonon modes
 
diagMatrix invsqrtM
 1/sqrt(M) per nuclear displacement mode
 
std::vector< KmeshEntrykMesh
 k-point mesh with FD formula
 
std::set< Kpointkpoints
 list of all k-points that will be in use (including those in FD formulae)
 
std::shared_ptr
< ColumnBundleTransform::BasisWrapper
basisWrapper
 
std::shared_ptr
< ColumnBundleTransform::BasisWrapper
basisSuperWrapper
 look-up tables for initializing transforms
 
std::map< Kpoint,
std::shared_ptr
< ColumnBundleTransform > > 
transformMap
 
std::map< Kpoint,
std::shared_ptr
< ColumnBundleTransform > > 
transformMapSuper
 wave-function transforms for each k-point to the common bases
 
Basis basis
 common basis (with indexing into full G-space)
 
TaskDivision kDivision
 
size_t ikStart
 
size_t ikStop
 
std::vector< ColumnBundleCother
 wavefunctions from another process
 
std::vector< std::vector
< matrix > > 
VdagCother
 psp projections of wavefunctions from another process
 
std::map< Kpoint,
std::shared_ptr< ColumnBundle > > 
numericalOrbitals
 numerical orbitals read from file
 

Friends

struct WannierGradient
 

Detailed Description

Base class for different wannier minimizers:

Member Function Documentation

static matrix WannierMinimizer::fixUnitary ( const matrix U,
bool *  isSingular = 0 
)
staticprotected

Return an exactly unitary version of U (orthogonalize columns) If isSingular is provided, function will set it to true and return rather than stack-tracing in singular cases.

virtual double WannierMinimizer::getOmega ( bool  grad = false)
pure virtual

Return Omega and set rExpect and rSqExpect. If grad=true, set Omega_U in the KMeshEntry array. Note base class handles computing U and propagating gradients. At input, U will be available on all processes and Omega_U will be zero. Base class will accumulate Omega_U across processes on return.

Implemented in WannierMinimizerFD, and WannierMinimizerRS.

matrix WannierMinimizer::overlap ( const ColumnBundle C1,
const ColumnBundle C2,
const std::vector< matrix > *  VdagC1ptr = 0,
const std::vector< matrix > *  VdagC2ptr = 0 
) const
protected

Overlap between columnbundles of different k-points, with appropriate ultrasoft augmentation. Note that the augmentation in the O() from electronic/ColumnBundle.h assumes both sides have same k-point. If provided, use the cached projections instead of recomputing them.

bool WannierMinimizer::report ( int  iter)
virtual

Override for optional processing/reporting after each/every few iterations It should return whether the state was modified

Reimplemented from Minimizable< WannierGradient >.


The documentation for this class was generated from the following file: