Skip to content

Commit

Permalink
Remove bonds before wrapping atoms to the unit cell
Browse files Browse the repository at this point in the history
Signed-off-by: Geoff Hutchison <[email protected]>
  • Loading branch information
ghutchis committed Jan 7, 2025
1 parent 2df9224 commit ca3eb41
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions avogadro/core/crystaltools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,16 @@ bool CrystalTools::wrapAtomsToUnitCell(Molecule& molecule)
if (!molecule.unitCell())
return false;

// remove any bonds first - otherwise they may wrap
// across the unit cell strangely
molecule.clearBonds();

std::for_each(molecule.atomPositions3d().begin(),
molecule.atomPositions3d().end(),
WrapAtomsToCellFunctor(molecule));

molecule.perceiveBondsSimple();
molecule.perceiveBondOrders();
return true;
}

Expand Down

0 comments on commit ca3eb41

Please sign in to comment.