Skip to content

Commit adf258d

Browse files
committed
Merge branch 'develop' of github.com:deepmodeling/abacus-develop into develop
2 parents 26d728c + 429e1f3 commit adf258d

File tree

110 files changed

+14076
-6235
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+14076
-6235
lines changed

source/Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ VPATH=./src_global\
1818
:./module_deepks\
1919
:./module_xc\
2020
:./module_esolver\
21-
:./module_surchem\
2221
:./src_pw\
2322
:./src_lcao\
2423
:./src_ions\
@@ -70,7 +69,6 @@ FP_OBJS_0=$(OBJS_FIRST_PRINCIPLES)\
7069
$(OBJS_PARALLEL)\
7170
$(OBJS_TOOLS) \
7271
$(OBJS_COMMON)\
73-
$(OBJS_SURCHEM)\
7472
main.o\
7573

7674
FP_OBJS=$(patsubst %.o, ${OBJ_DIR}/%.o, ${FP_OBJS_0})

source/Makefile.Objects

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ grid_bigcell.o\
111111
grid_meshball.o\
112112
gint_tools.o\
113113
gint_gamma.o\
114-
gint_gamma_common.o\
115114
gint_gamma_fvl.o\
116115
gint_gamma_vl.o\
117116
gint_gamma_rho.o\
@@ -122,7 +121,7 @@ gint_k_init.o\
122121
gint_k_vl.o\
123122
gint_k_rho.o\
124123
gint_k_fvl.o\
125-
grid_base_beta.o\
124+
gint_k_env.o \
126125
ORB_control.o\
127126
ORB_read.o\
128127
ORB_atomic.o\
@@ -142,7 +141,6 @@ ELEC_evolve.o\
142141
ELEC_scf.o\
143142
ELEC_nscf.o\
144143
LOOP_cell.o\
145-
LOOP_elec.o\
146144
LOOP_ions.o\
147145
run_md_lcao.o\
148146
DM_gamma.o\
@@ -233,9 +231,19 @@ OBJS_ESOLVER=esolver.o\
233231
esolver_ks_pw.o\
234232
esolver_sdft_pw.o\
235233
esolver_ks_lcao.o\
234+
esolver_ks_lcao_elec.o\
236235
esolver_lj.o\
237236
esolver_dp.o\
238237

238+
OBJS_SURCHEM=H_correction_pw.o\
239+
cal_epsilon.o\
240+
cal_pseudo.o\
241+
cal_totn.o\
242+
cal_vcav.o\
243+
cal_vel.o\
244+
corrected_energy.o\
245+
minimize_cg.o\
246+
239247
OBJS_XC=xc_funct_corr_gga.o \
240248
xc_funct_corr_lda.o \
241249
xc_funct_exch_gga.o \
@@ -253,6 +261,7 @@ $(OBJS_PW)\
253261
$(OBJS_LCAO)\
254262
$(OBJS_ESOLVER)\
255263
$(OBJS_XC)\
264+
$(OBJS_SURCHEM)\
256265
charge.o \
257266
charge_mixing.o \
258267
charge_pulay.o \
@@ -368,14 +377,6 @@ pzt2s.o\
368377
pdtrsm.o\
369378
pzhtrsm.o\
370379

371-
OBJS_SURCHEM=cal_epsilon.o\
372-
cal_pseudo.o\
373-
cal_totn.o\
374-
cal_vcav.o\
375-
cal_vel.o\
376-
corrected_energy.o\
377-
H_correction_pw.o\
378-
minimize_cg.o\
379380

380381
PDIAG_MR_0=dcopy.o\
381382
dlae2.o\

source/module_cell/read_pp_upf201.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ int Pseudopot_upf::read_pseudo_upf201(std::ifstream &ifs)
128128

129129
if (ModuleBase::GlobalFunc::SCAN_BEGIN(ifs, "<PP_R", true, false))
130130
{
131-
ModuleBase::GlobalFunc::READ_VALUE(ifs, word); // type size columns
131+
ifs.ignore(150, '>');
132+
// ModuleBase::GlobalFunc::READ_VALUE(ifs, word); // type size columns
132133
this->read_pseudo_upf201_r(ifs);
133134
}
134135
else if (ModuleBase::GlobalFunc::SCAN_BEGIN(ifs, "<PP_R>"))
@@ -139,7 +140,8 @@ int Pseudopot_upf::read_pseudo_upf201(std::ifstream &ifs)
139140

140141
if (ModuleBase::GlobalFunc::SCAN_BEGIN(ifs, "<PP_RAB", true, false))
141142
{
142-
ModuleBase::GlobalFunc::READ_VALUE(ifs, word); // type size columns
143+
ifs.ignore(150, '>');
144+
// ModuleBase::GlobalFunc::READ_VALUE(ifs, word); // type size columns
143145
this->read_pseudo_upf201_rab(ifs);
144146
}
145147
else if (ModuleBase::GlobalFunc::SCAN_BEGIN(ifs, "<PP_RAB>"))
@@ -224,7 +226,8 @@ int Pseudopot_upf::read_pseudo_upf201(std::ifstream &ifs)
224226

225227
if (ModuleBase::GlobalFunc::SCAN_BEGIN(ifs, "<PP_DIJ", true, false))
226228
{
227-
ModuleBase::GlobalFunc::READ_VALUE(ifs, word); // type size columns
229+
ifs.ignore(150, '>');
230+
// ModuleBase::GlobalFunc::READ_VALUE(ifs, word); // type size columns
228231
this->read_pseudo_upf201_dij(ifs);
229232
}
230233
else if ( ModuleBase::GlobalFunc::SCAN_BEGIN(ifs, "<PP_DIJ>"))
@@ -289,7 +292,8 @@ int Pseudopot_upf::read_pseudo_upf201(std::ifstream &ifs)
289292
//--------------------------------------
290293
if (ModuleBase::GlobalFunc::SCAN_BEGIN(ifs, "<PP_RHOATOM", true, false))
291294
{
292-
ModuleBase::GlobalFunc::READ_VALUE(ifs, word); // type size columns
295+
ifs.ignore(150, '>');
296+
// ModuleBase::GlobalFunc::READ_VALUE(ifs, word); // type size columns
293297
this->read_pseudo_upf201_rhoatom(ifs);
294298
}
295299
else if (ModuleBase::GlobalFunc::SCAN_BEGIN(ifs, "<PP_RHOATOM>"))
@@ -527,10 +531,10 @@ void Pseudopot_upf::read_pseudo_upf201_dij(std::ifstream &ifs)
527531
for(int j=0;j<nbeta;j++)
528532
{
529533
ifs >> dion(i,j);
530-
if ( i != j && dion(i,j) != 0.0 )
531-
{
532-
ModuleBase::WARNING_QUIT("read_pseudo_upf201","Error: for i != j, Dij of Pseudopotential must be 0.0");
533-
}
534+
// if ( i != j && dion(i,j) != 0.0 )
535+
// {
536+
// ModuleBase::WARNING_QUIT("read_pseudo_upf201","Error: for i != j, Dij of Pseudopotential must be 0.0");
537+
// }
534538
}
535539
}
536540
}

source/module_elecstate/elecstate_lcao.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ void ElecStateLCAO::psiToRho(const psi::Psi<std::complex<double>>& psi)
9494
//------------------------------------------------------------
9595

9696
ModuleBase::GlobalFunc::NOTE("Calculate the charge on real space grid!");
97-
this->uhm->GK.cal_rho_k(this->loc->DM_R);
97+
this->uhm->GK.cal_rho_k(this->loc->DM_R, this->charge);
9898

9999
this->charge->renormalize_rho();
100100

@@ -142,7 +142,7 @@ void ElecStateLCAO::psiToRho(const psi::Psi<double>& psi)
142142
// calculate the charge density on real space grid.
143143
//------------------------------------------------------------
144144
ModuleBase::GlobalFunc::NOTE("Calculate the charge on real space grid!");
145-
this->uhm->GG.cal_rho(this->loc->DM);
145+
this->uhm->GG.cal_rho(this->loc->DM, this->charge);
146146

147147
this->charge->renormalize_rho();
148148

source/module_esolver/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ add_library(
77
esolver_ks_pw.cpp
88
esolver_sdft_pw.cpp
99
esolver_ks_lcao.cpp
10+
esolver_ks_lcao_elec.cpp
1011
esolver_lj.cpp
1112
esolver_dp.cpp
1213
)

source/module_esolver/esolver.cpp

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -8,47 +8,47 @@
88

99
namespace ModuleESolver
1010
{
11-
void ESolver:: printname()
12-
{
13-
std::cout<<classname<<std::endl;
14-
}
15-
16-
17-
//Some API to operate E_Solver
18-
void init_esolver(ESolver *&p_esolver, const string use_esol)
19-
{
20-
if(use_esol == "ksdft_pw")
21-
{
22-
p_esolver = new ESolver_KS_PW();
23-
}
24-
else if(use_esol == "ksdft_lcao")
25-
{
26-
p_esolver = new ESolver_KS_LCAO();
27-
}
28-
else if(use_esol == "sdft_pw")
11+
void ESolver::printname()
2912
{
30-
p_esolver = new ESolver_SDFT_PW();
13+
std::cout << classname << std::endl;
3114
}
32-
// else if(use_esol == "ofdft")
33-
// {
34-
// p_esolver = new OFDFT();
35-
// }
36-
else if(use_esol == "lj_pot")
37-
{
38-
p_esolver = new ESolver_LJ();
39-
}
40-
else if(use_esol == "dp_pot")
15+
16+
17+
//Some API to operate E_Solver
18+
void init_esolver(ESolver*& p_esolver, const string use_esol)
4119
{
42-
p_esolver = new ESolver_DP();
20+
if (use_esol == "ksdft_pw")
21+
{
22+
p_esolver = new ESolver_KS_PW();
23+
}
24+
else if (use_esol == "ksdft_lcao")
25+
{
26+
p_esolver = new ESolver_KS_LCAO();
27+
}
28+
else if (use_esol == "sdft_pw")
29+
{
30+
p_esolver = new ESolver_SDFT_PW();
31+
}
32+
// else if(use_esol == "ofdft")
33+
// {
34+
// p_esolver = new OFDFT();
35+
// }
36+
else if (use_esol == "lj_pot")
37+
{
38+
p_esolver = new ESolver_LJ();
39+
}
40+
else if (use_esol == "dp_pot")
41+
{
42+
p_esolver = new ESolver_DP();
43+
}
4344
}
44-
}
4545

46-
void clean_esolver(ESolver *&pesolver)
47-
{
48-
if(pesolver!=NULL)
46+
void clean_esolver(ESolver*& pesolver)
4947
{
50-
delete pesolver;
48+
if (pesolver != NULL)
49+
{
50+
delete pesolver;
51+
}
5152
}
52-
}
5353

54-
}
54+
}

source/module_esolver/esolver.h

Lines changed: 40 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -16,48 +16,46 @@
1616
namespace ModuleESolver
1717
{
1818

19-
class ESolver
20-
{
21-
// protected:
22-
// ModuleBase::matrix lattice_v;
23-
public:
24-
ESolver(){
25-
classname = "ESolver";
26-
}
27-
virtual ~ESolver(){};
28-
29-
//virtual void Init(Input_EnSolver &inp, matrix &lattice_v)=0
30-
virtual void Init(Input &inp, UnitCell_pseudo &cell)=0;
31-
32-
// They shoud be add after atom class is refactored
33-
// virtual void UpdateLatAtom(ModuleBase::matrix &lat_in, Atom &atom_in);
34-
// virtual void UpdateLat(ModuleBase::matrix &lat_in);
35-
// virtual void UpdateAtom(Atom &atom_in);
36-
37-
/// These two virtual `Run` will be merged in the future.
38-
//virtual void Run(int istep, Atom &atom) = 0;
39-
virtual void Run(const int istep, UnitCell_pseudo& cell) = 0;
40-
virtual void Run(int istep,
41-
Record_adj& ra /**< would be a 2nd-module of Cell*/,
42-
Local_Orbital_Charge& loc /**< EState*/,
43-
Local_Orbital_wfc& lowf /**< Psi*/,
44-
LCAO_Hamilt& uhm /**< Hamilt*/) {};
45-
46-
virtual void cal_Energy(energy &en) = 0;
47-
virtual void cal_Force(ModuleBase::matrix &force) = 0;
48-
virtual void cal_Stress(ModuleBase::matrix &stress) = 0;
49-
50-
//Print current classname.
51-
void printname();
52-
53-
//temporarily
54-
//get iterstep used in current scf
55-
virtual int getniter(){return 0;}
56-
string classname;
57-
};
58-
59-
void init_esolver(ESolver* &p_esolver, const string use_esol);
60-
void clean_esolver(ESolver* &pesolver);
19+
class ESolver
20+
{
21+
// protected:
22+
// ModuleBase::matrix lattice_v;
23+
public:
24+
ESolver() {
25+
classname = "ESolver";
26+
}
27+
virtual ~ESolver() {};
28+
29+
//virtual void Init(Input_EnSolver &inp, matrix &lattice_v)=0
30+
virtual void Init(Input& inp, UnitCell_pseudo& cell) = 0;
31+
32+
// They shoud be add after atom class is refactored
33+
// virtual void UpdateLatAtom(ModuleBase::matrix &lat_in, Atom &atom_in);
34+
// virtual void UpdateLat(ModuleBase::matrix &lat_in);
35+
// virtual void UpdateAtom(Atom &atom_in);
36+
37+
virtual void Run(int istep, UnitCell_pseudo& cell) = 0;
38+
39+
//Deal with exx and other calculation than scf/md/relax:
40+
// such as nscf, istate-charge or envelope
41+
virtual void othercalculation(const int istep) {};
42+
43+
virtual void cal_Energy(energy& en) = 0;
44+
virtual void cal_Force(ModuleBase::matrix& force) = 0;
45+
virtual void cal_Stress(ModuleBase::matrix& stress) = 0;
46+
virtual void postprocess() {};
47+
48+
//Print current classname.
49+
void printname();
50+
51+
//temporarily
52+
//get iterstep used in current scf
53+
virtual int getniter() { return 0; }
54+
string classname;
55+
};
56+
57+
void init_esolver(ESolver*& p_esolver, const string use_esol);
58+
void clean_esolver(ESolver*& pesolver);
6159

6260
}
6361

0 commit comments

Comments
 (0)