|
11 | 11 | #include<valarray>
|
12 | 12 | #include <streambuf>
|
13 | 13 | #include "prepare_unitcell.h"
|
14 |
| - |
| 14 | +#include "module_cell/update_cell.h" |
15 | 15 | #ifdef __LCAO
|
16 | 16 | #include "module_basis/module_ao/ORB_read.h"
|
17 | 17 | InfoNonlocal::InfoNonlocal(){}
|
@@ -145,8 +145,47 @@ TEST_F(UcellTest,SetupCellAfterVC)
|
145 | 145 | ucell->ntype = 2;
|
146 | 146 | delete[] ucell->magnet.start_magnetization;
|
147 | 147 | ucell->magnet.start_magnetization = new double[ucell->ntype];
|
| 148 | + |
| 149 | + |
148 | 150 | ucell->setup_cell(fn,ofs_running);
|
149 |
| - ucell->setup_cell_after_vc(ofs_running); |
| 151 | + ucell->lat0 = 1.0; |
| 152 | + ucell->latvec.Zero(); |
| 153 | + ucell->latvec.e11 = 10.0; |
| 154 | + ucell->latvec.e22 = 10.0; |
| 155 | + ucell->latvec.e33 = 10.0; |
| 156 | + for (int i =0;i<ucell->ntype;i++) |
| 157 | + { |
| 158 | + ucell->atoms[i].na = 1; |
| 159 | + ucell->atoms[i].taud.resize(ucell->atoms[i].na); |
| 160 | + ucell->atoms[i].tau.resize(ucell->atoms[i].na); |
| 161 | + ucell->atoms[i].taud[0].x = 0.1; |
| 162 | + ucell->atoms[i].taud[0].y = 0.1; |
| 163 | + ucell->atoms[i].taud[0].z = 0.1; |
| 164 | + } |
| 165 | + |
| 166 | + unitcell::setup_cell_after_vc(*ucell,ofs_running); |
| 167 | + EXPECT_EQ(ucell->lat0_angstrom,0.529177); |
| 168 | + EXPECT_EQ(ucell->tpiba,ModuleBase::TWO_PI); |
| 169 | + EXPECT_EQ(ucell->tpiba2,ModuleBase::TWO_PI*ModuleBase::TWO_PI); |
| 170 | + EXPECT_EQ(ucell->a1.x ,10.0); |
| 171 | + EXPECT_EQ(ucell->a2.y ,10.0); |
| 172 | + EXPECT_EQ(ucell->a3.z ,10.0); |
| 173 | + EXPECT_EQ(ucell->omega,1000.0); |
| 174 | + EXPECT_EQ(ucell->GT.e11,0.1); |
| 175 | + EXPECT_EQ(ucell->GT.e22,0.1); |
| 176 | + EXPECT_EQ(ucell->GT.e33,0.1); |
| 177 | + EXPECT_EQ(ucell->G.e11,0.1); |
| 178 | + EXPECT_EQ(ucell->G.e22,0.1); |
| 179 | + EXPECT_EQ(ucell->G.e33,0.1); |
| 180 | + |
| 181 | + for (int it = 0; it < ucell->ntype; it++) { |
| 182 | + Atom* atom = &ucell->atoms[it]; |
| 183 | + for (int ia = 0; ia < atom->na; ia++) { |
| 184 | + EXPECT_EQ(atom->tau[ia].x,1); |
| 185 | + EXPECT_EQ(atom->tau[ia].y,1); |
| 186 | + EXPECT_EQ(atom->tau[ia].z,1); |
| 187 | + } |
| 188 | + } |
150 | 189 | ofs_running.close();
|
151 | 190 | remove("setup_cell.tmp");
|
152 | 191 | }
|
|
0 commit comments