11#include " cal_nelec_nband.h"
22#include " module_base/constants.h"
33#include " module_parameter/parameter.h"
4- #ifdef USE_PAW
5- #include " module_cell/module_paw/paw_cell.h"
6- #endif
74
85namespace elecstate {
96
@@ -14,37 +11,18 @@ void cal_nelec(const Atom* atoms, const int& ntype, double& nelec)
1411
1512 if (nelec == 0 )
1613 {
17- if (PARAM. inp . use_paw )
14+ for ( int it = 0 ; it < ntype; it++ )
1815 {
19- #ifdef USE_PAW
20- for (int it = 0 ; it < ntype; it++)
21- {
22- std::stringstream ss1, ss2;
23- ss1 << " electron number of element " << GlobalC::paw_cell.get_zat (it) << std::endl;
24- const int nelec_it = GlobalC::paw_cell.get_val (it) * atoms[it].na ;
25- nelec += nelec_it;
26- ss2 << " total electron number of element " << GlobalC::paw_cell.get_zat (it);
27-
28- ModuleBase::GlobalFunc::OUT (GlobalV::ofs_running, ss1.str (), GlobalC::paw_cell.get_val (it));
29- ModuleBase::GlobalFunc::OUT (GlobalV::ofs_running, ss2.str (), nelec_it);
30- }
31- #endif
32- }
33- else
34- {
35- for (int it = 0 ; it < ntype; it++)
36- {
37- std::stringstream ss1, ss2;
38- ss1 << " electron number of element " << atoms[it].label ;
39- const double nelec_it = atoms[it].ncpp .zv * atoms[it].na ;
40- nelec += nelec_it;
41- ss2 << " total electron number of element " << atoms[it].label ;
16+ std::stringstream ss1, ss2;
17+ ss1 << " electron number of element " << atoms[it].label ;
18+ const double nelec_it = atoms[it].ncpp .zv * atoms[it].na ;
19+ nelec += nelec_it;
20+ ss2 << " total electron number of element " << atoms[it].label ;
4221
43- ModuleBase::GlobalFunc::OUT (GlobalV::ofs_running, ss1.str (), atoms[it].ncpp .zv );
44- ModuleBase::GlobalFunc::OUT (GlobalV::ofs_running, ss2.str (), nelec_it);
45- }
46- ModuleBase::GlobalFunc::OUT (GlobalV::ofs_running, " AUTOSET number of electrons: " , nelec);
22+ ModuleBase::GlobalFunc::OUT (GlobalV::ofs_running, ss1.str (), atoms[it].ncpp .zv );
23+ ModuleBase::GlobalFunc::OUT (GlobalV::ofs_running, ss2.str (), nelec_it);
4724 }
25+ ModuleBase::GlobalFunc::OUT (GlobalV::ofs_running, " AUTOSET number of electrons: " , nelec);
4826 }
4927 if (PARAM.inp .nelec_delta != 0 )
5028 {
0 commit comments