-
Notifications
You must be signed in to change notification settings - Fork 2
/
DeloneTypeList.cpp
291 lines (267 loc) · 14.7 KB
/
DeloneTypeList.cpp
1
2
3
4
5
6
7
8
9
10
11
12
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
#include "DeloneTypeList.h"
#include "LabeledSellaMatrices.h"
#include "MatG6.h"
#include "LRL_MaximaTools.h"
//#include "SanMatrix.h"
#include "LRL_inverse.h"
#include "SellaBuild.h"
#include <sstream>
#include <string>
static const std::vector<std::string> typelist{ "C1","C3","C5","R1","R3","T1","T2","T5","O1A","O1B","O2",/*"O3",*/"O4","O5","M1A","M1B","M2A"/*,"M2B"*//*,"M3"*/,"M4"/*,"A1","A2","A3"*/,"H4" };
std::vector<std::pair<std::string, std::string> > CreateBravaisTypeList() {
std::vector<std::pair<std::string, std::string> > v;
v.push_back(std::make_pair("C1", "cI"));
v.push_back(std::make_pair("C3", "cF"));
v.push_back(std::make_pair("C5", "cP"));
v.push_back(std::make_pair("R1", "rP"));
v.push_back(std::make_pair("R3", "rP"));
v.push_back(std::make_pair("T1", "tI"));
v.push_back(std::make_pair("T2", "tI"));
v.push_back(std::make_pair("T5", "tP"));
v.push_back(std::make_pair("O1A", "oF"));
v.push_back(std::make_pair("O1B", "oI"));
v.push_back(std::make_pair("O2", "oI"));
v.push_back(std::make_pair("O3", "oI"));
v.push_back(std::make_pair("O4", "oP"));
v.push_back(std::make_pair("O5", "oP"));
v.push_back(std::make_pair("M1A", "mC"));
v.push_back(std::make_pair("M1B", "mC"));
v.push_back(std::make_pair("M2A", "mC"));
v.push_back(std::make_pair("M2B", "mC"));
v.push_back(std::make_pair("M3", "mC"));
v.push_back(std::make_pair("M4", "mP"));
v.push_back(std::make_pair("A1", "aP"));
v.push_back(std::make_pair("A2", "aP"));
v.push_back(std::make_pair("A3", "aP"));
v.push_back(std::make_pair("H4", "hP"));
return v;
}
std::vector<std::pair<std::string, std::string> > CreateCharacterList() {
std::vector<std::pair<std::string, std::string> > v;
v.push_back(std::make_pair("C1", "rrr rrr"));
v.push_back(std::make_pair("C3", "rr0 rr0"));
v.push_back(std::make_pair("C5", "000 rrr"));
v.push_back(std::make_pair("R1", "rrr sss"));
v.push_back(std::make_pair("R3", "rr0 sr0"));
v.push_back(std::make_pair("T1", "rrs rrs"));
v.push_back(std::make_pair("T2", "rr0 rrs"));
v.push_back(std::make_pair("T5", "000 rrs"));
v.push_back(std::make_pair("O1A", "rrs rrt"));
v.push_back(std::make_pair("O1B", "rst rst"));
v.push_back(std::make_pair("O2", "rs0 srt"));
v.push_back(std::make_pair("O3", "rs0 rs0"));
v.push_back(std::make_pair("O4", "00r sst"));
v.push_back(std::make_pair("O5", "000 rst"));
v.push_back(std::make_pair("M1A", "rrs ttu"));
v.push_back(std::make_pair("M1B", "rst rsu"));
v.push_back(std::make_pair("M2A", "rs0 stu"));
v.push_back(std::make_pair("M2B", "rs0 rst"));
v.push_back(std::make_pair("M3", "rs0 ts0"));
v.push_back(std::make_pair("M4", "00r stu"));
v.push_back(std::make_pair("A1", "rst uvw"));
v.push_back(std::make_pair("A2", "rs0 tuv"));
v.push_back(std::make_pair("A3", "rs0 tu0"));
v.push_back(std::make_pair("H4", "00r rrs"));
return v;
}
std::vector<std::pair<std::string, std::string> > CreateE3CenteringMatrixList() {
std::vector<std::pair<std::string, std::string> > v;
v.push_back(std::make_pair("C1", "0 1 1 1 0 1 1 1 0"));
v.push_back(std::make_pair("C3", "1 1 0 -1 1 0 1 1 2"));
//v.push_back(std::make_pair("C5", "1 0 0 0 0 1 0 1 1"));
v.push_back(std::make_pair("C5", "1 0 0 0 1 0 0 0 1"));
v.push_back(std::make_pair("R1", "1 -1 0 0 1 -1 1 1 1"));
v.push_back(std::make_pair("R3", "1 0 0 0 0 1 1 3 2"));
v.push_back(std::make_pair("T1", "0 1 1 1 0 1 1 1 0"));
v.push_back(std::make_pair("T2", "1 0 0 0 1 0 1 1 2"));
v.push_back(std::make_pair("T5", "1 0 0 0 1 0 0 0 1"));
//v.push_back(std::make_pair("T5", "1 0 0 0 0 1 0 1 1"));
//v.push_back(std::make_pair("T5", "0 1 0 0 1 1 1 0 0"));
v.push_back(std::make_pair("O1A", "1 1 0 -1 1 0 1 1 2"));
v.push_back(std::make_pair("O1B", "0 1 1 1 0 1 1 1 0"));
v.push_back(std::make_pair("O2", "1 0 0 0 1 0 1 1 2"));
v.push_back(std::make_pair("O3", "0 1 1 1 0 1 1 1 0"));
//v.push_back(std::make_pair("O3", "1 0 0 0 1 0 1 1 2"));
//v.push_back(std::make_pair("O4", "2 1 0 0 1 0 0 0 1"));
v.push_back(std::make_pair("O4", "1 -1 0 1 1 0 0 0 1"));
v.push_back(std::make_pair("O5", "1 0 0 0 1 0 0 0 1"));
//v.push_back(std::make_pair("O5", "1 0 0 0 0 1 0 1 1"));
v.push_back(std::make_pair("M1A", "-1 -1 -1 1 -1 0 0 0 1"));
v.push_back(std::make_pair("M1B", "0 1 1 1 1 0 -1 0 -1"));
v.push_back(std::make_pair("M2A", "-1 -1 -2 0 1 0 1 0 0"));
v.push_back(std::make_pair("M2B", "0 1 1 1 1 0 -1 0 -1"));
//v.push_back(std::make_pair("M2B", "-1 -1 -1 1 -1 0 0 0 1"));
v.push_back(std::make_pair("M3", "-1 -1 -2 0 1 0 1 0 0"));
//v.push_back(std::make_pair("M3", "1 1 0 0 -1 -1 -1 0 -1"));
v.push_back(std::make_pair("M4", "1 0 0 0 1 0 0 0 1"));
v.push_back(std::make_pair("A1", "1 0 0 0 1 0 0 0 1"));
v.push_back(std::make_pair("A2", "1 0 0 0 1 0 0 0 1"));
v.push_back(std::make_pair("A3", "1 0 0 0 1 0 0 0 1"));
v.push_back(std::make_pair("H4", "1 0 0 0 1 0 0 0 1"));
return v;
}
std::vector<std::pair< std::string, std::vector<MatS6> > > CreateAllPrjs() {
std::vector<LabeledSellaMatrices> vprj = LabeledSellaMatrices::CreateAllPrjs();
std::vector<std::pair< std::string, std::vector<MatS6> > > v;
for (size_t i = 0; i < vprj.size(); ++i) {
v.push_back(std::make_pair(vprj[i].GetLabel(), vprj[i].GetMatrices()));
}return v;
}
std::vector<std::pair< std::string, std::vector<MatS6> > > CreateAllPerps() {
std::vector<LabeledSellaMatrices> vperp = LabeledSellaMatrices::CreateAllPerps();
std::vector<std::pair< std::string, std::vector<MatS6> > > v;
for (size_t i = 0; i < vperp.size(); ++i) {
v.push_back(std::make_pair(vperp[i].GetLabel(), vperp[i].GetMatrices()));
}return v;
}
std::vector<std::pair< std::string, std::vector<MatS6> > > CreateAllToCanaon() {
SellaBuild sb;
const std::vector<LabeledDeloneTypeMatrices> sbmap = sb.Build();
std::vector<std::pair< std::string, std::vector<MatS6> > > v;
for (std::vector<LabeledDeloneTypeMatrices>::const_iterator it= sbmap.begin(); it!= sbmap.end(); ++it ) {
LabeledDeloneTypeMatrices ldtm = *it;
const std::string label = ldtm.GetLabel();
v.push_back(std::make_pair(label, ldtm.GetTocanon(label)));
}
return v;
}
DeloneTypeList::DeloneTypeList()
{
static const std::vector<std::pair<std::string, std::string> > characters = CreateCharacterList();
static const std::vector<std::pair<std::string, std::string> > e3matrices = CreateE3CenteringMatrixList();
static const std::vector<std::pair<std::string, std::string> > bravaisLatticeTypes = CreateBravaisTypeList();
static const std::vector<std::pair<std::string, MatS6> > centeringMatrices = CreateListOfCenteringMatrices();
static const std::vector<std::pair<std::string, std::vector<MatS6> > > prj = CreateAllPrjs();
static const std::vector<std::pair<std::string, std::vector<MatS6> > > perp = CreateAllPerps();
static const std::vector<std::pair<std::string, std::vector<MatS6> > > toCanon = CreateAllToCanaon();
static std::vector<std::pair<std::string,MatricesForOneDeloneType> > matrices;
if (matrices.empty()) {
for (size_t i = 0; i < typelist.size(); ++i) {
matrices.push_back(
std::make_pair(typelist[i],
MatricesForOneDeloneType(
Getter(typelist[i], prj),
Getter(typelist[i], perp),
Getter(typelist[i], toCanon))));
}
}
for (size_t i=0; i< typelist.size(); ++i ) {
const DeloneType dt(typelist[i],
Getter(typelist[i], bravaisLatticeTypes),
Getter(typelist[i], characters),
Getter(typelist[i], e3matrices),
Getter(typelist[i], centeringMatrices),
Getter(typelist[i], matrices));
m_deloneTypes.push_back(dt);
//std::cout << dt << std::endl;
}
}
std::vector<double> DeloneTypeList::Make3dVector( const std::string& s) {
std::istringstream istr(s);
double d;
std::vector<double> v;
while (istr && !istr.eof()) {
istr >> d;
if (d == 0.0) d = 0.0;
v.push_back(d);
}
if (v.size() != 9) throw;
return v;
}
std::pair<std::string, MatS6 > DeloneTypeList::CreateCenteringMatrix(const std::string& lattice, const std::string& threespaceMatrix) {
return std::make_pair(lattice, MatS6::e3Tos6(Make3dVector(threespaceMatrix)));
}
std::vector<std::pair<std::string, MatS6> > DeloneTypeList::CreateListOfCenteringMatrices() {
std::vector<std::pair<std::string, MatS6> > v;
v.push_back(DeloneTypeList::CreateCenteringMatrix("C1", "0 1 1 1 0 1 1 1 0"));
v.push_back(DeloneTypeList::CreateCenteringMatrix("C3", "1 1 0 -1 1 0 1 1 2"));
//v.push_back(DeloneTypeList::CreateCenteringMatrix("C5", "1 0 0 0 0 1 0 1 1"));
v.push_back(DeloneTypeList::CreateCenteringMatrix("C5", "1 0 0 0 1 0 0 0 1"));
v.push_back(DeloneTypeList::CreateCenteringMatrix("R1", "1 -1 0 0 1 -1 1 1 1"));
v.push_back(DeloneTypeList::CreateCenteringMatrix("R3", "1 0 0 0 0 1 1 3 2"));
v.push_back(DeloneTypeList::CreateCenteringMatrix("T1", "0 1 1 1 0 1 1 1 0"));
v.push_back(DeloneTypeList::CreateCenteringMatrix("T2", "1 0 0 0 1 0 1 1 2"));
v.push_back(DeloneTypeList::CreateCenteringMatrix("T5", "1 0 0 0 1 0 0 0 1"));
//v.push_back(DeloneTypeList::CreateCenteringMatrix("T5", "1 0 0 0 0 1 0 1 1"));
//v.push_back(DeloneTypeList::CreateCenteringMatrix("T5", "0 1 0 0 1 1 1 0 0"));
v.push_back(DeloneTypeList::CreateCenteringMatrix("O1A", "1 1 0 -1 1 0 1 1 2"));
v.push_back(DeloneTypeList::CreateCenteringMatrix("O1B", "0 1 1 1 0 1 1 1 0"));
v.push_back(DeloneTypeList::CreateCenteringMatrix("O2", "1 0 0 0 1 0 1 1 2"));
v.push_back(DeloneTypeList::CreateCenteringMatrix("O3", "0 1 1 1 0 1 1 1 0"));
//v.push_back(DeloneTypeList::CreateCenteringMatrix("O3", "1 0 0 0 1 0 1 1 2"));
//v.push_back(DeloneTypeList::CreateCenteringMatrix("O4", "2 1 0 0 1 0 0 0 1"));
v.push_back(DeloneTypeList::CreateCenteringMatrix("O4", "1 -1 0 1 1 0 0 0 1"));
v.push_back(DeloneTypeList::CreateCenteringMatrix("O5", "1 0 0 0 1 0 0 0 1"));
//v.push_back(DeloneTypeList::CreateCenteringMatrix("O5", "1 0 0 0 0 1 0 1 1"));
v.push_back(DeloneTypeList::CreateCenteringMatrix("M1A", "-1 -1 -1 1 -1 0 0 0 1"));
v.push_back(DeloneTypeList::CreateCenteringMatrix("M1B", "0 1 1 1 1 0 -1 0 -1"));
v.push_back(DeloneTypeList::CreateCenteringMatrix("M2A", "-1 -1 -2 0 1 0 1 0 0"));
v.push_back(DeloneTypeList::CreateCenteringMatrix("M2B", "0 1 1 1 1 0 -1 0 -1"));
//v.push_back(DeloneTypeList::CreateCenteringMatrix("M2B", "-1 -1 -1 1 -1 0 0 0 1"));
v.push_back(DeloneTypeList::CreateCenteringMatrix("M3", "-1 -1 -2 0 1 0 1 0 0"));
//v.push_back(DeloneTypeList::CreateCenteringMatrix("M3", "1 1 0 0 -1 -1 -1 0 -1"));
v.push_back(DeloneTypeList::CreateCenteringMatrix("M4", "1 0 0 0 1 0 0 0 1"));
v.push_back(DeloneTypeList::CreateCenteringMatrix("A1", "1 0 0 0 1 0 0 0 1"));
v.push_back(DeloneTypeList::CreateCenteringMatrix("A2", "1 0 0 0 1 0 0 0 1"));
v.push_back(DeloneTypeList::CreateCenteringMatrix("A3", "1 0 0 0 1 0 0 0 1"));
v.push_back(DeloneTypeList::CreateCenteringMatrix("H4", "1 0 0 0 1 0 0 0 1"));
return v;
}
std::vector<std::pair<std::string,std::vector<double> > > DeloneTypeList::Make3dCenteringMatrices() {
std::vector<std::pair<std::string, std::vector<double> > > v;
v.push_back(std::make_pair("C1", Make3dVector("0 1 1 1 0 1 1 1 0")));
v.push_back(std::make_pair("C3", Make3dVector("1 1 0 -1 1 0 1 1 2")));
//v.push_back(std::make_pair("C5", Make3dVector("1 0 0 0 0 1 0 1 1")));
v.push_back(std::make_pair("C5", Make3dVector("1 0 0 0 1 0 0 0 1")));
v.push_back(std::make_pair("H4", Make3dVector("1 0 0 0 1 0 0 0 1")));
v.push_back(std::make_pair("R1", Make3dVector("1 -1 0 0 1 -1 1 1 1")));
v.push_back(std::make_pair("R3", Make3dVector("1 0 0 0 0 1 1 3 2")));
v.push_back(std::make_pair("T1", Make3dVector("0 1 1 1 0 1 1 1 0")));
v.push_back(std::make_pair("T2", Make3dVector("1 0 0 0 1 0 1 1 2")));
v.push_back(std::make_pair("T5", Make3dVector("1 0 0 0 1 0 0 0 1")));
//v.push_back(std::make_pair("T5", Make3dVector("1 0 0 0 0 1 0 1 1")));
//v.push_back(std::make_pair("T5", Make3dVector("0 1 0 0 1 1 1 0 0")));
v.push_back(std::make_pair("O1A", Make3dVector("1 1 0 -1 1 0 1 1 2")));
v.push_back(std::make_pair("O1B", Make3dVector("0 1 1 1 0 1 1 1 0")));
v.push_back(std::make_pair("O2", Make3dVector("1 0 0 0 1 0 1 1 2")));
v.push_back(std::make_pair("O3", Make3dVector("0 1 1 1 0 1 1 1 0")));
//v.push_back(std::make_pair("O3", Make3dVector("1 0 0 0 1 0 1 1 2")));
//v.push_back(std::make_pair("O4", Make3dVector("2 1 0 0 1 0 0 0 1")));
v.push_back(std::make_pair("O4", Make3dVector("1 -1 0 1 1 0 0 0 1")));
v.push_back(std::make_pair("O5", Make3dVector("1 0 0 0 1 0 0 0 1")));
//v.push_back(std::make_pair("O5", Make3dVector("1 0 0 0 0 1 0 1 1")));
v.push_back(std::make_pair("M1A", Make3dVector("-1 -1 -1 1 -1 0 0 0 1")));
v.push_back(std::make_pair("M1B", Make3dVector("0 1 1 1 1 0 -1 0 -1")));
v.push_back(std::make_pair("M2A", Make3dVector("-1 -1 -2 0 1 0 1 0 0")));
v.push_back(std::make_pair("M2B", Make3dVector("0 1 1 1 1 0 -1 0 -1"))); // ?????????????????????????
//v.push_back(std::make_pair("M2B", Make3dVector("-1 -1 -1 1 -1 0 0 0 1"))); // ?????????????????????????
v.push_back(std::make_pair("M3", Make3dVector("-1 -1 -2 0 1 0 1 0 0")));
//v.push_back(std::make_pair("M3", Make3dVector("1 1 0 0 -1 -1 -1 0 -1")));
v.push_back(std::make_pair("M4", Make3dVector("1 0 0 0 1 0 0 0 1")));
v.push_back(std::make_pair("A1", Make3dVector("1 0 0 0 1 0 0 0 1")));
v.push_back(std::make_pair("A2", Make3dVector("1 0 0 0 1 0 0 0 1")));
v.push_back(std::make_pair("A3", Make3dVector("1 0 0 0 1 0 0 0 1")));
return v;
}
DeloneType DeloneTypeList::operator[] (const size_t n) const {
return m_deloneTypes[n];
}
DeloneType DeloneTypeList::operator[] (const std::string& s) const {
for (size_t i = 0; i < m_deloneTypes.size(); ++i)
if (m_deloneTypes[i].GetName() == s) return m_deloneTypes[i];
return DeloneType();
}
std::vector<std::tuple<double, S6, MatS6> > DeloneTypeList::Fit( const std::string& type, const S6& s6 ) const {
std::vector<std::tuple<double, S6, MatS6> > v;
for (size_t i = 0; i < m_deloneTypes.size( ); ++i) {
const std::string name = m_deloneTypes[i].GetName( );
if (type.empty( ) || name.find( type ) != std::string::npos) { // LCA make type UC
const std::tuple<double, S6, MatS6> fit = m_deloneTypes[i].GetFit( s6 );
v.push_back( fit );
}
}
return v;
}
std::vector<std::tuple<double, S6, MatS6> > DeloneTypeList::Fit( const S6& s6 ) const {
return Fit( "", s6 );
}