Mantid
Loading...
Searching...
No Matches
CenteringGroup.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
9
10namespace Mantid::Geometry {
11
13CenteringGroup::CenteringGroup(const std::string &centeringSymbol) : Group(), m_type(), m_symbol() {
14 m_type = CenteringGroupCreator::Instance().getCenteringType(centeringSymbol);
15 m_symbol = centeringSymbol.substr(0, 1);
16
18}
19
23
26std::string CenteringGroup::getSymbol() const { return m_symbol; }
27
31 auto it = m_centeringSymbolMap.find(centeringSymbol);
32
33 if (it == m_centeringSymbolMap.end()) {
34 throw std::invalid_argument("Centering does not exist: " + centeringSymbol);
35 }
36
37 return it->second;
38}
39
42std::vector<SymmetryOperation>
44 switch (centeringType) {
46 return getPrimitive();
48 return getBodyCentered();
50 return getACentered();
52 return getBCentered();
54 return getCCentered();
56 return getFCentered();
58 return getRobvCentered();
60 return getRrevCentered();
61 default:
62 throw std::invalid_argument("Unknown centering type.");
63 }
64}
65
67std::vector<SymmetryOperation> CenteringGroupCreatorImpl::getPrimitive() const {
68 return SymmetryOperationFactory::Instance().createSymOps("x,y,z");
69}
70
72std::vector<SymmetryOperation> CenteringGroupCreatorImpl::getBodyCentered() const {
73 return SymmetryOperationFactory::Instance().createSymOps("x,y,z; x+1/2,y+1/2,z+1/2");
74}
75
77std::vector<SymmetryOperation> CenteringGroupCreatorImpl::getACentered() const {
78 return SymmetryOperationFactory::Instance().createSymOps("x,y,z; x,y+1/2,z+1/2");
79}
80
82std::vector<SymmetryOperation> CenteringGroupCreatorImpl::getBCentered() const {
83 return SymmetryOperationFactory::Instance().createSymOps("x,y,z; x+1/2,y,z+1/2");
84}
85
87std::vector<SymmetryOperation> CenteringGroupCreatorImpl::getCCentered() const {
88 return SymmetryOperationFactory::Instance().createSymOps("x,y,z; x+1/2,y+1/2,z");
89}
90
92std::vector<SymmetryOperation> CenteringGroupCreatorImpl::getFCentered() const {
93 return SymmetryOperationFactory::Instance().createSymOps("x,y,z; x,y+1/2,z+1/2; x+1/2,y,z+1/2; x+1/2,y+1/2,z");
94}
95
97std::vector<SymmetryOperation> CenteringGroupCreatorImpl::getRobvCentered() const {
98 return SymmetryOperationFactory::Instance().createSymOps("x,y,z; x+1/3,y+2/3,z+2/3; x+2/3,y+1/3,z+1/3");
99}
100
102std::vector<SymmetryOperation> CenteringGroupCreatorImpl::getRrevCentered() const {
103 return SymmetryOperationFactory::Instance().createSymOps("x,y,z; x+1/3,y+2/3,z+1/3; x+2/3,y+1/3,z+2/3");
104}
105
107 : m_centeringSymbolMap({{"P", CenteringGroup::P},
108 {"I", CenteringGroup::I},
109 {"A", CenteringGroup::A},
110 {"B", CenteringGroup::B},
111 {"C", CenteringGroup::C},
112 {"F", CenteringGroup::F},
114 {"Robv", CenteringGroup::Robv},
115 {"Rrev", CenteringGroup::Rrev}}) {}
116
117} // namespace Mantid::Geometry
std::vector< SymmetryOperation > getCCentered() const
Returns symmetry operations for C-centering.
std::vector< SymmetryOperation > getFCentered() const
Returns symmetry operations for F-centering.
std::vector< SymmetryOperation > getSymmetryOperations(CenteringGroup::CenteringType centeringType) const
Returns a vector of symmetry operations for the given centering type or throws std::invalid_argument ...
std::vector< SymmetryOperation > getBCentered() const
Returns symmetry operations for B-centering.
std::vector< SymmetryOperation > getPrimitive() const
Returns symmetry operations for P-centering.
std::map< std::string, CenteringGroup::CenteringType > m_centeringSymbolMap
std::vector< SymmetryOperation > getRobvCentered() const
Returns symmetry operations for R-centering, obverse setting.
std::vector< SymmetryOperation > getBodyCentered() const
Returns symmetry operations for I-centering.
CenteringGroup::CenteringType getCenteringType(const std::string &centeringSymbol) const
Returns centering type enum value if centering symbol exists, throws std::invalid_argument exception ...
std::vector< SymmetryOperation > getACentered() const
Returns symmetry operations for A-centering.
std::vector< SymmetryOperation > getRrevCentered() const
Returns symmetry operations for R-centering, reverse setting.
CenteringGroup(const std::string &centeringSymbol)
String-based constructor which accepts centering symbols such as P, I or F.
std::string getSymbol() const
Returns the centering symbol, does not distinguish between Rhombohedral obverse and reverse.
CenteringType getType() const
Returns the centering type of the group (distinguishes between Rhombohedral obverse and reverse).
The class Group represents a set of symmetry operations (or symmetry group).
Definition: Group.h:135
std::vector< SymmetryOperation > getSymmetryOperations() const
Returns a vector with all symmetry operations.
Definition: Group.cpp:40
void setSymmetryOperations(const std::vector< SymmetryOperation > &symmetryOperations)
Assigns symmetry operations, throws std::invalid_argument if vector is empty.
Definition: Group.cpp:165
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...