@@ -153,7 +153,7 @@ TEST_F(UcellTest, UpdatePosTau)
153153 }
154154 delete[] pos_in;
155155}
156- TEST_F (UcellTest, UpdatePosTaud )
156+ TEST_F (UcellTest, UpdatePosTaud_pointer )
157157{
158158 double * pos_in = new double [ucell->nat * 3 ];
159159 ModuleBase::Vector3<double >* tmp = new ModuleBase::Vector3<double >[ucell->nat ];
@@ -167,7 +167,8 @@ TEST_F(UcellTest, UpdatePosTaud)
167167 ucell->iat2iait (iat, &ia, &it);
168168 tmp[iat] = ucell->atoms [it].taud [ia];
169169 }
170- ucell->update_pos_taud (pos_in);
170+ unitcell::update_pos_taud (ucell->lat ,pos_in,ucell->ntype ,
171+ ucell->nat ,ucell->atoms );
171172 for (int iat = 0 ; iat < ucell->nat ; ++iat)
172173 {
173174 int it, ia;
@@ -180,6 +181,37 @@ TEST_F(UcellTest, UpdatePosTaud)
180181 delete[] pos_in;
181182}
182183
184+ // test update_pos_taud with ModuleBase::Vector3<double> version
185+ TEST_F (UcellTest, UpdatePosTaud_Vector3)
186+ {
187+ ModuleBase::Vector3<double >* pos_in = new ModuleBase::Vector3<double >[ucell->nat ];
188+ ModuleBase::Vector3<double >* tmp = new ModuleBase::Vector3<double >[ucell->nat ];
189+ ucell->set_iat2itia ();
190+ for (int iat = 0 ; iat < ucell->nat ; ++iat)
191+ {
192+ for (int ik = 0 ; ik < 3 ; ++ik)
193+ {
194+ pos_in[iat][ik] = 0.01 ;
195+ }
196+ int it=0 ;
197+ int ia=0 ;
198+ ucell->iat2iait (iat, &ia, &it);
199+ tmp[iat] = ucell->atoms [it].taud [ia];
200+ }
201+ unitcell::update_pos_taud (ucell->lat ,pos_in,ucell->ntype ,
202+ ucell->nat ,ucell->atoms );
203+ for (int iat = 0 ; iat < ucell->nat ; ++iat)
204+ {
205+ int it, ia;
206+ ucell->iat2iait (iat, &ia, &it);
207+ for (int ik = 0 ; ik < 3 ; ++ik)
208+ {
209+ EXPECT_DOUBLE_EQ (ucell->atoms [it].taud [ia][ik], tmp[iat][ik] + 0.01 );
210+ }
211+ }
212+ delete[] tmp;
213+ delete[] pos_in;
214+ }
183215TEST_F (UcellTest, ReadPseudo)
184216{
185217 PARAM.input .pseudo_dir = pp_dir;
0 commit comments