@@ -48,24 +48,26 @@ double Cal_Test::meigts123=0.0;
4848
4949double Cal_Test::mtot=0.0 ;
5050
51- void Cal_Test::test_memory (
52- const ModulePW::PW_Basis* rhopw,
53- const ModulePW::PW_Basis_K* wfcpw,
54- const std::string chr_mixing_mode,
55- const int chr_mixing_ndim)
51+ void Cal_Test::test_memory (const int nat,
52+ const int ntype,
53+ const ModuleBase::Matrix3& GGT,
54+ const ModulePW::PW_Basis* rhopw,
55+ const ModulePW::PW_Basis_K* wfcpw,
56+ const std::string chr_mixing_mode,
57+ const int chr_mixing_ndim)
5658{
5759 ModuleBase::TITLE (" Cal_Test" ," test_memory" );
5860
59- const int ngmw = Cal_Test::cal_np (wfcpw->ggecut , rhopw->nx , rhopw->ny , rhopw->nz );
60- const int ngmc = Cal_Test::cal_np (rhopw->ggecut , rhopw->nx , rhopw->ny , rhopw->nz );
61+ const int ngmw = Cal_Test::cal_np (GGT, wfcpw->ggecut , rhopw->nx , rhopw->ny , rhopw->nz );
62+ const int ngmc = Cal_Test::cal_np (GGT, rhopw->ggecut , rhopw->nx , rhopw->ny , rhopw->nz );
6163
6264// const int ecut_wfc = INPUT.ecutwfc;
6365// const int ecut_chg = INPUT.ecutrho;
6466
6567// const int ngmw = Cal_Test::cal_np(ecut_wfc, rhopw->nx, rhopw->ny, rhopw->nz);
6668// const int ngmc = Cal_Test::cal_np(ecut_chg, rhopw->nx, rhopw->ny, rhopw->nz);
6769
68- std::cout << " number of atoms = " << GlobalC::ucell. nat << std::endl;
70+ std::cout << " number of atoms = " << nat << std::endl;
6971 std::cout << " plane wave number for wave functions = " << ngmw << std::endl;
7072 std::cout << " plane wave number for chage density = " << ngmc << std::endl;
7173
@@ -108,8 +110,8 @@ void Cal_Test::test_memory(
108110 mig2fftc = ModuleBase::Memory::calculate_mem ( ngmc , " int" );
109111 mgg = ModuleBase::Memory::calculate_mem ( ngmc, " double" );
110112 mig123 = ModuleBase::Memory::calculate_mem ( ngmc*3 , " int" );
111- mstrucFac = ModuleBase::Memory::calculate_mem ( GlobalC::ucell. ntype *ngmc, " cdouble" );
112- meigts123 = ModuleBase::Memory::calculate_mem ( GlobalC::ucell. nat * (2 *rhopw->nx +1 +2 *rhopw->ny +1 +2 *rhopw->nz +1 ), " cdouble" );
113+ mstrucFac = ModuleBase::Memory::calculate_mem ( ntype*ngmc, " cdouble" );
114+ meigts123 = ModuleBase::Memory::calculate_mem ( nat * (2 *rhopw->nx +1 +2 *rhopw->ny +1 +2 *rhopw->nz +1 ), " cdouble" );
113115
114116 // (3) Memory for H,S matrix.
115117 std::cout << " NLOCAL = " << PARAM.globalv .nlocal << std::endl;
@@ -130,7 +132,7 @@ void Cal_Test::test_memory(
130132// print_mem(8);
131133// print_mem(16);
132134
133- // if(GlobalC::ucell. nat > 200)
135+ // if(nat > 200)
134136// {
135137// print_mem(32);
136138// print_mem(64);
@@ -140,7 +142,11 @@ void Cal_Test::test_memory(
140142}
141143
142144// ! compute the number of plane waves
143- int Cal_Test::cal_np (const double &ggcut, const int &n1, const int &n2, const int &n3)
145+ int Cal_Test::cal_np (const ModuleBase::Matrix3& GGT,
146+ const double &ggcut,
147+ const int &n1,
148+ const int &n2,
149+ const int &n3)
144150{
145151
146152/*
@@ -170,7 +176,7 @@ int Cal_Test::cal_np(const double &ggcut, const int &n1, const int &n2, const in
170176 {
171177 ModuleBase::Vector3<double > f (i,j,k);
172178 // g2= |f|^2 in the unit of (2Pi/lat0)^2
173- double g2 = f * (GlobalC::ucell. GGT * f);
179+ double g2 = f * (GGT * f);
174180
175181 // gcut is from input.
176182 if (g2 <= ggcut)
0 commit comments