@@ -44,52 +44,56 @@ namespace ModuleESolver
4444 {
4545 ESolver_KS::Init (inp,ucell);
4646
47-
48- # ifdef __MPI
49- if (GlobalV::CALCULATION == " nscf " )
47+ // if we are only calculating S, then there is no need
48+ // to prepare for potentials and so on
49+ if (GlobalV::CALCULATION!= " calc_S " )
5050 {
51- switch (GlobalC::exx_global.info .hybrid_type )
51+ #ifdef __MPI
52+ if (GlobalV::CALCULATION == " nscf" )
5253 {
53- case Exx_Global::Hybrid_Type::HF:
54- case Exx_Global::Hybrid_Type::PBE0:
55- case Exx_Global::Hybrid_Type::SCAN0:
56- case Exx_Global::Hybrid_Type::HSE:
57- XC_Functional::set_xc_type (ucell.atoms [0 ].xc_func );
58- break ;
54+ switch (GlobalC::exx_global.info .hybrid_type )
55+ {
56+ case Exx_Global::Hybrid_Type::HF:
57+ case Exx_Global::Hybrid_Type::PBE0:
58+ case Exx_Global::Hybrid_Type::SCAN0:
59+ case Exx_Global::Hybrid_Type::HSE:
60+ XC_Functional::set_xc_type (ucell.atoms [0 ].xc_func );
61+ break ;
62+ }
5963 }
60- }
6164#endif
6265
6366#ifdef __DEEPKS
64- // wenfei 2021-12-19
65- // if we are performing DeePKS calculations, we need to load a model
66- if (GlobalV::deepks_scf)
67- {
68- // load the DeePKS model from deep neural network
69- GlobalC::ld.load_model (INPUT.deepks_model );
70- }
67+ // wenfei 2021-12-19
68+ // if we are performing DeePKS calculations, we need to load a model
69+ if (GlobalV::deepks_scf)
70+ {
71+ // load the DeePKS model from deep neural network
72+ GlobalC::ld.load_model (INPUT.deepks_model );
73+ }
7174#endif
7275
73- // Initialize the local wave functions.
74- // npwx, eigenvalues, and weights
75- // npwx may change according to cell change
76- // this function belongs to cell LOOP
77- GlobalC::wf.allocate_ekb_wg (GlobalC::kv.nks );
76+ // Initialize the local wave functions.
77+ // npwx, eigenvalues, and weights
78+ // npwx may change according to cell change
79+ // this function belongs to cell LOOP
80+ GlobalC::wf.allocate_ekb_wg (GlobalC::kv.nks );
7881
79- // Initialize the FFT.
80- // this function belongs to cell LOOP
82+ // Initialize the FFT.
83+ // this function belongs to cell LOOP
8184
82- // output is GlobalC::ppcell.vloc 3D local pseudopotentials
83- // without structure factors
84- // this function belongs to cell LOOP
85- GlobalC::ppcell.init_vloc (GlobalC::ppcell.vloc , GlobalC::rhopw);
85+ // output is GlobalC::ppcell.vloc 3D local pseudopotentials
86+ // without structure factors
87+ // this function belongs to cell LOOP
88+ GlobalC::ppcell.init_vloc (GlobalC::ppcell.vloc , GlobalC::rhopw);
8689
87- // Initialize the sum of all local potentials.
88- // if ion_step==0, read in/initialize the potentials
89- // this function belongs to ions LOOP
90- int ion_step = 0 ;
91- GlobalC::pot.init_pot (ion_step, GlobalC::sf.strucFac );
92- ModuleBase::GlobalFunc::DONE (GlobalV::ofs_running, " INIT POTENTIAL" );
90+ // Initialize the sum of all local potentials.
91+ // if ion_step==0, read in/initialize the potentials
92+ // this function belongs to ions LOOP
93+ int ion_step = 0 ;
94+ GlobalC::pot.init_pot (ion_step, GlobalC::sf.strucFac );
95+ ModuleBase::GlobalFunc::DONE (GlobalV::ofs_running, " INIT POTENTIAL" );
96+ } // end ifnot calc_S
9397
9498 // ------------------init Basis_lcao----------------------
9599 // Init Basis should be put outside of Ensolver.
@@ -98,6 +102,15 @@ namespace ModuleESolver
98102 this ->Init_Basis_lcao (this ->orb_con , inp, ucell);
99103 // ------------------init Basis_lcao----------------------
100104
105+ if (GlobalV::CALCULATION==" get_S" )
106+ {
107+ // pass Hamilt-pointer to Operator
108+ this ->UHM .genH .LM = this ->UHM .LM = &this ->LM ;
109+ // pass basis-pointer to EState and Psi
110+ this ->LOC .ParaV = this ->LOWF .ParaV = this ->LM .ParaV ;
111+ return ;
112+ }
113+
101114 // ------------------init Hamilt_lcao----------------------
102115 // * allocate H and S matrices according to computational resources
103116 // * set the 'trace' between local H/S and global H/S
0 commit comments