Skip to content

Commit 0d90ec1

Browse files
committed
modify compile bug
1 parent c586e9f commit 0d90ec1

File tree

10 files changed

+40
-39
lines changed

10 files changed

+40
-39
lines changed

source/module_elecstate/module_dm/test/prepare_unitcell.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ class UcellTestPrepare
7676
delete[] ucell.orbital_fn;
7777
delete[] ucell.magnet.start_magnetization; // mag set here
7878

79-
ucell->atom_label.resize(ucell->ntype);
80-
ucell->atom_mass.resize(ucell->ntype);
81-
ucell->pseudo_fn.resize(ucell->ntype);
82-
ucell->pseudo_type.resize(ucell->ntype);
79+
ucell.atom_label.resize(ucell.ntype);
80+
ucell.atom_mass.resize(ucell.ntype);
81+
ucell.pseudo_fn.resize(ucell.ntype);
82+
ucell.pseudo_type.resize(ucell.ntype);
8383
ucell.orbital_fn = new std::string[ucell.ntype];
8484
ucell.magnet.start_magnetization = new double[ucell.ntype]; // mag set here
8585
ucell.magnet.ux_[0] = 0.0; // ux_ set here

source/module_esolver/test/for_test.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ UnitCell::UnitCell()
2222
ntype = 2;
2323
nat = 2;
2424

25-
atom_label = new std::string[ntype];
25+
atom_label.resize(ntype);
2626
atom_label[0] = "Al";
2727
atom_label[1] = "Cu";
2828

source/module_hamilt_lcao/module_deepks/test/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ add_executable(
77
../../../module_cell/atom_spec.cpp
88
../../../module_cell/atom_pseudo.cpp
99
../../../module_cell/read_atoms.cpp
10+
../../../module_cell/read_stru.cpp
11+
../../../module_cell/read_atom_species.cpp
1012
../../../module_cell/setup_nonlocal.cpp
1113
../../../module_cell/pseudo.cpp
1214
../../../module_cell/read_pp.cpp
@@ -34,7 +36,7 @@ add_executable(
3436

3537
target_link_libraries(
3638
test_deepks
37-
base device parameter deepks psi planewave neighbor container
39+
base device parameter deepks psi planewave neighbor container
3840
orb gint numerical_atomic_orbitals paw
3941
${math_libs}
4042
)

source/module_hamilt_lcao/module_hcontainer/test/prepare_unitcell.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ class UcellTestPrepare
7474
ucell.setup(this->latname, this->ntype, this->lmaxmax, this->init_vel, this->fixed_axes);
7575
delete[] ucell.orbital_fn;
7676
delete[] ucell.magnet.start_magnetization; // mag set here
77-
ucell->atom_label.resize(ucell->ntype);
78-
ucell->atom_mass.resize(ucell->ntype);
79-
ucell->pseudo_fn.resize(ucell->ntype);
80-
ucell->pseudo_type.resize(ucell->ntype);
81-
77+
ucell.atom_label.resize(ucell.ntype);
78+
ucell.atom_mass.resize(ucell.ntype);
79+
ucell.pseudo_fn.resize(ucell.ntype);
80+
ucell.pseudo_type.resize(ucell.ntype);
81+
8282
ucell.orbital_fn = new std::string[ucell.ntype];
8383
ucell.magnet.start_magnetization = new double[ucell.ntype]; // mag set here
8484
ucell.magnet.ux_[0] = 0.0; // ux_ set here

source/module_io/json_output/init_info.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void gen_stru(UnitCell* ucell)
6363
int ntype = ucell->ntype;
6464

6565
// array of pseudopotential file
66-
std::string* pseudo_fn = ucell->pseudo_fn;
66+
std::string* pseudo_fn = ucell->pseudo_fn.data();
6767

6868
// array of orbital file
6969
std::string* orbital_fn = ucell->orbital_fn;
@@ -99,7 +99,7 @@ void gen_stru(UnitCell* ucell)
9999

100100
// atom coordinate, mag and label
101101
double lat0 = ucell->lat0;
102-
std::string* label = ucell->atom_label;
102+
std::string* label = ucell->atom_label.data();
103103
for (int i = 0; i < ntype; i++)
104104
{
105105
ModuleBase::Vector3<double>* tau = ucell->atoms[i].tau.data();

source/module_io/json_output/test/para_json_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,10 +337,10 @@ TEST(AbacusJsonTest, Init_stru_test)
337337

338338
double lat0 = 10.0;
339339
ucell.ntype = 1;
340-
ucell.pseudo_fn = new std::string[1];
340+
ucell.pseudo_fn.resize(1);
341341
ucell.orbital_fn = new std::string[1];
342342
ucell.atoms = atomlist;
343-
ucell.atom_label = new std::string[1];
343+
ucell.atom_label.resize(1);
344344
ucell.lat0 = lat0;
345345

346346
ModuleBase::Vector3<double> tau[2];

source/module_io/test/to_qo_test.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void define_fcc_cell(UnitCell& ucell)
5252
ucell.orbital_fn = new std::string[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";
55-
ucell.pseudo_fn = new std::string[2];
55+
ucell.pseudo_fn.resize(2);
5656
ucell.pseudo_fn[0] = "../../../../tests/PP_ORB/Si_dojo_soc.upf";
5757
ucell.pseudo_fn[1] = "../../../../tests/PP_ORB/C.LDA.UPF";
5858

@@ -88,7 +88,7 @@ void define_sc_cell(UnitCell& ucell)
8888
ucell.GGT = ucell.G * ucell.GT;
8989
ucell.orbital_fn = new std::string[1];
9090
ucell.orbital_fn[0] = "../../../../tests/PP_ORB/Si_gga_8au_100Ry_2s2p1d.orb";
91-
ucell.pseudo_fn = new std::string[1];
91+
ucell.pseudo_fn.resize(1);
9292
ucell.pseudo_fn[0] = "../../../../tests/PP_ORB/Si_dojo_soc.upf";
9393

9494
PARAM.sys.global_out_dir = "./";
@@ -309,7 +309,7 @@ TEST_F(toQOTest, RadialCollectionIndexing)
309309

310310
tqo.build_ao(ucell.ntype,
311311
"./",
312-
ucell.pseudo_fn,
312+
ucell.pseudo_fn.data(),
313313
{},
314314
PARAM.input.qo_thr,
315315
GlobalV::ofs_running,
@@ -363,7 +363,7 @@ TEST_F(toQOTest, BuildHydrogenMinimal)
363363
tqo.read_structures(&ucell, kvecs_d, 0, 1);
364364
tqo.build_ao(ucell.ntype,
365365
"./",
366-
ucell.pseudo_fn,
366+
ucell.pseudo_fn.data(),
367367
{},
368368
PARAM.input.qo_thr,
369369
GlobalV::ofs_running,
@@ -416,7 +416,7 @@ TEST_F(toQOTest, ScanSupercellForAtom)
416416
}
417417
tqo.build_ao(ucell.ntype,
418418
"./",
419-
ucell.pseudo_fn,
419+
ucell.pseudo_fn.data(),
420420
{},
421421
PARAM.input.qo_thr,
422422
GlobalV::ofs_running,
@@ -465,7 +465,7 @@ TEST_F(toQOTest, ScanSupercellFCC)
465465
0);
466466
tqo.build_ao(ucell.ntype,
467467
"./",
468-
ucell.pseudo_fn,
468+
ucell.pseudo_fn.data(),
469469
{},
470470
PARAM.input.qo_thr,
471471
GlobalV::ofs_running,
@@ -491,7 +491,7 @@ TEST_F(toQOTest, ScanSupercellSC1)
491491
PARAM.input.qo_thr = 1e-6;
492492
tqo.build_ao(ucell.ntype,
493493
"./",
494-
ucell.pseudo_fn,
494+
ucell.pseudo_fn.data(),
495495
{},
496496
PARAM.input.qo_thr,
497497
GlobalV::ofs_running,
@@ -521,7 +521,7 @@ TEST_F(toQOTest, AllocateOvlpMinimal)
521521
}
522522
tqo.build_ao(ucell.ntype,
523523
"./",
524-
ucell.pseudo_fn,
524+
ucell.pseudo_fn.data(),
525525
{},
526526
PARAM.input.qo_thr,
527527
GlobalV::ofs_running,
@@ -874,7 +874,7 @@ TEST_F(toQOTest, BuildHydrogenFull)
874874
PARAM.input.qo_thr = 1e-10;
875875
tqo.build_ao(ucell.ntype,
876876
"./",
877-
ucell.pseudo_fn,
877+
ucell.pseudo_fn.data(),
878878
{},
879879
PARAM.input.qo_thr,
880880
GlobalV::ofs_running,
@@ -1061,7 +1061,7 @@ TEST_F(toQOTest, BuildPswfcPartial1)
10611061
tqo.read_structures(&ucell, kvecs_d, 0, 1);
10621062
tqo.build_ao(ucell.ntype,
10631063
"./",
1064-
ucell.pseudo_fn,
1064+
ucell.pseudo_fn.data(),
10651065
PARAM.input.qo_screening_coeff,
10661066
PARAM.input.qo_thr,
10671067
GlobalV::ofs_running,
@@ -1081,7 +1081,7 @@ TEST_F(toQOTest, BuildPswfcPartial2)
10811081
tqo.read_structures(&ucell, kvecs_d, 0, 1);
10821082
tqo.build_ao(ucell.ntype,
10831083
"./",
1084-
ucell.pseudo_fn,
1084+
ucell.pseudo_fn.data(),
10851085
PARAM.input.qo_screening_coeff,
10861086
PARAM.input.qo_thr,
10871087
GlobalV::ofs_running,
@@ -1101,7 +1101,7 @@ TEST_F(toQOTest, BuildPswfcPartial3)
11011101
tqo.read_structures(&ucell, kvecs_d, 0, 1);
11021102
tqo.build_ao(ucell.ntype,
11031103
"./",
1104-
ucell.pseudo_fn,
1104+
ucell.pseudo_fn.data(),
11051105
PARAM.input.qo_screening_coeff,
11061106
PARAM.input.qo_thr,
11071107
GlobalV::ofs_running,
@@ -1122,7 +1122,7 @@ TEST_F(toQOTest, BuildPswfcAll)
11221122
tqo.read_structures(&ucell, kvecs_d, 0, 1);
11231123
tqo.build_ao(ucell.ntype,
11241124
"./",
1125-
ucell.pseudo_fn,
1125+
ucell.pseudo_fn.data(),
11261126
PARAM.input.qo_screening_coeff,
11271127
PARAM.input.qo_thr,
11281128
GlobalV::ofs_running,
@@ -1149,7 +1149,7 @@ TEST_F(toQOTest, ScanSupercellSC2)
11491149
PARAM.input.qo_thr = 1e-6;
11501150
tqo.build_ao(ucell.ntype,
11511151
"./",
1152-
ucell.pseudo_fn,
1152+
ucell.pseudo_fn.data(),
11531153
PARAM.input.qo_screening_coeff,
11541154
PARAM.input.qo_thr,
11551155
GlobalV::ofs_running,
@@ -1175,7 +1175,7 @@ TEST_F(toQOTest, ScanSupercellSC3)
11751175
PARAM.input.qo_thr = 1e-6;
11761176
tqo.build_ao(ucell.ntype,
11771177
"./",
1178-
ucell.pseudo_fn,
1178+
ucell.pseudo_fn.data(),
11791179
PARAM.input.qo_screening_coeff,
11801180
PARAM.input.qo_thr,
11811181
GlobalV::ofs_running,
@@ -1202,7 +1202,7 @@ TEST_F(toQOTest, ScanSupercellSC4)
12021202
PARAM.input.qo_thr = 1e-6;
12031203
tqo.build_ao(ucell.ntype,
12041204
"./",
1205-
ucell.pseudo_fn,
1205+
ucell.pseudo_fn.data(),
12061206
PARAM.input.qo_screening_coeff,
12071207
PARAM.input.qo_thr,
12081208
GlobalV::ofs_running,

source/module_io/to_qo_kernel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ void toQO::initialize(const std::string& out_dir,
8282
// build the numerical atomic orbital basis
8383
build_nao(ntype_, orbital_dir_, p_ucell_->orbital_fn, iproc_);
8484
// build another atomic orbital
85-
build_ao(ntype_, pseudo_dir_, p_ucell_->pseudo_fn, screening_coeffs_, qo_thr_, ofs_running, iproc_);
85+
build_ao(ntype_, pseudo_dir_, p_ucell_->pseudo_fn.data(), screening_coeffs_, qo_thr_, ofs_running, iproc_);
8686

8787
// neighbor list search, based on built RadialCollection(s)
8888
scan_supercell(iproc_, nprocs_);

source/module_psi/test/psi_initializer_unit_test.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ class PsiIntializerUnitTest : public ::testing::Test {
139139
this->p_ucell->tpiba = 2.0 * M_PI / this->p_ucell->lat0;
140140
this->p_ucell->tpiba2 = this->p_ucell->tpiba * this->p_ucell->tpiba;
141141
// atom
142-
this->p_ucell->atom_label.shrink_to_fit()
142+
this->p_ucell->atom_label.shrink_to_fit();
143143
this->p_ucell->atom_label.resize(1);
144144
this->p_ucell->atom_label[0] = "Si";
145145
// atom properties
@@ -156,9 +156,8 @@ class PsiIntializerUnitTest : public ::testing::Test {
156156
this->p_ucell->atoms[0].taud.resize(1, {0.25, 0.25, 0.25});
157157
this->p_ucell->atoms[0].mbl.resize(1, {0, 0, 0});
158158
// atom pseudopotential
159-
if(this->p_ucell->pseudo_fn != nullptr) { delete[] this->p_ucell->pseudo_fn;
160-
}
161-
this->p_ucell->pseudo_fn = new std::string[1];
159+
this->p_ucell->pseudo_fn.shrink_to_fit();
160+
this->p_ucell->pseudo_fn.resize(1);
162161
this->p_ucell->pseudo_fn[0] = "Si_NCSR_ONCVPSP_v0.5_dojo.upf";
163162
this->p_ucell->natomwfc = 4;
164163
this->p_ucell->atoms[0].ncpp.nchi = 2;

source/module_relax/relax_old/test/for_test.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ UnitCell::UnitCell()
4343
tpiba2 = 0.0;
4444
omega = 0.0;
4545

46-
atom_label = new std::string[1];
4746
atom_mass.shrink_to_fit();
48-
pseudo_fn = new std::string[1];
49-
pseudo_type = new std::string[1];
47+
atom_label.resize(1);
48+
pseudo_fn.resize(1);
49+
pseudo_type.resize(1);
5050
orbital_fn = new std::string[1];
5151

5252
atoms = new Atom[ntype];

0 commit comments

Comments
 (0)