2222#include " src_pw/wavefunc.h"
2323#include " src_pw/VNL_in_pw.h"
2424#include " src_pw/energy.h"
25- #include " module_xc/xc_functional.h"
26- #include " module_xc/exx_global.h"
27- #include " src_ri/exx_lcao.h"
2825#include " module_neighbor/sltk_atom_arrange.h"
2926Magnetism::Magnetism (){}
3027Magnetism::~Magnetism (){}
@@ -44,12 +41,6 @@ Gint_k::Gint_k(){}
4441Gint_k::~Gint_k (){}
4542Gint_k_init::Gint_k_init (){}
4643Gint_k_init::~Gint_k_init (){}
47- XC_Functional::XC_Functional (){}
48- XC_Functional::~XC_Functional (){}
49- int XC_Functional::get_func_type (){return 0 ;}
50- Exx_Lcao::Exx_Info::Exx_Info ( const Exx_Global::Exx_Info &info_global )
51- :hybrid_type(info_global.hybrid_type),hse_omega(info_global.hse_omega){}
52- Exx_Lcao::Exx_Lcao (const Exx_Global::Exx_Info &info_global ):info(info_global){}
5344wavefunc::wavefunc (){}
5445wavefunc::~wavefunc (){}
5546WF_atomic::WF_atomic (){}
@@ -72,9 +63,25 @@ namespace GlobalC
7263 wavefunc wf;
7364 Charge CHR;
7465 Grid_Driver GridD (GlobalV::test_deconstructor, GlobalV::test_grid_driver,GlobalV::test_grid);
66+ }
67+
68+ #include " module_xc/xc_functional.h"
69+ #include " module_xc/exx_global.h"
70+ XC_Functional::XC_Functional (){}
71+ XC_Functional::~XC_Functional (){}
72+ int XC_Functional::get_func_type (){return 0 ;}
73+
74+ #ifdef __MPI
75+ #include " src_ri/exx_lcao.h"
76+ Exx_Lcao::Exx_Info::Exx_Info ( const Exx_Global::Exx_Info &info_global )
77+ :hybrid_type(info_global.hybrid_type),hse_omega(info_global.hse_omega){}
78+ Exx_Lcao::Exx_Lcao (const Exx_Global::Exx_Info &info_global ):info(info_global){}
79+ namespace GlobalC
80+ {
7581 Exx_Global exx_global;
7682 Exx_Lcao exx_lcao (GlobalC::exx_global.info);
7783}
84+ #endif
7885
7986namespace WF_Local
8087{
@@ -130,11 +137,13 @@ void set_pw()
130137
131138void init ()
132139{
140+ #ifdef __MPI
133141 MPI_Comm_size (MPI_COMM_WORLD,&GlobalV::NPROC);
134142 MPI_Comm_rank (MPI_COMM_WORLD,&GlobalV::MY_RANK);
135143 Parallel_Global::split_diag_world (GlobalV::NPROC);
136144 Parallel_Global::split_grid_world (GlobalV::NPROC);
137145 MPI_Comm_split (MPI_COMM_WORLD,0 ,1 ,&POOL_WORLD); // in LCAO kpar=1
146+ #endif
138147
139148 GlobalV::BASIS_TYPE = " lcao" ;
140149 GlobalV::stru_file = " ./support/si2.STRU" ;
@@ -170,13 +179,14 @@ namespace elecstate
170179 {
171180 public:
172181 MockElecStateLCAO (Charge* chg_in,
182+ const K_Vectors* klist_in,
173183 int nks_in,
174184 int nbands_in,
175185 Local_Orbital_Charge* loc_in,
176186 LCAO_Hamilt* uhm_in,
177187 Local_Orbital_wfc* lowf_in,
178188 ModuleBase::matrix &wg_in)
179- :elecstate::ElecStateLCAO(chg_in,nks_in,nbands_in,loc_in,uhm_in,lowf_in)
189+ :elecstate::ElecStateLCAO(chg_in,klist_in, nks_in,nbands_in,loc_in,uhm_in,lowf_in)
180190 {
181191 this ->wg = wg_in;
182192 }
@@ -188,6 +198,7 @@ namespace elecstate
188198 }
189199
190200 void ElecState::calculate_weights (void ) {}
201+ void ElecState::calEBand () {}
191202}
192203
193204template <class T >
@@ -359,15 +370,16 @@ class ElecStateLCAOPrepare
359370
360371 void gather_rho (Charge* charge)
361372 {
373+ this ->rho_cal = new double * [GlobalV::NSPIN];
374+ for (int is = 0 ; is < GlobalV::NSPIN; is++) this ->rho_cal [is] = new double [GlobalC::pw.ncxyz ];
375+
376+ #ifdef __MPI
362377 MPI_Status ierror;
363378 int ncx = GlobalC::pw.ncx ;
364379 int ncy = GlobalC::pw.ncy ;
365380 int ncz = GlobalC::pw.ncz ;
366381 int nczp = GlobalC::pw.nczp ;
367382
368- this ->rho_cal = new double * [GlobalV::NSPIN];
369- for (int is = 0 ; is < GlobalV::NSPIN; is++) this ->rho_cal [is] = new double [GlobalC::pw.ncxyz ];
370-
371383 int * nz = new int [GlobalV::NPROC];
372384 for (int i=0 ;i<GlobalV::NPROC;i++)
373385 {
@@ -402,6 +414,13 @@ class ElecStateLCAOPrepare
402414 }
403415 }
404416 delete [] nz;
417+ #else
418+ for (int is = 0 ; is < GlobalV::NSPIN; is++)
419+ {
420+ for (int i=0 ;i<GlobalC::pw.ncxyz ;i++)
421+ rho_cal[is][i] = charge->rho [is][i];
422+ }
423+ #endif
405424 }
406425
407426 void out_rho (Charge* charge)
@@ -434,9 +453,11 @@ class ElecStateLCAOPrepare
434453 orb_con.setup_2d_division (GlobalV::ofs_running, GlobalV::ofs_warning);
435454
436455 loc.ParaV = lowf.ParaV = &(orb_con.ParaV );
437-
456+ # ifdef __MPI
438457 this ->distribute_psi_2d (this ->psi ,this ->psi_local ,loc.ParaV ->desc_wfc );
439-
458+ #else
459+ this ->psi_local = this ->psi ;
460+ #endif
440461 GlobalV::SEARCH_RADIUS = atom_arrange::set_sr_NL (
441462 GlobalV::ofs_running,
442463 GlobalV::OUT_LEVEL,
@@ -464,15 +485,15 @@ class ElecStateLCAOPrepare
464485
465486 loc.allocate_dm_wfc (GlobalC::GridT.lgd , lowf);
466487
467- elecstate::MockElecStateLCAO mesl (&GlobalC::CHR,nk,nbands,&loc,&uhm,&lowf,this ->wg );
488+ elecstate::MockElecStateLCAO mesl (&GlobalC::CHR,&GlobalC::kv, nk,nbands,&loc,&uhm,&lowf,this ->wg );
468489
469490 mesl.psiToRho (psi_local);
470491 }
471492
472493 void compare ()
473494 {
474- // this->out_rho(&GlobalC::CHR);
475- this ->gather_rho (&GlobalC::CHR);
495+ // this->out_rho(&GlobalC::CHR);
496+ this ->gather_rho (&GlobalC::CHR);
476497 this ->read_ref_rho ();
477498 if (GlobalV::MY_RANK == 0 )
478499 {
0 commit comments