15Group::Group() : m_allOperations(), m_operationSet(), m_axisSystem() {
16 std::vector<SymmetryOperation> operation(1);
22Group::Group(
const std::string &symmetryOperationString) : m_allOperations(), m_operationSet(), m_axisSystem() {
28Group::Group(
const std::vector<SymmetryOperation> &symmetryOperations)
29 : m_allOperations(), m_operationSet(), m_axisSystem() {
57 std::vector<SymmetryOperation> result;
58 result.reserve(
order() * other.order());
63 std::transform(other.m_allOperations.begin(), other.m_allOperations.end(), std::back_inserter(result),
64 [&operation](const auto &otherOp) { return operation * otherOp; });
73 std::vector<Kernel::V3D> result;
76 [&vector](
const auto &operation) { return Geometry::getWrappedVector(operation * vector); });
79 result.erase(std::unique(result.begin(), result.end()), result.end());
119 return opMatrix.
Tprime() * tensor * opMatrix;
123 return transformTensor(convertMatrix<double>(op.matrix()), tensor).equals(tensor, tolerance);
166 if (symmetryOperations.empty()) {
167 throw std::invalid_argument(
"Group needs at least one element.");
171 std::transform(symmetryOperations.cbegin(), symmetryOperations.cend(),
182 for (
const auto &symmetryOperation : symmetryOperations) {
183 std::vector<int> matrix = symmetryOperation.matrix();
184 if (std::count(matrix.begin(), matrix.end(), 0) == 5) {
194 Group result = (*this) * (*this);
203 for (
size_t i = 0; i < ops.size(); ++i) {
221 return this->containsOperation(getUnitCellIntervalOperation(operation.inverse()));
250 throw std::invalid_argument(
"One of the operands is null. Aborting.");
253 return std::make_shared<const Group>((*lhs) * (*
rhs));
259 throw std::invalid_argument(
"Cannot use null pointer for multiplication.");
268 throw std::invalid_argument(
"One of the operands is null. Aborting.");
271 return (*lhs) == (*rhs);
const std::vector< double > & rhs
Less-than-functor for comparison of atom positions with specifiable precision.
The class Group represents a set of symmetry operations (or symmetry group).
Group operator*(const Group &other) const
Multiplication operator of two groups.
CoordinateSystem m_axisSystem
bool operator!=(const Group &other) const
Returns true if groups are different from eachother.
bool isGroup() const
Returns whether the group fulfills the four group axioms.
bool isInvariant(const Kernel::DblMatrix &tensor, double tolerance=1e-8) const
Returns true if the tensor is invariant under the group operations.
std::vector< SymmetryOperation > getSymmetryOperations() const
Returns a vector with all symmetry operations.
Group()
Default constructor. Creates a group with one symmetry operation (identity).
CoordinateSystem getCoordinateSystem() const
Returns the axis system of the group (either orthogonal or hexagonal).
bool fulfillsAxiom(GroupAxiom axiom) const
Checks whether a certain group axiom is fulfilled, can be used as a more fine-grained alternative to ...
bool associativityHolds() const
Checks that associativity holds, i.e.
bool hasIdentity() const
Returns true if the group has the identity element.
bool isClosed() const
Returns true if the group is closed, i.e. all elements of G * G are in G.
bool operator==(const Group &other) const
Returns true if both groups contain the same set of symmetry operations.
std::vector< SymmetryOperation > m_allOperations
void setSymmetryOperations(const std::vector< SymmetryOperation > &symmetryOperations)
Assigns symmetry operations, throws std::invalid_argument if vector is empty.
bool containsOperation(const SymmetryOperation &operation) const
Returns true if the group contains the supplied operation.
bool eachElementHasInverse() const
Returns true if the inverse of each element is in the group.
CoordinateSystem getCoordinateSystemFromOperations(const std::vector< SymmetryOperation > &symmetryOperations) const
Returns the axis system based on the given symmetry operations.
size_t order() const
Returns the order of the group, which is the number of symmetry operations.
std::set< SymmetryOperation > m_operationSet
Crystallographic symmetry operations are composed of a rotational component, which is represented by ...
Matrix< T > Tprime() const
Transpose the matrix.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
MANTID_GEOMETRY_DLL bool operator==(const Group_const_sptr &lhs, const Group_const_sptr &rhs)
Equality operator for shared pointers.
MANTID_GEOMETRY_DLL Group_const_sptr operator*(const Group_const_sptr &lhs, const Group_const_sptr &rhs)
Convenience operator* for directly multiplying groups using shared pointers.
MANTID_GEOMETRY_DLL bool operator!=(const Group_const_sptr &lhs, const Group_const_sptr &rhs)
Inequality operator for shared pointers.
MANTID_GEOMETRY_DLL SymmetryOperation getUnitCellIntervalOperation(const SymmetryOperation &symOp)
Returns a SymmetryOperation with the vector wrapped to the interval (0, 1].
std::shared_ptr< const Group > Group_const_sptr