/** * @brief SortHKL::getUniqueReflections * * This method returns a map that contains a UniqueReflection- * object with 0 to n Peaks each. The key of the map is the * reflection index all peaks are equivalent to. * * @param peaks :: Vector of peaks to assign. * @param cell :: UnitCell to use for calculation of possible reflections. * @return Map of unique reflections. */ std::map<V3D, UniqueReflection> SortHKL::getUniqueReflections(const std::vector<Peak> &peaks, const UnitCell &cell) const { ReflectionCondition_sptr centering = getCentering(); PointGroup_sptr pointGroup = getPointgroup(); std::pair<double, double> dLimits = getDLimits(peaks, cell); std::map<V3D, UniqueReflection> uniqueReflectionInRange = getPossibleUniqueReflections(cell, dLimits, pointGroup, centering); for (auto const &peak : peaks) { V3D hkl = peak.getHKL(); hkl.round(); uniqueReflectionInRange.at(pointGroup->getReflectionFamily(hkl)) .addPeak(peak); } return uniqueReflectionInRange; }
/** * @brief SortHKL::getPossibleUniqueReflections * * This method returns a map that contains UniqueReflection-objects, one * for each unique reflection in the given resolution range. It uses the * given cell, point group and centering to determine which reflections * are allowed and which ones are equivalent. * * @param cell :: UnitCell of the sample. * @param dLimits :: Resolution limits for the generated reflections. * @param pointGroup :: Point group of the sample. * @param centering :: Lattice centering (important for completeness * calculation). * * @return Map of UniqueReflection objects with HKL of the reflection family as * key */ std::map<V3D, UniqueReflection> SortHKL::getPossibleUniqueReflections( const UnitCell &cell, const std::pair<double, double> &dLimits, const PointGroup_sptr &pointGroup, const ReflectionCondition_sptr ¢ering) const { HKLGenerator generator(cell, dLimits.first); HKLFilter_const_sptr dFilter = boost::make_shared<const HKLFilterDRange>( cell, dLimits.first, dLimits.second); HKLFilter_const_sptr centeringFilter = boost::make_shared<const HKLFilterCentering>(centering); HKLFilter_const_sptr filter = dFilter & centeringFilter; // Generate map of UniqueReflection-objects with reflection family as key. std::map<V3D, UniqueReflection> uniqueHKLs; for (auto hkl : generator) { if (filter->isAllowed(hkl)) { V3D hklFamily = pointGroup->getReflectionFamily(hkl); uniqueHKLs.emplace(hklFamily, UniqueReflection(hklFamily)); } } return uniqueHKLs; }