From 27a5e177be8583b9e9bbfc3f257c0fe3f1126fd8 Mon Sep 17 00:00:00 2001 From: Geoff Hutchison Date: Fri, 27 Dec 2024 22:42:28 -0500 Subject: [PATCH] When filling the unit cell, don't wrap existing atoms Signed-off-by: Geoff Hutchison --- avogadro/core/spacegroups.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/avogadro/core/spacegroups.cpp b/avogadro/core/spacegroups.cpp index 886f678091..0b4fa21b38 100644 --- a/avogadro/core/spacegroups.cpp +++ b/avogadro/core/spacegroups.cpp @@ -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; @@ -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. @@ -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