Resetting coordinates at lower levels in neighbor_list_find_cell.

This commit is contained in:
Patrick Shriwise 2021-03-31 23:38:25 -05:00
parent 66e7e998af
commit a8ce144585
2 changed files with 9 additions and 5 deletions

View file

@ -188,7 +188,9 @@ find_cell_inner(Particle& p, const NeighborList* neighbor_list)
coord.r -= c.translation_;
// Apply rotation.
coord.rotate(c.rotation_);
if (!c.rotation_.empty()) {
coord.rotate(c.rotation_);
}
} else if (c.type_ == Fill::LATTICE) {
//========================================================================
@ -245,6 +247,12 @@ find_cell_inner(Particle& p, const NeighborList* neighbor_list)
bool neighbor_list_find_cell(Particle& p)
{
// Reset all the deeper coordinate levels.
for (int i = p.n_coord_; i < p.coord_.size(); i++) {
p.coord_[i].reset();
}
// Get the cell this particle was in previously.
auto coord_lvl = p.n_coord_ - 1;
auto i_cell = p.coord_[coord_lvl].cell;