symcrys 0.10.1 → 0.11.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 (218) hide show
  1. package/README.md +6 -6
  2. package/dist/cell.d.ts +19 -16
  3. package/dist/cell.d.ts.map +1 -1
  4. package/dist/cell.js +63 -35
  5. package/dist/cell.js.map +1 -1
  6. package/dist/checks.d.ts +29 -0
  7. package/dist/checks.d.ts.map +1 -0
  8. package/dist/checks.js +79 -0
  9. package/dist/checks.js.map +1 -0
  10. package/dist/closure.d.ts +43 -0
  11. package/dist/closure.d.ts.map +1 -0
  12. package/dist/closure.js +201 -0
  13. package/dist/closure.js.map +1 -0
  14. package/dist/crystalClasses.d.ts +145 -117
  15. package/dist/crystalClasses.d.ts.map +1 -1
  16. package/dist/crystalClasses.js +161 -121
  17. package/dist/crystalClasses.js.map +1 -1
  18. package/dist/freeze.d.ts +7 -0
  19. package/dist/freeze.d.ts.map +1 -0
  20. package/dist/freeze.js +15 -0
  21. package/dist/freeze.js.map +1 -0
  22. package/dist/index.d.ts +11 -10
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +4 -3
  25. package/dist/index.js.map +1 -1
  26. package/dist/indices.d.ts +31 -5
  27. package/dist/indices.d.ts.map +1 -1
  28. package/dist/indices.js +104 -13
  29. package/dist/indices.js.map +1 -1
  30. package/dist/lattice.d.ts +15 -1
  31. package/dist/lattice.d.ts.map +1 -1
  32. package/dist/lattice.js +30 -1
  33. package/dist/lattice.js.map +1 -1
  34. package/dist/linalg.d.ts +2 -2
  35. package/dist/linalg.d.ts.map +1 -1
  36. package/dist/linalg.js +3 -3
  37. package/dist/linalg.js.map +1 -1
  38. package/dist/magnetic.d.ts +12 -10
  39. package/dist/magnetic.d.ts.map +1 -1
  40. package/dist/magnetic.js +8 -6
  41. package/dist/magnetic.js.map +1 -1
  42. package/dist/notation.d.ts +16 -0
  43. package/dist/notation.d.ts.map +1 -0
  44. package/dist/notation.js +66 -0
  45. package/dist/notation.js.map +1 -0
  46. package/dist/operations.d.ts +40 -26
  47. package/dist/operations.d.ts.map +1 -1
  48. package/dist/operations.js +48 -60
  49. package/dist/operations.js.map +1 -1
  50. package/dist/plane.d.ts +141 -79
  51. package/dist/plane.d.ts.map +1 -1
  52. package/dist/plane.js +147 -77
  53. package/dist/plane.js.map +1 -1
  54. package/dist/pointGroups/crystalForms.d.ts +6 -21
  55. package/dist/pointGroups/crystalForms.d.ts.map +1 -1
  56. package/dist/pointGroups/crystalForms.js +9 -16
  57. package/dist/pointGroups/crystalForms.js.map +1 -1
  58. package/dist/pointGroups/crystalFormsData.d.ts +4 -1
  59. package/dist/pointGroups/crystalFormsData.d.ts.map +1 -1
  60. package/dist/pointGroups/crystalFormsData.js +64 -1
  61. package/dist/pointGroups/crystalFormsData.js.map +1 -1
  62. package/dist/pointGroups/elements.d.ts +19 -17
  63. package/dist/pointGroups/elements.d.ts.map +1 -1
  64. package/dist/pointGroups/elements.js +65 -83
  65. package/dist/pointGroups/elements.js.map +1 -1
  66. package/dist/pointGroups/identify.d.ts +10 -18
  67. package/dist/pointGroups/identify.d.ts.map +1 -1
  68. package/dist/pointGroups/identify.js +27 -79
  69. package/dist/pointGroups/identify.js.map +1 -1
  70. package/dist/pointGroups/itaOrder.d.ts +15 -14
  71. package/dist/pointGroups/itaOrder.d.ts.map +1 -1
  72. package/dist/pointGroups/itaOrder.js +116 -94
  73. package/dist/pointGroups/itaOrder.js.map +1 -1
  74. package/dist/pointGroups/itcData.d.ts +96 -0
  75. package/dist/pointGroups/itcData.d.ts.map +1 -0
  76. package/dist/pointGroups/itcData.js +336 -0
  77. package/dist/pointGroups/itcData.js.map +1 -0
  78. package/dist/pointGroups/itcMagneticData.d.ts +55 -0
  79. package/dist/pointGroups/itcMagneticData.d.ts.map +1 -0
  80. package/dist/pointGroups/itcMagneticData.js +172 -0
  81. package/dist/pointGroups/itcMagneticData.js.map +1 -0
  82. package/dist/pointGroups/keys.d.ts +32 -0
  83. package/dist/pointGroups/keys.d.ts.map +1 -0
  84. package/dist/pointGroups/keys.js +120 -0
  85. package/dist/pointGroups/keys.js.map +1 -0
  86. package/dist/pointGroups/magneticSymbols.d.ts +6 -5
  87. package/dist/pointGroups/magneticSymbols.d.ts.map +1 -1
  88. package/dist/pointGroups/magneticSymbols.js +15 -12
  89. package/dist/pointGroups/magneticSymbols.js.map +1 -1
  90. package/dist/pointGroups/orbits.d.ts +23 -42
  91. package/dist/pointGroups/orbits.d.ts.map +1 -1
  92. package/dist/pointGroups/orbits.js +20 -62
  93. package/dist/pointGroups/orbits.js.map +1 -1
  94. package/dist/pointGroups/pointGroups.d.ts +135 -67
  95. package/dist/pointGroups/pointGroups.d.ts.map +1 -1
  96. package/dist/pointGroups/pointGroups.js +409 -244
  97. package/dist/pointGroups/pointGroups.js.map +1 -1
  98. package/dist/pointGroups/properties.d.ts +21 -22
  99. package/dist/pointGroups/properties.d.ts.map +1 -1
  100. package/dist/pointGroups/properties.js +40 -37
  101. package/dist/pointGroups/properties.js.map +1 -1
  102. package/dist/pointGroups/seitzData.d.ts +26 -0
  103. package/dist/pointGroups/seitzData.d.ts.map +1 -0
  104. package/dist/pointGroups/seitzData.js +130 -0
  105. package/dist/pointGroups/seitzData.js.map +1 -0
  106. package/dist/pointGroups/wyckoff.d.ts +70 -40
  107. package/dist/pointGroups/wyckoff.d.ts.map +1 -1
  108. package/dist/pointGroups/wyckoff.js +98 -91
  109. package/dist/pointGroups/wyckoff.js.map +1 -1
  110. package/dist/pointGroups/wyckoffData.d.ts +7 -4
  111. package/dist/pointGroups/wyckoffData.d.ts.map +1 -1
  112. package/dist/pointGroups/wyckoffData.js +789 -168
  113. package/dist/pointGroups/wyckoffData.js.map +1 -1
  114. package/dist/siteSymmetry.d.ts +8 -16
  115. package/dist/siteSymmetry.d.ts.map +1 -1
  116. package/dist/siteSymmetry.js +34 -24
  117. package/dist/siteSymmetry.js.map +1 -1
  118. package/dist/spaceGroups/affine.d.ts.map +1 -1
  119. package/dist/spaceGroups/affine.js +3 -2
  120. package/dist/spaceGroups/affine.js.map +1 -1
  121. package/dist/spaceGroups/cell.d.ts +43 -31
  122. package/dist/spaceGroups/cell.d.ts.map +1 -1
  123. package/dist/spaceGroups/cell.js +173 -85
  124. package/dist/spaceGroups/cell.js.map +1 -1
  125. package/dist/spaceGroups/describe.d.ts +12 -10
  126. package/dist/spaceGroups/describe.d.ts.map +1 -1
  127. package/dist/spaceGroups/describe.js +11 -10
  128. package/dist/spaceGroups/describe.js.map +1 -1
  129. package/dist/spaceGroups/planeGroupData.d.ts +1 -1
  130. package/dist/spaceGroups/planeGroupData.d.ts.map +1 -1
  131. package/dist/spaceGroups/planeGroupData.js +8 -8
  132. package/dist/spaceGroups/planeGroupData.js.map +1 -1
  133. package/dist/spaceGroups/planeGroups.d.ts.map +1 -1
  134. package/dist/spaceGroups/planeGroups.js +2 -1
  135. package/dist/spaceGroups/planeGroups.js.map +1 -1
  136. package/dist/spaceGroups/positions.d.ts +48 -19
  137. package/dist/spaceGroups/positions.d.ts.map +1 -1
  138. package/dist/spaceGroups/positions.js +166 -67
  139. package/dist/spaceGroups/positions.js.map +1 -1
  140. package/dist/tensors/propertyTable.d.ts +3 -1
  141. package/dist/tensors/propertyTable.d.ts.map +1 -1
  142. package/dist/tensors/propertyTable.js +17 -10
  143. package/dist/tensors/propertyTable.js.map +1 -1
  144. package/dist/tensors/rowEchelon.d.ts +3 -3
  145. package/dist/tensors/rowEchelon.d.ts.map +1 -1
  146. package/dist/tensors/rowEchelon.js +4 -4
  147. package/dist/tensors/rowEchelon.js.map +1 -1
  148. package/dist/tensors/tensorForm.d.ts +75 -34
  149. package/dist/tensors/tensorForm.d.ts.map +1 -1
  150. package/dist/tensors/tensorForm.js +171 -67
  151. package/dist/tensors/tensorForm.js.map +1 -1
  152. package/dist/tensors/tensorProperties.d.ts +10 -9
  153. package/dist/tensors/tensorProperties.d.ts.map +1 -1
  154. package/dist/tensors/tensorProperties.js +22 -12
  155. package/dist/tensors/tensorProperties.js.map +1 -1
  156. package/dist/tolerances.d.ts +56 -1
  157. package/dist/tolerances.d.ts.map +1 -1
  158. package/dist/tolerances.js +51 -1
  159. package/dist/tolerances.js.map +1 -1
  160. package/dist/version.d.ts +1 -1
  161. package/dist/version.js +1 -1
  162. package/package.json +1 -1
  163. package/src/cell.ts +78 -51
  164. package/src/checks.ts +84 -0
  165. package/src/closure.ts +214 -0
  166. package/src/crystalClasses.ts +232 -157
  167. package/src/freeze.ts +14 -0
  168. package/src/index.ts +21 -10
  169. package/src/indices.ts +108 -18
  170. package/src/lattice.ts +41 -1
  171. package/src/linalg.ts +3 -3
  172. package/src/magnetic.ts +14 -9
  173. package/src/notation.ts +73 -0
  174. package/src/operations.ts +78 -71
  175. package/src/plane.ts +253 -127
  176. package/src/pointGroups/crystalForms.ts +11 -44
  177. package/src/pointGroups/crystalFormsData.ts +66 -1
  178. package/src/pointGroups/elements.ts +82 -92
  179. package/src/pointGroups/identify.ts +38 -97
  180. package/src/pointGroups/itaOrder.ts +117 -101
  181. package/src/pointGroups/itcData.ts +404 -0
  182. package/src/pointGroups/itcMagneticData.ts +206 -0
  183. package/src/pointGroups/keys.ts +144 -0
  184. package/src/pointGroups/magneticSymbols.ts +18 -17
  185. package/src/pointGroups/orbits.ts +41 -89
  186. package/src/pointGroups/pointGroups.ts +540 -297
  187. package/src/pointGroups/properties.ts +44 -40
  188. package/src/pointGroups/seitzData.ts +147 -0
  189. package/src/pointGroups/wyckoff.ts +137 -112
  190. package/src/pointGroups/wyckoffData.ts +793 -170
  191. package/src/siteSymmetry.ts +43 -40
  192. package/src/spaceGroups/affine.ts +3 -2
  193. package/src/spaceGroups/cell.ts +227 -116
  194. package/src/spaceGroups/describe.ts +22 -19
  195. package/src/spaceGroups/planeGroupData.ts +9 -9
  196. package/src/spaceGroups/planeGroups.ts +2 -1
  197. package/src/spaceGroups/positions.ts +202 -78
  198. package/src/tensors/propertyTable.ts +26 -14
  199. package/src/tensors/rowEchelon.ts +4 -3
  200. package/src/tensors/tensorForm.ts +258 -88
  201. package/src/tensors/tensorProperties.ts +34 -14
  202. package/src/tolerances.ts +66 -1
  203. package/src/version.ts +1 -1
  204. package/dist/pointGroups/data.d.ts +0 -75
  205. package/dist/pointGroups/data.d.ts.map +0 -1
  206. package/dist/pointGroups/data.js +0 -212
  207. package/dist/pointGroups/data.js.map +0 -1
  208. package/dist/pointGroups/magneticData.d.ts +0 -66
  209. package/dist/pointGroups/magneticData.d.ts.map +0 -1
  210. package/dist/pointGroups/magneticData.js +0 -184
  211. package/dist/pointGroups/magneticData.js.map +0 -1
  212. package/dist/spaceGroups/snap.d.ts +0 -20
  213. package/dist/spaceGroups/snap.d.ts.map +0 -1
  214. package/dist/spaceGroups/snap.js +0 -103
  215. package/dist/spaceGroups/snap.js.map +0 -1
  216. package/src/pointGroups/data.ts +0 -305
  217. package/src/pointGroups/magneticData.ts +0 -328
  218. package/src/spaceGroups/snap.ts +0 -121
package/README.md CHANGED
@@ -12,8 +12,8 @@ npm install symcrys
12
12
  import { operations, symbol, tensorForm } from 'symcrys';
13
13
 
14
14
  symbol('32'); // '321': ITC short symbol of the default setting
15
- operations('-3m'); // 12 operations, Cartesian matrices; x ∥ a, z ∥ c
16
- tensorForm('mm2', { rank: 3, parity: 'polar', intrinsic: 'jk' }).parameters;
15
+ operations('-3m'); // 12 operations: W in the lattice basis (matrix) and Cartesian (cartesian); x ∥ a, z ∥ c
16
+ tensorForm('mm2', { rank: 3, kind: 'polar', intrinsic: 'symmetric-last-pair' }).parameters;
17
17
  // [[0,0,2], [1,1,2], [2,0,0], [2,1,1], [2,2,2]]: xxz, yyz, zxx, zyy, zzz
18
18
  ```
19
19
 
@@ -25,16 +25,16 @@ white group, and a crystal without magnetic order has the grey group of its clas
25
25
  import { allowedProperties } from 'symcrys/magnetic';
26
26
 
27
27
  allowedProperties("321'"); // ['piezoelectric', 'gyrotropic']: quartz
28
- allowedProperties("m'm'2"); // six of the seven names, 'ferromagnetic' among them
28
+ allowedProperties("m'm'2"); // six of the eight names, 'ferromagnetic' among them
29
29
  ```
30
30
 
31
31
  The 17 plane groups and the 10 plane point groups are in `symcrys/plane`, in the lattice basis:
32
32
 
33
33
  ```ts
34
- import { symmetryElements, wyckoffPositionOf } from 'symcrys/plane';
34
+ import { symmetryElements, wyckoffPosition } from 'symcrys/plane';
35
35
 
36
- wyckoffPositionOf('p6mm', [1 / 3, 2 / 3]).letter; // 'b'
37
- symmetryElements('p4gm').rotations; // the 4- and 2-fold centres in the cell
36
+ wyckoffPosition('p6mm', [1 / 3, 2 / 3]).letter; // 'b'
37
+ symmetryElements('p4gm').rotationPoints; // the 4- and 2-fold rotation points, each once modulo the lattice
38
38
  ```
39
39
 
40
40
  Documentation (getting started, conventions, tensors, examples, reference):
package/dist/cell.d.ts CHANGED
@@ -4,6 +4,7 @@
4
4
  * coordinates, as `latticeBasis` gives it; lengths in any unit, angles in degrees.
5
5
  */
6
6
  import { type Mat3, type Vec3 } from './linalg.js';
7
+ import { type ToleranceOptions } from './tolerances.js';
7
8
  /** The lattice parameters of a cell: edge lengths and angles in degrees (α between b and c, β between a and c, γ between a and b). */
8
9
  export interface LatticeParameters {
9
10
  /** Edge length a. */
@@ -28,9 +29,9 @@ export interface CellAngles {
28
29
  /** Angle γ between a and b, in degrees. */
29
30
  readonly gamma: number;
30
31
  }
31
- /** An operation of a list given to `residualOperations`: at least its matrix; other fields are kept. */
32
+ /** An operation of a list given to `residualOperations`: at least its matrix W; other fields are kept. */
32
33
  export interface CellOperation {
33
- /** The 3×3 matrix W acting on lattice coordinates. */
34
+ /** The integer 3×3 matrix W acting on lattice coordinates (the `matrix` of an operation). */
34
35
  readonly matrix: Mat3;
35
36
  }
36
37
  /** Options of `isValidCell`. */
@@ -42,11 +43,6 @@ export interface IsValidCellOptions {
42
43
  */
43
44
  readonly minVolumeRatio?: number;
44
45
  }
45
- /** Options of `residualOperations`. */
46
- export interface ResidualOperationsOptions {
47
- /** The largest accepted deviation of WᵀGW from G, relative to the largest entry of G; default `EPSILON`. */
48
- readonly tolerance?: number;
49
- }
50
46
  /**
51
47
  * Whether three angles (degrees) belong to a cell: each between 0° and 180°, and the three axes not
52
48
  * in one plane (the volume radicand 1 − cos²α − cos²β − cos²γ + 2 cos α cos β cos γ exceeds 10⁻¹², i.e.
@@ -64,7 +60,7 @@ export declare function isValidCell(angles: CellAngles, options?: IsValidCellOpt
64
60
  * axis b, b lies along y (docs/conventions.md, "Cell, metric and indices"). The basis is
65
61
  * right-handed. Throws a RangeError for an edge that is not positive and for angles that give no cell.
66
62
  */
67
- export declare function latticeFromParameters(p: LatticeParameters): Mat3;
63
+ export declare function latticeFromParameters(parameters: LatticeParameters): Mat3;
68
64
  /**
69
65
  * The lattice parameters of a basis given as the columns of a Cartesian matrix: the edge lengths and
70
66
  * the angles in degrees. Independent of the orientation of the basis in the Cartesian frame (and
@@ -79,22 +75,29 @@ export declare function metricTensor(basis: Mat3): Mat3;
79
75
  */
80
76
  export declare function reciprocalBasis(basis: Mat3): Mat3;
81
77
  /** The angle in degrees between two lattice directions [uvw] (coordinates in the basis, columns a, b, c), 0° to 180°. Throws a RangeError for a zero vector. */
82
- export declare function angleBetweenDirections(basis: Mat3, u: Vec3, v: Vec3): number;
78
+ export declare function angleBetweenDirections(basis: Mat3, direction1: Vec3, direction2: Vec3): number;
83
79
  /**
84
80
  * The angle in degrees between the normals of two planes (hkl), 0° to 180°: the angle between the
85
81
  * reciprocal vectors h·a* + k·b* + l·c*. For two faces this is 180° minus the interior dihedral
86
82
  * angle. Throws a RangeError for a zero vector.
87
83
  */
88
- export declare function angleBetweenPlanes(basis: Mat3, h: Vec3, k: Vec3): number;
84
+ export declare function angleBetweenPlanes(basis: Mat3, plane1: Vec3, plane2: Vec3): number;
85
+ /**
86
+ * The unit normal of a plane (hkl) in a cell, a Cartesian vector: h·a* + k·b* + l·c* normalised, the
87
+ * pole of the face (#137 G4). With `latticeBasis(family)` for a family with fixed cell angles, or
88
+ * `latticeFromParameters` for a real cell; Miller indices of hexagonal axes are three, without i.
89
+ * Throws a RangeError for a basis that is not a regular 3 × 3 matrix and for a zero vector.
90
+ */
91
+ export declare function faceNormal(basis: Mat3, hkl: Vec3): Vec3;
89
92
  /**
90
- * The operations that leave the metric of a cell unchanged: those W (integer matrices on the
91
- * coordinates of a lattice direction, as `latticeOperations` gives them) with WᵀGW = G, G the metric
93
+ * The operations that leave the metric of a cell unchanged: those W (`matrix`, the integer matrices
94
+ * on the coordinates of a lattice direction, as `operations` gives them) with WᵀGW = G, G the metric
92
95
  * tensor of `basis`. It is the point symmetry of a distorted lattice among the operations of a group;
93
96
  * the list is taken as it is, not closed into a group, and the kept operations are the ones of the
94
97
  * list, in its order. The deviation counts relative to the largest entry of G (`tolerance`, default
95
98
  * `EPSILON`), so the result does not depend on the unit of the edge lengths.
96
99
  */
97
- export declare function residualOperations<T extends CellOperation>(operations: readonly T[], basis: Mat3, options?: ResidualOperationsOptions): T[];
100
+ export declare function residualOperations<T extends CellOperation>(operations: readonly T[], basis: Mat3, options?: ToleranceOptions): readonly T[];
98
101
  /** An operation of the magnetic API passed to `residualOperations`: its matrix and whether it is combined with time reversal. */
99
102
  export interface MagneticCellOperation extends CellOperation {
100
103
  /** Whether the operation is combined with time reversal. */
@@ -102,11 +105,11 @@ export interface MagneticCellOperation extends CellOperation {
102
105
  }
103
106
  /**
104
107
  * The operations of a list that keep the metric of a cell: W with WᵀGW = G, G the metric tensor
105
- * of `basis`. The operations are integer matrices on lattice coordinates, as `latticeOperations`
106
- * gives them; the list is taken as it is and the kept operations are the ones of the list, in its
108
+ * of `basis`. The operations are read by `matrix`, the integer matrix W on lattice coordinates, as
109
+ * `operations` gives them; the list is taken as it is and the kept operations are the ones of the list, in its
107
110
  * order. The deviation counts relative to the largest entry of G (`tolerance`, default `EPSILON`).
108
111
  * Every operation must say whether it is combined with time reversal (`timeReversal`), which is
109
112
  * kept; one that does not (an operation of the crystallographic API) is a RangeError.
110
113
  */
111
- export declare function residualMagneticOperations<T extends MagneticCellOperation>(operations: readonly T[], basis: Mat3, options?: ResidualOperationsOptions): T[];
114
+ export declare function residualMagneticOperations<T extends MagneticCellOperation>(operations: readonly T[], basis: Mat3, options?: ToleranceOptions): readonly T[];
112
115
  //# sourceMappingURL=cell.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cell.d.ts","sourceRoot":"","sources":["../src/cell.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAmD,KAAK,IAAI,EAAE,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;AAIpG,sIAAsI;AACtI,MAAM,WAAW,iBAAiB;IAChC,qBAAqB;IACrB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,qBAAqB;IACrB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,qBAAqB;IACrB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,2CAA2C;IAC3C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,wCAAwC;AACxC,MAAM,WAAW,UAAU;IACzB,2CAA2C;IAC3C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,2CAA2C;IAC3C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,wGAAwG;AACxG,MAAM,WAAW,aAAa;IAC5B,sDAAsD;IACtD,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;CACvB;AAED,gCAAgC;AAChC,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC;AAED,uCAAuC;AACvC,MAAM,WAAW,yBAAyB;IACxC,4GAA4G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ticeBasis` gives it; lengths in any unit, angles in degrees.
5
5
  */
6
+ import { checkObject, checkOptions, shown, TOLERANCE_KEYS } from './checks.js';
6
7
  import { apply, inverse, isSingular, multiply, transpose } from './linalg.js';
7
8
  import { checkTimeReversal } from './operations.js';
8
- import { EPSILON } from './tolerances.js';
9
+ import { toleranceOf } from './tolerances.js';
10
+ import { deepFreeze } from './freeze.js';
9
11
  const DEG = Math.PI / 180;
10
12
  /** Cosine of an angle in degrees, exact at the multiples of 30° that cells use (90°, 60°, 120°, 180°). */
11
13
  function cosDeg(x) {
@@ -31,6 +33,15 @@ function anglesOk({ alpha, beta, gamma }) {
31
33
  * number from 0 to 1.
32
34
  */
33
35
  export function isValidCell(angles, options) {
36
+ checkOptions(options, ['minVolumeRatio'], 'isValidCell');
37
+ checkObject(angles, 'isValidCell takes the angles { alpha, beta, gamma }');
38
+ // Numbers out of range are no cell (false); anything else is wrong input.
39
+ for (const name of ['alpha', 'beta', 'gamma']) {
40
+ const x = angles[name];
41
+ if (!(typeof x === 'number' && Number.isFinite(x))) {
42
+ throw new RangeError(`The angle ${name} must be a finite number of degrees, not ${shown(x)}`);
43
+ }
44
+ }
34
45
  if (!anglesOk(angles))
35
46
  return false;
36
47
  const min = options?.minVolumeRatio ?? 0;
@@ -41,14 +52,16 @@ export function isValidCell(angles, options) {
41
52
  return false;
42
53
  return Math.sqrt(r) >= min;
43
54
  }
44
- function checkEdges({ a, b, c }) {
55
+ function checkEdges(p) {
56
+ checkObject(p, 'latticeFromParameters takes the parameters { a, b, c, alpha, beta, gamma }');
57
+ const { a, b, c } = p;
45
58
  for (const [name, x] of [
46
59
  ['a', a],
47
60
  ['b', b],
48
61
  ['c', c],
49
62
  ]) {
50
63
  if (typeof x !== 'number' || !Number.isFinite(x) || x <= 0) {
51
- throw new RangeError(`latticeFromParameters: edge ${name} must be a positive number, not ${JSON.stringify(x)}`);
64
+ throw new RangeError(`latticeFromParameters: edge ${name} must be a positive number, not ${shown(x)}`);
52
65
  }
53
66
  }
54
67
  }
@@ -60,24 +73,24 @@ function checkEdges({ a, b, c }) {
60
73
  * axis b, b lies along y (docs/conventions.md, "Cell, metric and indices"). The basis is
61
74
  * right-handed. Throws a RangeError for an edge that is not positive and for angles that give no cell.
62
75
  */
63
- export function latticeFromParameters(p) {
64
- checkEdges(p);
65
- if (!isValidCell(p)) {
66
- throw new RangeError(`latticeFromParameters: angles ${p.alpha}°, ${p.beta}°, ${p.gamma}° give no cell`);
76
+ export function latticeFromParameters(parameters) {
77
+ checkEdges(parameters);
78
+ if (!isValidCell(parameters)) {
79
+ throw new RangeError(`latticeFromParameters: angles ${parameters.alpha}°, ${parameters.beta}°, ${parameters.gamma}° give no cell`);
67
80
  }
68
- const ca = cosDeg(p.alpha);
69
- const cb = cosDeg(p.beta);
70
- const cg = cosDeg(p.gamma);
81
+ const ca = cosDeg(parameters.alpha);
82
+ const cb = cosDeg(parameters.beta);
83
+ const cg = cosDeg(parameters.gamma);
71
84
  const sg = Math.sqrt(1 - cg * cg);
72
- const volumeRatio = Math.sqrt(radicand(p));
85
+ const volumeRatio = Math.sqrt(radicand(parameters));
73
86
  // columns: a = (a, 0, 0), b = (b cos γ, b sin γ, 0), c = (c cos β, c (cos α − cos β cos γ)/sin γ, c V/(abc sin γ))
74
- const cy = (p.c * (ca - cb * cg)) / sg;
75
- const cz = (p.c * volumeRatio) / sg;
76
- return [
77
- [p.a + 0, p.b * cg + 0, p.c * cb + 0],
78
- [0, p.b * sg + 0, cy + 0],
87
+ const cy = (parameters.c * (ca - cb * cg)) / sg;
88
+ const cz = (parameters.c * volumeRatio) / sg;
89
+ return deepFreeze([
90
+ [parameters.a + 0, parameters.b * cg + 0, parameters.c * cb + 0],
91
+ [0, parameters.b * sg + 0, cy + 0],
79
92
  [0, 0, cz + 0],
80
- ];
93
+ ]);
81
94
  }
82
95
  function columns(basis) {
83
96
  return [0, 1, 2].map((j) => [basis[0][j], basis[1][j], basis[2][j]]);
@@ -105,12 +118,12 @@ export function latticeParameters(basis) {
105
118
  const cross = [u[1] * v[2] - u[2] * v[1], u[2] * v[0] - u[0] * v[2], u[0] * v[1] - u[1] * v[0]];
106
119
  return Math.atan2(norm(cross), dot(u, v)) / DEG + 0;
107
120
  };
108
- return { a: norm(a), b: norm(b), c: norm(c), alpha: angle(b, c), beta: angle(a, c), gamma: angle(a, b) };
121
+ return deepFreeze({ a: norm(a), b: norm(b), c: norm(c), alpha: angle(b, c), beta: angle(a, c), gamma: angle(a, b) });
109
122
  }
110
123
  /** The metric tensor G = AᵀA of a basis A (columns a, b, c): g_ij = a_i · a_j, in the unit of the edge lengths squared. */
111
124
  export function metricTensor(basis) {
112
125
  checkBasis(basis, 'metricTensor');
113
- return multiply(transpose(basis), basis);
126
+ return deepFreeze(multiply(transpose(basis), basis));
114
127
  }
115
128
  /**
116
129
  * The reciprocal basis B = A⁻ᵀ of a basis A (columns a, b, c) as the columns a*, b*, c*, with
@@ -118,7 +131,7 @@ export function metricTensor(basis) {
118
131
  */
119
132
  export function reciprocalBasis(basis) {
120
133
  checkBasis(basis, 'reciprocalBasis');
121
- return transpose(inverse(basis));
134
+ return deepFreeze(transpose(inverse(basis)));
122
135
  }
123
136
  function vector(v, name) {
124
137
  if (!Array.isArray(v) || v.length !== 3 || !v.every((x) => typeof x === 'number' && Number.isFinite(x))) {
@@ -133,34 +146,44 @@ function angleOf(u, v) {
133
146
  return Math.atan2(norm(cross), dot(u, v)) / DEG + 0;
134
147
  }
135
148
  /** The angle in degrees between two lattice directions [uvw] (coordinates in the basis, columns a, b, c), 0° to 180°. Throws a RangeError for a zero vector. */
136
- export function angleBetweenDirections(basis, u, v) {
149
+ export function angleBetweenDirections(basis, direction1, direction2) {
137
150
  checkBasis(basis, 'angleBetweenDirections');
138
- return angleOf(apply(basis, vector(u, 'u')), apply(basis, vector(v, 'v')));
151
+ return angleOf(apply(basis, vector(direction1, 'direction1')), apply(basis, vector(direction2, 'direction2')));
139
152
  }
140
153
  /**
141
154
  * The angle in degrees between the normals of two planes (hkl), 0° to 180°: the angle between the
142
155
  * reciprocal vectors h·a* + k·b* + l·c*. For two faces this is 180° minus the interior dihedral
143
156
  * angle. Throws a RangeError for a zero vector.
144
157
  */
145
- export function angleBetweenPlanes(basis, h, k) {
158
+ export function angleBetweenPlanes(basis, plane1, plane2) {
146
159
  checkBasis(basis, 'angleBetweenPlanes');
147
160
  const b = reciprocalBasis(basis);
148
- return angleOf(apply(b, vector(h, 'h')), apply(b, vector(k, 'k')));
161
+ return angleOf(apply(b, vector(plane1, 'plane1')), apply(b, vector(plane2, 'plane2')));
162
+ }
163
+ /**
164
+ * The unit normal of a plane (hkl) in a cell, a Cartesian vector: h·a* + k·b* + l·c* normalised, the
165
+ * pole of the face (#137 G4). With `latticeBasis(family)` for a family with fixed cell angles, or
166
+ * `latticeFromParameters` for a real cell; Miller indices of hexagonal axes are three, without i.
167
+ * Throws a RangeError for a basis that is not a regular 3 × 3 matrix and for a zero vector.
168
+ */
169
+ export function faceNormal(basis, hkl) {
170
+ checkBasis(basis, 'faceNormal');
171
+ const v = apply(reciprocalBasis(basis), vector(hkl, 'hkl'));
172
+ const n = norm(v);
173
+ return Object.freeze(v.map((x) => x / n + 0));
149
174
  }
150
175
  /**
151
- * The operations that leave the metric of a cell unchanged: those W (integer matrices on the
152
- * coordinates of a lattice direction, as `latticeOperations` gives them) with WᵀGW = G, G the metric
176
+ * The operations that leave the metric of a cell unchanged: those W (`matrix`, the integer matrices
177
+ * on the coordinates of a lattice direction, as `operations` gives them) with WᵀGW = G, G the metric
153
178
  * tensor of `basis`. It is the point symmetry of a distorted lattice among the operations of a group;
154
179
  * the list is taken as it is, not closed into a group, and the kept operations are the ones of the
155
180
  * list, in its order. The deviation counts relative to the largest entry of G (`tolerance`, default
156
181
  * `EPSILON`), so the result does not depend on the unit of the edge lengths.
157
182
  */
158
183
  export function residualOperations(operations, basis, options) {
184
+ checkOptions(options, TOLERANCE_KEYS, 'residualOperations');
159
185
  const g = metricTensor(basis);
160
- const tolerance = options?.tolerance ?? EPSILON;
161
- if (typeof tolerance !== 'number' || !Number.isFinite(tolerance) || tolerance < 0) {
162
- throw new RangeError(`residualOperations: tolerance must be a non-negative number, not ${JSON.stringify(tolerance)}`);
163
- }
186
+ const tolerance = toleranceOf(options, 'metric');
164
187
  if (!Array.isArray(operations))
165
188
  throw new RangeError('residualOperations: operations must be a list');
166
189
  operations.forEach((op, i) => {
@@ -170,17 +193,22 @@ export function residualOperations(operations, basis, options) {
170
193
  m.every((r) => Array.isArray(r) && r.length === 3 && r.every((x) => typeof x === 'number' && Number.isFinite(x)));
171
194
  if (!ok)
172
195
  throw new RangeError(`residualOperations: operation ${i} has no 3×3 matrix of finite numbers`);
196
+ // W is an integer matrix; a Cartesian matrix (±√3/2) passed as `matrix` would give a wrong answer.
197
+ if (!m.every((r) => r.every((x) => Math.abs(x - Math.round(x)) <= 1e-9))) {
198
+ throw new RangeError(`residualOperations: the matrix of operation ${i} is not an integer matrix in the lattice basis (the field matrix of an operation, not cartesian): ${shown(m)}`);
199
+ }
173
200
  });
174
201
  const scale = Math.max(...g.flat().map(Math.abs));
175
- return operations.filter((op) => {
202
+ // The list is frozen, not the operations in it, which are the caller's.
203
+ return Object.freeze(operations.filter((op) => {
176
204
  const m = multiply(multiply(transpose(op.matrix), g), op.matrix);
177
- return m.every((row, i) => row.every((x, j) => Math.abs(x - g[i][j]) <= tolerance * scale));
178
- });
205
+ return m.every((row, i) => row.every((x, j) => Math.abs(x - g[i][j]) < tolerance * scale));
206
+ }));
179
207
  }
180
208
  /**
181
209
  * The operations of a list that keep the metric of a cell: W with WᵀGW = G, G the metric tensor
182
- * of `basis`. The operations are integer matrices on lattice coordinates, as `latticeOperations`
183
- * gives them; the list is taken as it is and the kept operations are the ones of the list, in its
210
+ * of `basis`. The operations are read by `matrix`, the integer matrix W on lattice coordinates, as
211
+ * `operations` gives them; the list is taken as it is and the kept operations are the ones of the list, in its
184
212
  * order. The deviation counts relative to the largest entry of G (`tolerance`, default `EPSILON`).
185
213
  * Every operation must say whether it is combined with time reversal (`timeReversal`), which is
186
214
  * kept; one that does not (an operation of the crystallographic API) is a RangeError.
package/dist/cell.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cell.js","sourceRoot":"","sources":["../src/cell.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAwB,MAAM,aAAa,CAAC;AACpG,OAAO,EAAE,iBAAiB,EAAuC,MAAM,iBAAiB,CAAC;AACzF,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAkD1C,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC;AAE1B,0GAA0G;AAC1G,SAAS,MAAM,CAAC,CAAS;IACvB,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;IAClB,MAAM,KAAK,GAA2B,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;IAChH,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9B,OAAO,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;AACnD,CAAC;AAED,mFAAmF;AACnF,SAAS,QAAQ,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAc;IAClD,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,IA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AC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC;QACjE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC;IAC7F,CAAC,CAAC,CACH,CAAC;AACJ,CAAC;AAQD;;;;;;;GAOG;AACH,MAAM,UAAU,0BAA0B,CACxC,UAAwB,EACxB,KAAW,EACX,OAA0B;IAE1B,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC;QAAE,iBAAiB,CAAC,UAAqD,CAAC,CAAC;IACxG,OAAO,kBAAkB,CAAC,UAAU,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AACxD,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Checks of what a caller passes in, shared by the entry points (#137 D2): wrong input is a
3
+ * RangeError that names what is wrong, never a TypeError from deep inside the library.
4
+ */
5
+ /**
6
+ * A value for an error message; never throws: numbers as written (NaN, Infinity), BigInt with its
7
+ * `n`, a function or symbol by its kind, and a value with a cycle as such.
8
+ */
9
+ export declare function shown(value: unknown): string;
10
+ /** The keys of the options of the functions that choose a setting of a point group. */
11
+ export declare const SETTING_KEYS: readonly ["setting", "axes", "uniqueAxis"];
12
+ /** The key of the options of the functions that compare numbers of a caller. */
13
+ export declare const TOLERANCE_KEYS: readonly ["tolerance"];
14
+ /**
15
+ * Throws unless `options` is undefined or a plain object whose keys are all among `keys`: an
16
+ * options argument of the wrong type and a key the function does not know (a misspelling such as
17
+ * `uniqueaxis`, which would otherwise be ignored) are RangeErrors. The option `convention`, removed
18
+ * in 0.11.0, gets a message of its own.
19
+ */
20
+ export declare function checkOptions(options: unknown, keys: readonly string[], what: string): void;
21
+ /** The options restricted to `keys`, for a function that passes part of its options on. */
22
+ export declare function pick<T extends object>(options: T | undefined, keys: readonly string[]): Partial<T> | undefined;
23
+ /** Throws unless `v` is an array of `length` finite numbers. */
24
+ export declare function checkNumbers(v: unknown, length: number, what: string): asserts v is readonly number[];
25
+ /** True for a plain object: `{ … }` or one without a prototype, not an array, a Map or a Date. */
26
+ export declare function isPlainObject(v: unknown): v is Record<string, unknown>;
27
+ /** Throws unless `v` is a plain object. */
28
+ export declare function checkObject(v: unknown, what: string): asserts v is object;
29
+ //# sourceMappingURL=checks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../src/checks.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAoB5C;AAED,uFAAuF;AACvF,eAAO,MAAM,YAAY,4CAA6C,CAAC;AACvE,gFAAgF;AAChF,eAAO,MAAM,cAAc,wBAAyB,CAAC;AAErD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAgB1F;AAED,2FAA2F;AAC3F,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,SAAS,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,SAAS,CAG9G;AAED,gEAAgE;AAChE,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,IAAI,SAAS,MAAM,EAAE,CAIrG;AAED,kGAAkG;AAClG,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAItE;AAED,2CAA2C;AAC3C,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,IAAI,MAAM,CAEzE"}
package/dist/checks.js ADDED
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Checks of what a caller passes in, shared by the entry points (#137 D2): wrong input is a
3
+ * RangeError that names what is wrong, never a TypeError from deep inside the library.
4
+ */
5
+ /**
6
+ * A value for an error message; never throws: numbers as written (NaN, Infinity), BigInt with its
7
+ * `n`, a function or symbol by its kind, and a value with a cycle as such.
8
+ */
9
+ export function shown(value) {
10
+ if (typeof value === 'number')
11
+ return String(value);
12
+ if (typeof value === 'bigint')
13
+ return `${value}n`;
14
+ if (typeof value === 'function')
15
+ return 'a function';
16
+ if (typeof value === 'symbol')
17
+ return 'a symbol';
18
+ try {
19
+ return (JSON.stringify(value, (_, v) => typeof v === 'bigint'
20
+ ? `${v}n`
21
+ : typeof v === 'symbol'
22
+ ? 'a symbol'
23
+ : typeof v === 'number' && !Number.isFinite(v)
24
+ ? String(v)
25
+ : v) ?? String(value));
26
+ }
27
+ catch {
28
+ return 'a value that contains itself';
29
+ }
30
+ }
31
+ /** The keys of the options of the functions that choose a setting of a point group. */
32
+ export const SETTING_KEYS = ['setting', 'axes', 'uniqueAxis'];
33
+ /** The key of the options of the functions that compare numbers of a caller. */
34
+ export const TOLERANCE_KEYS = ['tolerance'];
35
+ /**
36
+ * Throws unless `options` is undefined or a plain object whose keys are all among `keys`: an
37
+ * options argument of the wrong type and a key the function does not know (a misspelling such as
38
+ * `uniqueaxis`, which would otherwise be ignored) are RangeErrors. The option `convention`, removed
39
+ * in 0.11.0, gets a message of its own.
40
+ */
41
+ export function checkOptions(options, keys, what) {
42
+ if (options === undefined)
43
+ return;
44
+ if (!isPlainObject(options)) {
45
+ throw new RangeError(`${what} takes its options as an object { ${keys.join(', ')} }, not ${shown(options)}`);
46
+ }
47
+ const unknown = Object.keys(options).filter((k) => !keys.includes(k));
48
+ if (unknown.includes('convention')) {
49
+ throw new RangeError('The option convention was removed in symcrys 0.11.0: symcrys follows ITC only (CHANGELOG.md, 0.11.0)');
50
+ }
51
+ if (unknown.length > 0) {
52
+ throw new RangeError(`${what} takes the options ${keys.join(', ')}, not ${unknown.map((k) => JSON.stringify(k)).join(', ')}`);
53
+ }
54
+ }
55
+ /** The options restricted to `keys`, for a function that passes part of its options on. */
56
+ export function pick(options, keys) {
57
+ if (options === undefined)
58
+ return undefined;
59
+ return Object.fromEntries(Object.entries(options).filter(([k]) => keys.includes(k)));
60
+ }
61
+ /** Throws unless `v` is an array of `length` finite numbers. */
62
+ export function checkNumbers(v, length, what) {
63
+ if (!Array.isArray(v) || v.length !== length || !v.every((x) => typeof x === 'number' && Number.isFinite(x))) {
64
+ throw new RangeError(`${what} must be ${length} finite numbers, not ${shown(v)}`);
65
+ }
66
+ }
67
+ /** True for a plain object: `{ … }` or one without a prototype, not an array, a Map or a Date. */
68
+ export function isPlainObject(v) {
69
+ if (typeof v !== 'object' || v === null)
70
+ return false;
71
+ const proto = Object.getPrototypeOf(v);
72
+ return proto === Object.prototype || proto === null;
73
+ }
74
+ /** Throws unless `v` is a plain object. */
75
+ export function checkObject(v, what) {
76
+ if (!isPlainObject(v))
77
+ throw new RangeError(`${what}, not ${shown(v)}`);
78
+ }
79
+ //# sourceMappingURL=checks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checks.js","sourceRoot":"","sources":["../src/checks.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,UAAU,KAAK,CAAC,KAAc;IAClC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACpD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,GAAG,KAAK,GAAG,CAAC;IAClD,IAAI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,CAAC,CAAC;IACpF,CAAC;AACH,CAAC;AAED,kGAAkG;AAClG,MAAM,UAAU,aAAa,CAAC,CAAU;IACtC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IACtD,MAAM,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC,CAAY,CAAC;IAClD,OAAO,KAAK,KAAK,MAAM,CAAC,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC;AACtD,CAAC;AAED,2CAA2C;AAC3C,MAAM,UAAU,WAAW,CAAC,CAAU,EAAE,IAAY;IAClD,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;QAAE,MAAM,IAAI,UAAU,CAAC,GAAG,IAAI,SAAS,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AAC1E,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * The group generated by operations a caller passes in, within a tolerance, and that group made
3
+ * exact (docs/conventions.md, "Tolerances"). Operations read from a file or computed elsewhere carry
4
+ * rounding errors (√3/2 written as 0.866025); compared within the tolerance they still generate the
5
+ * right group, but its matrices are not exactly a group, and a tensor form computed from them has
6
+ * the wrong number of free parameters (#89). `idealGroup` therefore replaces them by the exact group
7
+ * nearest to them before anything is computed from them.
8
+ */
9
+ import type { CartesianOperation } from './operations.js';
10
+ /** No finite group of Cartesian operations that symcrys computes with has more elements (m-3m1' has 96). */
11
+ export declare const MAX_GROUP_ORDER = 200;
12
+ /** True if the two operations agree in time reversal and in every matrix entry within `tolerance`. */
13
+ export declare function sameWithin(a: CartesianOperation, b: CartesianOperation, tolerance: number): boolean;
14
+ /**
15
+ * The group the operations generate within `tolerance` (two operations equal when they agree in
16
+ * time reversal and in every matrix entry within it), the identity first, then the operations of
17
+ * the list that are new, then products in the order they are found; or undefined if it has more
18
+ * than `maxOrder` elements. A new operation is compared only with the operations of its kind.
19
+ */
20
+ export declare function closeWithin(operations: readonly CartesianOperation[], tolerance: number, maxOrder?: number): CartesianOperation[] | undefined;
21
+ /**
22
+ * The group the operations generate within `tolerance` (`closeWithin`); throws a RangeError if it
23
+ * has more than `MAX_GROUP_ORDER` elements.
24
+ */
25
+ export declare function closedGroup(operations: readonly CartesianOperation[], tolerance: number): CartesianOperation[];
26
+ /** A group made exact: its operations, and how far they lie from the operations it was made from. */
27
+ export interface IdealGroup {
28
+ readonly operations: readonly CartesianOperation[];
29
+ /** The largest difference of a matrix entry from the closed operations of the caller. */
30
+ readonly deviation: number;
31
+ }
32
+ /**
33
+ * The group generated by `operations` within `tolerance` (`closeWithin`, at most `MAX_GROUP_ORDER`
34
+ * elements), made exact: each matrix f(x) is replaced by the mean of f(xy)·f(y)⁻¹ over the group,
35
+ * repeated until nothing changes. For an exact group this is f(x) itself; for matrices that are a
36
+ * group only within a small error the passes settle on an exact representation nearby (tested in
37
+ * closure.test.ts and tensors/tolerance.test.ts), and the invariant metric of the result makes it
38
+ * orthogonal. Entries within 10⁻¹² of 0, ±1/2, ±√2/2, ±√3/2, ±1 are then set to them, so that exact
39
+ * input stays exact. Throws a RangeError if the operations generate more than `MAX_GROUP_ORDER`
40
+ * elements or do not settle into a group (a tolerance too large or too small for their errors).
41
+ */
42
+ export declare function idealGroup(operations: readonly CartesianOperation[], tolerance: number): IdealGroup;
43
+ //# sourceMappingURL=closure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"closure.d.ts","sourceRoot":"","sources":["../src/closure.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAY1D,4GAA4G;AAC5G,eAAO,MAAM,eAAe,MAAM,CAAC;AAEnC,sGAAsG;AACtG,wBAAgB,UAAU,CAAC,CAAC,EAAE,kBAAkB,EAAE,CAAC,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAKnG;AAMD;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,UAAU,EAAE,SAAS,kBAAkB,EAAE,EACzC,SAAS,EAAE,MAAM,EACjB,QAAQ,SAAkB,GACzB,kBAAkB,EAAE,GAAG,SAAS,CA+BlC;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,UAAU,EAAE,SAAS,kBAAkB,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,kBAAkB,EAAE,CAQ9G;AA+BD,qGAAqG;AACrG,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,UAAU,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACnD,yFAAyF;IACzF,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,SAAS,kBAAkB,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,UAAU,CAyEnG"}