Skip to content

Commit 2ecd66a

Browse files
committed
Fix unittests of Charge<double>
1 parent cac6351 commit 2ecd66a

File tree

10 files changed

+29
-30
lines changed

10 files changed

+29
-30
lines changed

source/source_esolver/esolver_of.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ void ESolver_OF::before_opt(const int istep, UnitCell& ucell)
250250
for (int ibs = 0; ibs < this->pw_rho->nrxx; ++ibs)
251251
{
252252
// Here we initialize rho to be uniform,
253-
// because the rho got by pot.init_pot -> Charge<double>::atomic_rho may contain minus elements.
253+
// because the rho got by pot.init_pot -> Charge::atomic_rho may contain minus elements.
254254
this->chr.rho[is][ibs] = this->nelec_[is] / ucell.omega;
255255
this->pphi_[is][ibs] = sqrt(this->chr.rho[is][ibs]);
256256
}

source/source_estate/test/elecstate_base_test.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ Potential::~Potential()
2727
{
2828
}
2929
} // namespace elecstate
30-
Charge<double>::Charge<double>()
30+
template<> Charge<double>::Charge()
3131
{
3232
}
33-
Charge<double>::~Charge<double>()
33+
template<> Charge<double>::~Charge()
3434
{
3535
}
3636
UnitCell::UnitCell()
@@ -77,24 +77,24 @@ void ModulePW::PW_Basis::initgrids(double, ModuleBase::Matrix3, int, int, int)
7777
void ModulePW::PW_Basis::distribute_r()
7878
{
7979
}
80-
void Charge<double>::set_rho_core(const UnitCell& ucell, ModuleBase::ComplexMatrix const&, const bool*)
80+
template<> void Charge<double>::set_rho_core(const UnitCell& ucell, ModuleBase::ComplexMatrix const&, const bool*)
8181
{
8282
}
83-
void Charge<double>::init_rho(const UnitCell&,
83+
template<> void Charge<double>::init_rho(const UnitCell&,
8484
const Parallel_Grid&,
8585
ModuleBase::ComplexMatrix const&,
8686
ModuleSymmetry::Symmetry& symm,
8787
const void*,
8888
const void*)
8989
{
9090
}
91-
void Charge<double>::set_rhopw(ModulePW::PW_Basis*)
91+
template<> void Charge<double>::set_rhopw(ModulePW::PW_Basis*)
9292
{
9393
}
94-
void Charge<double>::renormalize_rho()
94+
template<> void Charge<double>::renormalize_rho()
9595
{
9696
}
97-
void Charge<double>::check_rho()
97+
template<> void Charge<double>::check_rho()
9898
{
9999
}
100100

source/source_estate/test/elecstate_magnetism_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
#define private public
2828
#include "source_estate/magnetism.h"
2929
#undef private
30-
Charge<double>::Charge<double>()
30+
template<> Charge<double>::Charge()
3131
{
3232
}
33-
Charge<double>::~Charge<double>()
33+
template<> Charge<double>::~Charge()
3434
{
3535
}
3636

source/source_estate/test/elecstate_print_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ Magnetism::Magnetism(){}
3131
Magnetism::~Magnetism(){}
3232
InfoNonlocal::InfoNonlocal(){}
3333
InfoNonlocal::~InfoNonlocal(){}
34-
Charge<double>::Charge()
34+
template<> Charge<double>::Charge()
3535
{
3636
}
37-
Charge<double>::~Charge()
37+
template<> Charge<double>::~Charge()
3838
{
3939
}
4040
SepPot::SepPot(){}

source/source_estate/test/elecstate_pw_test.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ Potential::~Potential()
2525
{
2626
}
2727
} // namespace elecstate
28-
Charge<double>::Charge()
28+
template<> Charge<double>::Charge()
2929
{
3030
}
31-
Charge<double>::~Charge()
31+
template<> Charge<double>::~Charge()
3232
{
3333
}
3434
UnitCell::UnitCell()
@@ -126,25 +126,24 @@ Fcoef::~Fcoef()
126126
{
127127
}
128128
#include "source_cell/klist.h"
129-
130-
void Charge<double>::set_rho_core(const UnitCell& ucell, ModuleBase::ComplexMatrix const&, const bool*)
129+
template<> void Charge<double>::set_rho_core(const UnitCell& ucell, ModuleBase::ComplexMatrix const&, const bool*)
131130
{
132131
}
133-
void Charge<double>::init_rho(const UnitCell&,
132+
template<> void Charge<double>::init_rho(const UnitCell&,
134133
const Parallel_Grid&,
135134
ModuleBase::ComplexMatrix const&,
136135
ModuleSymmetry::Symmetry& symm,
137136
const void*,
138137
const void*)
139138
{
140139
}
141-
void Charge<double>::set_rhopw(ModulePW::PW_Basis*)
140+
template<> void Charge<double>::set_rhopw(ModulePW::PW_Basis*)
142141
{
143142
}
144-
void Charge<double>::renormalize_rho()
143+
template<> void Charge<double>::renormalize_rho()
145144
{
146145
}
147-
void Charge<double>::check_rho()
146+
template<> void Charge<double>::check_rho()
148147
{
149148
}
150149

source/source_estate/test/potential_new_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ InfoNonlocal::~InfoNonlocal()
3636
{
3737
}
3838
#endif
39-
Charge<double>::Charge()
39+
template<> Charge<double>::Charge()
4040
{
4141
}
42-
Charge<double>::~Charge()
42+
template<> Charge<double>::~Charge()
4343
{
4444
}
4545
surchem::surchem()

source/source_estate/test_mpi/charge_mpi_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
#include "source_io/module_parameter/parameter.h"
99

1010
bool XC_Functional::ked_flag = false;
11-
Charge<double>::Charge()
11+
template<> Charge<double>::Charge()
1212
{
1313
}
14-
Charge<double>::~Charge()
14+
template<> Charge<double>::~Charge()
1515
{
1616
delete[] rec;
1717
delete[] dis;

source/source_hamilt/module_xc/test/xc3_mock.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ namespace GlobalC
181181
UnitCell::UnitCell(){};
182182
UnitCell::~UnitCell(){};
183183

184-
Charge<double>::Charge(){};
185-
Charge<double>::~Charge(){};
184+
template<> Charge<double>::Charge(){};
185+
template<> Charge<double>::~Charge(){};
186186

187187
Magnetism::Magnetism(){};
188188
Magnetism::~Magnetism(){};

source/source_hsolver/test/test_hsolver_sdft.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ void Stochastic_Iter<T, Device>::cal_storho(const UnitCell& ucell,
183183
}
184184
template class Stochastic_Iter<std::complex<double>, base_device::DEVICE_CPU>;
185185

186-
Charge<double>::Charge(){};
187-
Charge<double>::~Charge(){};
186+
template<> Charge<double>::Charge(){};
187+
template<> Charge<double>::~Charge(){};
188188

189189
// Mock implementations for the template functions causing linking errors
190190
namespace ModulePW {

source/source_io/test/read_wf2rho_pw_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ Parallel_Grid::Parallel_Grid()
2828
Parallel_Grid::~Parallel_Grid()
2929
{
3030
}
31-
Charge<double>::Charge()
31+
template<> Charge<double>::Charge()
3232
{
3333
}
34-
Charge<double>::~Charge()
34+
template<> Charge<double>::~Charge()
3535
{
3636
}
3737
UnitCell::UnitCell()

0 commit comments

Comments
 (0)