Mantid
|
The class Group represents a set of symmetry operations (or symmetry group). More...
#include <Group.h>
Public Types | |
enum | CoordinateSystem { Orthogonal , Hexagonal } |
enum | GroupAxiom { Closure , Identity , Inversion , Associativity } |
Public Member Functions | |
bool | containsOperation (const SymmetryOperation &operation) const |
Returns true if the group contains the supplied operation. More... | |
bool | fulfillsAxiom (GroupAxiom axiom) const |
Checks whether a certain group axiom is fulfilled, can be used as a more fine-grained alternative to isGroup(). More... | |
CoordinateSystem | getCoordinateSystem () const |
Returns the axis system of the group (either orthogonal or hexagonal). More... | |
std::vector< SymmetryOperation > | getSymmetryOperations () const |
Returns a vector with all symmetry operations. More... | |
Group () | |
Default constructor. Creates a group with one symmetry operation (identity). More... | |
Group (const std::string &symmetryOperationString) | |
Uses SymmetryOperationFactory to create a vector of symmetry operations from the string. More... | |
Group (const std::vector< SymmetryOperation > &symmetryOperations) | |
Constructs a group from the symmetry operations in the vector, duplicates are removed. More... | |
bool | isGroup () const |
Returns whether the group fulfills the four group axioms. More... | |
bool | isInvariant (const Kernel::DblMatrix &tensor, double tolerance=1e-8) const |
Returns true if the tensor is invariant under the group operations. More... | |
bool | operator!= (const Group &other) const |
Returns true if groups are different from eachother. More... | |
Group | operator* (const Group &other) const |
Multiplication operator of two groups. More... | |
std::vector< Kernel::V3D > | operator* (const Kernel::V3D &vector) const |
Returns a unique set of Kernel::V3D resulting from applying all symmetry operations, vectors are wrapped to [0, 1). More... | |
bool | operator== (const Group &other) const |
Returns true if both groups contain the same set of symmetry operations. More... | |
size_t | order () const |
Returns the order of the group, which is the number of symmetry operations. More... | |
virtual | ~Group ()=default |
Protected Member Functions | |
bool | associativityHolds () const |
Checks that associativity holds, i.e. More... | |
bool | eachElementHasInverse () const |
Returns true if the inverse of each element is in the group. More... | |
CoordinateSystem | getCoordinateSystemFromOperations (const std::vector< SymmetryOperation > &symmetryOperations) const |
Returns the axis system based on the given symmetry operations. More... | |
bool | hasIdentity () const |
Returns true if the group has the identity element. More... | |
bool | isClosed () const |
Returns true if the group is closed, i.e. all elements of G * G are in G. More... | |
void | setSymmetryOperations (const std::vector< SymmetryOperation > &symmetryOperations) |
Assigns symmetry operations, throws std::invalid_argument if vector is empty. More... | |
Protected Attributes | |
std::vector< SymmetryOperation > | m_allOperations |
CoordinateSystem | m_axisSystem |
std::set< SymmetryOperation > | m_operationSet |
The class Group represents a set of symmetry operations (or symmetry group).
It can be constructed by providing a vector of the symmetry operations it consists of. Another possibility is using a string (see SymmetryOperationFactory for format).
Upon construction of Group, the vector of symmetry operations is potentially reduced to a set of unique operations, because each operation may occur only once.
The number of symmetry operations in the group determines its so-called order, it can be queried with the member function Group::order(). If one needs to process the symmetry operation themselves, they can be obtained by Group::getSymmetryOperations().
A common task is to apply all symmetry operations of a group to a point (given in the form of a Kernel::V3D-object). The multiplication operator for carrying out this operation has been overloaded to perform this task:
vector<V3D> coordinates = Group * V3D
Please note that a set of unique coordinates is produced, which means that the number of coordinates in the vector may be smaller than the order of the group, depending on the input. This is because the components of V3D are mapped onto the interval [0, 1).
Two groups A and B can be combined by a multiplication operation, provided by the corresponding overloaded operator:
Group A, B; Group C = A * B
In this operation each element of A is multiplied with each element of B and from the resulting list a new group is constructed. For better illustration, an example is provided. Group A has two symmetry operations: identity ("x,y,z") and inversion ("-x,-y,-z"). Group B also consists of two operations: identity ("x,y,z") and a rotation around the y-axis ("-x,y,-z"). In terms of symmetry elements, the groups are defined like so:
A := { 1, -1 }; B := { 1, 2 [010] }
The following table shows all multiplications that are carried out and their results (for multiplication of symmetry operations see SymmetryOperation)
| x,y,z | -x,-y,-z -------- | ---------- | ----------- x,y,z | x,y,z | -x,-y,-z -x,y,-z | -x,y,-z | x,-y,z
The resulting group contains the three elements of A and B (1, -1, 2 [010]), but also one new element that is the result of multiplying "x,y,z" and "-x,y,-z", which is "x,-y,z" - the operation resulting from a mirror plane perpendicular to the y-axis. In fact, this example demonstrated how the combination of two crystallographic point groups (see PointGroup documentation and wiki) "-1" and "2" results in a new point group "2/m".
Most of the time it's not required to use Group directly, there are several sub-classes that implement different behavior (CenteringGroup, CyclicGroup, ProductOfCyclicGroups) and are easier to handle. For construction there is a simple "factory function", that works for all Group-based classes which provide a string-based constructor:
Group_const_sptr group = GroupFactory::create<CyclicGroup>("-x,-y,-z");
However, the most useful sub-class is SpaceGroup, which comes with its own factory. For detailed information about the respective sub-classes, please consult their documentation.
Mantid::Geometry::Group::Group | ( | ) |
Default constructor. Creates a group with one symmetry operation (identity).
Definition at line 15 of file Group.cpp.
References setSymmetryOperations().
Mantid::Geometry::Group::Group | ( | const std::string & | symmetryOperationString | ) |
Uses SymmetryOperationFactory to create a vector of symmetry operations from the string.
Definition at line 22 of file Group.cpp.
References Mantid::Kernel::SingletonHolder< T >::Instance(), and setSymmetryOperations().
Mantid::Geometry::Group::Group | ( | const std::vector< SymmetryOperation > & | symmetryOperations | ) |
Constructs a group from the symmetry operations in the vector, duplicates are removed.
Definition at line 28 of file Group.cpp.
References setSymmetryOperations().
|
virtualdefault |
References std::operator!=(), Mantid::API::operator*(), and std::operator==().
|
protected |
Checks that associativity holds, i.e.
(a*b)*c == a*(b*c)
In fact, this method returns always true, because associativity is implicitly contained in the definition of the binary operator of SymmetryOperation:
(S1 * S2) * S3 = (W1*W2, W1*w2 + w1) * S3 = (W1*W2*W3, W1*W2*w3 + W1*w2 + w1) S1 * (S2 * S3) = S1 * (W2*W3, W2*w3 + w2) = (W1*W2*W3, W1*W2*w3 + W1*w2 + w1)
No matter what symmetry operations are chosen, this always holds. However, for completeness the method has been added anyway.
Definition at line 244 of file Group.cpp.
Referenced by fulfillsAxiom(), and isGroup().
bool Mantid::Geometry::Group::containsOperation | ( | const SymmetryOperation & | operation | ) | const |
Returns true if the group contains the supplied operation.
Definition at line 43 of file Group.cpp.
References m_allOperations.
Referenced by export_Group(), and hasIdentity().
|
protected |
Returns true if the inverse of each element is in the group.
Definition at line 219 of file Group.cpp.
References m_allOperations.
Referenced by fulfillsAxiom(), and isGroup().
bool Mantid::Geometry::Group::fulfillsAxiom | ( | GroupAxiom | axiom | ) | const |
Checks whether a certain group axiom is fulfilled, can be used as a more fine-grained alternative to isGroup().
Definition at line 135 of file Group.cpp.
References Associativity, associativityHolds(), Closure, eachElementHasInverse(), hasIdentity(), Identity, Inversion, and isClosed().
Referenced by export_Group().
Group::CoordinateSystem Mantid::Geometry::Group::getCoordinateSystem | ( | ) | const |
Returns the axis system of the group (either orthogonal or hexagonal).
Definition at line 37 of file Group.cpp.
References m_axisSystem.
Referenced by Mantid::Geometry::PointGroupFactoryImpl::createPointGroupFromSpaceGroup(), export_Group(), and Mantid::Geometry::PointGroup::getLatticeSystemFromCrystalSystemAndGroup().
|
protected |
Returns the axis system based on the given symmetry operations.
Hexagonal systems have 4 non-zero elements in the matrix, orthogonal have 6.
Definition at line 181 of file Group.cpp.
References Hexagonal, and Orthogonal.
Referenced by setSymmetryOperations().
std::vector< SymmetryOperation > Mantid::Geometry::Group::getSymmetryOperations | ( | ) | const |
Returns a vector with all symmetry operations.
Definition at line 40 of file Group.cpp.
References m_allOperations.
Referenced by Mantid::Geometry::CenteringGroup::CenteringGroup(), export_Group(), and isClosed().
|
protected |
Returns true if the group has the identity element.
Definition at line 213 of file Group.cpp.
References containsOperation().
Referenced by fulfillsAxiom(), and isGroup().
|
protected |
Returns true if the group is closed, i.e. all elements of G * G are in G.
Definition at line 193 of file Group.cpp.
References getSymmetryOperations(), m_allOperations, and order().
Referenced by fulfillsAxiom(), and isGroup().
bool Mantid::Geometry::Group::isGroup | ( | ) | const |
Returns whether the group fulfills the four group axioms.
When a Group is constructed from a list of symmetry operations, no checks are performed whether this set of operations fulfills the four group axioms, i.e. whether it is a group at all. If you are not sure whether a set of symmetry operations is a group, construct one and look at the return value of this method.
Definition at line 161 of file Group.cpp.
References associativityHolds(), eachElementHasInverse(), hasIdentity(), and isClosed().
Referenced by export_Group().
bool Mantid::Geometry::Group::isInvariant | ( | const Kernel::DblMatrix & | tensor, |
double | tolerance = 1e-8 |
||
) | const |
Returns true if the tensor is invariant under the group operations.
This method returns true if the supplied tensor is not changed by the group's symmetry operations. This is done by applying eq. 10 from [1],
G_i = W_i' * G * W_i
where G is the tensor and W_i is the matrix of the i-th symmetry operation. If G_i == G holds for all i, the tensor is invariant with respect to the groups symmetry operations. To allow for floating point errors, a tolerance can be specified.
One application of this method is to check whether a unit cell is compatible with the symmetry operations of a space group:
UnitCell cell(5, 5, 10); SpaceGroup_const_sptr sg = SpaceGroupFactory::Instance() .createSpaceGroup("F m -3 m");
// returns false: sg->isTensorInvariant(cell.getG());
This is expected, because the cell with a different length for c is not compatible with the restrictions imposed by cubic symmetry.
[1] G. Rigault, Metric tensor and symmetry operations in crystallography, http://www.iucr.org/education/pamphlets/10
tensor | :: Tensor to check. |
tolerance | :: Tolerance for comparison of tensor equality. |
Definition at line 117 of file Group.cpp.
References m_allOperations, and Mantid::Kernel::Matrix< T >::Tprime().
Referenced by Mantid::Geometry::SpaceGroup::isAllowedUnitCell().
bool Mantid::Geometry::Group::operator!= | ( | const Group & | other | ) | const |
Returns true if groups are different from eachother.
Definition at line 131 of file Group.cpp.
References operator==().
Multiplication operator of two groups.
Multiplies each element of this group with each element of the other group, as described in the class documentation.
other | :: A group. |
Definition at line 56 of file Group.cpp.
References m_allOperations, and order().
std::vector< Kernel::V3D > Mantid::Geometry::Group::operator* | ( | const Kernel::V3D & | vector | ) | const |
Returns a unique set of Kernel::V3D resulting from applying all symmetry operations, vectors are wrapped to [0, 1).
Definition at line 72 of file Group.cpp.
References m_allOperations.
bool Mantid::Geometry::Group::operator== | ( | const Group & | other | ) | const |
Returns true if both groups contain the same set of symmetry operations.
Definition at line 128 of file Group.cpp.
References m_operationSet.
Referenced by operator!=().
size_t Mantid::Geometry::Group::order | ( | ) | const |
Returns the order of the group, which is the number of symmetry operations.
Definition at line 34 of file Group.cpp.
References m_allOperations.
Referenced by export_Group(), isClosed(), and operator*().
|
protected |
Assigns symmetry operations, throws std::invalid_argument if vector is empty.
Definition at line 165 of file Group.cpp.
References getCoordinateSystemFromOperations(), Mantid::Geometry::getUnitCellIntervalOperation(), m_allOperations, m_axisSystem, and m_operationSet.
Referenced by Mantid::Geometry::CenteringGroup::CenteringGroup(), and Group().
|
protected |
Definition at line 173 of file Group.h.
Referenced by containsOperation(), eachElementHasInverse(), Mantid::Geometry::PointGroup::getAllEquivalents(), Mantid::Geometry::PointGroup::getCrystalSystemFromGroup(), Mantid::Geometry::SpaceGroup::getSiteSymmetryGroup(), getSymmetryOperations(), Mantid::Geometry::SpaceGroup::isAllowedReflection(), isClosed(), isInvariant(), operator*(), order(), and setSymmetryOperations().
|
protected |
Definition at line 175 of file Group.h.
Referenced by getCoordinateSystem(), and setSymmetryOperations().
|
protected |
Definition at line 174 of file Group.h.
Referenced by operator==(), and setSymmetryOperations().