diff --git a/avogadro/core/spacegroups.cpp b/avogadro/core/spacegroups.cpp index e89ffbbe00..d96b239a6c 100644 --- a/avogadro/core/spacegroups.cpp +++ b/avogadro/core/spacegroups.cpp @@ -259,7 +259,7 @@ Array SpaceGroups::getTransforms(unsigned short hallNumber, } void SpaceGroups::fillUnitCell(Molecule& mol, unsigned short hallNumber, - double cartTol) + double cartTol, bool wrapToCell, bool allCopies) { if (!mol.unitCell()) return; @@ -303,13 +303,17 @@ void SpaceGroups::fillUnitCell(Molecule& mol, unsigned short hallNumber, newAtom.setPosition3d(newCandidate); } } - // @todo make this optional - 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 // if a fractional coordinate contains 0.0, we need to generate a copy // of the atom at 1.0 + if (!allCopies) + return; + atomicNumbers = mol.atomicNumbers(); positions = mol.atomPositions3d(); numAtoms = mol.atomCount(); diff --git a/avogadro/core/spacegroups.h b/avogadro/core/spacegroups.h index 67a0efa68c..22fc963a70 100644 --- a/avogadro/core/spacegroups.h +++ b/avogadro/core/spacegroups.h @@ -42,7 +42,8 @@ class AVOGADROCORE_EXPORT SpaceGroups ~SpaceGroups(); /** - * @return The hall number of the matching space group string or 0 if not found + * @return The hall number of the matching space group string or 0 if not + * found */ static unsigned short hallNumber(const std::string& spaceGroup); @@ -65,8 +66,8 @@ class AVOGADROCORE_EXPORT SpaceGroups static const char* schoenflies(unsigned short hallNumber); /** - * @return the Hall symbol for a given hall number. '=' is used instead of '"'. - * If an invalid hall number is given, an empty string will be returned. + * @return the Hall symbol for a given hall number. '=' is used instead of + * '"'. If an invalid hall number is given, an empty string will be returned. */ static const char* hallSymbol(unsigned short hallNumber); @@ -118,7 +119,8 @@ class AVOGADROCORE_EXPORT SpaceGroups * distance, the new atom will not be placed there. */ static void fillUnitCell(Molecule& mol, unsigned short hallNumber, - double cartTol = 1e-5); + double cartTol = 1e-5, bool wrapToCell = true, + bool allCopies = true); /** * Reduce a cell to its asymmetric unit. @@ -137,7 +139,7 @@ class AVOGADROCORE_EXPORT SpaceGroups static const char* transformsString(unsigned short hallNumber); }; -} // end Core namespace -} // end Avogadro namespace +} // namespace Core +} // namespace Avogadro #endif // AVOGADRO_CORE_SPACE_GROUPS_H