コード例 #1
0
/** Execute the algorithm.
   */
void PoldiCreatePeaksFromCell::exec() {
  // Get all user input regarding the unit cell
  SpaceGroup_const_sptr spaceGroup = getSpaceGroup(getProperty("SpaceGroup"));
  PointGroup_sptr pointGroup =
      PointGroupFactory::Instance().createPointGroupFromSpaceGroup(spaceGroup);
  UnitCell unitCell = getConstrainedUnitCell(getUnitCellFromProperties(),
                                             pointGroup->crystalSystem(),
                                             pointGroup->getCoordinateSystem());

  g_log.information() << "Constrained unit cell is: " << unitCellToStr(unitCell)
                      << '\n';

  CompositeBraggScatterer_sptr scatterers = CompositeBraggScatterer::create(
      IsotropicAtomBraggScattererParser(getProperty("Atoms"))());

  // Create a CrystalStructure-object for use with PoldiPeakCollection
  CrystalStructure crystalStructure(unitCell, spaceGroup, scatterers);

  double dMin = getProperty("LatticeSpacingMin");
  double dMax = getDMaxValue(unitCell);

  // Create PoldiPeakCollection using given parameters, set output workspace
  PoldiPeakCollection_sptr peaks =
      boost::make_shared<PoldiPeakCollection>(crystalStructure, dMin, dMax);

  setProperty("OutputWorkspace", peaks->asTableWorkspace());
}
コード例 #2
0
ファイル: PointGroupFactory.cpp プロジェクト: DanNixon/mantid
/// Returns the Hermann-Mauguin symbols of all point groups that belong to a
/// certain crystal system.
std::vector<std::string> PointGroupFactoryImpl::getPointGroupSymbols(
    const PointGroup::CrystalSystem &crystalSystem) {
  std::vector<std::string> pointGroups;

  for (auto &generator : m_generatorMap) {
    PointGroup_sptr pointGroup = getPrototype(generator.first);

    if (pointGroup->crystalSystem() == crystalSystem) {
      pointGroups.push_back(generator.first);
    }
  }

  return pointGroups;
}
コード例 #3
0
ファイル: PointGroupFactory.cpp プロジェクト: nimgould/mantid
/// Returns the Hermann-Mauguin symbols of all point groups that belong to a
/// certain crystal system.
std::vector<std::string> PointGroupFactoryImpl::getPointGroupSymbols(
    const PointGroup::CrystalSystem &crystalSystem) {
  std::vector<std::string> pointGroups;

  for (auto it = m_generatorMap.begin(); it != m_generatorMap.end(); ++it) {
    PointGroup_sptr pointGroup = getPrototype(it->first);

    if (pointGroup->crystalSystem() == crystalSystem) {
      pointGroups.push_back(it->first);
    }
  }

  return pointGroups;
}
コード例 #4
0
std::string PoldiPeakCollection::pointGroupToString(
    const PointGroup_sptr &pointGroup) const {
  if (pointGroup) {
    return pointGroup->getSymbol();
  }

  return "1";
}
コード例 #5
0
ファイル: PoldiFitPeaks2D.cpp プロジェクト: DanNixon/mantid
/**
 * Returns the lattice system for the specified point group
 *
 * This function simply uses Geometry::getLatticeSystemAsString().
 *
 * @param pointGroup :: The point group for which to find the crystal system
 * @return The crystal system for the point group
 */
std::string PoldiFitPeaks2D::getLatticeSystemFromPointGroup(
    const PointGroup_sptr &pointGroup) const {
  if (!pointGroup) {
    throw std::invalid_argument(
        "Cannot return lattice system for null PointGroup.");
  }

  return Geometry::getLatticeSystemAsString(pointGroup->latticeSystem());
}
コード例 #6
0
/**
 * @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;
}
コード例 #7
0
/** Execute the algorithm.
   */
void PoldiCreatePeaksFromCell::exec() {
  // Get all user input regarding the unit cell
  SpaceGroup_const_sptr spaceGroup = getSpaceGroup(getProperty("SpaceGroup"));
  PointGroup_sptr pointGroup =
      PointGroupFactory::Instance().createPointGroupFromSpaceGroupSymbol(
          spaceGroup->hmSymbol());
  UnitCell unitCell = getConstrainedUnitCell(getUnitCellFromProperties(),
                                             pointGroup->crystalSystem());
  CompositeBraggScatterer_sptr scatterers = getScatterers(getProperty("Atoms"));

  // Create a CrystalStructure-object for use with PoldiPeakCollection
  CrystalStructure_sptr crystalStructure =
      boost::make_shared<CrystalStructure>(unitCell, spaceGroup, scatterers);

  double dMin = getProperty("LatticeSpacingMin");
  double dMax = getDMaxValue(unitCell);

  // Create PoldiPeakCollection using given parameters, set output workspace
  PoldiPeakCollection_sptr peaks =
      boost::make_shared<PoldiPeakCollection>(crystalStructure, dMin, dMax);

  setProperty("OutputWorkspace", peaks->asTableWorkspace());
}
コード例 #8
0
/**
 * @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 &centering) 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;
}