Skip to content

Commit 6f095fb

Browse files
committed
change efermi to Efermi in fp_energy.h
1 parent 5463571 commit 6f095fb

19 files changed

+184
-100
lines changed

source/Makefile.Objects

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,7 @@ OBJS_IO=input_conv.o\
579579
write_elecstat_pot.o\
580580
write_elf.o\
581581
write_dipole.o\
582+
write_init.o\
582583
td_current_io.o\
583584
write_libxc_r.o\
584585
output_log.o\

source/source_esolver/esolver_fp.cpp

Lines changed: 4 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@
1313
#include "source_io/print_info.h"
1414
#include "source_io/rhog_io.h"
1515
#include "source_io/module_parameter/parameter.h"
16-
#include "source_io/ctrl_output_fp.h"
1716

1817
#include "source_pw/module_pwdft/setup_pwrho.h" // mohan 20251005
1918
#include "source_hamilt/module_xc/xc_functional.h" // mohan 20251005
19+
#include "source_io/ctrl_output_fp.h"
20+
#include "source_io/write_init.h" // write_chg_init, write_pot_init
2021

2122
namespace ModuleESolver
2223
{
@@ -146,63 +147,8 @@ void ESolver_FP::before_scf(UnitCell& ucell, const int istep)
146147
elecstate::cal_ux(ucell);
147148

148149
//! output the initial charge density
149-
const int nspin = PARAM.inp.nspin;
150-
if (PARAM.inp.out_chg[0] == 2)
151-
{
152-
for (int is = 0; is < nspin; is++)
153-
{
154-
std::stringstream ss;
155-
ss << PARAM.globalv.global_out_dir << "chg";
156-
157-
if(nspin==1)
158-
{
159-
ss << "ini.cube";
160-
}
161-
else if(nspin==2 || nspin==4)
162-
{
163-
ss << "s" << is + 1 << "ini.cube";
164-
}
165-
166-
ModuleIO::write_vdata_palgrid(this->Pgrid,
167-
this->chr.rho[is],
168-
is,
169-
nspin,
170-
istep,
171-
ss.str(),
172-
this->pelec->eferm.ef,
173-
&(ucell));
174-
}
175-
}
176-
177-
//! output total local potential of the initial charge density
178-
if (PARAM.inp.out_pot == 3)
179-
{
180-
for (int is = 0; is < nspin; is++)
181-
{
182-
std::stringstream ss;
183-
ss << PARAM.globalv.global_out_dir << "pot";
184-
185-
if(nspin==1)
186-
{
187-
ss << "ini.cube";
188-
}
189-
else if(nspin==2 || nspin==4)
190-
{
191-
ss << "s" << is + 1 << "ini.cube";
192-
}
193-
194-
ModuleIO::write_vdata_palgrid(this->Pgrid,
195-
this->pelec->pot->get_effective_v(is),
196-
is,
197-
nspin,
198-
istep,
199-
ss.str(),
200-
0.0, // efermi
201-
&(ucell),
202-
11, // precsion
203-
0); // out_fermi
204-
}
205-
}
150+
ModuleIO::write_chg_init(ucell, this->Pgrid, this->chr, this->pelec->eferm, istep, PARAM.inp);
151+
ModuleIO::write_pot_init(ucell, this->Pgrid, this->pelec, istep, PARAM.inp);
206152

207153
return;
208154
}

source/source_esolver/esolver_ks.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,30 @@
11
#include "esolver_ks.h"
22

3+
/*
34
#include "source_base/timer.h"
45
#include "source_base/global_variable.h"
56
#include "source_pw/module_pwdft/global.h"
67
#include "source_io/module_parameter/parameter.h"
78
#include "source_lcao/module_dftu/dftu.h"
89
910
#include "source_cell/cal_atoms_info.h"
10-
#include "source_estate/elecstate_print.h"
11-
#include "source_hamilt/module_xc/xc_functional.h"
12-
#include "source_hsolver/hsolver.h"
1311
#include "source_io/cube_io.h"
12+
*/
1413

15-
#include "source_io/write_bands.h"
16-
// for output log information
17-
#include "source_io/output_log.h"
18-
#include "source_io/print_info.h"
19-
#include "source_io/write_eig_occ.h"
2014
// for jason output information
2115
#include "source_io/json_output/init_info.h"
2216
#include "source_io/json_output/output_info.h"
2317

2418
#include "source_estate/update_pot.h" // mohan add 20251016
2519
#include "source_estate/module_charge/chgmixing.h" // mohan add 20251018
2620
#include "source_pw/module_pwdft/setup_pwwfc.h" // mohan add 20251018
21+
#include "source_hsolver/hsolver.h"
22+
#include "source_io/write_eig_occ.h"
23+
#include "source_io/write_bands.h"
24+
#include "source_hamilt/module_xc/xc_functional.h"
25+
#include "source_io/output_log.h" // use write_head
26+
#include "source_estate/elecstate_print.h" // print_etot
27+
#include "source_io/print_info.h" // print_parameters
2728

2829
namespace ModuleESolver
2930
{

source/source_estate/elecstate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ class ElecState
150150
double get_local_pp_energy();
151151

152152
fenergy f_en; ///< energies contribute to the total free energy
153-
efermi eferm; ///< fermi energies
153+
Efermi eferm; ///< fermi energies
154154

155155
// below defines the bandgap:
156156

source/source_estate/elecstate_tools.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace elecstate
2929
void calculate_weights(const ModuleBase::matrix& ekb,
3030
ModuleBase::matrix& wg,
3131
const K_Vectors* klist,
32-
efermi& eferm,
32+
Efermi& eferm,
3333
fenergy& f_en,
3434
std::vector<double>& nelec_spin,
3535
const bool skip_weights=false)
@@ -179,4 +179,4 @@ namespace elecstate
179179
skip_weights = true;
180180

181181
}
182-
}
182+
}

source/source_estate/elecstate_tools.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ void calEBand(const ModuleBase::matrix& ekb, const ModuleBase::matrix& wg, fener
1010
void calculate_weights(const ModuleBase::matrix& ekb,
1111
ModuleBase::matrix& wg,
1212
const K_Vectors* klist,
13-
efermi& eferm,
13+
Efermi& eferm,
1414
fenergy& f_en,
1515
std::vector<double>& nelec_spin,
1616
const bool skip_weights);
@@ -23,4 +23,4 @@ void fixed_weights(const std::vector<double>& ocp_kb,
2323
bool& skip_weights);
2424
} // namespace elecstate
2525

26-
#endif
26+
#endif

source/source_estate/fp_energy.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ void fenergy::print_all() const
6161
std::cout << " total= " << etot << std::endl;
6262
}
6363

64-
/// @brief set efermi of a specific spin
64+
/// @brief set Efermi of a specific spin
6565
/// @param is SPIN
6666
/// @param ef_in fermi(is)
67-
void efermi::set_efval(const int& is, const double& ef_in)
67+
void Efermi::set_efval(const int& is, const double& ef_in)
6868
{
6969
if (!two_efermi)
7070
{
@@ -88,7 +88,7 @@ void efermi::set_efval(const int& is, const double& ef_in)
8888
/// @brief get the value of fermi of a specific spin
8989
/// @param is SPIN
9090
/// @return value of fermi(is)
91-
double efermi::get_efval(const int& is) const
91+
double Efermi::get_efval(const int& is) const
9292
{
9393
if (!two_efermi)
9494
{
@@ -111,7 +111,7 @@ double efermi::get_efval(const int& is) const
111111

112112
/// @brief get all fermi energies for all spins
113113
/// @return all fermi energies for all spins
114-
std::vector<double> efermi::get_all_ef() const
114+
std::vector<double> Efermi::get_all_ef() const
115115
{
116116
if (two_efermi)
117117
{

source/source_estate/fp_energy.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ struct fenergy
5959
* @struct efermi
6060
* @brief Fermi energies
6161
*/
62-
struct efermi
62+
struct Efermi
6363
{
6464
double ef = 0.0; ///< Fermi energy
6565
double ef_up = 0.0; ///< spin up Fermi energy

source/source_estate/module_charge/charge.h

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@
1313
//a forward declaration of UnitCell
1414
class UnitCell;
1515

16-
//==========================================================
1716
// Electron Charge Density
18-
//==========================================================
1917
class Charge
2018
{
2119

2220
public:
21+
2322
Charge();
2423
~Charge();
2524

@@ -43,8 +42,8 @@ class Charge
4342

4443
double **kin_r = nullptr; // kinetic energy density in real space, for meta-GGA
4544
double **kin_r_save = nullptr; // kinetic energy density in real space, for meta-GGA
46-
// wenfei 2021-07-28
4745
const Parallel_Grid* pgrid = nullptr;
46+
4847
private:
4948

5049
//temporary
@@ -56,6 +55,7 @@ class Charge
5655
double *_space_kin_r_save = nullptr;
5756

5857
public:
58+
5959
double **nhat = nullptr; //compensation charge for PAW
6060
double **nhat_save = nullptr; //compensation charge for PAW
6161
// wenfei 2023-09-05
@@ -77,7 +77,7 @@ class Charge
7777
* @param klist [in] k points list if needed
7878
* @param wfcpw [in] PW basis for wave function if needed
7979
*/
80-
void init_rho(elecstate::efermi& eferm_iout,
80+
void init_rho(elecstate::Efermi& eferm_iout,
8181
const UnitCell& ucell,
8282
const Parallel_Grid& pgrid,
8383
const ModuleBase::ComplexMatrix& strucFac,
@@ -96,6 +96,7 @@ class Charge
9696
void set_rho_core(const UnitCell& ucell,
9797
const ModuleBase::ComplexMatrix& structure_factor,
9898
const bool* numeric);
99+
99100
void set_rho_core_paw();
100101

101102
void renormalize_rho();
@@ -119,14 +120,13 @@ class Charge
119120

120121
double cal_rho2ne(const double *rho_in) const;
121122

122-
void check_rho(); // to check whether the charge density is normal
123+
void check_rho(); // to check whether the charge density is normal
123124

124-
void init_final_scf(); //LiuXh add 20180619
125+
void init_final_scf(); //LiuXh add 20180619
125126

126127
public:
127128
/**
128129
* @brief init some arrays for mpi_inter_pools, rho_mpi
129-
*
130130
*/
131131
void init_chgmpi();
132132

@@ -136,14 +136,14 @@ class Charge
136136
*/
137137
void rho_mpi();
138138

139-
/**
140-
* @brief Reduce among different pools
139+
/**
140+
* @brief Reduce among different pools
141141
* If NPROC_IN_POOLs are all the same, use GlobalV::KP_WORLD
142142
* else, gather rho in a POOL, and then reduce among different POOLs
143-
*
144-
* @param array_rho f(rho): an array [nrxx]
145-
*/
146-
void reduce_diff_pools(double* array_rho) const;
143+
*
144+
* @param array_rho f(rho): an array [nrxx]
145+
*/
146+
void reduce_diff_pools(double* array_rho) const;
147147

148148
void set_omega(double* omega_in){this->omega_ = omega_in;};
149149

@@ -154,6 +154,7 @@ class Charge
154154
int nspin=0; // number of spins
155155
ModulePW::PW_Basis* rhopw = nullptr;// When double_grid is used, rhopw = rhodpw (dense grid)
156156
bool cal_elf = false; // whether to calculate electron localization function (ELF)
157+
157158
private:
158159

159160
void destroy(); // free arrays liuyu 2023-03-12
@@ -163,8 +164,8 @@ class Charge
163164
bool allocate_rho;
164165

165166
bool allocate_rho_final_scf; // LiuXh add 20180606
167+
166168
#ifdef __MPI
167-
private:
168169
int *rec = nullptr; //The number of elements each process should receive into the receive buffer.
169170
int *dis = nullptr; //The displacement (relative to recvbuf) for each process in the receive buffer.
170171
#endif

source/source_estate/module_charge/charge_init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include "source_io/rhog_io.h"
1919
#include "source_io/read_wf2rho_pw.h"
2020

21-
void Charge::init_rho(elecstate::efermi& eferm_iout,
21+
void Charge::init_rho(elecstate::Efermi& eferm_iout,
2222
const UnitCell& ucell,
2323
const Parallel_Grid& pgrid,
2424
const ModuleBase::ComplexMatrix& strucFac,

0 commit comments

Comments
 (0)