Skip to content

Commit 49ea9c9

Browse files
committed
delete USE_PAW code
1 parent dcbeb06 commit 49ea9c9

File tree

27 files changed

+81
-1221
lines changed

27 files changed

+81
-1221
lines changed

source/module_cell/klist.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
#include "module_hamilt_pw/hamilt_pwdft/global.h"
1010
#include "module_io/berryphase.h"
1111
#include "module_parameter/parameter.h"
12-
#ifdef USE_PAW
13-
#include "module_cell/module_paw/paw_cell.h"
14-
#endif
1512

1613
void K_Vectors::cal_ik_global()
1714
{
@@ -168,10 +165,6 @@ void K_Vectors::set(const UnitCell& ucell,
168165

169166
// std::cout << " NUMBER OF K-POINTS : " << nkstot << std::endl;
170167

171-
#ifdef USE_PAW
172-
GlobalC::paw_cell.set_isk(nks, isk.data());
173-
#endif
174-
175168
return;
176169
}
177170

source/module_cell/unitcell.cpp

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@
1818
#include "mpi.h"
1919
#endif
2020

21-
#ifdef USE_PAW
22-
#include "module_cell/module_paw/paw_cell.h"
23-
#endif
24-
2521
#ifdef __LCAO
2622
#include "../module_basis/module_ao/ORB_read.h" // to use 'ORB' -- mohan 2021-01-30
2723
#endif
@@ -360,40 +356,6 @@ void UnitCell::setup_cell(const std::string& fn, std::ofstream& log)
360356
//===================================
361357
this->set_iat2itia();
362358

363-
#ifdef USE_PAW
364-
if (PARAM.inp.use_paw)
365-
{
366-
GlobalC::paw_cell.set_libpaw_cell(latvec, lat0);
367-
368-
int* typat = nullptr;
369-
double* xred = nullptr;
370-
371-
typat = new int[nat];
372-
xred = new double[nat * 3];
373-
374-
int iat = 0;
375-
for (int it = 0; it < ntype; it++)
376-
{
377-
for (int ia = 0; ia < atoms[it].na; ia++)
378-
{
379-
typat[iat] = it + 1; // Fortran index starts from 1 !!!!
380-
xred[iat * 3 + 0] = atoms[it].taud[ia].x;
381-
xred[iat * 3 + 1] = atoms[it].taud[ia].y;
382-
xred[iat * 3 + 2] = atoms[it].taud[ia].z;
383-
iat++;
384-
}
385-
}
386-
387-
GlobalC::paw_cell.set_libpaw_atom(nat, ntype, typat, xred);
388-
delete[] typat;
389-
delete[] xred;
390-
391-
GlobalC::paw_cell.set_libpaw_files();
392-
393-
GlobalC::paw_cell.set_nspin(PARAM.inp.nspin);
394-
}
395-
#endif
396-
397359
return;
398360
}
399361

source/module_elecstate/cal_nelec_nband.cpp

Lines changed: 9 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
#include "cal_nelec_nband.h"
22
#include "module_base/constants.h"
33
#include "module_parameter/parameter.h"
4-
#ifdef USE_PAW
5-
#include "module_cell/module_paw/paw_cell.h"
6-
#endif
74

85
namespace elecstate {
96

@@ -14,37 +11,18 @@ void cal_nelec(const Atom* atoms, const int& ntype, double& nelec)
1411

1512
if (nelec == 0)
1613
{
17-
if (PARAM.inp.use_paw)
14+
for (int it = 0; it < ntype; it++)
1815
{
19-
#ifdef USE_PAW
20-
for (int it = 0; it < ntype; it++)
21-
{
22-
std::stringstream ss1, ss2;
23-
ss1 << " electron number of element " << GlobalC::paw_cell.get_zat(it) << std::endl;
24-
const int nelec_it = GlobalC::paw_cell.get_val(it) * atoms[it].na;
25-
nelec += nelec_it;
26-
ss2 << "total electron number of element " << GlobalC::paw_cell.get_zat(it);
27-
28-
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, ss1.str(), GlobalC::paw_cell.get_val(it));
29-
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, ss2.str(), nelec_it);
30-
}
31-
#endif
32-
}
33-
else
34-
{
35-
for (int it = 0; it < ntype; it++)
36-
{
37-
std::stringstream ss1, ss2;
38-
ss1 << "electron number of element " << atoms[it].label;
39-
const double nelec_it = atoms[it].ncpp.zv * atoms[it].na;
40-
nelec += nelec_it;
41-
ss2 << "total electron number of element " << atoms[it].label;
16+
std::stringstream ss1, ss2;
17+
ss1 << "electron number of element " << atoms[it].label;
18+
const double nelec_it = atoms[it].ncpp.zv * atoms[it].na;
19+
nelec += nelec_it;
20+
ss2 << "total electron number of element " << atoms[it].label;
4221

43-
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, ss1.str(), atoms[it].ncpp.zv);
44-
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, ss2.str(), nelec_it);
45-
}
46-
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "AUTOSET number of electrons: ", nelec);
22+
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, ss1.str(), atoms[it].ncpp.zv);
23+
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, ss2.str(), nelec_it);
4724
}
25+
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "AUTOSET number of electrons: ", nelec);
4826
}
4927
if (PARAM.inp.nelec_delta != 0)
5028
{

source/module_elecstate/elecstate_energy.cpp

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55
#include "module_parameter/parameter.h"
66

77
#include <cmath>
8-
#ifdef USE_PAW
9-
#include "module_hamilt_general/module_xc/xc_functional.h"
10-
#include "module_hamilt_pw/hamilt_pwdft/global.h"
11-
#endif
128

139
namespace elecstate
1410
{
@@ -104,27 +100,6 @@ double ElecState::cal_delta_eband(const UnitCell& ucell) const
104100
const double* v_fixed = this->pot->get_fixed_v();
105101
const double* v_ofk = nullptr;
106102
const bool v_ofk_flag = (XC_Functional::get_ked_flag());
107-
#ifdef USE_PAW
108-
if (PARAM.inp.use_paw)
109-
{
110-
ModuleBase::matrix v_xc;
111-
const std::tuple<double, double, ModuleBase::matrix> etxc_vtxc_v
112-
= XC_Functional::v_xc(this->charge->nrxx, this->charge, &ucell);
113-
v_xc = std::get<2>(etxc_vtxc_v);
114-
115-
for (int ir = 0; ir < this->charge->rhopw->nrxx; ir++)
116-
{
117-
deband_aux -= this->charge->rho[0][ir] * v_xc(0, ir);
118-
}
119-
if (PARAM.inp.nspin == 2)
120-
{
121-
for (int ir = 0; ir < this->charge->rhopw->nrxx; ir++)
122-
{
123-
deband_aux -= this->charge->rho[1][ir] * v_xc(1, ir);
124-
}
125-
}
126-
}
127-
#endif
128103

129104
if (!PARAM.inp.use_paw)
130105
{

source/module_elecstate/fp_energy.cpp

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
#include "module_parameter/parameter.h"
44
#include "module_base/global_variable.h"
5-
#ifdef USE_PAW
6-
#include "module_cell/module_paw/paw_cell.h"
7-
#endif
5+
86

97
#include "module_base/tool_quit.h"
108

@@ -27,15 +25,6 @@ double fenergy::calculate_etot()
2725
etot = eband + deband + (etxc - etxcc) + ewald_energy + hartree_energy + demet + descf + exx + efield
2826
+ gatefield + evdw + esol_el + esol_cav + edftu + edeepks_scf + escon;
2927
}
30-
31-
#ifdef USE_PAW
32-
if (PARAM.inp.use_paw)
33-
{
34-
double ecore = GlobalC::paw_cell.calculate_ecore();
35-
double epawdc = GlobalC::paw_cell.get_epawdc();
36-
etot += (ecore + epawdc);
37-
}
38-
#endif
3928
return etot;
4029
}
4130

@@ -52,14 +41,6 @@ double fenergy::calculate_harris()
5241
etot_harris = eband + deband_harris + (etxc - etxcc) + ewald_energy + hartree_energy + demet + descf + exx
5342
+ efield + gatefield + evdw + esol_el + esol_cav + edftu + edeepks_scf + escon;
5443
}
55-
#ifdef USE_PAW
56-
if (PARAM.inp.use_paw)
57-
{
58-
double ecore = GlobalC::paw_cell.calculate_ecore();
59-
double epawdc = GlobalC::paw_cell.get_epawdc();
60-
etot_harris += (ecore + epawdc);
61-
}
62-
#endif
6344
return etot_harris;
6445
}
6546

source/module_elecstate/module_charge/charge.cpp

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@
3333

3434
#include <vector>
3535

36-
#ifdef USE_PAW
37-
#include "module_cell/module_paw/paw_cell.h"
38-
#endif
39-
4036
Charge::Charge()
4137
{
4238
allocate_rho = false;
@@ -273,57 +269,6 @@ void Charge::atomic_rho(const int spin_number_need,
273269
ModuleBase::TITLE("Charge", "atomic_rho");
274270
ModuleBase::timer::tick("Charge", "atomic_rho");
275271

276-
if(PARAM.inp.use_paw)
277-
{
278-
// In ABINIT, the initial charge density is calculated using some Gaussian functions
279-
// centered at the nuclei
280-
#ifdef USE_PAW
281-
GlobalC::paw_cell.init_rho(rho_in);
282-
double ne_tot = 0.0;
283-
std::vector<double> ne(spin_number_need);
284-
int spin0 = 1;
285-
if (spin_number_need == 2)
286-
{
287-
spin0 = spin_number_need;
288-
}
289-
290-
for (int is = 0; is < spin0; ++is)
291-
{
292-
for (int ir = 0; ir < this->rhopw->nrxx; ++ir)
293-
{
294-
ne[is] += rho_in[is][ir];
295-
}
296-
ne[is] *= omega / (double)this->rhopw->nxyz;
297-
#ifdef __MPI
298-
Parallel_Reduce::reduce_pool(ne[is]);
299-
#endif
300-
GlobalV::ofs_warning << "\n SETUP ATOMIC RHO FOR SPIN " << is + 1 << std::endl;
301-
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_warning, "Electron number from rho", ne[is]);
302-
ne_tot += ne[is];
303-
}
304-
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_warning, "total electron number from rho", ne_tot);
305-
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_warning, "should be", PARAM.inp.nelec);
306-
for (int is = 0; is < spin_number_need; ++is)
307-
{
308-
for (int ir = 0; ir < this->rhopw->nrxx; ++ir)
309-
{
310-
rho_in[is][ir] = rho_in[is][ir] / ne_tot * PARAM.inp.nelec;
311-
}
312-
}
313-
314-
double* nhatgr=nullptr;
315-
GlobalC::paw_cell.get_nhat(nhat,nhatgr);
316-
317-
for (int is = 0; is < spin_number_need; ++is)
318-
{
319-
for (int ir = 0; ir < this->rhopw->nrxx; ++ir)
320-
{
321-
rho_in[is][ir] -= nhat[is][ir];
322-
}
323-
}
324-
#endif
325-
}
326-
else
327272
{
328273
ModuleBase::ComplexMatrix rho_g3d = [&]() -> ModuleBase::ComplexMatrix
329274
{
@@ -718,12 +663,6 @@ void Charge::save_rho_before_sum_band()
718663
{
719664
ModuleBase::GlobalFunc::DCOPY(kin_r[is], kin_r_save[is], this->rhopw->nrxx);
720665
}
721-
#ifdef USE_PAW
722-
if(PARAM.inp.use_paw)
723-
{
724-
ModuleBase::GlobalFunc::DCOPY(nhat[is], nhat_save[is], this->rhopw->nrxx);
725-
}
726-
#endif
727666
}
728667
return;
729668
}

source/module_elecstate/module_charge/charge_init.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
#include "module_io/cube_io.h"
1818
#include "module_io/rhog_io.h"
1919
#include "module_io/read_wf2rho_pw.h"
20-
#ifdef USE_PAW
21-
#include "module_cell/module_paw/paw_cell.h"
22-
#endif
2320

2421
void Charge::init_rho(elecstate::efermi& eferm_iout,
2522
const UnitCell& ucell,
@@ -358,13 +355,6 @@ void Charge::set_rho_core(const UnitCell& ucell,
358355
void Charge::set_rho_core_paw()
359356
{
360357
ModuleBase::TITLE("Charge","set_rho_core_paw");
361-
#ifdef USE_PAW
362-
double* tmp = new double[nrxx];
363-
GlobalC::paw_cell.get_vloc_ncoret(tmp,this->rho_core);
364-
delete[] tmp;
365-
366-
this->rhopw->real2recip(this->rho_core,this->rhog_core);
367-
#endif
368358
}
369359

370360

source/module_elecstate/module_charge/charge_mixing.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,6 @@ void Charge_Mixing::init_mixing()
160160
}
161161
}
162162

163-
// initailize nhat_mdata
164-
#ifdef USE_PAW
165-
if(PARAM.inp.use_paw) { this->mixing->init_mixing_data(this->nhat_mdata, this->rhopw->nrxx * PARAM.inp.nspin, sizeof(double));
166-
}
167-
#endif
168-
169163
ModuleBase::timer::tick("Charge_Mixing", "init_mixing");
170164

171165
return;
@@ -186,10 +180,6 @@ void Charge_Mixing::mix_reset()
186180
{
187181
this->tau_mdata.reset();
188182
}
189-
// reset for paw
190-
#ifdef USE_PAW
191-
this->nhat_mdata.reset();
192-
#endif
193183
}
194184

195185
bool Charge_Mixing::if_scf_oscillate(const int iteration, const double drho, const int iternum_used, const double threshold)

0 commit comments

Comments
 (0)