21 #ifndef JDFTX_ELECTRONIC_ELECINFO_H 22 #define JDFTX_ELECTRONIC_ELECINFO_H 24 #include <electronic/common.h> 43 int index()
const {
return spin<0 ? 1 : 0; }
55 bool isMine(
int q)
const {
return qDivision.isMine(q); }
56 int whose(
int q)
const {
return qDivision.whose(q); }
57 int qStartOther(
int iProc)
const {
return qDivision.start(iProc); }
58 int qStopOther(
int iProc)
const {
return qDivision.stop(iProc); }
62 std::vector<QuantumNumber>
qnums;
64 bool isNoncollinear()
const {
return spinType==SpinVector || spinType==SpinOrbit; }
65 int spinorLength()
const {
return isNoncollinear() ? 2 : 1; }
90 void printFillings(FILE* fp)
const;
91 void smearReport(
const double* muOverride=0)
const;
92 void updateFillingsEnergies(
const std::vector<diagMatrix>& eps,
Energies&)
const;
95 inline double muEff(
double mu,
double Bz,
int q)
const {
return mu + Bz*qnums[q].spin; }
96 double smear(
double mu,
double eps)
const;
97 double smearPrime(
double mu,
double eps)
const;
98 double smearEntropy(
double mu,
double eps)
const;
108 double nElectronsCalc(
double mu,
const std::vector<diagMatrix>& eps,
double& Bz)
const;
112 double findMu(
const std::vector<diagMatrix>& eps,
double nElectrons,
double& Bz)
const;
114 void kpointsPrint(FILE* fp,
bool printSpin=
false)
const;
115 void kpointPrint(FILE* fp,
int q,
bool printSpin=
false)
const;
117 int findHOMO(
int q)
const;
120 void read(std::vector<diagMatrix>&,
const char *fname,
int nRowsOverride=0)
const;
121 void read(std::vector<matrix>&,
const char *fname,
int nRowsOverride=0,
int nColsOverride=0)
const;
122 void write(
const std::vector<diagMatrix>&,
const char *fname,
int nRowsOverride=0)
const;
123 void write(
const std::vector<matrix>&,
const char *fname,
int nRowsOverride=0,
int nColsOverride=0)
const;
124 void appendWrite(
const std::vector<diagMatrix>&,
const char *fname,
int nRowsOverride=0)
const;
132 double Qinitial, Minitial;
134 friend struct CommandElecInitialFillings;
135 friend struct CommandElecInitialCharge;
136 friend struct CommandElecInitialMagnetization;
137 friend struct CommandInitialState;
139 friend struct LCAOminimizer;
142 double magnetizationCalc(
double mu,
double Bz,
const std::vector<diagMatrix>& eps,
double& nElectrons)
const;
146 friend struct CommandKpointFolding;
150 void kpointsReduce();
153 #endif // JDFTX_ELECTRONIC_ELECINFO_H std::vector< QuantumNumber > qnums
k-points, spins and weights for each state
Definition: ElecInfo.h:62
int index() const
return the appropriate index into electron (spin) density/potential arrays
Definition: ElecInfo.h:43
vector3 k
k-point wave vector
Definition: ElecInfo.h:38
bool muLoop
Whether to optimize mu in an outer loop over fixed charge calculations.
Definition: ElecInfo.h:82
bool scalarFillings
whether fillings are scalar (equal for all bands) at all quantum numbers
Definition: ElecInfo.h:72
string initialFillingsFilename
Flag to check whether the calculation has a DFT+U self-interaction correction.
Definition: ElecInfo.h:86
General complex matrix.
Definition: matrix.h:58
int qStop
Range of states handled by current process (= 0 and nStates for non-MPI jobs)
Definition: ElecInfo.h:54
Definition: Energies.h:26
int whose(int q) const
find out which process this state index belongs to
Definition: ElecInfo.h:56
double weight
state weight (= 1x or 2x k-point weight depending on spintype)
Definition: ElecInfo.h:40
Fermi-Dirac smearing.
Definition: ElecInfo.h:75
Real diagonal matrix.
Definition: matrix.h:31
Definition: ElecInfo.h:35
Calculate phonon dispersion, free energies and electron-phonon matrix elements.
Definition: Phonon.h:47
SpinType spinType
tells us what sort of spins we are using if any
Definition: ElecInfo.h:60
int qStartOther(int iProc) const
find out qStart for another process
Definition: ElecInfo.h:57
int spin
possible spin orientation. up=1, down=-1, none=0
Definition: ElecInfo.h:39
FillingsUpdate
Definition: ElecInfo.h:67
double smearingWidth
Smearing width (temperature in the Fermi case)
Definition: ElecInfo.h:80
bool isMine(int q) const
check if state index is local
Definition: ElecInfo.h:55
double mu
If NaN, fix nElectrons, otherwise fix/target chemical potential to this.
Definition: ElecInfo.h:81
double nElectrons
the number of electrons = Sum w Tr[F]
Definition: ElecInfo.h:61
constant fillings (T=0)
Definition: ElecInfo.h:68
Definition: Everything.h:41
Definition: ElecVars.h:30
Definition: ElecInfo.h:49
Gaussian smearing.
Definition: ElecInfo.h:76
int nStates
Number of bands and total number of states.
Definition: ElecInfo.h:52
int qStopOther(int iProc) const
find out qStop for another process
Definition: ElecInfo.h:58
int qWeightSum
number of density components, spin weight factor (= max occupation per state) and sum of k-point weig...
Definition: ElecInfo.h:53
SmearingType
Definition: ElecInfo.h:74