Skip to content

Commit

Permalink
When filling the unit cell, don't wrap existing atoms
Browse files Browse the repository at this point in the history
Signed-off-by: Geoff Hutchison <geoff.hutchison@gmail.com>
  • Loading branch information
ghutchis committed Dec 28, 2024
1 parent 43704a8 commit 27a5e17
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions avogadro/core/spacegroups.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace Avogadro::Core {

unsigned short SpaceGroups::hallNumber(const std::string& spaceGroup)
{
unsigned short hall = 0; // can't find anything
unsigned short hall = 0; // can't find anything
const unsigned short hall_count = 531; // 530 but first one is empty
// some files use " instead of = for the space group symbol
std::string sg = spaceGroup;
Expand Down Expand Up @@ -275,6 +275,9 @@ void SpaceGroups::fillUnitCell(Molecule& mol, unsigned short hallNumber,
for (Index j = 1; j < newAtoms.size(); ++j) {
// The new atoms are in fractional coordinates. Convert to cartesian.
Vector3 newCandidate = uc->toCartesian(newAtoms[j]);
// if we are wrapping to the cell, we need to wrap the new atom
if (wrapToCell)
newCandidate = uc->wrapCartesian(newCandidate);

// If there is already an atom in this location within a
// certain tolerance, do not add the atom.
Expand All @@ -298,8 +301,8 @@ void SpaceGroups::fillUnitCell(Molecule& mol, unsigned short hallNumber,
}
}

if (wrapToCell)
CrystalTools::wrapAtomsToUnitCell(mol);
// if (wrapToCell)
// CrystalTools::wrapAtomsToUnitCell(mol);

// Now we need to generate any copies on the unit boundary
// We need to loop through all the atoms again
Expand Down

0 comments on commit 27a5e17

Please sign in to comment.