@@ -67,6 +67,12 @@ class UcellTest : public ::testing::Test
6767 void SetUp ()
6868 {
6969 ucell->lmaxmax = 2 ;
70+ ucell->ntype = 2 ;
71+ ucell->atom_mass .resize (ucell->ntype );
72+ ucell->atom_label .resize (ucell->ntype );
73+ ucell->pseudo_fn .resize (ucell->ntype );
74+ ucell->pseudo_type .resize (ucell->ntype );
75+ ucell->orbital_fn .resize (ucell->ntype );
7076 }
7177};
7278
@@ -78,7 +84,7 @@ TEST_F(UcellTest,SetupCellS1)
7884 std::ofstream ofs_running;
7985 ofs_running.open (" setup_cell.tmp" );
8086 PARAM.input .nspin = 1 ;
81- ucell-> ntype = 2 ;
87+
8288 ucell->setup_cell (fn,ofs_running);
8389 ofs_running.close ();
8490 remove (" setup_cell.tmp" );
@@ -90,7 +96,7 @@ TEST_F(UcellTest,SetupCellS2)
9096 std::ofstream ofs_running;
9197 ofs_running.open (" setup_cell.tmp" );
9298 PARAM.input .nspin = 2 ;
93- ucell-> ntype = 2 ;
99+
94100 ucell->setup_cell (fn,ofs_running);
95101 ofs_running.close ();
96102 remove (" setup_cell.tmp" );
@@ -102,7 +108,7 @@ TEST_F(UcellTest,SetupCellS4)
102108 std::ofstream ofs_running;
103109 ofs_running.open (" setup_cell.tmp" );
104110 PARAM.input .nspin = 4 ;
105- ucell-> ntype = 2 ;
111+
106112 ucell->setup_cell (fn,ofs_running);
107113 ofs_running.close ();
108114 remove (" setup_cell.tmp" );
@@ -113,7 +119,7 @@ TEST_F(UcellDeathTest,SetupCellWarning1)
113119 std::string fn = " ./STRU_MgO" ;
114120 std::ofstream ofs_running;
115121 ofs_running.open (" setup_cell.tmp" );
116- ucell-> ntype = 2 ;
122+
117123 testing::internal::CaptureStdout ();
118124 EXPECT_EXIT (ucell->setup_cell (fn,ofs_running),::testing::ExitedWithCode (1 )," " );
119125 output = testing::internal::GetCapturedStdout ();
@@ -127,7 +133,7 @@ TEST_F(UcellDeathTest,SetupCellWarning2)
127133 std::string fn = " ./support/STRU_MgO_WarningC2" ;
128134 std::ofstream ofs_running;
129135 ofs_running.open (" setup_cell.tmp" );
130- ucell-> ntype = 2 ;
136+
131137 testing::internal::CaptureStdout ();
132138 EXPECT_EXIT (ucell->setup_cell (fn,ofs_running),::testing::ExitedWithCode (1 )," " );
133139 output = testing::internal::GetCapturedStdout ();
@@ -142,7 +148,7 @@ TEST_F(UcellTest,SetupCellAfterVC)
142148 std::ofstream ofs_running;
143149 ofs_running.open (" setup_cell.tmp" );
144150 PARAM.input .nspin = 1 ;
145- ucell-> ntype = 2 ;
151+
146152 delete[] ucell->magnet .start_magnetization ;
147153 ucell->magnet .start_magnetization = new double [ucell->ntype ];
148154
0 commit comments