Skip to content

Commit a0992c7

Browse files
authored
test
1 parent 53427ed commit a0992c7

15 files changed

Lines changed: 25 additions & 24 deletions

File tree

source/source_esolver/esolver_of_tool.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void ESolver_OF::init_elecstate(UnitCell& ucell)
4343
}
4444
// no variable can choose xc, maybe it is necessary
4545
pot_register_in.push_back("xc");
46-
if (PARAM.inp.imp_sol)
46+
if (PARAM.inp.imp_sol != 0)
4747
{
4848
pot_register_in.push_back("surchem");
4949
}

source/source_estate/elecstate_energy.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ void ElecState::cal_energies(const int type)
295295
this->f_en.gatefield = get_etot_gatefield();
296296

297297
//! energy from implicit solvation model
298-
if (PARAM.inp.imp_sol)
298+
if (PARAM.inp.imp_sol != 0)
299299
{
300300
this->f_en.esol_el = get_solvent_model_Ael();
301301
this->f_en.esol_cav = get_solvent_model_Acav();

source/source_estate/elecstate_print.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ void print_etot(const Magnetism& magnet,
262262
energies_Ry.push_back(elec.f_en.exx);
263263

264264
//! solvation energy
265-
if (PARAM.inp.imp_sol)
265+
if (PARAM.inp.imp_sol != 0)
266266
{
267267
titles.push_back("E_sol_el");
268268
energies_Ry.push_back(elec.f_en.esol_el);

source/source_estate/module_pot/efield.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ ModuleBase::matrix Efield::add_efield(const UnitCell& cell,
6969
elec_dipole = cal_elec_dipole(cell, rho_basis, nspin, rho, bmod);
7070
tot_dipole = ion_dipole - elec_dipole;
7171

72-
if (PARAM.inp.imp_sol)
72+
if (PARAM.inp.imp_sol != 0)
7373
{
7474
induced_dipole = cal_induced_dipole(cell, rho_basis, solvent, bmod);
7575
tot_dipole += induced_dipole;
@@ -95,7 +95,7 @@ ModuleBase::matrix Efield::add_efield(const UnitCell& cell,
9595
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "Computed dipole along efield_dir", efield_dir);
9696
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "Elec. dipole (Ry a.u.)", elec_dipole);
9797
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "Ion dipole (Ry a.u.)", ion_dipole);
98-
if (PARAM.inp.imp_sol)
98+
if (PARAM.inp.imp_sol != 0)
9999
{
100100
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "Induced dipole (Ry a.u.)", induced_dipole);
101101
}

source/source_estate/test/elecstate_energy_test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class MockElecState : public ElecState
6868
public:
6969
void Set_GlobalV_Default()
7070
{
71-
PARAM.input.imp_sol = false;
71+
PARAM.input.imp_sol = 0;
7272
PARAM.input.dft_plus_u = 0;
7373
// base class
7474
PARAM.input.nspin = 1;
@@ -117,7 +117,7 @@ TEST_F(ElecStateEnergyTest, CalEnergiesHarris)
117117
TEST_F(ElecStateEnergyTest, CalEnergiesHarrisImpSol)
118118
{
119119
elecstate->f_en.deband_harris = 0.1;
120-
PARAM.input.imp_sol = true;
120+
PARAM.inp.imp_sol = 1;
121121
elecstate->cal_energies(1);
122122
// deband_harris + hatree + efiled + gatefield + esol_el + esol_cav + escon
123123
EXPECT_DOUBLE_EQ(elecstate->f_en.etot_harris, 1.6);
@@ -147,7 +147,7 @@ TEST_F(ElecStateEnergyTest, CalEnergiesEtot)
147147
TEST_F(ElecStateEnergyTest, CalEnergiesEtotImpSol)
148148
{
149149
elecstate->f_en.deband = 0.1;
150-
PARAM.input.imp_sol = true;
150+
PARAM.inp.imp_sol = 1;
151151
elecstate->cal_energies(2);
152152
// deband + hatree + efiled + gatefield + esol_el + esol_cav + escon
153153
EXPECT_DOUBLE_EQ(elecstate->f_en.etot, 1.6);

source/source_estate/test/elecstate_print_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ TEST_F(ElecStatePrintTest, PrintEtotColorS2)
216216
elecstate.charge->nxyz = 1000;
217217

218218
PARAM.input.out_freq_elec = 1;
219-
PARAM.input.imp_sol = true;
219+
PARAM.input.imp_sol = 1;
220220
PARAM.input.efield_flag = true;
221221
PARAM.input.gate_flag = true;
222222
PARAM.sys.two_fermi = true;
@@ -245,7 +245,7 @@ TEST_F(ElecStatePrintTest, PrintEtotColorS4)
245245
elecstate.charge->nxyz = 1000;
246246

247247
PARAM.input.out_freq_elec = 1;
248-
PARAM.input.imp_sol = true;
248+
PARAM.input.imp_sol = 1;
249249
PARAM.input.efield_flag = true;
250250
PARAM.input.gate_flag = true;
251251
PARAM.sys.two_fermi = true;

source/source_hamilt/module_surchem/cal_vel.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ void surchem::cal_smpbe_physics(const int nrxx,
2222
double* kappa2_factor_out)
2323
{
2424
// 1. 获取参数
25-
double T = (PARAM.inp.temperature < 1.0) ? 298.15 : PARAM.inp.temperature;
25+
double T = (PARAM.inp.sol_temp < 1.0) ? 298.15 : PARAM.inp.sol_temp;
2626
double beta = 1.0 / (KB_au * T);
2727
double c_bulk_M = PARAM.inp.c_molar;
2828
double c_bulk_au = c_bulk_M * 6.022e-4 * pow(0.52917721, 3);
@@ -80,7 +80,7 @@ void cal_dielectric_saturation(const int nrxx,
8080
{
8181
double eps_inf = (PARAM.inp.epsilon_inf < 1.0) ? 1.78 : PARAM.inp.epsilon_inf;
8282
double eps_bulk = PARAM.inp.eb_k;
83-
double T = (PARAM.inp.temperature < 1.0) ? 298.15 : PARAM.inp.temperature;
83+
double T = (PARAM.inp.sol_temp < 1.0) ? 298.15 : PARAM.inp.sol_temp;
8484
double beta = 1.0 / (KB_au * T);
8585

8686
// Debye -> Atomic Units conversion (1 Debye approx 0.39343 au)

source/source_io/module_parameter/input_parameter.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ struct Input_para
487487
double block_height = 0.1; ///< height of the block
488488

489489
// implicit solvation model Menglin Sun added on 2022-04-04
490-
bool imp_sol = false; ///< true: implicit solvation correction; false:
490+
int imp_sol = 0; ///< true: implicit solvation correction; false:
491491
///< vacuum calculation(default)
492492
double eb_k = 80; ///< the relative permittivity of the bulk solvent
493493
double tau = 1.0798e-05; ///< the effective surface tension parameter
@@ -499,6 +499,7 @@ struct Input_para
499499
double ion_size = 3.0;
500500
double p_mol = 1.85;
501501
double n_mol = 0.033;
502+
double epsilon_inf = 1.78;
502503

503504
// ============== #Parameters (14.vdW Correction) ===========================
504505
// ==========================================================

source/source_io/read_input_item_model.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ void ReadInput::item_model()
102102
{
103103
Input_Item item("imp_sol");
104104
item.annotation = "calculate implicit solvation correction or not";
105-
read_sync_bool(input.imp_sol);
105+
read_sync_int(input.imp_sol);
106106
this->add_item(item);
107107
}
108108
{

source/source_io/write_elecstat_pot.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ void write_elecstat_pot(
3232
const int nspin = PARAM.inp.nspin;
3333
const int efield = PARAM.inp.efield_flag;
3434
const int dip_corr = PARAM.inp.dip_cor_flag;
35-
const bool imp_sol = PARAM.inp.imp_sol;
35+
const int imp_sol = PARAM.inp.imp_sol;
3636

3737
//==========================================
3838
// Hartree potential

0 commit comments

Comments
 (0)