/** * Tries to parse the given symbol * * This method tries to parse a given symbol and returns the matrix/vector pair * resulting from the parsing process. It takes a string representing a * symmetry operation in the format: * x+a/b, -y-c/d, e/f-z * where x, y and z are the literals 'x', 'y' and 'z', while a-f are integers, * representing rational numbers. The latter don't need to be present, * a string "x,y,z" is valid. Leading plus-signs may be included if desired, * so that "+x,+y,+z" is also valid. * * If there is a problem, a Kernel::Exception::ParseError exception is thrown. * * See also SymmetryOperationSymbolParser::getNormalizedIdentifier, which * performs the opposite operation. * * @param identifier :: Symbol representing a symmetry operation * @return Kernel::IntMatrix and V3R, representing the symmetry operation. */ std::pair<Kernel::IntMatrix, V3R> SymmetryOperationSymbolParser::parseIdentifier(const std::string &identifier) { MatrixVectorPair<int, V3R> pair = parseMatrixVectorPair<int>(identifier); verifyMatrix(pair.getMatrix()); return std::make_pair(pair.getMatrix(), pair.getVector()); }
/** * Transforms the operation using the internally stored SymmetryOperation. * * This method returns the transformed symmetry operation, using the * following relation: * * S' = O^-1 * S * O * * Where O is the internally stored operation. * * @param operation :: SymmetryOperation to transform. * @return Transformed symmetry operation. */ SymmetryOperation GroupTransformation::transformOperation( const SymmetryOperation &operation) const { MatrixVectorPair<double, V3R> op = m_inversePair * MatrixVectorPair<double, V3R>(convertMatrix<double>(operation.matrix()), operation.vector()) * m_matrixVectorPair; return SymmetryOperation(op.getMatrix(), op.getVector()); }
/// 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()); }
/// Returns a Jones faithful representation of the symmetry operation /// characterized by the supplied matrix/column pair. std::string SymmetryOperationSymbolParser::getNormalizedIdentifier( const MatrixVectorPair<int, V3R> &data) { return getNormalizedIdentifier(data.getMatrix(), data.getVector()); }