Skip to content

Commit 0b2dce3

Browse files
committed
add part of vel: epspot.
1 parent fe794c4 commit 0b2dce3

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

source/module_surchem/cal_vel.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,11 @@ ModuleBase::matrix surchem::cal_vel(const UnitCell &cell,
109109
double Ael = cal_Ael(cell, pwb);
110110

111111
// the 2nd item of tmp_Vel
112-
double *Vel2 = new double[pwb.nrxx];
113-
ModuleBase::GlobalFunc::ZEROS(Vel2, pwb.nrxx);
114-
115-
eps_pot(PS_TOTN_real, Sol_phi, pwb, epsilon, Vel2);
112+
eps_pot(PS_TOTN_real, Sol_phi, pwb, epsilon, epspot);
116113

117114
for (int i = 0; i < pwb.nrxx; i++)
118115
{
119-
tmp_Vel[i] += Vel2[i];
116+
tmp_Vel[i] += epspot[i];
120117
}
121118

122119
// ModuleBase::matrix v(nspin, pwb.nrxx);
@@ -147,7 +144,7 @@ ModuleBase::matrix surchem::cal_vel(const UnitCell &cell,
147144
delete[] epsilon;
148145
delete[] epsilon0;
149146
delete[] tmp_Vel;
150-
delete[] Vel2;
147+
// delete[] Vel2;
151148
// delete[] TOTN_real;
152149
delete[] phi_tilda_R;
153150
delete[] phi_tilda_R0;

source/module_surchem/surchem.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ surchem::surchem()
99
{
1010
TOTN_real = new double[1];
1111
delta_phi = new double[1];
12+
epspot = new double[1];
1213
Vcav = ModuleBase::matrix();
1314
Vel = ModuleBase::matrix();
1415
qs = 0;
@@ -21,14 +22,17 @@ void surchem::allocate(const int &nrxx, const int &nspin)
2122

2223
delete[] TOTN_real;
2324
delete[] delta_phi;
25+
delete[] epspot;
2426

2527
TOTN_real = new double[nrxx];
2628
delta_phi = new double[nrxx];
29+
epspot = new double[nrxx];
2730
Vcav.create(nspin, nrxx);
2831
Vel.create(nspin, nrxx);
2932

3033
ModuleBase::GlobalFunc::ZEROS(delta_phi, nrxx);
3134
ModuleBase::GlobalFunc::ZEROS(TOTN_real, nrxx);
35+
ModuleBase::GlobalFunc::ZEROS(epspot, nrxx);
3236
return;
3337
}
3438

source/module_surchem/surchem.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class surchem
1919

2020
double *TOTN_real;
2121
double *delta_phi;
22+
double *epspot;
2223
ModuleBase::matrix Vcav;
2324
ModuleBase::matrix Vel;
2425
double qs;

0 commit comments

Comments
 (0)