1 parent 9ac9626 commit 487555cCopy full SHA for 487555c
1 file changed
source/source_cell/update_cell.cpp
@@ -496,12 +496,13 @@ void periodic_boundary_adjustment(Atom* atoms,
496
atom->taud[ia][ik] -= 1.0;
497
}
498
499
- if (atom->taud[ia].x < 0
500
- || atom->taud[ia].y < 0
501
- || atom->taud[ia].z < 0
502
- || atom->taud[ia].x >= 1.0
503
- || atom->taud[ia].y >= 1.0
504
- || atom->taud[ia].z >= 1.0)
+ const double eps = 1e-12;
+ if (atom->taud[ia].x < -eps
+ || atom->taud[ia].y < -eps
+ || atom->taud[ia].z < -eps
+ || atom->taud[ia].x >= 1.0+eps
+ || atom->taud[ia].y >= 1.0+eps
505
+ || atom->taud[ia].z >= 1.0+eps)
506
{
507
GlobalV::ofs_warning << " atom type=" << it + 1 << " atom index=" << ia + 1 << std::endl;
508
GlobalV::ofs_warning << " direct coordinate=" << atom->taud[ia].x << " "
0 commit comments