Mantid
Loading...
Searching...
No Matches
SpaceGroup.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2014 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
13#include "MantidGeometry/DllConfig.h"
14#include "MantidKernel/V3D.h"
15
16#include <set>
17
18namespace Mantid {
19namespace Geometry {
20
46class MANTID_GEOMETRY_DLL SpaceGroup : public Group {
47public:
48 SpaceGroup(size_t itNumber, std::string hmSymbol, const Group &group);
49
50 size_t number() const;
51 std::string hmSymbol() const;
52
53 template <typename T> std::vector<T> getEquivalentPositions(const T &position) const {
54 const std::vector<SymmetryOperation> &symmetryOperations = getSymmetryOperations();
55
56 std::vector<T> equivalents;
57 equivalents.reserve(symmetryOperations.size());
58 std::transform(symmetryOperations.cbegin(), symmetryOperations.cend(), std::back_inserter(equivalents),
59 [&position](const SymmetryOperation &op) { return Geometry::getWrappedVector(op * position); });
60
61 // Use fuzzy compare with the same condition as V3D::operator==().
62 std::sort(equivalents.begin(), equivalents.end(), AtomPositionsLessThan());
63 equivalents.erase(std::unique(equivalents.begin(), equivalents.end(), AtomPositionsEqual()), equivalents.end());
64
65 return equivalents;
66 }
67
68 bool isAllowedReflection(const Kernel::V3D &hkl) const;
69 bool isAllowedUnitCell(const UnitCell &cell) const;
70
71 PointGroup_sptr getPointGroup() const;
72 Group_const_sptr getSiteSymmetryGroup(const Kernel::V3D &position) const;
73
74protected:
75 size_t m_number;
76 std::string m_hmSymbol;
77};
78
79MANTID_GEOMETRY_DLL std::ostream &operator<<(std::ostream &stream, const SpaceGroup &self);
80
81using SpaceGroup_sptr = std::shared_ptr<SpaceGroup>;
82using SpaceGroup_const_sptr = std::shared_ptr<const SpaceGroup>;
83
84} // namespace Geometry
85} // namespace Mantid
double position
Definition: GetAllEi.cpp:154
Equality-functor for comparison of atom positions with specifiable precision.
Definition: Group.h:22
Less-than-functor for comparison of atom positions with specifiable precision.
Definition: Group.h:37
The class Group represents a set of symmetry operations (or symmetry group).
Definition: Group.h:135
A class for representing space groups, inheriting from Group.
Definition: SpaceGroup.h:46
std::vector< T > getEquivalentPositions(const T &position) const
Definition: SpaceGroup.h:53
Crystallographic symmetry operations are composed of a rotational component, which is represented by ...
Class to implement unit cell of crystals.
Definition: UnitCell.h:44
Class for 3D vectors.
Definition: V3D.h:34
std::shared_ptr< PointGroup > PointGroup_sptr
Shared pointer to a PointGroup.
Definition: PointGroup.h:67
std::shared_ptr< const SpaceGroup > SpaceGroup_const_sptr
Definition: SpaceGroup.h:82
MANTID_GEOMETRY_DLL std::ostream & operator<<(std::ostream &stream, const PointGroup &self)
Returns a streamed representation of the PointGroup object.
Definition: PointGroup.cpp:312
std::shared_ptr< SpaceGroup > SpaceGroup_sptr
Definition: SpaceGroup.h:81
std::shared_ptr< const Group > Group_const_sptr
Definition: Group.h:179
Helper class which provides the Collimation Length for SANS instruments.