ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
Classes | Functions | Variables
elecstate Namespace Reference

Classes

class  DensityMatrix
 
struct  efermi
 Fermi energies. More...
 
class  Efield
 
class  ElecState
 
struct  elecstate_pw_op
 
struct  elecstate_pw_op< FPTYPE, base_device::DEVICE_CPU >
 
class  ElecStateLCAO
 
class  ElecStatePW
 
class  ElecStatePW_SDFT
 
struct  fenergy
 
class  Gatefield
 
class  H_Hartree_pw
 
class  H_TDDFT_pw
 
class  MockElecState
 
class  MockPot
 
class  PotBase
 
class  PotEfield
 
class  Potential
 
class  PotGate
 
class  PotHartree
 
class  PotLocal
 
class  PotLocal_PAW
 
class  PotSurChem
 
class  PotXC
 
struct  ShiftRealComplex
 DensityMatrix Class <TK,TR> = <double,double> for Gamma-only calculation <TK,TR> = <std::complex<double>,double> for multi-k calculation. More...
 
struct  ShiftRealComplex< double >
 
struct  ShiftRealComplex< std::complex< double > >
 

Functions

void cal_dm (const Parallel_Orbitals *ParaV, const ModuleBase::matrix &wg, const psi::Psi< double > &wfc, std::vector< ModuleBase::matrix > &dm)
 
void cal_dm (const Parallel_Orbitals *ParaV, const ModuleBase::matrix &wg, const psi::Psi< std::complex< double > > &wfc, std::vector< ModuleBase::ComplexMatrix > &dm)
 
void cal_nelec (const Atom *atoms, const int &ntype, double &nelec)
 calculate the total number of electrons in system
 
void cal_nbands (const int &nelec, const int &nlocal, const std::vector< double > &nelec_spin, int &nbands)
 Calculate the number of bands.
 
void cal_ux (UnitCell &ucell)
 
bool judge_parallel (double a[3], ModuleBase::Vector3< double > b)
 
void cal_nwfc (std::ofstream &log, UnitCell &ucell, Atom *atoms)
 
void cal_meshx (int &meshx, const Atom *atoms, const int ntype)
 
void cal_natomwfc (std::ofstream &log, int &natomwfc, const int ntype, const Atom *atoms)
 
void print_scf_iterinfo (const std::string &ks_solver, const int &istep, const int &witer, const std::vector< double > &mag, const int &wmag, const double &etot, const double &ediff, const int &wener, const std::vector< double > &drho, const int &wrho, const double &time, const int &wtime)
 
void print_etot (const Magnetism &magnet, const ElecState &elec, const bool converged, const int &iter_in, const double &scf_thr, const double &scf_thr_kin, const double &duration, const double &pw_diag_thr, const double &avg_iter, const bool print)
 print total free energy and other energies
 
void print_format (const std::string &name, const double &value)
 function to print name, value and value*Ry_to_eV
 
void calEBand (const ModuleBase::matrix &ekb, const ModuleBase::matrix &wg, fenergy &f_en)
 
void calculate_weights (const ModuleBase::matrix &ekb, ModuleBase::matrix &wg, const K_Vectors *klist, efermi &eferm, fenergy &f_en, std::vector< double > &nelec_spin, const bool skip_weights=false)
 
void fixed_weights (const std::vector< double > &ocp_kb, const int &nbands, const double &nelec, const K_Vectors *klist, ModuleBase::matrix &wg, bool &skip_weights)
 
void cal_dm_psi (const Parallel_Orbitals *ParaV, const ModuleBase::matrix &wg, const psi::Psi< double > &wfc, elecstate::DensityMatrix< double, double > &DM)
 
void cal_dm_psi (const Parallel_Orbitals *ParaV, const ModuleBase::matrix &wg, const psi::Psi< std::complex< double > > &wfc, elecstate::DensityMatrix< std::complex< double >, double > &DM)
 
void psiMulPsiMpi (const psi::Psi< double > &psi1, const psi::Psi< double > &psi2, double *dm_out, const int *desc_psi, const int *desc_dm)
 
void psiMulPsiMpi (const psi::Psi< std::complex< double > > &psi1, const psi::Psi< std::complex< double > > &psi2, std::complex< double > *dm_out, const int *desc_psi, const int *desc_dm)
 
void psiMulPsi (const psi::Psi< double > &psi1, const psi::Psi< double > &psi2, double *dm_out)
 
void psiMulPsi (const psi::Psi< std::complex< double > > &psi1, const psi::Psi< std::complex< double > > &psi2, std::complex< double > *dm_out)
 
void cal_edm_tddft (Parallel_Orbitals &pv, elecstate::ElecState *pelec, K_Vectors &kv, hamilt::Hamilt< std::complex< double > > *p_hamilt)
 
void read_orb_file (int it, std::string &orb_file, std::ofstream &ofs_running, Atom *atom)
 read number of numerical orbitals for each angular momentum
 
void read_pseudo (std::ofstream &ofs, UnitCell &ucell)
 
void read_cell_pseudopots (const std::string &pp_dir, std::ofstream &log, UnitCell &ucell)
 
void print_unitcell_pseudo (const std::string &fn, UnitCell &ucell)
 
void Set_GlobalV_Default ()
 
std::vector< std::vector< std::complex< double > > > restore_dm (const K_Vectors &kv, const std::vector< std::vector< std::complex< double > > > &dm_k_ibz, const ModuleSymmetry::Symmetry_rotation &symrot, const Parallel_2D &pv)
 for symmetry, multi-k, nspin<4: restore DM(k) form DM(k_ibz)
 
std::vector< std::vector< double > > restore_dm (const K_Vectors &kv, const std::vector< std::vector< double > > &dm_k_ibz, const ModuleSymmetry::Symmetry_rotation &symrot, const Parallel_2D &pv)
 do nothing if gamma_only
 

Variables

double tmp_ucell_omega = 500.0
 
double tmp_gridecut = 80.0
 

Detailed Description

InitSCF: elecstate::ElecState::init_scf()

FixedWeights: elecstate::ElecState::fixed_weights()

CalEBand: elecstate::ElecState::cal_eband()

CalculateWeights: elecstate::ElecState::calculate_weights()

Tested functions:

Function Documentation

◆ cal_dm() [1/2]

void elecstate::cal_dm ( const Parallel_Orbitals ParaV,
const ModuleBase::matrix wg,
const psi::Psi< double > &  wfc,
std::vector< ModuleBase::matrix > &  dm 
)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cal_dm() [2/2]

void elecstate::cal_dm ( const Parallel_Orbitals ParaV,
const ModuleBase::matrix wg,
const psi::Psi< std::complex< double > > &  wfc,
std::vector< ModuleBase::ComplexMatrix > &  dm 
)
inline
Here is the call graph for this function:

◆ cal_dm_psi() [1/2]

void elecstate::cal_dm_psi ( const Parallel_Orbitals ParaV,
const ModuleBase::matrix wg,
const psi::Psi< double > &  wfc,
elecstate::DensityMatrix< double, double > &  DM 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cal_dm_psi() [2/2]

void elecstate::cal_dm_psi ( const Parallel_Orbitals ParaV,
const ModuleBase::matrix wg,
const psi::Psi< std::complex< double > > &  wfc,
elecstate::DensityMatrix< std::complex< double >, double > &  DM 
)
Here is the call graph for this function:

◆ cal_edm_tddft()

void elecstate::cal_edm_tddft ( Parallel_Orbitals pv,
elecstate::ElecState pelec,
K_Vectors kv,
hamilt::Hamilt< std::complex< double > > *  p_hamilt 
)

be careful, the type of nloc is 'long' whether the long type is safe, needs more discussion

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cal_meshx()

void elecstate::cal_meshx ( int &  meshx,
const Atom atoms,
const int  ntype 
)
Here is the caller graph for this function:

◆ cal_natomwfc()

void elecstate::cal_natomwfc ( std::ofstream &  log,
int &  natomwfc,
const int  ntype,
const Atom atoms 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cal_nbands()

void elecstate::cal_nbands ( const int &  nelec,
const int &  nlocal,
const std::vector< double > &  nelec_spin,
int &  nbands 
)

Calculate the number of bands.

Parameters
nelec[in] total number of electrons
nlocal[in] total number of local basis
nelec_spin[in] number of electrons for each spin
nbands[out] number of bands
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cal_nelec()

void elecstate::cal_nelec ( const Atom atoms,
const int &  ntype,
double &  nelec 
)

calculate the total number of electrons in system

Parameters
atoms[in] atom pointer
ntype[in] number of atom types
nelec[out] total number of electrons
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cal_nwfc()

void elecstate::cal_nwfc ( std::ofstream &  log,
UnitCell ucell,
Atom atoms 
)

");

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cal_ux()

void elecstate::cal_ux ( UnitCell ucell)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ calculate_weights()

void elecstate::calculate_weights ( const ModuleBase::matrix ekb,
ModuleBase::matrix wg,
const K_Vectors klist,
efermi eferm,
fenergy f_en,
std::vector< double > &  nelec_spin,
const bool  skip_weights = false 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ calEBand()

void elecstate::calEBand ( const ModuleBase::matrix ekb,
const ModuleBase::matrix wg,
fenergy f_en 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ fixed_weights()

void elecstate::fixed_weights ( const std::vector< double > &  ocp_kb,
const int &  nbands,
const double &  nelec,
const K_Vectors klist,
ModuleBase::matrix wg,
bool &  skip_weights 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ judge_parallel()

bool elecstate::judge_parallel ( double  a[3],
ModuleBase::Vector3< double >  b 
)
Here is the caller graph for this function:

◆ print_etot()

void elecstate::print_etot ( const Magnetism magnet,
const ElecState elec,
const bool  converged,
const int &  iter_in,
const double &  scf_thr,
const double &  scf_thr_kin,
const double &  duration,
const double &  pw_diag_thr,
const double &  avg_iter,
const bool  print 
)

print total free energy and other energies

Parameters
ucellunit cell
convergedif converged
iter_initer
scf_thrthreshold for scf
durationtime of each iteration
pw_diag_thrthreshold for diagonalization
avg_iteraveraged diagonalization iteration of each scf iteration
printif print to screen
Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_format()

void elecstate::print_format ( const std::string &  name,
const double &  value 
)

function to print name, value and value*Ry_to_eV

Parameters
namename
valuevalue
Here is the caller graph for this function:

◆ print_scf_iterinfo()

void elecstate::print_scf_iterinfo ( const std::string &  ks_solver,
const int &  istep,
const int &  witer,
const std::vector< double > &  mag,
const int &  wmag,
const double &  etot,
const double &  ediff,
const int &  wener,
const std::vector< double > &  drho,
const int &  wrho,
const double &  time,
const int &  wtime 
)

Notes on refactor of ESolver's functions

the print of SCF iteration on-the-fly information.

  1. Previously it is expected for nspin 1, 2, and 4, also with xc_type 3/5 or not, the information will organized in different ways. This brings inconsistencies between patterns of print and make it hard to vectorize information.
  2. the function print_etot actually do two kinds of things, 1) print information into running_*.log, 2) print information onto screen. These two tasks are, in no way should be placed/implemented in one function directly
  3. there are information redundance: the istep of SCF can provide information determing whether print out the SCF iteration info. table header or not, rather than dividing into two functions and hard code the format.

For nspin 1, print: ITER, ETOT, EDIFF, DRHO, TIME nspin 2, print: ITER, TMAG, AMAG, ETOT, EDIFF, DRHO, TIME nspin 4 with nlcc, print: ITER, TMAGX, TMAGY, TMAGZ, AMAG, ETOT, EDIFF, DRHO, TIME xc type_id 3/5: DKIN

Based on summary above, there are several groups of info:

  1. counting: ITER
  2. (optional) magnetization: TMAG or TMAGX-TMAGY-TMAGZ, AMAG
  3. energies: ETOT, EDIFF
  4. densities: DRHO, DKIN(optional)
  5. time: TIME
Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_unitcell_pseudo()

void elecstate::print_unitcell_pseudo ( const std::string &  fn,
UnitCell ucell 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ psiMulPsi() [1/2]

void elecstate::psiMulPsi ( const psi::Psi< double > &  psi1,
const psi::Psi< double > &  psi2,
double *  dm_out 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ psiMulPsi() [2/2]

void elecstate::psiMulPsi ( const psi::Psi< std::complex< double > > &  psi1,
const psi::Psi< std::complex< double > > &  psi2,
std::complex< double > *  dm_out 
)
Here is the call graph for this function:

◆ psiMulPsiMpi() [1/2]

void elecstate::psiMulPsiMpi ( const psi::Psi< double > &  psi1,
const psi::Psi< double > &  psi2,
double *  dm_out,
const int *  desc_psi,
const int *  desc_dm 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ psiMulPsiMpi() [2/2]

void elecstate::psiMulPsiMpi ( const psi::Psi< std::complex< double > > &  psi1,
const psi::Psi< std::complex< double > > &  psi2,
std::complex< double > *  dm_out,
const int *  desc_psi,
const int *  desc_dm 
)
Here is the call graph for this function:

◆ read_cell_pseudopots()

void elecstate::read_cell_pseudopots ( const std::string &  pp_dir,
std::ofstream &  log,
UnitCell ucell 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_orb_file()

void elecstate::read_orb_file ( int  it,
std::string &  orb_file,
std::ofstream &  ofs_running,
Atom atom 
)

read number of numerical orbitals for each angular momentum

Parameters
itindex of atom type
orb_fileorbital filename
ofs_runningofstream
atomAtom instance stored in UnitCell
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_pseudo()

void elecstate::read_pseudo ( std::ofstream &  ofs,
UnitCell ucell 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ restore_dm() [1/2]

std::vector< std::vector< double > > elecstate::restore_dm ( const K_Vectors kv,
const std::vector< std::vector< double > > &  dm_k_ibz,
const ModuleSymmetry::Symmetry_rotation symrot,
const Parallel_2D pv 
)

do nothing if gamma_only

◆ restore_dm() [2/2]

std::vector< std::vector< std::complex< double > > > elecstate::restore_dm ( const K_Vectors kv,
const std::vector< std::vector< std::complex< double > > > &  dm_k_ibz,
const ModuleSymmetry::Symmetry_rotation symrot,
const Parallel_2D pv 
)

for symmetry, multi-k, nspin<4: restore DM(k) form DM(k_ibz)

◆ Set_GlobalV_Default()

void elecstate::Set_GlobalV_Default ( )
Here is the caller graph for this function:

Variable Documentation

◆ tmp_gridecut

double elecstate::tmp_gridecut = 80.0

◆ tmp_ucell_omega

double elecstate::tmp_ucell_omega = 500.0