Newer
Older
#ifndef MANTID_GEOMETRY_REFLECTIONCONDITION_H_
#define MANTID_GEOMETRY_REFLECTIONCONDITION_H_
Gigg, Martyn Anthony
committed
#include "MantidGeometry/DllConfig.h"
#ifndef Q_MOC_RUN
Janik Zikovsky
committed
#include <vector>
Gigg, Martyn Anthony
committed
#include <string>
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
namespace Mantid {
namespace Geometry {
/** A class containing the Reflection Condition for a crystal.
* e.g. Face-centered, etc.
* determining which HKL's are allows and which are not.
*
* @author Janik Zikovsky
* @date 2011-05-16 11:55:15.983855
*/
class MANTID_GEOMETRY_DLL ReflectionCondition {
public:
ReflectionCondition() {}
virtual ~ReflectionCondition() {}
/// Name of the reflection condition
virtual std::string getName() = 0;
/// Symbol of the associated lattice centering.
virtual std::string getSymbol() = 0;
/// Return true if the hkl is allowed.
virtual bool isAllowed(int h, int k, int l) = 0;
};
//------------------------------------------------------------------------
/** Primitive ReflectionCondition */
class MANTID_GEOMETRY_DLL ReflectionConditionPrimitive
: public ReflectionCondition {
public:
/// Name of the reflection condition
virtual std::string getName() { return "Primitive"; }
/// Symbol of the associated lattice centering.
virtual std::string getSymbol() { return "P"; }
/// Return true if the hkl is allowed.
virtual bool isAllowed(int /*h*/, int /*k*/, int /*l*/) { return true; }
};
//------------------------------------------------------------------------
/** C-face centred ReflectionCondition */
class MANTID_GEOMETRY_DLL ReflectionConditionCFaceCentred
: public ReflectionCondition {
public:
/// Name of the reflection condition
virtual std::string getName() { return "C-face centred"; }
/// Symbol of the associated lattice centering.
virtual std::string getSymbol() { return "C"; }
/// Return true if the hkl is allowed.
virtual bool isAllowed(int h, int k, int /*l*/) {
return (((h + k) % 2) == 0);
}
};
//------------------------------------------------------------------------
/** A-face centred ReflectionCondition */
class MANTID_GEOMETRY_DLL ReflectionConditionAFaceCentred
: public ReflectionCondition {
public:
/// Name of the reflection condition
virtual std::string getName() { return "A-face centred"; }
/// Symbol of the associated lattice centering.
virtual std::string getSymbol() { return "A"; }
/// Return true if the hkl is allowed.
virtual bool isAllowed(int /*h*/, int k, int l) {
return (((k + l) % 2) == 0);
}
};
//------------------------------------------------------------------------
/** B-face centred ReflectionCondition */
class MANTID_GEOMETRY_DLL ReflectionConditionBFaceCentred
: public ReflectionCondition {
public:
/// Name of the reflection condition
virtual std::string getName() { return "B-face centred"; }
/// Symbol of the associated lattice centering.
virtual std::string getSymbol() { return "B"; }
/// Return true if the hkl is allowed.
virtual bool isAllowed(int h, int /*k*/, int l) {
return (((h + l) % 2) == 0);
}
};
//------------------------------------------------------------------------
/** Body centred ReflectionCondition */
class MANTID_GEOMETRY_DLL ReflectionConditionBodyCentred
: public ReflectionCondition {
public:
/// Name of the reflection condition
virtual std::string getName() { return "Body centred"; }
/// Symbol of the associated lattice centering.
virtual std::string getSymbol() { return "I"; }
/// Return true if the hkl is allowed.
virtual bool isAllowed(int h, int k, int l) { return ((h + k + l) % 2) == 0; }
};
//------------------------------------------------------------------------
/** All-face centred ReflectionCondition */
class MANTID_GEOMETRY_DLL ReflectionConditionAllFaceCentred
: public ReflectionCondition {
public:
/// Name of the reflection condition
virtual std::string getName() { return "All-face centred"; }
/// Symbol of the associated lattice centering.
virtual std::string getSymbol() { return "F"; }
/// Return true if the hkl is allowed.
virtual bool isAllowed(int h, int k, int l) {
return (
((((h + k) % 2) == 0) && (((h + l) % 2) == 0) && (((k + l) % 2) == 0)) |
((h % 2 == 0) && (k % 2 == 0) && (l % 2 == 0)) ||
((h % 2 == 1) && (k % 2 == 1) && (l % 2 == 1)));
}
};
//------------------------------------------------------------------------
/** Rhombohedrally centred, obverse ReflectionCondition*/
class MANTID_GEOMETRY_DLL ReflectionConditionRhombohedrallyObverse
: public ReflectionCondition {
public:
/// Name of the reflection condition
virtual std::string getName() { return "Rhombohedrally centred, obverse"; }
/// Symbol of the associated lattice centering.
virtual std::string getSymbol() { return "Robv"; }
/// Return true if the hkl is allowed.
virtual bool isAllowed(int h, int k, int l) {
return (((-h + k + l) % 3) == 0);
}
};
//------------------------------------------------------------------------
/** Rhombohedrally centred, reverse ReflectionCondition*/
class MANTID_GEOMETRY_DLL ReflectionConditionRhombohedrallyReverse
: public ReflectionCondition {
public:
/// Name of the reflection condition
virtual std::string getName() { return "Rhombohedrally centred, reverse"; }
/// Symbol of the associated lattice centering.
virtual std::string getSymbol() { return "Rrev"; }
/// Return true if the hkl is allowed.
virtual bool isAllowed(int h, int k, int l) {
return (((h - k + l) % 3) == 0);
}
};
//------------------------------------------------------------------------
/** Hexagonally centred, reverse ReflectionCondition*/
class MANTID_GEOMETRY_DLL ReflectionConditionHexagonallyReverse
: public ReflectionCondition {
public:
/// Name of the reflection condition
virtual std::string getName() { return "Hexagonally centred, reverse"; }
/// Symbol of the associated lattice centering.
virtual std::string getSymbol() { return "H"; }
/// Return true if the hkl is allowed.
virtual bool isAllowed(int h, int k, int /*l*/) {
return (((h - k) % 3) == 0);
}
};
/// Shared pointer to a ReflectionCondition
typedef boost::shared_ptr<ReflectionCondition> ReflectionCondition_sptr;
MANTID_GEOMETRY_DLL std::vector<ReflectionCondition_sptr>
getAllReflectionConditions();
Janik Zikovsky
committed
} // namespace Mantid
} // namespace Geometry
#endif /* MANTID_GEOMETRY_REFLECTIONCONDITION_H_ */