Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/module_base/kernels/math_ylm_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct cal_ylm_real_op {
/// @param PI_HALF - ModuleBase::PI_HALF
/// @param FOUR_PI - ModuleBase::FOUR_PI,
/// @param SQRT_INVERSE_FOUR_PI - ModuleBase::SQRT_INVERSE_FOUR_PI,
/// @param g - input array with size npw * 3, GlobalC::wf.get_1qvec_cartesian
/// @param g - input array with size npw * 3, wf.get_1qvec_cartesian
/// @param p - intermediate array
///
/// Output Parameters
Expand Down
2 changes: 1 addition & 1 deletion source/module_basis/module_nao/two_center_bundle.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class TwoCenterBundle
void tabulate(const double lcao_ecut, const double lcao_dk, const double lcao_dr, const double lcao_rmax);

/**
* @brief Overwrites the content of a LCAO_Orbitals object (e.g. GlobalC::ORB)
* @brief Overwrites the content of a LCAO_Orbitals object (e.g. ORB)
* with the current object.
*
* This function provides an interface to the corresponding object in the old module_ao.
Expand Down
4 changes: 0 additions & 4 deletions source/module_cell/test/klist_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@ Fcoef::~Fcoef()
{
}

namespace GlobalC
{
Parallel_Kpoints Pkpoints;
} // namespace GlobalC

/************************************************
* unit test of class K_Vectors
Expand Down
5 changes: 0 additions & 5 deletions source/module_cell/test/klist_test_para.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,6 @@ Fcoef::~Fcoef()
{
}

namespace GlobalC
{
Parallel_Kpoints Pkpoints;
UnitCell ucell;
} // namespace GlobalC

/************************************************
* unit test of class K_Vectors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ TEST_F(cal_epsilon_test, cal_epsilon)
device_flag = "cpu";

ModulePW::PW_Basis pwtest(device_flag, precision_flag);
GlobalC::rhopw = &pwtest;

ModuleBase::Matrix3 latvec;
int nx, ny, nz; // f*G
double wfcecut;
Expand All @@ -70,17 +68,17 @@ TEST_F(cal_epsilon_test, cal_epsilon)
#endif

#ifdef __MPI
GlobalC::rhopw->initmpi(1, 0, POOL_WORLD);
pwtest.initmpi(1, 0, POOL_WORLD);
#endif
// pwtest.initgrids(lat0,latvec,wfcecut);
GlobalC::rhopw->initgrids(lat0, latvec, wfcecut);
GlobalC::rhopw->initparameters(gamma_only, wfcecut, distribution_type, xprime);
GlobalC::rhopw->setuptransform();
GlobalC::rhopw->collect_local_pw();
pwtest.initgrids(lat0, latvec, wfcecut);
pwtest.initparameters(gamma_only, wfcecut, distribution_type, xprime);
pwtest.setuptransform();
pwtest.collect_local_pw();

GlobalC::rhopw->nrxx = 125000;
const int npw = GlobalC::rhopw->npw;
const int nrxx = GlobalC::rhopw->nrxx;
pwtest.nrxx = 125000;
const int npw = pwtest.npw;
const int nrxx = pwtest.nrxx;

std::ifstream fin;
fin.open("./support/PS_TOTN_real.in");
Expand All @@ -99,8 +97,7 @@ TEST_F(cal_epsilon_test, cal_epsilon)
double* epsilon = new double[nrxx];
double* epsilon0 = new double[nrxx];

GlobalC::rhopw = &pwtest;
solvent_model.cal_epsilon(GlobalC::rhopw, PS_TOTN_real, epsilon, epsilon0);
solvent_model.cal_epsilon(&pwtest, PS_TOTN_real, epsilon, epsilon0);

EXPECT_EQ(PS_TOTN_real[0], 0.274231);
EXPECT_EQ(epsilon[0], 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ TEST_F(cal_pseudo_test, gauss_charge)
device_flag = "cpu";

ModulePW::PW_Basis pwtest(device_flag, precision_flag);
GlobalC::rhopw = &pwtest;
ModuleBase::Matrix3 latvec;
int nx, ny, nz; // f*G
double wfcecut;
Expand All @@ -58,26 +57,26 @@ TEST_F(cal_pseudo_test, gauss_charge)
#endif

#ifdef __MPI
GlobalC::rhopw->initmpi(1, 0, POOL_WORLD);
pwtest.initmpi(1, 0, POOL_WORLD);
#endif
// pwtest.initgrids(lat0,latvec,wfcecut);

GlobalC::rhopw->initgrids(ucell.lat0, ucell.latvec, wfcecut);
pwtest.initgrids(ucell.lat0, ucell.latvec, wfcecut);

GlobalC::rhopw->initparameters(gamma_only, wfcecut, distribution_type, xprime);
GlobalC::rhopw->setuptransform();
GlobalC::rhopw->collect_local_pw();
GlobalC::rhopw->collect_uniqgg();
pwtest.initparameters(gamma_only, wfcecut, distribution_type, xprime);
pwtest.setuptransform();
pwtest.collect_local_pw();
pwtest.collect_uniqgg();

const int npw = GlobalC::rhopw->npw;
const int nrxx = GlobalC::rhopw->nrxx;
const int npw = pwtest.npw;
const int nrxx = pwtest.nrxx;
complex<double>* N = new complex<double>[npw];
ModuleBase::GlobalFunc::ZEROS(N, npw);

Structure_Factor sf;
sf.nbspline = -1;

solvent_model.gauss_charge(ucell, pgrid, GlobalC::rhopw, N, &sf);
solvent_model.gauss_charge(ucell, pgrid, &pwtest, N, &sf);

EXPECT_NEAR(N[14].real(), 0.002, 1e-9);
EXPECT_NEAR(N[16].real(), -0.001573534, 1e-9);
Expand All @@ -92,7 +91,6 @@ TEST_F(cal_pseudo_test, cal_pseudo)
device_flag = "cpu";
Setcell::setupcell(ucell);
ModulePW::PW_Basis pwtest(device_flag, precision_flag);
GlobalC::rhopw = &pwtest;
ModuleBase::Matrix3 latvec;
int nx, ny, nz; // f*G
double wfcecut;
Expand All @@ -113,18 +111,18 @@ TEST_F(cal_pseudo_test, cal_pseudo)
#endif

#ifdef __MPI
GlobalC::rhopw->initmpi(1, 0, POOL_WORLD);
pwtest.initmpi(1, 0, POOL_WORLD);
#endif
// pwtest.initgrids(lat0,latvec,wfcecut);

GlobalC::rhopw->initgrids(ucell.lat0, ucell.latvec, wfcecut);
GlobalC::rhopw->initparameters(gamma_only, wfcecut, distribution_type, xprime);
GlobalC::rhopw->setuptransform();
GlobalC::rhopw->collect_local_pw();
GlobalC::rhopw->collect_uniqgg();
pwtest.initgrids(ucell.lat0, ucell.latvec, wfcecut);
pwtest.initparameters(gamma_only, wfcecut, distribution_type, xprime);
pwtest.setuptransform();
pwtest.collect_local_pw();
pwtest.collect_uniqgg();

const int npw = GlobalC::rhopw->npw;
const int nrxx = GlobalC::rhopw->nrxx;
const int npw = pwtest.npw;
const int nrxx = pwtest.nrxx;

Structure_Factor sf;
sf.nbspline = -1;
Expand All @@ -137,7 +135,7 @@ TEST_F(cal_pseudo_test, cal_pseudo)
}

complex<double>* PS_TOTN = new complex<double>[npw];
solvent_model.cal_pseudo(ucell, pgrid, GlobalC::rhopw, Porter_g, PS_TOTN, &sf);
solvent_model.cal_pseudo(ucell, pgrid, &pwtest, Porter_g, PS_TOTN, &sf);

EXPECT_NEAR(PS_TOTN[16].real(), 0.098426466, 1e-9);
EXPECT_NEAR(PS_TOTN[14].real(), 0.102, 1e-9);
Expand Down
34 changes: 16 additions & 18 deletions source/module_hamilt_general/module_surchem/test/cal_totn_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ TEST_F(cal_totn_test, cal_totn)
device_flag = "cpu";

ModulePW::PW_Basis pwtest(device_flag, precision_flag);
GlobalC::rhopw = &pwtest;
ModuleBase::Matrix3 latvec;
int nx, ny, nz; // f*G
double wfcecut;
Expand All @@ -56,19 +55,19 @@ TEST_F(cal_totn_test, cal_totn)
#endif

#ifdef __MPI
GlobalC::rhopw->initmpi(1, 0, POOL_WORLD);
pwtest.initmpi(1, 0, POOL_WORLD);
#endif
// pwtest.initgrids(lat0,latvec,wfcecut);

GlobalC::rhopw->initgrids(ucell.lat0, ucell.latvec, wfcecut);
pwtest.initgrids(ucell.lat0, ucell.latvec, wfcecut);

GlobalC::rhopw->initparameters(gamma_only, wfcecut, distribution_type, xprime);
GlobalC::rhopw->setuptransform();
GlobalC::rhopw->collect_local_pw();
GlobalC::rhopw->collect_uniqgg();
pwtest.initparameters(gamma_only, wfcecut, distribution_type, xprime);
pwtest.setuptransform();
pwtest.collect_local_pw();
pwtest.collect_uniqgg();

const int npw = GlobalC::rhopw->npw;
const int nrxx = GlobalC::rhopw->nrxx;
const int npw = pwtest.npw;
const int nrxx = pwtest.nrxx;
complex<double>* N = new complex<double>[npw];
ModuleBase::GlobalFunc::ZEROS(N, npw);
complex<double>* TOTN = new complex<double>[npw];
Expand All @@ -88,7 +87,7 @@ TEST_F(cal_totn_test, cal_totn)
vloc[i] = 0.1;
}

solvent_model.cal_totn(ucell, GlobalC::rhopw, Porter_g, N, TOTN, vloc);
solvent_model.cal_totn(ucell, &pwtest, Porter_g, N, TOTN, vloc);

EXPECT_NEAR(TOTN[0].real(), -0.0999496256, 1e-10);
EXPECT_NEAR(TOTN[0].imag(), -1.299621928166352e-7, 1e-10);
Expand All @@ -107,7 +106,6 @@ TEST_F(cal_totn_test, induced_charge)
Setcell::setupcell(ucell);

ModulePW::PW_Basis pwtest(device_flag, precision_flag);
GlobalC::rhopw = &pwtest;
ModuleBase::Matrix3 latvec;
int nx, ny, nz; // f*G
double wfcecut;
Expand All @@ -126,19 +124,19 @@ TEST_F(cal_totn_test, induced_charge)
#endif

#ifdef __MPI
GlobalC::rhopw->initmpi(1, 0, POOL_WORLD);
pwtest.initmpi(1, 0, POOL_WORLD);
#endif
// pwtest.initgrids(lat0,latvec,wfcecut);

GlobalC::rhopw->initgrids(ucell.lat0, ucell.latvec, wfcecut);
pwtest.initgrids(ucell.lat0, ucell.latvec, wfcecut);

GlobalC::rhopw->initparameters(gamma_only, wfcecut, distribution_type, xprime);
GlobalC::rhopw->setuptransform();
GlobalC::rhopw->collect_local_pw();
GlobalC::rhopw->collect_uniqgg();
pwtest.initparameters(gamma_only, wfcecut, distribution_type, xprime);
pwtest.setuptransform();
pwtest.collect_local_pw();
pwtest.collect_uniqgg();

double fac;
fac = ModuleBase::e2 * ModuleBase::FOUR_PI / (ucell.tpiba2 * GlobalC::rhopw->gg[0]);
fac = ModuleBase::e2 * ModuleBase::FOUR_PI / (ucell.tpiba2 * pwtest.gg[0]);
complex<double> delta_phi{-2.0347933860e-05, 4.5900395826e-07};
complex<double> induced_charge;
induced_charge = -delta_phi / fac;
Expand Down
64 changes: 32 additions & 32 deletions source/module_hamilt_general/module_surchem/test/cal_vcav_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ TEST_F(cal_vcav_test, lapl_rho)
device_flag = "cpu";

ModulePW::PW_Basis pwtest(device_flag, precision_flag);
GlobalC::rhopw = &pwtest;

ModuleBase::Matrix3 latvec;
int nx, ny, nz; // f*G
double wfcecut;
Expand All @@ -60,22 +60,22 @@ TEST_F(cal_vcav_test, lapl_rho)
#endif

#ifdef __MPI
GlobalC::rhopw->initmpi(1, 0, POOL_WORLD);
pwtest.initmpi(1, 0, POOL_WORLD);
#endif
GlobalC::rhopw->initgrids(ucell.lat0, ucell.latvec, wfcecut);
pwtest.initgrids(ucell.lat0, ucell.latvec, wfcecut);

GlobalC::rhopw->initparameters(gamma_only, wfcecut, distribution_type, xprime);
GlobalC::rhopw->setuptransform();
GlobalC::rhopw->collect_local_pw();
GlobalC::rhopw->collect_uniqgg();
pwtest.initparameters(gamma_only, wfcecut, distribution_type, xprime);
pwtest.setuptransform();
pwtest.collect_local_pw();
pwtest.collect_uniqgg();

const int npw = GlobalC::rhopw->npw;
const int nrxx = GlobalC::rhopw->nrxx;
const int npw = pwtest.npw;
const int nrxx = pwtest.nrxx;
std::complex<double>* gdrtmpg = new std::complex<double>[npw];
double* lapn = new double[nrxx];
ModuleBase::GlobalFunc::ZEROS(lapn, nrxx);

std::complex<double>* aux = new std::complex<double>[GlobalC::rhopw->nmaxgr];
std::complex<double>* aux = new std::complex<double>[pwtest.nmaxgr];

gdrtmpg[0] = {2.431e-07, 4.760e-08};
gdrtmpg[1] = {-7.335e-08, 9.826e-07};
Expand All @@ -89,9 +89,9 @@ TEST_F(cal_vcav_test, lapl_rho)
{
for (int ig = 0; ig < npw; ig++)
{
aux[ig] = gdrtmpg[ig] * pow(GlobalC::rhopw->gcar[ig][i], 2);
aux[ig] = gdrtmpg[ig] * pow(pwtest.gcar[ig][i], 2);
}
GlobalC::rhopw->recip2real(aux, aux);
pwtest.recip2real(aux, aux);
for (int ir = 0; ir < nrxx; ir++)
{
lapn[ir] -= aux[ir].real() * ucell.tpiba2;
Expand Down Expand Up @@ -148,7 +148,7 @@ TEST_F(cal_vcav_test, createcavity)
device_flag = "cpu";

ModulePW::PW_Basis pwtest(device_flag, precision_flag);
GlobalC::rhopw = &pwtest;

ModuleBase::Matrix3 latvec;
int nx, ny, nz; // f*G
double wfcecut;
Expand All @@ -167,17 +167,17 @@ TEST_F(cal_vcav_test, createcavity)
#endif

#ifdef __MPI
GlobalC::rhopw->initmpi(1, 0, POOL_WORLD);
pwtest.initmpi(1, 0, POOL_WORLD);
#endif
GlobalC::rhopw->initgrids(ucell.lat0, ucell.latvec, wfcecut);
pwtest.initgrids(ucell.lat0, ucell.latvec, wfcecut);

GlobalC::rhopw->initparameters(gamma_only, wfcecut, distribution_type, xprime);
GlobalC::rhopw->setuptransform();
GlobalC::rhopw->collect_local_pw();
GlobalC::rhopw->collect_uniqgg();
pwtest.initparameters(gamma_only, wfcecut, distribution_type, xprime);
pwtest.setuptransform();
pwtest.collect_local_pw();
pwtest.collect_uniqgg();

const int npw = GlobalC::rhopw->npw;
const int nrxx = GlobalC::rhopw->nrxx;
const int npw = pwtest.npw;
const int nrxx = pwtest.nrxx;
std::complex<double>* PS_TOTN = new std::complex<double>[npw];
double* vwork = new double[nrxx];
ModuleBase::GlobalFunc::ZEROS(vwork, nrxx);
Expand All @@ -191,7 +191,7 @@ TEST_F(cal_vcav_test, createcavity)
PS_TOTN[ig] = 1e-7;
}

solvent_model.createcavity(ucell, GlobalC::rhopw, PS_TOTN, vwork);
solvent_model.createcavity(ucell, &pwtest, PS_TOTN, vwork);

EXPECT_NEAR(vwork[0], 4.8556305312, 1e-10);
EXPECT_NEAR(vwork[1], -2.1006480538, 1e-10);
Expand All @@ -209,7 +209,7 @@ TEST_F(cal_vcav_test, cal_vcav)
device_flag = "cpu";

ModulePW::PW_Basis pwtest(device_flag, precision_flag);
GlobalC::rhopw = &pwtest;

ModuleBase::Matrix3 latvec;
int nx, ny, nz;
double wfcecut;
Expand All @@ -228,17 +228,17 @@ TEST_F(cal_vcav_test, cal_vcav)
#endif

#ifdef __MPI
GlobalC::rhopw->initmpi(1, 0, POOL_WORLD);
pwtest.initmpi(1, 0, POOL_WORLD);
#endif
GlobalC::rhopw->initgrids(ucell.lat0, ucell.latvec, wfcecut);
pwtest.initgrids(ucell.lat0, ucell.latvec, wfcecut);

GlobalC::rhopw->initparameters(gamma_only, wfcecut, distribution_type, xprime);
GlobalC::rhopw->setuptransform();
GlobalC::rhopw->collect_local_pw();
GlobalC::rhopw->collect_uniqgg();
pwtest.initparameters(gamma_only, wfcecut, distribution_type, xprime);
pwtest.setuptransform();
pwtest.collect_local_pw();
pwtest.collect_uniqgg();

const int npw = GlobalC::rhopw->npw;
const int nrxx = GlobalC::rhopw->nrxx;
const int npw = pwtest.npw;
const int nrxx = pwtest.nrxx;
std::complex<double>* PS_TOTN = new std::complex<double>[npw];

PS_TOTN[0] = {2.432e-07, 4.862e-08};
Expand All @@ -253,7 +253,7 @@ TEST_F(cal_vcav_test, cal_vcav)
int nspin = 2;
solvent_model.Vcav.create(nspin, nrxx);

solvent_model.cal_vcav(ucell, GlobalC::rhopw, PS_TOTN, nspin);
solvent_model.cal_vcav(ucell, &pwtest, PS_TOTN, nspin);

EXPECT_NEAR(solvent_model.Vcav(0, 0), 4.8556305312, 1e-10);
EXPECT_NEAR(solvent_model.Vcav(0, 1), -2.1006480538, 1e-10);
Expand Down
Loading
Loading