forked from abacusmodeling/abacus-develop
-
Notifications
You must be signed in to change notification settings - Fork 222
Expand file tree
/
Copy pathelecstate.cpp
More file actions
63 lines (52 loc) · 1.77 KB
/
elecstate.cpp
File metadata and controls
63 lines (52 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include "elecstate.h"
#include "source_io/module_parameter/parameter.h"
#include "source_base/global_variable.h"
#include "source_io/module_parameter/parameter.h"
#include "source_base/memory.h"
#include "source_base/parallel_reduce.h"
#include "source_base/tool_title.h"
#include "occupy.h"
namespace elecstate
{
const double* ElecState::getRho(int spin) const
{
return &(this->charge->rho[spin][0]);
}
void ElecState::init_nelec_spin()
{
this->nelec_spin.resize(PARAM.inp.nspin);
if (PARAM.inp.nspin == 2)
{
this->nelec_spin[0] = (PARAM.inp.nelec + PARAM.inp.nupdown) / 2.0;
this->nelec_spin[1] = (PARAM.inp.nelec - PARAM.inp.nupdown) / 2.0;
}
}
void ElecState::init_scf(const UnitCell& ucell,
const Parallel_Grid& pgrid,
const ModuleBase::ComplexMatrix& strucfac,
const bool* numeric,
ModuleSymmetry::Symmetry& symm,
const void* wfcpw)
{
//! core correction potential.
this->charge->set_rho_core(ucell,strucfac, numeric);
//! renormalize the charge density
this->charge->renormalize_rho();
//! initialize the potential
this->pot->init_pot(this->charge);
}
void ElecState::init_ks(Charge<double>* chr_in, // pointer for class Charge<double>
const K_Vectors* klist_in,
int nk_in,
const ModulePW::PW_Basis_Big* bigpw_in)
{
this->charge = chr_in;
this->klist = klist_in;
this->bigpw = bigpw_in;
// init nelec_spin with nelec and nupdown
this->init_nelec_spin();
// initialize ekb and wg
this->ekb.create(nk_in, PARAM.globalv.nbands_l);
this->wg.create(nk_in, PARAM.globalv.nbands_l);
}
} // namespace elecstate