Skip to content

Commit 80f5933

Browse files
committed
fix bug in the file
1 parent a91a5e4 commit 80f5933

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

source/module_io/test/to_qo_test.cpp

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void define_fcc_cell(UnitCell& ucell)
4949
ucell.GT = ucell.latvec.Inverse();
5050
ucell.G = ucell.GT.Transpose();
5151
ucell.GGT = ucell.G * ucell.GT;
52-
ucell.orbital_fn = new std::string[2];
52+
ucell.orbital_fn.resize(2);
5353
ucell.orbital_fn[0] = "../../../../tests/PP_ORB/Si_gga_8au_100Ry_2s2p1d.orb";
5454
ucell.orbital_fn[1] = "../../../../tests/PP_ORB/C_gga_8au_100Ry_2s2p1d.orb";
5555
ucell.pseudo_fn = new std::string[2];
@@ -86,7 +86,7 @@ void define_sc_cell(UnitCell& ucell)
8686
ucell.GT = ucell.latvec.Inverse();
8787
ucell.G = ucell.GT.Transpose();
8888
ucell.GGT = ucell.G * ucell.GT;
89-
ucell.orbital_fn = new std::string[1];
89+
ucell.orbital_fn.resize(1);
9090
ucell.orbital_fn[0] = "../../../../tests/PP_ORB/Si_gga_8au_100Ry_2s2p1d.orb";
9191
ucell.pseudo_fn = new std::string[1];
9292
ucell.pseudo_fn[0] = "../../../../tests/PP_ORB/Si_dojo_soc.upf";
@@ -180,7 +180,7 @@ TEST_F(toQOTest, BuildNao)
180180
std::vector<ModuleBase::Vector3<double>> kvecs_d;
181181
kvecs_d.push_back(ModuleBase::Vector3<double>(0.0, 0.0, 0.0)); // Gamma point
182182
tqo.read_structures(&ucell, kvecs_d, 0, 1);
183-
tqo.build_nao(ucell.ntype, "./", ucell.orbital_fn, 0);
183+
tqo.build_nao(ucell.ntype, "./", ucell.orbital_fn.data(), 0);
184184
EXPECT_EQ(tqo.p_nao()->nchi(), 10); // not (l, m)-resoluted
185185
EXPECT_EQ(tqo.nphi(), 26); // (l, m)-resoluted
186186
}
@@ -195,9 +195,9 @@ TEST_F(toQOTest, RadialCollectionIndexing)
195195
std::vector<ModuleBase::Vector3<double>> kvecs_d;
196196
kvecs_d.push_back(ModuleBase::Vector3<double>(0.0, 0.0, 0.0)); // Gamma point
197197
tqo.read_structures(&ucell, kvecs_d, 0, 1);
198-
tqo.build_nao(ucell.ntype, "./", ucell.orbital_fn, 0);
199-
// ucell.orbital_fn[0] = "../../../../tests/PP_ORB/Si_gga_8au_100Ry_2s2p1d.orb";
200-
// ucell.orbital_fn[1] = "../../../../tests/PP_ORB/C_gga_8au_100Ry_2s2p1d.orb";
198+
tqo.build_nao(ucell.ntype, "./", ucell.orbital_fn.data(), 0);
199+
// ucell.orbital_fn.data()[0] = "../../../../tests/PP_ORB/Si_gga_8au_100Ry_2s2p1d.orb";
200+
// ucell.orbital_fn.data()[1] = "../../../../tests/PP_ORB/C_gga_8au_100Ry_2s2p1d.orb";
201201
// test1 1Si, 1C
202202
std::vector<int> natoms = {1, 1};
203203
std::map<std::tuple<int,int,int,int,int>,int> index;
@@ -407,7 +407,7 @@ TEST_F(toQOTest, ScanSupercellForAtom)
407407
tqo.read_structures(&ucell, kvecs_d, 0, 1);
408408
tqo.build_nao(ucell.ntype, // ntype
409409
"./", // orbital_dir
410-
ucell.orbital_fn,// orbital_fn
410+
ucell.orbital_fn.data(),// orbital_fn
411411
0); // rank
412412
std::vector<int> nmax = std::vector<int>(ucell.ntype);
413413
for(int itype = 0; itype < ucell.ntype; itype++)
@@ -461,7 +461,7 @@ TEST_F(toQOTest, ScanSupercellFCC)
461461
tqo.read_structures(&ucell, kvecs_d, 0, 1);
462462
tqo.build_nao(ucell.ntype,
463463
"./",
464-
ucell.orbital_fn,
464+
ucell.orbital_fn.data(),
465465
0);
466466
tqo.build_ao(ucell.ntype,
467467
"./",
@@ -486,7 +486,7 @@ TEST_F(toQOTest, ScanSupercellSC1)
486486
tqo.read_structures(&ucell, kvecs_d, 0, 1);
487487
tqo.build_nao(ucell.ntype,
488488
"./",
489-
ucell.orbital_fn,
489+
ucell.orbital_fn.data(),
490490
0);
491491
PARAM.input.qo_thr = 1e-6;
492492
tqo.build_ao(ucell.ntype,
@@ -512,7 +512,7 @@ TEST_F(toQOTest, AllocateOvlpMinimal)
512512
tqo.read_structures(&ucell, kvecs_d, 0, 1);
513513
tqo.build_nao(ucell.ntype,
514514
"./",
515-
ucell.orbital_fn,
515+
ucell.orbital_fn.data(),
516516
0);
517517
std::vector<int> nmax = std::vector<int>(ucell.ntype);
518518
for(int itype = 0; itype < ucell.ntype; itype++)
@@ -649,8 +649,8 @@ TEST_F(toQOTest, CalculateSelfOvlpRMinimal)
649649
PARAM.input.qo_screening_coeff);
650650
std::vector<ModuleBase::Vector3<double>> kvecs_d;
651651
kvecs_d.push_back(ModuleBase::Vector3<double>(0.0, 0.0, 0.0)); // Gamma point
652-
ucell.orbital_fn[0] = "Si_special_use_unittest.orb"; // generated in unittest BuildAo
653-
ucell.orbital_fn[1] = "C_special_use_unittest.orb"; // generated in unittest BuildAo
652+
ucell.orbital_fn.data()[0] = "Si_special_use_unittest.orb"; // generated in unittest BuildAo
653+
ucell.orbital_fn.data()[1] = "C_special_use_unittest.orb"; // generated in unittest BuildAo
654654
ucell.atoms[1].nwl = 1; // only s and p for C
655655
tqo.initialize(PARAM.sys.global_out_dir,
656656
"",
@@ -718,8 +718,8 @@ TEST_F(toQOTest, CalculateSelfOvlpKSymmetrical)
718718
{"minimal-nodeless", "minimal-nodeless"},
719719
PARAM.input.qo_thr,
720720
PARAM.input.qo_screening_coeff);
721-
ucell.orbital_fn[0] = "Si_special_use_unittest.orb"; // generated in unittest BuildAo
722-
ucell.orbital_fn[1] = "C_special_use_unittest.orb"; // generated in unittest BuildAo
721+
ucell.orbital_fn.data()[0] = "Si_special_use_unittest.orb"; // generated in unittest BuildAo
722+
ucell.orbital_fn.data()[1] = "C_special_use_unittest.orb"; // generated in unittest BuildAo
723723
ucell.atoms[1].nwl = 1; // only s and p for C
724724

725725
std::vector<ModuleBase::Vector3<double>> kvecs_d;
@@ -894,8 +894,8 @@ TEST_F(toQOTest, CalculateSelfOvlpRFull)
894894
PARAM.input.qo_screening_coeff);
895895
std::vector<ModuleBase::Vector3<double>> kvecs_d;
896896
kvecs_d.push_back(ModuleBase::Vector3<double>(0.0, 0.0, 0.0)); // Gamma point
897-
ucell.orbital_fn[0] = "Si_special_use_unittest.orb"; // generated in unittest BuildAo
898-
ucell.orbital_fn[1] = "C_special_use_unittest.orb"; // generated in unittest BuildAo
897+
ucell.orbital_fn.data()[0] = "Si_special_use_unittest.orb"; // generated in unittest BuildAo
898+
ucell.orbital_fn.data()[1] = "C_special_use_unittest.orb"; // generated in unittest BuildAo
899899
ucell.atoms[1].nwl = 1; // only s and p for C
900900
PARAM.input.qo_thr = 1e-10;
901901
tqo.initialize(PARAM.sys.global_out_dir,
@@ -1143,7 +1143,7 @@ TEST_F(toQOTest, ScanSupercellSC2)
11431143
tqo.read_structures(&ucell, kvecs_d, 0, 1);
11441144
tqo.build_nao(ucell.ntype,
11451145
"./",
1146-
ucell.orbital_fn,
1146+
ucell.orbital_fn.data(),
11471147
0);
11481148
PARAM.input.qo_screening_coeff[0] = 0.1; // use this to control the tailing of radial function
11491149
PARAM.input.qo_thr = 1e-6;
@@ -1169,7 +1169,7 @@ TEST_F(toQOTest, ScanSupercellSC3)
11691169
tqo.read_structures(&ucell, kvecs_d, 0, 1);
11701170
tqo.build_nao(ucell.ntype,
11711171
"./",
1172-
ucell.orbital_fn,
1172+
ucell.orbital_fn.data(),
11731173
0);
11741174
PARAM.input.qo_screening_coeff[0] = 0.25; // use this to control the tailing of radial function
11751175
PARAM.input.qo_thr = 1e-6;
@@ -1196,7 +1196,7 @@ TEST_F(toQOTest, ScanSupercellSC4)
11961196
tqo.read_structures(&ucell, kvecs_d, 0, 1);
11971197
tqo.build_nao(ucell.ntype,
11981198
"./",
1199-
ucell.orbital_fn,
1199+
ucell.orbital_fn.data(),
12001200
0);
12011201
PARAM.input.qo_screening_coeff[0] = 0.5; // use this to control the tailing of radial function
12021202
PARAM.input.qo_thr = 1e-6;
@@ -1221,8 +1221,8 @@ TEST_F(toQOTest, CalculateSelfOvlpRPswfc)
12211221
PARAM.input.qo_screening_coeff);
12221222
std::vector<ModuleBase::Vector3<double>> kvecs_d;
12231223
kvecs_d.push_back(ModuleBase::Vector3<double>(0.0, 0.0, 0.0)); // Gamma point
1224-
ucell.orbital_fn[0] = "Si_special_use_unittest.orb"; // generated in unittest BuildAo
1225-
ucell.orbital_fn[1] = "C_special_use_unittest.orb"; // generated in unittest BuildAo
1224+
ucell.orbital_fn.data()[0] = "Si_special_use_unittest.orb"; // generated in unittest BuildAo
1225+
ucell.orbital_fn.data()[1] = "C_special_use_unittest.orb"; // generated in unittest BuildAo
12261226
ucell.atoms[1].nwl = 1; // only s and p for C
12271227
//PARAM.input.qo_thr = 1e-10;
12281228
tqo.initialize(PARAM.sys.global_out_dir,

0 commit comments

Comments
 (0)