Skip to content

Commit 228ffdc

Browse files
committed
Refactor: remove GlocalC::ucell in elecstate_energy_terms.cpp
1 parent 7198ec1 commit 228ffdc

File tree

7 files changed

+14
-29
lines changed

7 files changed

+14
-29
lines changed

source/Makefile.Objects

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,6 @@ OBJS_SURCHEM=surchem.o\
438438
cal_totn.o\
439439
cal_vcav.o\
440440
cal_vel.o\
441-
corrected_energy.o\
442441
minimize_cg.o\
443442
sol_force.o\
444443

source/module_elecstate/elecstate_energy_terms.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ double ElecState::get_etot_gatefield()
2626

2727
double ElecState::get_solvent_model_Ael()
2828
{
29-
return GlobalC::solvent_model.cal_Ael(GlobalC::ucell, this->charge->nrxx, this->charge->nxyz);
29+
return GlobalC::solvent_model.Ael;
3030
}
3131

3232
double ElecState::get_solvent_model_Acav()
3333
{
34-
return GlobalC::solvent_model.cal_Acav(GlobalC::ucell, this->charge->nxyz);
34+
return GlobalC::solvent_model.Acav;
3535
}
3636

3737
#ifdef __LCAO

source/module_hamilt_general/module_surchem/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ add_library(
88
cal_totn.cpp
99
cal_vcav.cpp
1010
cal_vel.cpp
11-
corrected_energy.cpp
1211
minimize_cg.cpp
1312
sol_force.cpp
1413
)

source/module_hamilt_general/module_surchem/cal_vcav.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ void surchem::createcavity(const UnitCell& ucell,
116116
//-------------------------------------------------------------
117117
// cavitation energy
118118
//-------------------------------------------------------------
119+
this->Acav = PARAM.inp.tau * qs * ucell.omega / rho_basis->nxyz;
120+
Parallel_Reduce::reduce_pool(this->Acav);
119121

120122
// double Ael = cal_Acav(ucell, pwb);
121123

source/module_hamilt_general/module_surchem/cal_vel.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,13 @@ ModuleBase::matrix surchem::cal_vel(const UnitCell& cell,
109109
}
110110

111111
// calculate Ael
112-
// double Ael = cal_Ael(cell, pwb);
112+
this->Ael = 0.0;
113+
for (int ir = 0; ir < rho_basis->nrxx; ir++)
114+
{
115+
this->Ael -= TOTN_real[ir] * delta_phi[ir];
116+
}
117+
Parallel_Reduce::reduce_pool(this->Ael);
118+
this->Ael *= cell.omega / rho_basis->nxyz;
113119

114120
// the 2nd item of tmp_Vel
115121
eps_pot(PS_TOTN_real, Sol_phi, rho_basis, epsilon, epspot);

source/module_hamilt_general/module_surchem/corrected_energy.cpp

Lines changed: 0 additions & 24 deletions
This file was deleted.

source/module_hamilt_general/module_surchem/surchem.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ class surchem
2424
ModuleBase::matrix Vel;
2525
double qs;
2626

27+
double Acav;
28+
double Ael;
29+
2730
// get atom info
2831
atom_in GetAtom;
2932

0 commit comments

Comments
 (0)