Mantid
|
This is a parser for symmetry operation symbols in the Jones faithful representation. More...
#include <SymmetryOperationSymbolParser.h>
Static Public Member Functions | |
static std::string | getNormalizedIdentifier (const Kernel::IntMatrix &matrix, const V3R &vector) |
Returns the Jones faithful representation of a symmetry operation. More... | |
static std::string | getNormalizedIdentifier (const MatrixVectorPair< int, V3R > &data) |
Returns a Jones faithful representation of the symmetry operation characterized by the supplied matrix/column pair. More... | |
static MatrixVectorPair< int, V3R > | parseIdentifier (const std::string &identifier) |
Tries to parse the given symbol. More... | |
Protected Member Functions | |
SymmetryOperationSymbolParser ()=default | |
Static Protected Member Functions | |
static bool | isValidMatrixRow (const int *element, size_t columnNumber) |
Checks if there are either 1 or 2 zeros in a given matrix row and all non-zero elements are 1 or -1. More... | |
static void | verifyMatrix (const Kernel::IntMatrix &matrix) |
Verify that the matrix does not contain elements with abs(element) > 1 and has an acceptable number of non-zero elements. More... | |
This is a parser for symmetry operation symbols in the Jones faithful representation.
It creates matrix and a vector component from the given symbol. First an example with no translational component, the inversion:
-x,-y,-z
Parsing this symbol returns the following matrix/vector pair:
Matrix Vector -1 0 0 0 0 -1 0 0 0 0 -1 0
Translational components, as required for screw axes and glide planes are given as rational numbers, such as in this 2_1 screw axis around z:
-x,-y,z+1/2
Which returns the following matrix/vector pair:
Matrix Vector -1 0 0 0 0 -1 0 0 0 0 1 1/2
From these components, a SymmetryOperation object can be constructed. See the documentation for SymmetryOperation and SymmetryOperationFactory.
Definition at line 52 of file SymmetryOperationSymbolParser.h.
|
protecteddefault |
|
static |
Returns the Jones faithful representation of a symmetry operation.
This method generates a Jones faithful string for the given matrix and vector. The string is generated bases on some rules:
If the matrix is not 3x3, an std::runtime_error exception is thrown.
matrix | |
vector |
Definition at line 85 of file SymmetryOperationSymbolParser.cpp.
References Mantid::Kernel::Matrix< T >::numCols(), and Mantid::Kernel::Matrix< T >::numRows().
|
static |
Returns a Jones faithful representation of the symmetry operation characterized by the supplied matrix/column pair.
Definition at line 59 of file SymmetryOperationSymbolParser.cpp.
References Mantid::Geometry::MatrixVectorPair< MatrixNumericType, VectorType >::getMatrix(), getNormalizedIdentifier(), and Mantid::Geometry::MatrixVectorPair< MatrixNumericType, VectorType >::getVector().
Referenced by getNormalizedIdentifier(), Mantid::Geometry::SymmetryOperation::init(), and Mantid::Geometry::SymmetryOperation::SymmetryOperation().
|
staticprotected |
Checks if there are either 1 or 2 zeros in a given matrix row and all non-zero elements are 1 or -1.
Definition at line 130 of file SymmetryOperationSymbolParser.cpp.
Referenced by verifyMatrix().
|
static |
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.
identifier | :: Symbol representing a symmetry operation |
Definition at line 49 of file SymmetryOperationSymbolParser.cpp.
References Mantid::Geometry::MatrixVectorPair< MatrixNumericType, VectorType >::getMatrix(), and verifyMatrix().
Referenced by Mantid::Geometry::isValidGeneratorString(), and Mantid::Geometry::SymmetryOperation::SymmetryOperation().
|
staticprotected |
Verify that the matrix does not contain elements with abs(element) > 1 and has an acceptable number of non-zero elements.
Definition at line 18 of file SymmetryOperationSymbolParser.cpp.
References error, isValidMatrixRow(), Mantid::Kernel::Matrix< T >::numCols(), and Mantid::Kernel::Matrix< T >::numRows().
Referenced by parseIdentifier().