symcrys 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/README.md +11 -2
  2. package/dist/cell.d.ts +5 -2
  3. package/dist/cell.d.ts.map +1 -1
  4. package/dist/cell.js +7 -7
  5. package/dist/cell.js.map +1 -1
  6. package/dist/crystalClasses.d.ts +13 -8
  7. package/dist/crystalClasses.d.ts.map +1 -1
  8. package/dist/crystalClasses.js +13 -8
  9. package/dist/crystalClasses.js.map +1 -1
  10. package/dist/indices.d.ts +3 -1
  11. package/dist/indices.d.ts.map +1 -1
  12. package/dist/indices.js +6 -2
  13. package/dist/indices.js.map +1 -1
  14. package/dist/linalg.d.ts +7 -1
  15. package/dist/linalg.d.ts.map +1 -1
  16. package/dist/linalg.js +20 -3
  17. package/dist/linalg.js.map +1 -1
  18. package/dist/operations.d.ts +6 -0
  19. package/dist/operations.d.ts.map +1 -1
  20. package/dist/operations.js +19 -0
  21. package/dist/operations.js.map +1 -1
  22. package/dist/plane.d.ts +225 -0
  23. package/dist/plane.d.ts.map +1 -0
  24. package/dist/plane.js +219 -0
  25. package/dist/plane.js.map +1 -0
  26. package/dist/pointGroups/identify.d.ts +4 -2
  27. package/dist/pointGroups/identify.d.ts.map +1 -1
  28. package/dist/pointGroups/identify.js +5 -18
  29. package/dist/pointGroups/identify.js.map +1 -1
  30. package/dist/pointGroups/orbits.d.ts +1 -1
  31. package/dist/pointGroups/orbits.d.ts.map +1 -1
  32. package/dist/pointGroups/orbits.js +3 -3
  33. package/dist/pointGroups/orbits.js.map +1 -1
  34. package/dist/pointGroups/properties.d.ts +6 -2
  35. package/dist/pointGroups/properties.d.ts.map +1 -1
  36. package/dist/pointGroups/properties.js +6 -2
  37. package/dist/pointGroups/properties.js.map +1 -1
  38. package/dist/siteSymmetry.d.ts +5 -3
  39. package/dist/siteSymmetry.d.ts.map +1 -1
  40. package/dist/siteSymmetry.js +6 -2
  41. package/dist/siteSymmetry.js.map +1 -1
  42. package/dist/spaceGroups/affine.d.ts +81 -0
  43. package/dist/spaceGroups/affine.d.ts.map +1 -0
  44. package/dist/spaceGroups/affine.js +245 -0
  45. package/dist/spaceGroups/affine.js.map +1 -0
  46. package/dist/spaceGroups/cell.d.ts +58 -0
  47. package/dist/spaceGroups/cell.d.ts.map +1 -0
  48. package/dist/spaceGroups/cell.js +297 -0
  49. package/dist/spaceGroups/cell.js.map +1 -0
  50. package/dist/spaceGroups/describe.d.ts +44 -0
  51. package/dist/spaceGroups/describe.d.ts.map +1 -0
  52. package/dist/spaceGroups/describe.js +92 -0
  53. package/dist/spaceGroups/describe.js.map +1 -0
  54. package/dist/spaceGroups/planeGroupData.d.ts +44 -0
  55. package/dist/spaceGroups/planeGroupData.d.ts.map +1 -0
  56. package/dist/spaceGroups/planeGroupData.js +371 -0
  57. package/dist/spaceGroups/planeGroupData.js.map +1 -0
  58. package/dist/spaceGroups/planeGroups.d.ts +28 -0
  59. package/dist/spaceGroups/planeGroups.d.ts.map +1 -0
  60. package/dist/spaceGroups/planeGroups.js +61 -0
  61. package/dist/spaceGroups/planeGroups.js.map +1 -0
  62. package/dist/spaceGroups/planePointGroups.d.ts +31 -0
  63. package/dist/spaceGroups/planePointGroups.d.ts.map +1 -0
  64. package/dist/spaceGroups/planePointGroups.js +77 -0
  65. package/dist/spaceGroups/planePointGroups.js.map +1 -0
  66. package/dist/spaceGroups/positions.d.ts +65 -0
  67. package/dist/spaceGroups/positions.d.ts.map +1 -0
  68. package/dist/spaceGroups/positions.js +183 -0
  69. package/dist/spaceGroups/positions.js.map +1 -0
  70. package/dist/spaceGroups/rational.d.ts +43 -0
  71. package/dist/spaceGroups/rational.d.ts.map +1 -0
  72. package/dist/spaceGroups/rational.js +95 -0
  73. package/dist/spaceGroups/rational.js.map +1 -0
  74. package/dist/tensors/tensorForm.d.ts +3 -1
  75. package/dist/tensors/tensorForm.d.ts.map +1 -1
  76. package/dist/tensors/tensorForm.js +3 -1
  77. package/dist/tensors/tensorForm.js.map +1 -1
  78. package/dist/tensors/tensorProperties.d.ts +4 -2
  79. package/dist/tensors/tensorProperties.d.ts.map +1 -1
  80. package/dist/tensors/tensorProperties.js +4 -2
  81. package/dist/tensors/tensorProperties.js.map +1 -1
  82. package/dist/version.d.ts +1 -1
  83. package/dist/version.js +1 -1
  84. package/package.json +7 -2
  85. package/src/cell.ts +9 -8
  86. package/src/crystalClasses.ts +13 -8
  87. package/src/indices.ts +5 -2
  88. package/src/linalg.ts +21 -2
  89. package/src/operations.ts +20 -0
  90. package/src/plane.ts +455 -0
  91. package/src/pointGroups/identify.ts +5 -19
  92. package/src/pointGroups/orbits.ts +3 -3
  93. package/src/pointGroups/properties.ts +6 -2
  94. package/src/siteSymmetry.ts +6 -3
  95. package/src/spaceGroups/affine.ts +315 -0
  96. package/src/spaceGroups/cell.ts +371 -0
  97. package/src/spaceGroups/describe.ts +133 -0
  98. package/src/spaceGroups/planeGroupData.ts +407 -0
  99. package/src/spaceGroups/planeGroups.ts +75 -0
  100. package/src/spaceGroups/planePointGroups.ts +90 -0
  101. package/src/spaceGroups/positions.ts +237 -0
  102. package/src/spaceGroups/rational.ts +115 -0
  103. package/src/tensors/tensorForm.ts +3 -1
  104. package/src/tensors/tensorProperties.ts +4 -2
  105. package/src/version.ts +1 -1
@@ -0,0 +1,407 @@
1
+ /**
2
+ * The 17 plane groups as ITA prints them (6th ed., 2016, Chapter 2.2, pp. 176–192, plane group n on
3
+ * p. 175 + n). The same data are in references/itc/vol-a-2016-plane-groups.md, which the reference
4
+ * test re-parses and compares with this file; change both only by transcription from print.
5
+ *
6
+ * Notation as in the transcription: a leading `-` is an overbar; coordinates in the lattice basis
7
+ * a, b; `<=` for ≤. The oriented site-symmetry symbols without the spaces of the print.
8
+ */
9
+
10
+ /** A crystal system of the plane, as ITA names it. */
11
+ export type PlaneSystem = 'oblique' | 'rectangular' | 'square' | 'hexagonal';
12
+
13
+ /** [multiplicity, Wyckoff letter, oriented site symmetry, coordinates of the (0,0)+ set]. */
14
+ export type PlaneWyckoffRow = readonly [number, string, string, readonly string[]];
15
+
16
+ /** One plane group as printed. */
17
+ export interface PlaneGroupEntry {
18
+ /** Number of the plane group, 1 to 17. */
19
+ readonly number: number;
20
+ /** Short Hermann–Mauguin symbol, e.g. `p2mg`. */
21
+ readonly symbol: string;
22
+ /** Full Hermann–Mauguin symbol, e.g. `p1m1`. */
23
+ readonly fullSymbol: string;
24
+ /** The plane point group, e.g. `2mm`. */
25
+ readonly pointGroup: string;
26
+ /** The crystal system. */
27
+ readonly system: PlaneSystem;
28
+ /** Printed page. */
29
+ readonly page: number;
30
+ /** The block "Origin" as printed, e.g. `at 21g`. */
31
+ readonly origin: string;
32
+ /** The block "Asymmetric unit" as printed. */
33
+ readonly asymmetricUnit: string;
34
+ /** The vertices of the asymmetric unit, where printed (hexagonal groups). */
35
+ readonly vertices?: readonly string[];
36
+ /** Centring translations besides (0,0): `['1/2,1/2']` for the c groups. */
37
+ readonly centring: readonly string[];
38
+ /** The general position, (0,0)+ set, in ITA's numbering. */
39
+ readonly generalPosition: readonly string[];
40
+ /** "Generators selected": numbers in the general position, after (1) and the integer translations (and the centring). */
41
+ readonly generators: readonly number[];
42
+ /** The Wyckoff positions in printed order, general position first. */
43
+ readonly wyckoff: readonly PlaneWyckoffRow[];
44
+ }
45
+
46
+ /** The 17 plane groups in ITA's order. */
47
+ export const PLANE_GROUP_DATA: readonly PlaneGroupEntry[] = [
48
+ {
49
+ number: 1,
50
+ symbol: 'p1',
51
+ fullSymbol: 'p1',
52
+ pointGroup: '1',
53
+ system: 'oblique',
54
+ page: 176,
55
+ origin: 'arbitrary',
56
+ asymmetricUnit: '0 <= x <= 1; 0 <= y <= 1',
57
+ centring: [],
58
+ generalPosition: ['x,y'],
59
+ generators: [],
60
+ wyckoff: [[1, 'a', '1', ['x,y']]],
61
+ },
62
+ {
63
+ number: 2,
64
+ symbol: 'p2',
65
+ fullSymbol: 'p2',
66
+ pointGroup: '2',
67
+ system: 'oblique',
68
+ page: 177,
69
+ origin: 'at 2',
70
+ asymmetricUnit: '0 <= x <= 1/2; 0 <= y <= 1',
71
+ centring: [],
72
+ generalPosition: ['x,y', '-x,-y'],
73
+ generators: [2],
74
+ wyckoff: [
75
+ [2, 'e', '1', ['x,y', '-x,-y']],
76
+ [1, 'd', '2', ['1/2,1/2']],
77
+ [1, 'c', '2', ['1/2,0']],
78
+ [1, 'b', '2', ['0,1/2']],
79
+ [1, 'a', '2', ['0,0']],
80
+ ],
81
+ },
82
+ {
83
+ number: 3,
84
+ symbol: 'pm',
85
+ fullSymbol: 'p1m1',
86
+ pointGroup: 'm',
87
+ system: 'rectangular',
88
+ page: 178,
89
+ origin: 'on m',
90
+ asymmetricUnit: '0 <= x <= 1/2; 0 <= y <= 1',
91
+ centring: [],
92
+ generalPosition: ['x,y', '-x,y'],
93
+ generators: [2],
94
+ wyckoff: [
95
+ [2, 'c', '1', ['x,y', '-x,y']],
96
+ [1, 'b', '.m.', ['1/2,y']],
97
+ [1, 'a', '.m.', ['0,y']],
98
+ ],
99
+ },
100
+ {
101
+ number: 4,
102
+ symbol: 'pg',
103
+ fullSymbol: 'p1g1',
104
+ pointGroup: 'm',
105
+ system: 'rectangular',
106
+ page: 179,
107
+ origin: 'on g',
108
+ asymmetricUnit: '0 <= x <= 1/2; 0 <= y <= 1',
109
+ centring: [],
110
+ generalPosition: ['x,y', '-x,y+1/2'],
111
+ generators: [2],
112
+ wyckoff: [[2, 'a', '1', ['x,y', '-x,y+1/2']]],
113
+ },
114
+ {
115
+ number: 5,
116
+ symbol: 'cm',
117
+ fullSymbol: 'c1m1',
118
+ pointGroup: 'm',
119
+ system: 'rectangular',
120
+ page: 180,
121
+ origin: 'on m',
122
+ asymmetricUnit: '0 <= x <= 1/2; 0 <= y <= 1/2',
123
+ centring: ['1/2,1/2'],
124
+ generalPosition: ['x,y', '-x,y'],
125
+ generators: [2],
126
+ wyckoff: [
127
+ [4, 'b', '1', ['x,y', '-x,y']],
128
+ [2, 'a', '.m.', ['0,y']],
129
+ ],
130
+ },
131
+ {
132
+ number: 6,
133
+ symbol: 'p2mm',
134
+ fullSymbol: 'p2mm',
135
+ pointGroup: '2mm',
136
+ system: 'rectangular',
137
+ page: 181,
138
+ origin: 'at 2mm',
139
+ asymmetricUnit: '0 <= x <= 1/2; 0 <= y <= 1/2',
140
+ centring: [],
141
+ generalPosition: ['x,y', '-x,-y', '-x,y', 'x,-y'],
142
+ generators: [2, 3],
143
+ wyckoff: [
144
+ [4, 'i', '1', ['x,y', '-x,-y', '-x,y', 'x,-y']],
145
+ [2, 'h', '.m.', ['1/2,y', '1/2,-y']],
146
+ [2, 'g', '.m.', ['0,y', '0,-y']],
147
+ [2, 'f', '..m', ['x,1/2', '-x,1/2']],
148
+ [2, 'e', '..m', ['x,0', '-x,0']],
149
+ [1, 'd', '2mm', ['1/2,1/2']],
150
+ [1, 'c', '2mm', ['1/2,0']],
151
+ [1, 'b', '2mm', ['0,1/2']],
152
+ [1, 'a', '2mm', ['0,0']],
153
+ ],
154
+ },
155
+ {
156
+ number: 7,
157
+ symbol: 'p2mg',
158
+ fullSymbol: 'p2mg',
159
+ pointGroup: '2mm',
160
+ system: 'rectangular',
161
+ page: 182,
162
+ origin: 'at 21g',
163
+ asymmetricUnit: '0 <= x <= 1/4; 0 <= y <= 1',
164
+ centring: [],
165
+ generalPosition: ['x,y', '-x,-y', '-x+1/2,y', 'x+1/2,-y'],
166
+ generators: [2, 3],
167
+ wyckoff: [
168
+ [4, 'd', '1', ['x,y', '-x,-y', '-x+1/2,y', 'x+1/2,-y']],
169
+ [2, 'c', '.m.', ['1/4,y', '3/4,-y']],
170
+ [2, 'b', '2..', ['0,1/2', '1/2,1/2']],
171
+ [2, 'a', '2..', ['0,0', '1/2,0']],
172
+ ],
173
+ },
174
+ {
175
+ number: 8,
176
+ symbol: 'p2gg',
177
+ fullSymbol: 'p2gg',
178
+ pointGroup: '2mm',
179
+ system: 'rectangular',
180
+ page: 183,
181
+ origin: 'at 2',
182
+ asymmetricUnit: '0 <= x <= 1/2; 0 <= y <= 1/2',
183
+ centring: [],
184
+ generalPosition: ['x,y', '-x,-y', '-x+1/2,y+1/2', 'x+1/2,-y+1/2'],
185
+ generators: [2, 3],
186
+ wyckoff: [
187
+ [4, 'c', '1', ['x,y', '-x,-y', '-x+1/2,y+1/2', 'x+1/2,-y+1/2']],
188
+ [2, 'b', '2..', ['1/2,0', '0,1/2']],
189
+ [2, 'a', '2..', ['0,0', '1/2,1/2']],
190
+ ],
191
+ },
192
+ {
193
+ number: 9,
194
+ symbol: 'c2mm',
195
+ fullSymbol: 'c2mm',
196
+ pointGroup: '2mm',
197
+ system: 'rectangular',
198
+ page: 184,
199
+ origin: 'at 2mm',
200
+ asymmetricUnit: '0 <= x <= 1/4; 0 <= y <= 1/2',
201
+ centring: ['1/2,1/2'],
202
+ generalPosition: ['x,y', '-x,-y', '-x,y', 'x,-y'],
203
+ generators: [2, 3],
204
+ wyckoff: [
205
+ [8, 'f', '1', ['x,y', '-x,-y', '-x,y', 'x,-y']],
206
+ [4, 'e', '.m.', ['0,y', '0,-y']],
207
+ [4, 'd', '..m', ['x,0', '-x,0']],
208
+ [4, 'c', '2..', ['1/4,1/4', '3/4,1/4']],
209
+ [2, 'b', '2mm', ['0,1/2']],
210
+ [2, 'a', '2mm', ['0,0']],
211
+ ],
212
+ },
213
+ {
214
+ number: 10,
215
+ symbol: 'p4',
216
+ fullSymbol: 'p4',
217
+ pointGroup: '4',
218
+ system: 'square',
219
+ page: 185,
220
+ origin: 'at 4',
221
+ asymmetricUnit: '0 <= x <= 1/2; 0 <= y <= 1/2',
222
+ centring: [],
223
+ generalPosition: ['x,y', '-x,-y', '-y,x', 'y,-x'],
224
+ generators: [2, 3],
225
+ wyckoff: [
226
+ [4, 'd', '1', ['x,y', '-x,-y', '-y,x', 'y,-x']],
227
+ [2, 'c', '2..', ['1/2,0', '0,1/2']],
228
+ [1, 'b', '4..', ['1/2,1/2']],
229
+ [1, 'a', '4..', ['0,0']],
230
+ ],
231
+ },
232
+ {
233
+ number: 11,
234
+ symbol: 'p4mm',
235
+ fullSymbol: 'p4mm',
236
+ pointGroup: '4mm',
237
+ system: 'square',
238
+ page: 186,
239
+ origin: 'at 4mm',
240
+ asymmetricUnit: '0 <= x <= 1/2; 0 <= y <= 1/2; x <= y',
241
+ centring: [],
242
+ generalPosition: ['x,y', '-x,-y', '-y,x', 'y,-x', '-x,y', 'x,-y', 'y,x', '-y,-x'],
243
+ generators: [2, 3, 5],
244
+ wyckoff: [
245
+ [8, 'g', '1', ['x,y', '-x,-y', '-y,x', 'y,-x', '-x,y', 'x,-y', 'y,x', '-y,-x']],
246
+ [4, 'f', '..m', ['x,x', '-x,-x', '-x,x', 'x,-x']],
247
+ [4, 'e', '.m.', ['x,1/2', '-x,1/2', '1/2,x', '1/2,-x']],
248
+ [4, 'd', '.m.', ['x,0', '-x,0', '0,x', '0,-x']],
249
+ [2, 'c', '2mm.', ['1/2,0', '0,1/2']],
250
+ [1, 'b', '4mm', ['1/2,1/2']],
251
+ [1, 'a', '4mm', ['0,0']],
252
+ ],
253
+ },
254
+ {
255
+ number: 12,
256
+ symbol: 'p4gm',
257
+ fullSymbol: 'p4gm',
258
+ pointGroup: '4mm',
259
+ system: 'square',
260
+ page: 187,
261
+ origin: 'at 41g',
262
+ asymmetricUnit: '0 <= x <= 1/2; 0 <= y <= 1/2; y <= 1/2 - x',
263
+ centring: [],
264
+ generalPosition: ['x,y', '-x,-y', '-y,x', 'y,-x', '-x+1/2,y+1/2', 'x+1/2,-y+1/2', 'y+1/2,x+1/2', '-y+1/2,-x+1/2'],
265
+ generators: [2, 3, 5],
266
+ wyckoff: [
267
+ [8, 'd', '1', ['x,y', '-x,-y', '-y,x', 'y,-x', '-x+1/2,y+1/2', 'x+1/2,-y+1/2', 'y+1/2,x+1/2', '-y+1/2,-x+1/2']],
268
+ [4, 'c', '..m', ['x,x+1/2', '-x,-x+1/2', '-x+1/2,x', 'x+1/2,-x']],
269
+ [2, 'b', '2.mm', ['1/2,0', '0,1/2']],
270
+ [2, 'a', '4..', ['0,0', '1/2,1/2']],
271
+ ],
272
+ },
273
+ {
274
+ number: 13,
275
+ symbol: 'p3',
276
+ fullSymbol: 'p3',
277
+ pointGroup: '3',
278
+ system: 'hexagonal',
279
+ page: 188,
280
+ origin: 'at 3',
281
+ asymmetricUnit: '0 <= x <= 2/3; 0 <= y <= 2/3; x <= (1 + y)/2; y <= min(1 - x, (1 + x)/2)',
282
+ vertices: ['0,0', '1/2,0', '2/3,1/3', '1/3,2/3', '0,1/2'],
283
+ centring: [],
284
+ generalPosition: ['x,y', '-y,x-y', '-x+y,-x'],
285
+ generators: [2],
286
+ wyckoff: [
287
+ [3, 'd', '1', ['x,y', '-y,x-y', '-x+y,-x']],
288
+ [1, 'c', '3..', ['2/3,1/3']],
289
+ [1, 'b', '3..', ['1/3,2/3']],
290
+ [1, 'a', '3..', ['0,0']],
291
+ ],
292
+ },
293
+ {
294
+ number: 14,
295
+ symbol: 'p3m1',
296
+ fullSymbol: 'p3m1',
297
+ pointGroup: '3m',
298
+ system: 'hexagonal',
299
+ page: 189,
300
+ origin: 'at 3m1',
301
+ asymmetricUnit: '0 <= x <= 2/3; 0 <= y <= 2/3; x <= 2y; y <= min(1 - x, 2x)',
302
+ vertices: ['0,0', '2/3,1/3', '1/3,2/3'],
303
+ centring: [],
304
+ generalPosition: ['x,y', '-y,x-y', '-x+y,-x', '-y,-x', '-x+y,y', 'x,x-y'],
305
+ generators: [2, 4],
306
+ wyckoff: [
307
+ [6, 'e', '1', ['x,y', '-y,x-y', '-x+y,-x', '-y,-x', '-x+y,y', 'x,x-y']],
308
+ [3, 'd', '.m.', ['x,-x', 'x,2x', '-2x,-x']],
309
+ [1, 'c', '3m.', ['2/3,1/3']],
310
+ [1, 'b', '3m.', ['1/3,2/3']],
311
+ [1, 'a', '3m.', ['0,0']],
312
+ ],
313
+ },
314
+ {
315
+ number: 15,
316
+ symbol: 'p31m',
317
+ fullSymbol: 'p31m',
318
+ pointGroup: '3m',
319
+ system: 'hexagonal',
320
+ page: 190,
321
+ origin: 'at 31m',
322
+ asymmetricUnit: '0 <= x <= 2/3; 0 <= y <= 1/2; x <= (1 + y)/2; y <= min(1 - x, x)',
323
+ vertices: ['0,0', '1/2,0', '2/3,1/3', '1/2,1/2'],
324
+ centring: [],
325
+ generalPosition: ['x,y', '-y,x-y', '-x+y,-x', 'y,x', 'x-y,-y', '-x,-x+y'],
326
+ generators: [2, 4],
327
+ wyckoff: [
328
+ [6, 'd', '1', ['x,y', '-y,x-y', '-x+y,-x', 'y,x', 'x-y,-y', '-x,-x+y']],
329
+ [3, 'c', '..m', ['x,0', '0,x', '-x,-x']],
330
+ [2, 'b', '3..', ['1/3,2/3', '2/3,1/3']],
331
+ [1, 'a', '3.m', ['0,0']],
332
+ ],
333
+ },
334
+ {
335
+ number: 16,
336
+ symbol: 'p6',
337
+ fullSymbol: 'p6',
338
+ pointGroup: '6',
339
+ system: 'hexagonal',
340
+ page: 191,
341
+ origin: 'at 6',
342
+ asymmetricUnit: '0 <= x <= 2/3; 0 <= y <= 1/2; x <= (1 + y)/2; y <= min(1 - x, x)',
343
+ vertices: ['0,0', '1/2,0', '2/3,1/3', '1/2,1/2'],
344
+ centring: [],
345
+ generalPosition: ['x,y', '-y,x-y', '-x+y,-x', '-x,-y', 'y,-x+y', 'x-y,x'],
346
+ generators: [2, 4],
347
+ wyckoff: [
348
+ [6, 'd', '1', ['x,y', '-y,x-y', '-x+y,-x', '-x,-y', 'y,-x+y', 'x-y,x']],
349
+ [3, 'c', '2..', ['1/2,0', '0,1/2', '1/2,1/2']],
350
+ [2, 'b', '3..', ['1/3,2/3', '2/3,1/3']],
351
+ [1, 'a', '6..', ['0,0']],
352
+ ],
353
+ },
354
+ {
355
+ number: 17,
356
+ symbol: 'p6mm',
357
+ fullSymbol: 'p6mm',
358
+ pointGroup: '6mm',
359
+ system: 'hexagonal',
360
+ page: 192,
361
+ origin: 'at 6mm',
362
+ asymmetricUnit: '0 <= x <= 2/3; 0 <= y <= 1/3; x <= (1 + y)/2; y <= x/2',
363
+ vertices: ['0,0', '1/2,0', '2/3,1/3'],
364
+ centring: [],
365
+ generalPosition: [
366
+ 'x,y',
367
+ '-y,x-y',
368
+ '-x+y,-x',
369
+ '-x,-y',
370
+ 'y,-x+y',
371
+ 'x-y,x',
372
+ '-y,-x',
373
+ '-x+y,y',
374
+ 'x,x-y',
375
+ 'y,x',
376
+ 'x-y,-y',
377
+ '-x,-x+y',
378
+ ],
379
+ generators: [2, 4, 7],
380
+ wyckoff: [
381
+ [
382
+ 12,
383
+ 'f',
384
+ '1',
385
+ [
386
+ 'x,y',
387
+ '-y,x-y',
388
+ '-x+y,-x',
389
+ '-x,-y',
390
+ 'y,-x+y',
391
+ 'x-y,x',
392
+ '-y,-x',
393
+ '-x+y,y',
394
+ 'x,x-y',
395
+ 'y,x',
396
+ 'x-y,-y',
397
+ '-x,-x+y',
398
+ ],
399
+ ],
400
+ [6, 'e', '.m.', ['x,-x', 'x,2x', '-2x,-x', '-x,x', '-x,-2x', '2x,x']],
401
+ [6, 'd', '..m', ['x,0', '0,x', '-x,-x', '-x,0', '0,-x', 'x,x']],
402
+ [3, 'c', '2mm', ['1/2,0', '0,1/2', '1/2,1/2']],
403
+ [2, 'b', '3m.', ['1/3,2/3', '2/3,1/3']],
404
+ [1, 'a', '6mm', ['0,0']],
405
+ ],
406
+ },
407
+ ];
@@ -0,0 +1,75 @@
1
+ /**
2
+ * The 17 plane groups as exact operations: the general position of ITA in its numbering, the
3
+ * centring and ITA's selected generators (CLAUDE.md, "Plane groups (and later space groups)").
4
+ * Internal for now; the entry point `symcrys/plane` comes later.
5
+ */
6
+
7
+ import {
8
+ closure,
9
+ compose,
10
+ equalModLattice,
11
+ parseOperation,
12
+ reduceModLattice,
13
+ translationOperation,
14
+ type ExactOperation,
15
+ } from './affine.js';
16
+ import { PLANE_GROUP_DATA, type PlaneGroupEntry } from './planeGroupData.js';
17
+ import { parseRational } from './rational.js';
18
+
19
+ /** The short symbols of the 17 plane groups, in ITA's order. */
20
+ export const PLANE_GROUP_KEYS = PLANE_GROUP_DATA.map((g) => g.symbol);
21
+
22
+ /** The printed data of a plane group, by short symbol (`'p2mg'`) or number (7); throws if unknown. */
23
+ export function planeGroupEntry(key: string | number): PlaneGroupEntry {
24
+ const entry = PLANE_GROUP_DATA.find((g) => g.symbol === key || g.number === key);
25
+ if (!entry) {
26
+ throw new RangeError(`Unknown plane group: ${JSON.stringify(key)}`);
27
+ }
28
+ return entry;
29
+ }
30
+
31
+ /** The centring translations of a plane group as operations, (0,0) first. */
32
+ export function centringOperations(entry: PlaneGroupEntry): ExactOperation[] {
33
+ return [
34
+ translationOperation([parseRational('0'), parseRational('0')]),
35
+ ...entry.centring.map((t) => translationOperation(t.split(',').map(parseRational))),
36
+ ];
37
+ }
38
+
39
+ const cache = new Map<number, ExactOperation[]>();
40
+
41
+ /**
42
+ * The operations of a plane group, one per coset of the integer translations, translations in
43
+ * [0, 1): the general position in ITA's numbering, then, for a centred group, the same sequence
44
+ * with the centring (1/2, 1/2) added, as ITA prints the "(1/2,1/2)+ set". Throws if ITA's selected
45
+ * generators, with the integer translations and the centring, do not give exactly this set, which
46
+ * would be an error in the data.
47
+ */
48
+ export function planeGroupOperations(key: string | number): ExactOperation[] {
49
+ const entry = planeGroupEntry(key);
50
+ const cached = cache.get(entry.number);
51
+ if (cached) return cached;
52
+ const general = entry.generalPosition.map(parseOperation);
53
+ const ops = centringOperations(entry).flatMap((t) => general.map((op) => reduceModLattice(compose(t, op))));
54
+ const generated = closure(planeGroupGenerators(entry.number), { dimension: 2 });
55
+ const same =
56
+ generated.length === ops.length &&
57
+ generated.every((g) => ops.some((op) => equalModLattice(op, g))) &&
58
+ ops.every((op, i) => ops.findIndex((o) => equalModLattice(o, op)) === i);
59
+ if (!same) {
60
+ throw new Error(`The selected generators of ${entry.symbol} do not give its general position`);
61
+ }
62
+ cache.set(entry.number, ops);
63
+ return ops;
64
+ }
65
+
66
+ /**
67
+ * ITA's "Generators selected" of a plane group as operations, in printed order: the centring
68
+ * translation (for a centred group), then the operations named by number. The identity and the
69
+ * integer translations, which begin the printed line, are left out.
70
+ */
71
+ export function planeGroupGenerators(key: string | number): ExactOperation[] {
72
+ const entry = planeGroupEntry(key);
73
+ const general = entry.generalPosition.map(parseOperation);
74
+ return [...centringOperations(entry).slice(1), ...entry.generators.map((n) => general[n - 1])];
75
+ }
@@ -0,0 +1,90 @@
1
+ /**
2
+ * The ten plane point groups (ITA 6th ed., Table 3.2.1.1, p. 720), `3m` in its two orientations
3
+ * `3m1` and `31m` (Ch. 3.2, p. 721, item (d)). Their operations are the linear parts of the
4
+ * symmorphic plane group of each, in ITA's order (pm for m, p3m1 and p31m for the two settings of
5
+ * 3m), so that the point group of a plane group is its linear part and one data source serves both.
6
+ * Internal; exported through `symcrys/plane`.
7
+ */
8
+
9
+ import { type ExactOperation } from './affine.js';
10
+ import { type PlaneSystem } from './planeGroupData.js';
11
+ import { planeGroupEntry, planeGroupGenerators, planeGroupOperations } from './planeGroups.js';
12
+ import { ZERO } from './rational.js';
13
+
14
+ /** The keys of the ten plane point groups, in the order of ITA Table 3.2.1.1. */
15
+ export const PLANE_POINT_GROUP_KEYS = ['1', '2', 'm', '2mm', '4', '4mm', '3', '3m', '6', '6mm'] as const;
16
+
17
+ /** The key of a plane point group. */
18
+ export type PlanePointGroupKey = (typeof PLANE_POINT_GROUP_KEYS)[number];
19
+
20
+ /** The symmorphic plane group of each point group and setting, whose linear parts it is. */
21
+ const SOURCE: Record<PlanePointGroupKey, readonly string[]> = {
22
+ '1': ['p1'],
23
+ '2': ['p2'],
24
+ m: ['pm'],
25
+ '2mm': ['p2mm'],
26
+ '4': ['p4'],
27
+ '4mm': ['p4mm'],
28
+ '3': ['p3'],
29
+ '3m': ['p3m1', 'p31m'],
30
+ '6': ['p6'],
31
+ '6mm': ['p6mm'],
32
+ };
33
+
34
+ /** The point group of a plane group and its setting: the key under which the plane group's symbol appears in `SOURCE`. */
35
+ export function planePointGroupOf(groupSymbol: string): { key: PlanePointGroupKey; setting: number } {
36
+ for (const key of PLANE_POINT_GROUP_KEYS) {
37
+ const i = SOURCE[key].indexOf(groupSymbol);
38
+ if (i >= 0) return { key, setting: i + 1 };
39
+ }
40
+ // A plane group that is not symmorphic has the setting of the symmorphic group of its point group.
41
+ const entry = planeGroupEntry(groupSymbol);
42
+ return { key: entry.pointGroup as PlanePointGroupKey, setting: 1 };
43
+ }
44
+
45
+ /** True if `key` is the key of a plane point group. */
46
+ export function isPlanePointGroupKey(key: unknown): key is PlanePointGroupKey {
47
+ return typeof key === 'string' && (PLANE_POINT_GROUP_KEYS as readonly string[]).includes(key);
48
+ }
49
+
50
+ /** The symmorphic plane group for a point group and a setting (1-based); throws for an unknown one. */
51
+ function source(key: PlanePointGroupKey, setting = 1): string {
52
+ const list = SOURCE[key];
53
+ if (!Number.isInteger(setting) || setting < 1 || setting > list.length) {
54
+ throw new RangeError(`The plane point group ${key} has no setting ${String(setting)}`);
55
+ }
56
+ return list[setting - 1];
57
+ }
58
+
59
+ /** The number of settings of a plane point group: 2 for `3m`, otherwise 1. */
60
+ export function planePointGroupSettingCount(key: PlanePointGroupKey): number {
61
+ return SOURCE[key].length;
62
+ }
63
+
64
+ /** The symbol of a plane point group in a setting: `3m1` or `31m` for `3m`, otherwise the key. */
65
+ export function planePointGroupSymbol(key: PlanePointGroupKey, setting = 1): string {
66
+ const full = planeGroupEntry(source(key, setting)).fullSymbol.slice(1);
67
+ return key === '3m' ? full : key;
68
+ }
69
+
70
+ /** The crystal system of a plane point group. */
71
+ export function planePointGroupSystem(key: PlanePointGroupKey): PlaneSystem {
72
+ return planeGroupEntry(source(key)).system;
73
+ }
74
+
75
+ const linear = (op: ExactOperation): ExactOperation => ({
76
+ matrix: op.matrix,
77
+ translation: op.translation.map(() => ZERO),
78
+ });
79
+
80
+ /** The operations of a plane point group in a setting, in ITA's order, as operations without translation. */
81
+ export function planePointGroupOperations(key: PlanePointGroupKey, setting = 1): ExactOperation[] {
82
+ return planeGroupOperations(source(key, setting)).map(linear);
83
+ }
84
+
85
+ /** The generators of a plane point group: the linear parts of ITA's selected generators of its symmorphic plane group. */
86
+ export function planePointGroupGenerators(key: PlanePointGroupKey, setting = 1): ExactOperation[] {
87
+ return planeGroupGenerators(source(key, setting))
88
+ .filter((op) => !(op.matrix[0][0] === 1 && op.matrix[0][1] === 0 && op.matrix[1][0] === 0 && op.matrix[1][1] === 1))
89
+ .map(linear);
90
+ }