JDFTx  1.7.0
ElecVars Class Reference

Electronic variables and main energy calculator. More...

#include <ElecVars.h>

Classes

struct  BoxPotential
 < box potetial desciptor More...
 

Public Member Functions

ScalarFieldArray get_nXC (const ScalarFieldArray *n_alt=0) const
 return the total (spin) density including core contributions (optionally based on an alternate n)
 
ScalarField get_nTot () const
 return the total electron density (even in spin polarized situations)
 
void setup (const Everything &everything)
 
void EdensityAndVscloc (Energies &ener, const ExCorr *alternateExCorr=0)
 
double elecEnergyAndGrad (Energies &ener, ElecGradient *grad=0, ElecGradient *Kgrad=0, bool calc_Hsub=false)
 
matrix3 latticeGrad () const
 Compute gradient of electronic energy with respect to lattice vectors.
 
void setEigenvectors ()
 Set C to eigenvectors of the subspace hamiltonian.
 
ScalarFieldArray KEdensity () const
 Compute the kinetic energy density.
 
ScalarFieldArray calcDensity () const
 Calculate density using current orthonormal wavefunctions (C)
 
void orthonormalize (int q, matrix *extraRotation=0)
 
double applyHamiltonian (int q, const diagMatrix &Fq, ColumnBundle &HCq, Energies &ener, bool need_Hsub=false, bool diagonalize_Hsub=true)
 

Public Attributes

std::vector< ColumnBundleC
 orthonormal electronic wavefunctions
 
std::vector< diagMatrixHaux_eigs
 auxilliary hamiltonian eigenvalues
 
std::vector< diagMatrixF
 the fillings (diagonal matrices) for each state
 
std::vector< matrixHsub
 Subspace Hamiltonian: Hsub[q]=C[q]^H*C[q].
 
std::vector< matrixHsub_evecs
 eigenvectors of Hsub[q] in columns
 
std::vector< diagMatrixHsub_eigs
 eigenvalues of Hsub[q]
 
std::vector< std::vector< matrix > > VdagC
 cached pseudopotential projections (by state and then species)
 
ScalarFieldArray n
 electron density (single ScalarField) or spin density (two ScalarFields [up,dn]) or spin density matrix (four ScalarFields [UpUp, DnDn, Re(UpDn), Im(UpDn)])
 
ScalarFieldArray nAccum
 ElecVars::n accumulated over an MD trajectory.
 
ScalarFieldArray tau
 kinetic energy density including tauCore, if present (computed if a meta GGA is being used)
 
ScalarFieldTilde d_fluid
 electrostatic potential due to fluid
 
ScalarFieldTilde V_cavity
 non-electrostatic potential on electrons due to fluid
 
ScalarFieldArray Vscloc
 
ScalarFieldArray Vxc
 Local part of (optionally spin-dependent) self-consistent potential.
 
ScalarFieldArray Vtau
 Exchange-correlation potential.
 
std::vector< matrixrhoAtom
 Gradient w.r.t kinetic energy density (if meta-GGA)
 
std::vector< matrixU_rhoAtom
 Atomic density matrices and gradients w.r.t them (for DFT+U)
 
ScalarFieldArray Vexternal
 external potential
 
ScalarFieldTilde rhoExternal
 external charge density
 
bool rhoExternalSelfEnergy
 whether to include self-energy of rhoExternal in output energy
 
std::vector< BoxPotentialboxPot
 parameters for the external box potential
 
FluidSolverParams fluidParams
 
std::shared_ptr< struct FluidSolverfluidSolver
 
string fluidInitialStateFilename
 
string wfnsFilename
 file to read wavefunctions from
 
std::shared_ptr< struct ElecInfo::ColumnBundleReadConversionreadConversion
 ColumnBundle conversion.
 
bool isRandom
 indicates whether the electronic state is random (not yet minimized)
 
bool initLCAO
 initialize wave functions using linear combinations of atomic orbitals
 
bool skipWfnsInit
 whether to skip wavefunction initialization (used to speed up dry runs, phonon calculations)
 
string eigsFilename
 file to read eigenvalues from
 
bool HauxInitialized
 whether Haux has been read in/computed
 
string nFilenamePattern
 file pattern to read electron (spin,kinetic) density from
 
string VFilenamePattern
 file pattern to read electron (spin,kinetic) potential from
 

Friends

struct CommandVexternal
 
struct CommandRhoExternal
 
struct CommandWavefunction
 
struct CommandLcaoParams
 
class Dump
 

Detailed Description

Electronic variables and main energy calculator.

Member Function Documentation

◆ applyHamiltonian()

double ElecVars::applyHamiltonian ( int  q,
const diagMatrix Fq,
ColumnBundle HCq,
Energies ener,
bool  need_Hsub = false,
bool  diagonalize_Hsub = true 
)

Applies the Kohn-Sham Hamiltonian on the orthonormal wavefunctions C, and computes Hsub if necessary, for a single quantum number If Hsub is computed, diagonalize_Hsub controls whether it is diagonalized (no effect if need_Hsub=false). Returns the Kinetic energy contribution from q, which can be used for the inverse kinetic preconditioner

◆ EdensityAndVscloc()

void ElecVars::EdensityAndVscloc ( Energies ener,
const ExCorr alternateExCorr = 0 
)

Compute the terms written as a functional of the electronic density, and its gradient i.e. Vscloc If supplied, alternateExCorr replaces the main exchange and correlaton functional

◆ elecEnergyAndGrad()

double ElecVars::elecEnergyAndGrad ( Energies ener,
ElecGradient grad = 0,
ElecGradient Kgrad = 0,
bool  calc_Hsub = false 
)

Update and return the electronic system energy. Optionally compute the gradient, preconditioned gradient and/or the subspace hamiltonian

◆ orthonormalize()

void ElecVars::orthonormalize ( int  q,
matrix extraRotation = 0 
)

Orthonormalise wavefunctions, with an optional extra rotation If extraRotation is present, it is applied after symmetric orthononormalization, and on output extraRotation contains the net transformation applied to the wavefunctions.


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