ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
Charge Class Reference

#include <charge.h>

Collaboration diagram for Charge:

Public Member Functions

 Charge ()
 ~Charge ()
 Charge (const Charge &)=delete
Charge & operator= (const Charge &)=delete
void set_rhopw (ModulePW::PW_Basis *rhopw_in)
void init_rho (const UnitCell &ucell, const Parallel_Grid &pgrid, const ModuleBase::ComplexMatrix &strucFac, ModuleSymmetry::Symmetry &symm, const void *klist, const void *wfcpw, const module_charge::InitRhoCfg &cfg)
 Init charge density from file or atomic pseudo-wave-functions.
void allocate (const int &nspin_in, const bool kin_den, const bool meta_gga, const int test_charge)
 Allocate the rho/rhog/kin_r buffers.
void renormalize_rho (const double nelec, const double omega)
 Renormalize rho so that its integral equals the electron number.
double sum_rho (const double omega) const
void save_rho_before_sum_band ()
bool get_allocate_rho () const
 whether allocate() has already claimed the density buffers

Public Attributes

double ** rho = nullptr
double ** rho_save = nullptr
std::complex< double > ** rhog = nullptr
std::complex< double > ** rhog_save = nullptr
double ** kin_r = nullptr
double ** kin_r_save = nullptr
const Parallel_Grid * pgrid = nullptr
double * rho_core = nullptr
std::complex< double > * rhog_core = nullptr
int nrxx =0
int nxyz = 0
int ngmc =0
int nspin =0
bool meta_gga = false
ModulePW::PW_Basis * rhopw = nullptr

Private Member Functions

void destroy ()

Private Attributes

std::vector< double > _space_rho
std::vector< double > _space_rho_save
std::vector< std::complex< double > > _space_rhog
std::vector< std::complex< double > > _space_rhog_save
std::vector< double > _space_kin_r
std::vector< double > _space_kin_r_save
std::vector< double * > _ptrs_rho
std::vector< std::complex< double > * > _ptrs_rhog
std::vector< double * > _ptrs_rho_save
std::vector< std::complex< double > * > _ptrs_rhog_save
std::vector< double * > _ptrs_kin_r
std::vector< double * > _ptrs_kin_r_save
std::vector< double > _space_rho_core
std::vector< std::complex< double > > _space_rhog_core
bool allocate_rho

Constructor & Destructor Documentation

◆ Charge() [1/2]

Charge::Charge ( )
Here is the caller graph for this function:

◆ ~Charge()

Charge::~Charge ( )
Here is the call graph for this function:

◆ Charge() [2/2]

Charge::Charge ( const Charge & )
delete
Here is the call graph for this function:

Member Function Documentation

◆ allocate()

void Charge::allocate ( const int & nspin_in,
const bool kin_den,
const bool meta_gga,
const int test_charge )

Allocate the rho/rhog/kin_r buffers.

Parameters
nspin_innumber of spins
kin_denwhether to allocate the kinetic-energy density buffers
meta_ggawhether the functional is meta-GGA (kin_r carries XC physics, not just ELF output); stored for tau handling
test_chargeverbosity flag (PARAM.inp.test_charge)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ destroy()

void Charge::destroy ( )
private
Here is the caller graph for this function:

◆ get_allocate_rho()

bool Charge::get_allocate_rho ( ) const
inline

whether allocate() has already claimed the density buffers

Returns
true once allocate() has run; allocate() is idempotent and returns early when this is already true

◆ init_rho()

void Charge::init_rho ( const UnitCell & ucell,
const Parallel_Grid & pgrid,
const ModuleBase::ComplexMatrix & strucFac,
ModuleSymmetry::Symmetry & symm,
const void * klist,
const void * wfcpw,
const module_charge::InitRhoCfg & cfg )

Init charge density from file or atomic pseudo-wave-functions.

Parameters
ucell[in] unit cell
pgrid[in] parallel grid descriptor
strucFac[in] structure factor
symm[in] symmetry
klist[in] k points list if needed
wfcpw[in] PW basis for wave function if needed
cfg[in] INPUT values for charge initialization
Here is the call graph for this function:

◆ operator=()

Charge & Charge::operator= ( const Charge & )
delete
Here is the call graph for this function:

◆ renormalize_rho()

void Charge::renormalize_rho ( const double nelec,
const double omega )

Renormalize rho so that its integral equals the electron number.

Parameters
nelectarget total electron number (PARAM.inp.nelec)
omegacurrent unit-cell volume. Must be ucell.omega, NOT rhopw->omega, because in variable-cell calculations (e.g. NPT) rhopw->omega is stale (pw_rho/pw_rhod are not rebuilt on cell change) while ucell.omega is updated every step. Using the stale volume gives a wrong electron count and a wrong renormalization factor, which corrupts the stress.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ save_rho_before_sum_band()

void Charge::save_rho_before_sum_band ( )
Here is the caller graph for this function:

◆ set_rhopw()

void Charge::set_rhopw ( ModulePW::PW_Basis * rhopw_in)
Here is the caller graph for this function:

◆ sum_rho()

double Charge::sum_rho ( const double omega) const
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _ptrs_kin_r

std::vector<double*> Charge::_ptrs_kin_r
private

◆ _ptrs_kin_r_save

std::vector<double*> Charge::_ptrs_kin_r_save
private

◆ _ptrs_rho

std::vector<double*> Charge::_ptrs_rho
private

◆ _ptrs_rho_save

std::vector<double*> Charge::_ptrs_rho_save
private

◆ _ptrs_rhog

std::vector<std::complex<double>*> Charge::_ptrs_rhog
private

◆ _ptrs_rhog_save

std::vector<std::complex<double>*> Charge::_ptrs_rhog_save
private

◆ _space_kin_r

std::vector<double> Charge::_space_kin_r
private

◆ _space_kin_r_save

std::vector<double> Charge::_space_kin_r_save
private

◆ _space_rho

std::vector<double> Charge::_space_rho
private

◆ _space_rho_core

std::vector<double> Charge::_space_rho_core
private

◆ _space_rho_save

std::vector<double> Charge::_space_rho_save
private

◆ _space_rhog

std::vector<std::complex<double> > Charge::_space_rhog
private

◆ _space_rhog_core

std::vector<std::complex<double> > Charge::_space_rhog_core
private

◆ _space_rhog_save

std::vector<std::complex<double> > Charge::_space_rhog_save
private

◆ allocate_rho

bool Charge::allocate_rho
private

◆ kin_r

double** Charge::kin_r = nullptr

◆ kin_r_save

double** Charge::kin_r_save = nullptr

◆ meta_gga

bool Charge::meta_gga = false

◆ ngmc

int Charge::ngmc =0

◆ nrxx

int Charge::nrxx =0

◆ nspin

int Charge::nspin =0

◆ nxyz

int Charge::nxyz = 0

◆ pgrid

const Parallel_Grid* Charge::pgrid = nullptr

◆ rho

double** Charge::rho = nullptr

◆ rho_core

double* Charge::rho_core = nullptr

◆ rho_save

double** Charge::rho_save = nullptr

◆ rhog

std::complex<double>** Charge::rhog = nullptr

◆ rhog_core

std::complex<double>* Charge::rhog_core = nullptr

◆ rhog_save

std::complex<double>** Charge::rhog_save = nullptr

◆ rhopw

ModulePW::PW_Basis* Charge::rhopw = nullptr

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