1717#include " H_Ewald_pw.h"
1818#include " H_Hartree_pw.h"
1919#include " ../module_surchem/efield.h" // liuyu add 2022-05-06
20+ #include " ../module_surchem/surchem.h"
2021#ifdef __DEEPKS
2122#include " ../module_deepks/LCAO_deepks.h"
2223#endif
@@ -36,6 +37,8 @@ energy::energy()
3637
3738 this ->demet = 0 ; // correction for metals
3839 this ->ef = 0 ; // the fermi energy
40+ this ->esol_el = 0 ; // the implicit solvation energy Ael
41+ this ->esol_cav = 0 ; // the implicit solvation energy Acav
3942}
4043
4144energy::~energy ()
@@ -91,7 +94,11 @@ void energy::calculate_etot(void)
9194 + exx
9295 + Efield::etotefield
9396 + evdw; // Peize Lin add evdw 2021.03.09
94-
97+ if (GlobalV::imp_sol)
98+ {
99+ this ->etot += GlobalC::solvent_model.cal_Ael (GlobalC::ucell, GlobalC::rhopw)
100+ + GlobalC::solvent_model.cal_Acav (GlobalC::ucell, GlobalC::rhopw);
101+ }
95102 // Quxin adds for DFT+U energy correction on 20201029
96103
97104 // std::cout << std::resetiosflags(ios::scientific) << std::endl;
@@ -165,7 +172,15 @@ void energy::print_etot(
165172 {
166173 this ->print_format (" E_vdwD3" , evdw);
167174 }
168- this ->print_format (" E_exx" , exx);
175+ this ->print_format (" E_exx" , exx);
176+
177+ if (GlobalV::imp_sol)
178+ {
179+ esol_el = GlobalC::solvent_model.cal_Ael (GlobalC::ucell, GlobalC::rhopw);
180+ esol_cav = GlobalC::solvent_model.cal_Acav (GlobalC::ucell, GlobalC::rhopw);
181+ this ->print_format (" E_sol_el" , esol_el);
182+ this ->print_format (" E_sol_cav" , esol_cav);
183+ }
169184#ifdef __DEEPKS
170185 if (GlobalV::deepks_scf) // caoyu add 2021-08-10
171186 {
0 commit comments