JDFTx  1.2.0
Wannier.h
1 /*-------------------------------------------------------------------
2 Copyright 2012 Ravishankar Sundararaman
3 
4 This file is part of JDFTx.
5 
6 JDFTx is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10 
11 JDFTx is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with JDFTx. If not, see <http://www.gnu.org/licenses/>.
18 -------------------------------------------------------------------*/
19 
20 #ifndef JDFTX_WANNIER_WANNIER_H
21 #define JDFTX_WANNIER_WANNIER_H
22 
23 #include <core/MinimizeParams.h>
24 #include <electronic/Everything.h>
25 #include <electronic/DOS.h>
26 #include <memory>
27 
29 class Wannier
30 {
31 public:
32  Wannier();
33  void setup(const Everything& everything);
34 
37  double a;
38  int sp, atom;
41  double coeff;
42  };
43  struct TrialOrbital : public std::vector<AtomicOrbital>
44  { bool pinned;
45  vector3<> rCenter;
46  TrialOrbital() : pinned(false) {}
47  };
48  std::vector<TrialOrbital> trialOrbitals;
49  bool needAtomicOrbitals;
50 
51  enum LocalizationMeasure
52  { LM_FiniteDifference,
53  LM_RealSpace
54  }
55  localizationMeasure;
56  bool precond; //whether to precondition minimize
57 
58  int bStart; //index of lowest band included in Wannier determination (used only when no energy windows)
59  double eOuterMin, eOuterMax;
60  double eInnerMin, eInnerMax;
61  bool outerWindow, innerWindow;
62 
63  int nFrozen; string frozenUfilename;
64  int nCenters;
65 
66  bool saveWfns;
68  bool saveMomenta;
70  string initFilename, dumpFilename;
71 
74 
76 
77  void saveMLWF();
78 
79  enum FilenameType
80  { FilenameInit,
81  FilenameDump
82  };
85  string getFilename(FilenameType fnType, string varName, int* spin=0) const;
86 
87 private:
88  const Everything* e;
89  MinimizeParams minParams;
90  std::shared_ptr<class WannierMinimizer> wmin;
91  friend class WannierMinimizer;
92  friend struct CommandWannierMinimize;
93 };
94 
97 { Wannier wannier;
98  void setup();
99 };
100 
101 #endif // JDFTX_WANNIER_WANNIER_H
string getFilename(FilenameType fnType, string varName, int *spin=0) const
Base class for different wannier minimizers:
Definition: WannierMinimizer.h:48
vector3< int > phononSup
phonon supercell (process e-ph matrix elements on this supercell if non-zero)
Definition: Wannier.h:75
double eInnerMax
inner energy window (within which all bands used)
Definition: Wannier.h:60
Version of Everything with Wannier added.
Definition: Wannier.h:96
Definition: Wannier.h:35
bool saveWfns
whether to write wavefunctions
Definition: Wannier.h:66
int numericalOrbIndex
index to a numerical orbital (<0 if not using a numerical orbital)
Definition: Wannier.h:39
Definition: Wannier.h:43
Parameters to control the minimization algorithm.
Definition: MinimizeParams.h:29
string frozenUfilename
number of frozen centers, and the filename to read their rotations from
Definition: Wannier.h:63
bool innerWindow
denotes which windows are available
Definition: Wannier.h:61
string numericalOrbitalsFilename
filename for reading numerical orbitals
Definition: Wannier.h:72
double a
exponential decay length of nodeless hydrogenic orbital of current l
Definition: Wannier.h:37
int atom
species code (<0 if not using a pseudopotential atomic orbital) and atom number (<0 if not using an o...
Definition: Wannier.h:38
std::vector< TrialOrbital > trialOrbitals
group of centers
Definition: Wannier.h:48
double coeff
coefficient (prefactor) in contribution to trial orbital (1 if only using a single orbital) ...
Definition: Wannier.h:41
vector3 numericalOrbitalsOffset
lattice coordinates of the origin in the input
Definition: Wannier.h:73
DOS::Weight::OrbitalDesc orbitalDesc
orbital code
Definition: Wannier.h:40
bool loadRotations
whether to load initial rotations from previous dump
Definition: Wannier.h:69
bool saveMomenta
whether to output momentum matrix elements
Definition: Wannier.h:68
string dumpFilename
filename patterns for input and output
Definition: Wannier.h:70
Definition: Everything.h:41
void saveMLWF()
Output the Maximally-Localized Wannier Functions from current wavefunctions.
Compute Maximally-Localized Wannier Functions.
Definition: Wannier.h:29
double eOuterMax
outer energy window (outside which bands do not contribute)
Definition: Wannier.h:59
int nCenters
total number of centers, those being optimized and frozen
Definition: Wannier.h:64
Definition: DOS.h:69
vector3 r
guess for center of localized wannier function
Definition: Wannier.h:36
bool saveWfnsRealSpace
whether to output Wannier functions band-by-band in real-space
Definition: Wannier.h:67