Skip to content

Commit 2f3540b

Browse files
committed
add unittest for checktau
1 parent 89ffb98 commit 2f3540b

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

source/module_cell/test/unitcell_test.cpp

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ TEST_F(UcellTest, CheckDTau)
753753
}
754754
}
755755

756-
TEST_F(UcellTest, CheckTau)
756+
TEST_F(UcellTest, CheckTauFalse)
757757
{
758758
UcellTestPrepare utp = UcellTestLib["C1H2-CheckTau"];
759759
PARAM.input.relax_new = utp.relax_new;
@@ -769,6 +769,31 @@ TEST_F(UcellTest, CheckTau)
769769
remove("checktau_warning");
770770
}
771771

772+
TEST_F(UcellTest, CheckTauTrue)
773+
{
774+
UcellTestPrepare utp = UcellTestLib["C1H2-CheckTau"];
775+
PARAM.input.relax_new = utp.relax_new;
776+
ucell = utp.SetUcellInfo();
777+
GlobalV::ofs_warning.open("checktau_warning");
778+
int atom=0;
779+
ucell->nat=3;
780+
for (int it=0;it<ucell->ntype;it++)
781+
{
782+
for(int ia=0; ia<ucell->atoms[it].na; ++ia)
783+
{
784+
785+
for (int i=0;i<3;i++)
786+
{
787+
ucell->atoms[it].tau[ia][i]=((atom+i)/(ucell->nat*3.0));
788+
std::cout<<"the tau is "<<ucell->atoms[it].tau[ia][i];
789+
}
790+
atom+=3;
791+
}
792+
}
793+
EXPECT_EQ(unitcell::check_tau(ucell->atoms ,ucell->ntype, ucell->lat0),true);
794+
GlobalV::ofs_warning.close();
795+
}
796+
772797
TEST_F(UcellTest, SelectiveDynamics)
773798
{
774799
UcellTestPrepare utp = UcellTestLib["C1H2-SD"];

0 commit comments

Comments
 (0)