Skip to content

Commit 90ce545

Browse files
committed
Replace UFFT with FFT and fix makefile
1 parent 9643594 commit 90ce545

File tree

8 files changed

+24
-24
lines changed

8 files changed

+24
-24
lines changed

source/Makefile.Objects

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ OBJS_SURCHEM=H_correction_pw.o\
245245
corrected_energy.o\
246246
minimize_cg.o\
247247
efield.o\
248+
sol_force.o\
248249

249250
OBJS_XC=xc_funct_corr_gga.o \
250251
xc_funct_corr_lda.o \

source/module_surchem/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ add_library(
1111
corrected_energy.cpp
1212
minimize_cg.cpp
1313
efield.cpp
14-
force.cpp
14+
sol_force.cpp
1515
)

source/module_surchem/H_correction_pw.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ ModuleBase::matrix surchem::v_correction(const UnitCell &cell,
2626
complex<double> *Porter_g = new complex<double>[rho_basis->npw];
2727
ModuleBase::GlobalFunc::ZEROS(Porter_g, rho_basis->npw);
2828

29-
GlobalC::UFFT.ToReciSpace(Porter, Porter_g, rho_basis);
29+
rho_basis->real2recip(Porter, Porter_g);
3030

3131
complex<double> *N = new complex<double>[rho_basis->npw];
3232
complex<double> *TOTN = new complex<double>[rho_basis->npw];
@@ -149,7 +149,7 @@ ModuleBase::matrix surchem::v_compensating(const UnitCell &cell, ModulePW::PW_Ba
149149
// std::cout << " ecomp=" << ecomp << std::endl;
150150
comp_chg_energy = ecomp;
151151

152-
GlobalC::UFFT.ToRealSpace(phi_comp_G, phi_comp_R, rho_basis);
152+
rho_basis->recip2real(phi_comp_G, phi_comp_R);
153153

154154
ModuleBase::matrix v_comp(GlobalV::NSPIN, rho_basis->nrxx);
155155
if (GlobalV::NSPIN == 4)
@@ -205,7 +205,7 @@ void surchem::test_V_to_N(ModuleBase::matrix &v,
205205
phi_comp_R[ir] = v(0, ir);
206206
}
207207

208-
GlobalC::UFFT.ToReciSpace(phi_comp_R, phi_comp_G, rho_basis);
208+
rho_basis->real2recip(phi_comp_R, phi_comp_G);
209209
for (int ig = 0; ig < rho_basis->npw; ig++)
210210
{
211211
if (rho_basis->gg[ig] >= 1.0e-12) // LiuXh 20180410
@@ -214,7 +214,7 @@ void surchem::test_V_to_N(ModuleBase::matrix &v,
214214
comp_reci[ig] = phi_comp_G[ig] / fac;
215215
}
216216
}
217-
GlobalC::UFFT.ToRealSpace(comp_reci, N_real, rho_basis);
217+
rho_basis->recip2real(comp_reci, N_real);
218218

219219
complex<double> *vloc_g = new complex<double>[rho_basis->npw];
220220
complex<double> *ng = new complex<double>[rho_basis->npw];
@@ -225,8 +225,7 @@ void surchem::test_V_to_N(ModuleBase::matrix &v,
225225
for (int ir = 0; ir < rho_basis->nrxx; ir++)
226226
Porter[ir] = rho[0][ir];
227227

228-
GlobalC::UFFT.ToReciSpace(GlobalC::pot.vltot,
229-
vloc_g, rho_basis); // now n is vloc in Recispace
228+
rho_basis->real2recip(GlobalC::pot.vltot,vloc_g);// now n is vloc in Recispace
230229
for (int ig = 0; ig < rho_basis->npw; ig++) {
231230
if (rho_basis->gg[ig] >= 1.0e-12) // LiuXh 20180410
232231
{
@@ -237,7 +236,7 @@ void surchem::test_V_to_N(ModuleBase::matrix &v,
237236
}
238237
}
239238
double *nr = new double[rho_basis->nrxx];
240-
GlobalC::UFFT.ToRealSpace(ng, nr, rho_basis);
239+
rho_basis->recip2real(ng, nr);
241240

242241
double *diff = new double[rho_basis->nrxx];
243242
double *diff2 = new double[rho_basis->nrxx];

source/module_surchem/cal_totn.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ void surchem::cal_totn(const UnitCell &cell, ModulePW::PW_Basis* rho_basis,
77
complex<double> *vloc_g = new complex<double>[rho_basis->npw];
88
ModuleBase::GlobalFunc::ZEROS(vloc_g, rho_basis->npw);
99

10-
GlobalC::UFFT.ToReciSpace(GlobalC::pot.vltot,
11-
vloc_g, rho_basis); // now n is vloc in Recispace
10+
rho_basis->real2recip(GlobalC::pot.vltot, vloc_g); // now n is vloc in Recispace
1211
for (int ig = 0; ig < rho_basis->npw; ig++) {
1312
if(ig==rho_basis->ig_gge0)
1413
{

source/module_surchem/cal_vcav.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void shape_gradn(const complex<double> *PS_TOTN, ModulePW::PW_Basis* rho_basis,
3636

3737
double *PS_TOTN_real = new double[rho_basis->nrxx];
3838
ModuleBase::GlobalFunc::ZEROS(PS_TOTN_real, rho_basis->nrxx);
39-
GlobalC::UFFT.ToRealSpace(PS_TOTN, PS_TOTN_real,rho_basis);
39+
rho_basis->recip2real(PS_TOTN, PS_TOTN_real);
4040

4141
double epr_c = 1.0 / sqrt(ModuleBase::TWO_PI) / GlobalV::sigma_k;
4242
double epr_z = 0;
@@ -119,8 +119,8 @@ void surchem::createcavity(const UnitCell &ucell, ModulePW::PW_Basis* rho_basis,
119119
// packs the real array into a complex one
120120
// to G space
121121
complex<double> *inv_gn = new complex<double>[rho_basis->npw];
122-
GlobalC::UFFT.ToReciSpace(sqrt_nablan_2, inv_gn,rho_basis);
123-
122+
rho_basis->real2recip(sqrt_nablan_2, inv_gn);
123+
124124
// \nabla(1 / |\nabla n|), ggn in real space
125125
ModuleBase::Vector3<double> *ggn = new ModuleBase::Vector3<double>[rho_basis->nrxx];
126126
XC_Functional::grad_rho(inv_gn, ggn, rho_basis);

source/module_surchem/cal_vel.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ ModuleBase::matrix surchem::cal_vel(const UnitCell &cell,
5858
ModuleBase::timer::tick("surchem", "cal_vel");
5959

6060
// double *TOTN_real = new double[pwb.nrxx];
61-
GlobalC::UFFT.ToRealSpace(TOTN, TOTN_real,rho_basis);
61+
rho_basis->recip2real(TOTN, TOTN_real);
6262

6363
// -4pi * TOTN(G)
6464
complex<double> *B = new complex<double>[rho_basis->npw];
@@ -69,7 +69,7 @@ ModuleBase::matrix surchem::cal_vel(const UnitCell &cell,
6969

7070
// Build a nrxx vector to DO FFT .
7171
double *PS_TOTN_real = new double[rho_basis->nrxx];
72-
GlobalC::UFFT.ToRealSpace(PS_TOTN, PS_TOTN_real,rho_basis);
72+
rho_basis->recip2real(PS_TOTN, PS_TOTN_real);
7373

7474
// build epsilon in real space (nrxx)
7575
double *epsilon = new double[rho_basis->nrxx];
@@ -95,8 +95,8 @@ ModuleBase::matrix surchem::cal_vel(const UnitCell &cell,
9595
double *phi_tilda_R0 = new double[rho_basis->nrxx];
9696
// double *delta_phi_R = new double[pwb.nrxx];
9797

98-
GlobalC::UFFT.ToRealSpace(Sol_phi, phi_tilda_R,rho_basis);
99-
GlobalC::UFFT.ToRealSpace(Sol_phi0, phi_tilda_R0,rho_basis);
98+
rho_basis->recip2real(Sol_phi, phi_tilda_R);
99+
rho_basis->recip2real(Sol_phi0, phi_tilda_R0);
100100

101101
// the 1st item of tmp_Vel
102102
for (int i = 0; i < rho_basis->nrxx; i++)

source/module_surchem/minimize_cg.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ void surchem::Leps2(const UnitCell &ucell,
202202
{
203203
grad_grad_phi[ir] = grad_phi[ir].x;
204204
}
205-
GlobalC::UFFT.ToReciSpace(grad_grad_phi, grad_grad_phi_G, rho_basis);
205+
rho_basis->real2recip(grad_grad_phi, grad_grad_phi_G);
206206
XC_Functional::grad_rho(grad_grad_phi_G, tmp_vector3, rho_basis);
207207
for (int ir = 0; ir < rho_basis->nrxx; ir++)
208208
{
@@ -217,7 +217,7 @@ void surchem::Leps2(const UnitCell &ucell,
217217
{
218218
grad_grad_phi[ir] = grad_phi[ir].y;
219219
}
220-
GlobalC::UFFT.ToReciSpace(grad_grad_phi, grad_grad_phi_G, rho_basis);
220+
rho_basis->real2recip(grad_grad_phi, grad_grad_phi_G);
221221
XC_Functional::grad_rho(grad_grad_phi_G, tmp_vector3, rho_basis);
222222
for (int ir = 0; ir < rho_basis->nrxx; ir++)
223223
{
@@ -232,7 +232,7 @@ void surchem::Leps2(const UnitCell &ucell,
232232
{
233233
grad_grad_phi[ir] = grad_phi[ir].z;
234234
}
235-
GlobalC::UFFT.ToReciSpace(grad_grad_phi, grad_grad_phi_G, rho_basis);
235+
rho_basis->real2recip(grad_grad_phi, grad_grad_phi_G);
236236
XC_Functional::grad_rho(grad_grad_phi_G, tmp_vector3, rho_basis);
237237
for (int ir = 0; ir < rho_basis->nrxx; ir++)
238238
{
@@ -243,7 +243,7 @@ void surchem::Leps2(const UnitCell &ucell,
243243
// cout << lp_real << [i] << endl;
244244
// }
245245

246-
GlobalC::UFFT.ToReciSpace(lp_real, lp, rho_basis);
246+
rho_basis->real2recip(lp_real, lp);
247247
// cout<<"lp: "<<endl;
248248
// test_print(lp, 10);
249249

source/module_surchem/force.cpp renamed to source/module_surchem/sol_force.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ void force_cor_one(const UnitCell &cell, ModulePW::PW_Basis* rho_basis , ModuleB
1111
std::complex<double> *delta_phi_g = new complex<double>[rho_basis->npw];
1212
//ModuleBase::GlobalFunc::ZEROS(delta_phi_g, rho_basis->npw);
1313

14-
GlobalC::UFFT.ToReciSpace(GlobalC::solvent_model.delta_phi, delta_phi_g,rho_basis);
14+
rho_basis->real2recip(GlobalC::solvent_model.delta_phi, delta_phi_g);
15+
//GlobalC::UFFT.ToReciSpace(GlobalC::solvent_model.delta_phi, delta_phi_g,rho_basis);
1516
double Ael=0;double Ael1 = 0;
1617
//ModuleBase::GlobalFunc::ZEROS(vg, ngmc);
1718
int iat = 0;
@@ -85,8 +86,8 @@ void force_cor_two(const UnitCell &cell, ModulePW::PW_Basis* rho_basis , ModuleB
8586
}
8687
}
8788

88-
GlobalC::UFFT.ToReciSpace(Vcav_sum, Vcav_g, rho_basis);
89-
GlobalC::UFFT.ToReciSpace(GlobalC::solvent_model.epspot, Vel_g, rho_basis);
89+
rho_basis->real2recip(Vcav_sum, Vcav_g);
90+
rho_basis->real2recip(GlobalC::solvent_model.epspot, Vel_g);
9091

9192
int iat = 0;
9293
double Ael1 = 0;

0 commit comments

Comments
 (0)