Mantid
|
Crystallographic symmetry operations are composed of a rotational component, which is represented by a matrix and a translational part, which is described by a vector. More...
#include <SymmetryOperation.h>
Public Member Functions | |
bool | hasTranslation () const |
Returns true if the operation has a translational component. More... | |
std::string | identifier () const |
Returns the string-identifier for this symmetry operation. More... | |
SymmetryOperation | inverse () const |
Returns the inverse of the symmetry operation. More... | |
bool | isIdentity () const |
Returns true if this is the identity operation. More... | |
const Kernel::IntMatrix & | matrix () const |
Returns a const reference to the internally stored matrix. More... | |
bool | operator!= (const SymmetryOperation &other) const |
Returns true if operatios are not equal. More... | |
SymmetryOperation | operator* (const SymmetryOperation &operand) const |
Multiplication operator for combining symmetry operations. More... | |
template<typename T > | |
T | operator* (const T &operand) const |
Returns the transformed vector. More... | |
bool | operator< (const SymmetryOperation &other) const |
Returns true if SymmetryOperation is "smaller" than other, determined by using the identifier strings. More... | |
bool | operator== (const SymmetryOperation &other) const |
Returns true if matrix and vector are equal. More... | |
SymmetryOperation | operator^ (size_t exponent) const |
Returns the symmetry operation, applied to itself (exponent) times. More... | |
size_t | order () const |
Returns the order of the symmetry operation. More... | |
const V3R & | reducedVector () const |
SymmetryOperation::reducedVector. More... | |
SymmetryOperation () | |
Default constructor, results in identity. More... | |
SymmetryOperation (const Kernel::DblMatrix &matrix, const V3R &vector) | |
Convenience constructor for double-matrices. More... | |
SymmetryOperation (const Kernel::IntMatrix &matrix, const V3R &vector) | |
Constructs a symmetry operation from a matrix component and a vector, derives order and identifier from matrix and vector. More... | |
SymmetryOperation (const std::string &identifier) | |
Construct a symmetry operation from a Jones faithful representation. More... | |
Kernel::V3D | transformHKL (const Kernel::V3D &hkl) const |
Transforms an index triplet hkl. More... | |
const V3R & | vector () const |
Returns a const reference to the internall stored vector. More... | |
Protected Member Functions | |
size_t | getOrderFromMatrix (const Kernel::IntMatrix &matrix) const |
Returns the order of the symmetry operation based on the matrix. More... | |
V3R | getReducedVector (const Kernel::IntMatrix &matrix, const V3R &vector) const |
void | init (const MatrixVectorPair< int, V3R > &matrixVectorPair) |
Initialize from matrix and vector. More... | |
Protected Attributes | |
std::string | m_identifier |
MatrixVectorPair< int, V3R > | m_matrixVectorPair |
size_t | m_order |
V3R | m_reducedVector |
Kernel::IntMatrix | m_transposedInverseMatrix |
Crystallographic symmetry operations are composed of a rotational component, which is represented by a matrix and a translational part, which is described by a vector.
In this interface, each symmetry operation has a so-called order, which is an unsigned integer describing the number of times a symmetry operation has to be applied to an object until it is identical.
Furthermore, each symmetry operation has a string-identifier. It contains the Jones faithful representation of the operation, as it is commonly used in many crystallographic programs and of course the International Tables for Crystallography, where the symmetry operations and their representations may be found [1].
The Jones faithful notation is a very concise way of describing matrix/vector pairs. The matrix/vector pair of a two-fold rotation axis along z is for example:
Matrix Vector -1 0 0 0 0 -1 0 0 0 0 1 0
This is described by the symbol '-x,-y,z'. If it were a 2_1 screw axis in the same direction, the matrix/vector pair would look like this:
Matrix Vector -1 0 0 0 0 -1 0 0 0 0 1 1/2
And this is represented by the string '-x,-y,z+1/2'. In hexagonal systems there are often operations involving 1/3 or 2/3, so the translational part is kept as a vector of rational numbers in order to carry out precise calculations. For details, see the class Kernel::V3R.
Using the symmetry operations in code is easy, since SymmetryOperationSymbolParser is automatically called by the string-based constructor of SymmetryOperation and the multiplication operator is overloaded:
SymmetryOperation inversion("-x,-y,-z"); V3D transformed = inversion * V3D(1, 1, -1); // results in -1, -1, 1
The operator is templated and works for any object Kernel::IntMatrix can be multiplied with and V3R can be added to (for example V3R, V3D). Note that for the transformation of HKLs, the matrix needs to be transposed. In some cases, such as the example above, it does not matter, because the matrix is identical to its transposed. In general however, transposing is necessary, so there is a dedicated method for that:
SymmetryOperation sixFold("x-y,x,z"); V3D hklPrime = sixFold.transformHKL(V3D(1,0,0)); //
A special case is the multiplication of several symmetry operations, which can be used to generate new operations:
SymmetryOperation inversion("-x,-y,-z"); SymmetryOperation identity = inversion * inversion;
In context of Group, the vector of SymmetryOperation is wrapped onto the interval (0, 1] using the getUnitCellIntervalOperation-function.
Constructing a SymmetryOperation object from a string is heavy, because the string has to be parsed every time. It's preferable to use the available factory:
SymmetryOperation inversion = SymmetryOperationFactory::Instance().createSymOp("-x,-y,-z");
It stores a prototype of the created operation and copy constructs a new instance on subsequent calls with the same string.
SymmetryOperation-objects are for example used in PointGroup.
References: [1] International Tables for Crystallography, Volume A, Fourth edition, pp 797-798.
Definition at line 106 of file SymmetryOperation.h.
Mantid::Geometry::SymmetryOperation::SymmetryOperation | ( | ) |
Default constructor, results in identity.
Definition at line 16 of file SymmetryOperation.cpp.
References Mantid::Geometry::SymmetryOperationSymbolParser::getNormalizedIdentifier(), m_identifier, and m_matrixVectorPair.
Referenced by inverse(), operator*(), and operator^().
Mantid::Geometry::SymmetryOperation::SymmetryOperation | ( | const std::string & | identifier | ) |
Construct a symmetry operation from a Jones faithful representation.
This method invokes SymmetryOperationSymbolParser and tries to parse the supplied string. Please not that parsing this string is not very efficient. If you have to create the same operations very often, use SymmetryOperationFactory, which works with the copy constructor - it's orders of magnitude faster.
identifier | :: Jones faithful representation of a symmetry operation |
Definition at line 33 of file SymmetryOperation.cpp.
References identifier(), init(), and Mantid::Geometry::SymmetryOperationSymbolParser::parseIdentifier().
Mantid::Geometry::SymmetryOperation::SymmetryOperation | ( | const Kernel::IntMatrix & | matrix, |
const V3R & | vector | ||
) |
Constructs a symmetry operation from a matrix component and a vector, derives order and identifier from matrix and vector.
Definition at line 39 of file SymmetryOperation.cpp.
Mantid::Geometry::SymmetryOperation::SymmetryOperation | ( | const Kernel::DblMatrix & | matrix, |
const V3R & | vector | ||
) |
Convenience constructor for double-matrices.
Definition at line 44 of file SymmetryOperation.cpp.
|
protected |
Returns the order of the symmetry operation based on the matrix.
From "Introduction to Crystal Growth and Characterization, Benz and Neumann, Wiley, 2014, p. 51."
Definition at line 196 of file SymmetryOperation.cpp.
References Mantid::Kernel::Matrix< T >::determinant(), matrix(), and Mantid::Kernel::Matrix< T >::Trace().
Referenced by init().
|
protected |
bool Mantid::Geometry::SymmetryOperation::hasTranslation | ( | ) | const |
Returns true if the operation has a translational component.
Definition at line 115 of file SymmetryOperation.cpp.
References m_matrixVectorPair.
Referenced by Mantid::Geometry::SymmetryElementIdentityGenerator::canProcess(), Mantid::Geometry::SymmetryElementTranslationGenerator::canProcess(), and isIdentity().
std::string Mantid::Geometry::SymmetryOperation::identifier | ( | ) | const |
Returns the string-identifier for this symmetry operation.
Definition at line 107 of file SymmetryOperation.cpp.
References m_identifier.
Referenced by Mantid::Geometry::SymmetryElementFactoryImpl::createSymElement(), export_SymmetryOperation(), Mantid::Geometry::operator<<(), and SymmetryOperation().
|
protected |
Initialize from matrix and vector.
Definition at line 49 of file SymmetryOperation.cpp.
References Mantid::Geometry::SymmetryOperationSymbolParser::getNormalizedIdentifier(), getOrderFromMatrix(), getReducedVector(), Mantid::Kernel::Matrix< T >::Invert(), m_identifier, m_matrixVectorPair, m_order, m_reducedVector, m_transposedInverseMatrix, and Mantid::Kernel::Matrix< T >::Transpose().
Referenced by SymmetryOperation().
SymmetryOperation Mantid::Geometry::SymmetryOperation::inverse | ( | ) | const |
Returns the inverse of the symmetry operation.
Definition at line 154 of file SymmetryOperation.cpp.
References inverse(), m_matrixVectorPair, and SymmetryOperation().
Referenced by Mantid::Geometry::SpaceGroupFactoryImpl::getTransformedSymbolOrthorhombic(), and inverse().
bool Mantid::Geometry::SymmetryOperation::isIdentity | ( | ) | const |
Returns true if this is the identity operation.
Definition at line 110 of file SymmetryOperation.cpp.
References hasTranslation(), and m_matrixVectorPair.
const Kernel::IntMatrix & Mantid::Geometry::SymmetryOperation::matrix | ( | ) | const |
Returns a const reference to the internally stored matrix.
Definition at line 64 of file SymmetryOperation.cpp.
References m_matrixVectorPair.
Referenced by Mantid::Geometry::SymmetryElementInversionGenerator::canProcess(), Mantid::Geometry::SymmetryElementRotationGenerator::canProcess(), Mantid::Geometry::SymmetryElementMirrorGenerator::canProcess(), Mantid::Geometry::SymmetryElementRotationGenerator::determineRotationSense(), Mantid::Geometry::SymmetryElementRotationGenerator::determineSymbol(), Mantid::Geometry::SymmetryElementRotationGenerator::generateElement(), Mantid::Geometry::SymmetryElementMirrorGenerator::generateElement(), getOrderFromMatrix(), getReducedVector(), Mantid::Geometry::getUnitCellIntervalOperation(), Mantid::Geometry::operator*(), SymmetryOperation(), and Mantid::Geometry::GroupTransformation::transformOperation().
bool Mantid::Geometry::SymmetryOperation::operator!= | ( | const SymmetryOperation & | other | ) | const |
Returns true if operatios are not equal.
Definition at line 191 of file SymmetryOperation.cpp.
References operator==().
SymmetryOperation Mantid::Geometry::SymmetryOperation::operator* | ( | const SymmetryOperation & | operand | ) | const |
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].
operand |
Definition at line 148 of file SymmetryOperation.cpp.
References Mantid::Geometry::MatrixVectorPair< MatrixNumericType, VectorType >::getMatrix(), Mantid::Geometry::MatrixVectorPair< MatrixNumericType, VectorType >::getVector(), m_matrixVectorPair, and SymmetryOperation().
|
inline |
Returns the transformed vector.
Definition at line 124 of file SymmetryOperation.h.
bool Mantid::Geometry::SymmetryOperation::operator< | ( | const SymmetryOperation & | other | ) | const |
Returns true if SymmetryOperation is "smaller" than other, determined by using the identifier strings.
Definition at line 188 of file SymmetryOperation.cpp.
References m_identifier.
bool Mantid::Geometry::SymmetryOperation::operator== | ( | const SymmetryOperation & | other | ) | const |
Returns true if matrix and vector are equal.
Definition at line 182 of file SymmetryOperation.cpp.
References m_matrixVectorPair.
Referenced by operator!=().
SymmetryOperation Mantid::Geometry::SymmetryOperation::operator^ | ( | size_t | exponent | ) | const |
Returns the symmetry operation, applied to itself (exponent) times.
Definition at line 161 of file SymmetryOperation.cpp.
References SymmetryOperation().
size_t Mantid::Geometry::SymmetryOperation::order | ( | ) | const |
Returns the order of the symmetry operation.
Definition at line 100 of file SymmetryOperation.cpp.
References m_order.
Referenced by Mantid::Geometry::SymmetryElementIdentityGenerator::canProcess(), Mantid::Geometry::SymmetryElementTranslationGenerator::canProcess(), Mantid::Geometry::SymmetryElementRotationGenerator::determineSymbol(), export_SymmetryOperation(), Mantid::Geometry::CyclicGroup::generateAllOperations(), and getReducedVector().
const V3R & Mantid::Geometry::SymmetryOperation::reducedVector | ( | ) | const |
SymmetryOperation::reducedVector.
According to ITA, 11.2, the translation component of a symmetry operation can be termined with the following algorithm. First, a matrix \(W\) is calculated using the symmetry operation \(S\) and its powers up to its order \(k\), adding the matrices of the resulting operations:
\[ W = W_1(S^0) + W_2(S^1) + \dots + W_k(S^{k-1}) \]
The translation vector is then calculation from the vector \(w\) of the operation:
\[ t = \frac{1}{k}\cdot (W \times w) \]
For operations which do not have translation components, this algorithm returns a 0-vector.
Definition at line 93 of file SymmetryOperation.cpp.
References m_reducedVector.
Referenced by Mantid::Geometry::SymmetryElementWithAxisGenerator::determineTranslation().
Kernel::V3D Mantid::Geometry::SymmetryOperation::transformHKL | ( | const Kernel::V3D & | hkl | ) | const |
Transforms an index triplet hkl.
Unlike coordinates, hkls are transformed using the inverse transformation matrix, as detailed in the footnote on ITA, page 766. This method performs the multiplication with the transposed matrix.
hkl | :: HKL index triplet to transform |
Definition at line 127 of file SymmetryOperation.cpp.
References m_transposedInverseMatrix.
Referenced by Mantid::MDAlgorithms::MDNorm::buildSymmetryMatrix(), and Mantid::MDAlgorithms::MDNorm::calQTransform().
const V3R & Mantid::Geometry::SymmetryOperation::vector | ( | ) | const |
Returns a const reference to the internall stored vector.
Definition at line 67 of file SymmetryOperation.cpp.
References m_matrixVectorPair.
Referenced by Mantid::Geometry::SymmetryElementTranslationGenerator::generateElement(), Mantid::Geometry::SymmetryElementInversionGenerator::generateElement(), getReducedVector(), Mantid::Geometry::getUnitCellIntervalOperation(), SymmetryOperation(), and Mantid::Geometry::GroupTransformation::transformOperation().
|
protected |
Definition at line 146 of file SymmetryOperation.h.
Referenced by identifier(), init(), operator<(), and SymmetryOperation().
|
protected |
Definition at line 148 of file SymmetryOperation.h.
Referenced by hasTranslation(), init(), inverse(), isIdentity(), matrix(), operator*(), operator==(), SymmetryOperation(), and vector().
|
protected |
Definition at line 143 of file SymmetryOperation.h.
|
protected |
Definition at line 145 of file SymmetryOperation.h.
Referenced by init(), and reducedVector().
|
protected |
Definition at line 144 of file SymmetryOperation.h.
Referenced by init(), and transformHKL().