/// Creates a SymmetryOperation object from its identifier. SymmetryOperation SymmetryOperationFactoryImpl::createSymOp(const std::string &identifier) { if (!isSubscribed(identifier)) { subscribeSymOp(identifier); } return SymmetryOperation(m_prototypes[identifier]); }
/// Returns the symmetry operation, applied to itself (exponent) times. SymmetryOperation SymmetryOperation::operator^(size_t exponent) const { // If the exponent is 1, no calculations are necessary. if (exponent == 1) { return SymmetryOperation(*this); } SymmetryOperation op; // The same for 0, which means identity in every case. if (exponent == 0) { return op; } for (size_t i = 0; i < exponent; ++i) { op = (*this) * op; } return op; }
/// Returns true if the group has the identity element. bool Group::hasIdentity() const { // Since the identity element does not change, this is an easy check. return containsOperation(SymmetryOperation()); }
/// Returns the inverse of the symmetry operation. SymmetryOperation SymmetryOperation::inverse() const { Kernel::IntMatrix matrix(m_matrix); matrix.Invert(); return SymmetryOperation(matrix, -(matrix * m_vector)); }
/** * Multiplication operator for combining symmetry operations * * This operator constructs from S1 (this) and S2 (other) a new symmetry *operation SymOp' with * * SymOp'(M', v') * * where * M' = M1 * M2 * * and * v' = (M1 * v2) + v1 * * and the components of v' are on the interval (0, 1]. * * @param operand * @return */ SymmetryOperation SymmetryOperation:: operator*(const SymmetryOperation &operand) const { return SymmetryOperation( m_matrix * operand.m_matrix, getWrappedVector((m_matrix * operand.m_vector) + m_vector)); }
/// Returns the inverse of the symmetry operation. SymmetryOperation SymmetryOperation::inverse() const { MatrixVectorPair<int, V3R> inverse = m_matrixVectorPair.getInverse(); return SymmetryOperation(inverse.getMatrix(), inverse.getVector()); }
/** * Multiplication operator for combining symmetry operations * * This operator constructs from S1 (this) and S2 (other) a new symmetry *operation SymOp' with * * SymOp'(M', v') * * where * M' = M1 * M2 * * and * v' = (M1 * v2) + v1 * * and the components of v' are on the interval (0, 1]. * * @param operand * @return */ SymmetryOperation SymmetryOperation:: operator*(const SymmetryOperation &operand) const { MatrixVectorPair<int, V3R> result = m_matrixVectorPair * operand.m_matrixVectorPair; return SymmetryOperation(result.getMatrix(), result.getVector()); }