88#include " module_base/mathzone.h"
99#include " module_cell/check_atomic_stru.h"
1010#include " module_cell/unitcell.h"
11+ #include " module_elecstate/read_pseudo.h"
1112#include < valarray>
1213#include < vector>
1314#ifdef __MPI
@@ -136,7 +137,7 @@ TEST_F(UcellDeathTest, ReadCellPPWarning1) {
136137 PARAM.input .lspinorb = true ;
137138 ucell->pseudo_fn [1 ] = " H_sr.upf" ;
138139 testing::internal::CaptureStdout ();
139- EXPECT_EXIT (ucell-> read_cell_pseudopots (pp_dir, ofs),
140+ EXPECT_EXIT (elecstate:: read_cell_pseudopots (pp_dir, ofs, *ucell ),
140141 ::testing::ExitedWithCode (1 ),
141142 "");
142143 output = testing::internal::GetCapturedStdout ();
@@ -147,7 +148,7 @@ TEST_F(UcellDeathTest, ReadCellPPWarning1) {
147148TEST_F (UcellDeathTest, ReadCellPPWarning2) {
148149 pp_dir = " ./arbitrary/" ;
149150 testing::internal::CaptureStdout ();
150- EXPECT_EXIT (ucell-> read_cell_pseudopots (pp_dir, ofs),
151+ EXPECT_EXIT (elecstate:: read_cell_pseudopots (pp_dir, ofs, *ucell ),
151152 ::testing::ExitedWithCode (1 ),
152153 "");
153154 output = testing::internal::GetCapturedStdout ();
@@ -158,7 +159,7 @@ TEST_F(UcellDeathTest, ReadCellPPWarning2) {
158159TEST_F (UcellDeathTest, ReadCellPPWarning3) {
159160 ucell->pseudo_type [0 ] = " upf" ;
160161 testing::internal::CaptureStdout ();
161- EXPECT_EXIT (ucell-> read_cell_pseudopots (pp_dir, ofs),
162+ EXPECT_EXIT (elecstate:: read_cell_pseudopots (pp_dir, ofs, *ucell ),
162163 ::testing::ExitedWithCode (1 ),
163164 "");
164165 output = testing::internal::GetCapturedStdout ();
@@ -169,7 +170,7 @@ TEST_F(UcellDeathTest, ReadCellPPWarning3) {
169170TEST_F (UcellDeathTest, ReadCellPPWarning4) {
170171 PARAM.input .dft_functional = " LDA" ;
171172 testing::internal::CaptureStdout ();
172- EXPECT_NO_THROW (ucell-> read_cell_pseudopots (pp_dir, ofs));
173+ EXPECT_NO_THROW (elecstate:: read_cell_pseudopots (pp_dir, ofs, *ucell ));
173174 output = testing::internal::GetCapturedStdout ();
174175 EXPECT_THAT (output, testing::HasSubstr (" dft_functional readin is: LDA" ));
175176 EXPECT_THAT (output,
@@ -181,7 +182,7 @@ TEST_F(UcellDeathTest, ReadCellPPWarning4) {
181182TEST_F (UcellDeathTest, ReadCellPPWarning5) {
182183 ucell->pseudo_type [0 ] = " upf0000" ;
183184 testing::internal::CaptureStdout ();
184- EXPECT_EXIT (ucell-> read_cell_pseudopots (pp_dir, ofs),
185+ EXPECT_EXIT (elecstate:: read_cell_pseudopots (pp_dir, ofs, *ucell ),
185186 ::testing::ExitedWithCode (1 ),
186187 "");
187188 output = testing::internal::GetCapturedStdout ();
@@ -190,7 +191,7 @@ TEST_F(UcellDeathTest, ReadCellPPWarning5) {
190191
191192TEST_F (UcellTest, ReadCellPP) {
192193 ucell->atoms [1 ].flag_empty_element = true ;
193- ucell-> read_cell_pseudopots (pp_dir, ofs);
194+ elecstate:: read_cell_pseudopots (pp_dir, ofs, *ucell );
194195 EXPECT_EQ (ucell->atoms [0 ].ncpp .pp_type , " NC" );
195196 EXPECT_FALSE (ucell->atoms [0 ].ncpp .has_so ); // becomes false in average_p
196197 EXPECT_FALSE (ucell->atoms [1 ].ncpp .has_so );
@@ -213,15 +214,15 @@ TEST_F(UcellTest, ReadCellPP) {
213214}
214215
215216TEST_F (UcellTest, CalMeshx) {
216- ucell-> read_cell_pseudopots (pp_dir, ofs);
217+ elecstate:: read_cell_pseudopots (pp_dir, ofs, *ucell );
217218 ucell->cal_meshx ();
218219 EXPECT_EQ (ucell->atoms [0 ].ncpp .msh , 1247 );
219220 EXPECT_EQ (ucell->atoms [1 ].ncpp .msh , 1165 );
220221 EXPECT_EQ (ucell->meshx , 1247 );
221222}
222223
223224TEST_F (UcellTest, CalNatomwfc1) {
224- ucell-> read_cell_pseudopots (pp_dir, ofs);
225+ elecstate:: read_cell_pseudopots (pp_dir, ofs, *ucell );
225226 EXPECT_FALSE (ucell->atoms [0 ].ncpp .has_so );
226227 EXPECT_FALSE (ucell->atoms [1 ].ncpp .has_so );
227228 ucell->cal_natomwfc (ofs);
@@ -235,7 +236,7 @@ TEST_F(UcellTest, CalNatomwfc1) {
235236TEST_F (UcellTest, CalNatomwfc2) {
236237 PARAM.input .lspinorb = false ;
237238 PARAM.input .nspin = 4 ;
238- ucell-> read_cell_pseudopots (pp_dir, ofs);
239+ elecstate:: read_cell_pseudopots (pp_dir, ofs, *ucell );
239240 EXPECT_FALSE (ucell->atoms [0 ].ncpp .has_so );
240241 EXPECT_FALSE (ucell->atoms [1 ].ncpp .has_so );
241242 ucell->cal_natomwfc (ofs);
@@ -249,7 +250,7 @@ TEST_F(UcellTest, CalNatomwfc2) {
249250TEST_F (UcellTest, CalNatomwfc3) {
250251 PARAM.input .lspinorb = true ;
251252 PARAM.input .nspin = 4 ;
252- ucell-> read_cell_pseudopots (pp_dir, ofs);
253+ elecstate:: read_cell_pseudopots (pp_dir, ofs, *ucell );
253254 EXPECT_TRUE (ucell->atoms [0 ].ncpp .has_so );
254255 EXPECT_TRUE (ucell->atoms [1 ].ncpp .has_so );
255256 ucell->cal_natomwfc (ofs);
@@ -262,7 +263,7 @@ TEST_F(UcellTest, CalNatomwfc3) {
262263}
263264
264265TEST_F (UcellTest, CalNwfc1) {
265- ucell-> read_cell_pseudopots (pp_dir, ofs);
266+ elecstate:: read_cell_pseudopots (pp_dir, ofs, *ucell );
266267 EXPECT_FALSE (ucell->atoms [0 ].ncpp .has_so );
267268 EXPECT_FALSE (ucell->atoms [1 ].ncpp .has_so );
268269 PARAM.sys .nlocal = 3 * 9 ;
@@ -328,15 +329,15 @@ TEST_F(UcellTest, CalNwfc1) {
328329TEST_F (UcellTest, CalNwfc2) {
329330 PARAM.input .nspin = 4 ;
330331 PARAM.input .basis_type = " lcao" ;
331- ucell-> read_cell_pseudopots (pp_dir, ofs);
332+ elecstate:: read_cell_pseudopots (pp_dir, ofs, *ucell );
332333 EXPECT_FALSE (ucell->atoms [0 ].ncpp .has_so );
333334 EXPECT_FALSE (ucell->atoms [1 ].ncpp .has_so );
334335 PARAM.sys .nlocal = 3 * 9 * 2 ;
335336 EXPECT_NO_THROW (ucell->cal_nwfc (ofs));
336337}
337338
338339TEST_F (UcellDeathTest, CheckStructure) {
339- ucell-> read_cell_pseudopots (pp_dir, ofs);
340+ elecstate:: read_cell_pseudopots (pp_dir, ofs, *ucell );
340341 EXPECT_FALSE (ucell->atoms [0 ].ncpp .has_so );
341342 EXPECT_FALSE (ucell->atoms [1 ].ncpp .has_so );
342343 // trial 1
@@ -379,7 +380,7 @@ TEST_F(UcellDeathTest, ReadPseudoWarning1) {
379380 PARAM.input .out_element_info = true ;
380381 ucell->pseudo_fn [1 ] = " H_sr_lda.upf" ;
381382 testing::internal::CaptureStdout ();
382- EXPECT_EXIT (ucell-> read_pseudo (ofs), ::testing::ExitedWithCode (1 ), " " );
383+ EXPECT_EXIT (elecstate:: read_pseudo (ofs, *ucell ), ::testing::ExitedWithCode (1 ), " " );
383384 output = testing::internal::GetCapturedStdout ();
384385 EXPECT_THAT (output,
385386 testing::HasSubstr (" All DFT functional must consistent." ));
@@ -390,7 +391,7 @@ TEST_F(UcellDeathTest, ReadPseudoWarning2) {
390391 PARAM.input .out_element_info = true ;
391392 ucell->pseudo_fn [0 ] = " Al_ONCV_PBE-1.0.upf" ;
392393 testing::internal::CaptureStdout ();
393- EXPECT_NO_THROW (ucell-> read_pseudo (ofs));
394+ EXPECT_NO_THROW (elecstate:: read_pseudo (ofs, *ucell ));
394395 output = testing::internal::GetCapturedStdout ();
395396 EXPECT_THAT (
396397 output,
@@ -399,7 +400,7 @@ TEST_F(UcellDeathTest, ReadPseudoWarning2) {
399400}
400401
401402TEST_F (UcellTest, CalNelec) {
402- ucell-> read_cell_pseudopots (pp_dir, ofs);
403+ elecstate:: read_cell_pseudopots (pp_dir, ofs, *ucell );
403404 EXPECT_EQ (4 , ucell->atoms [0 ].ncpp .zv );
404405 EXPECT_EQ (1 , ucell->atoms [1 ].ncpp .zv );
405406 EXPECT_EQ (1 , ucell->atoms [0 ].na );
0 commit comments