symcrys 0.10.1 → 0.12.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 (248) 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/coordinates.d.ts +143 -0
  15. package/dist/coordinates.d.ts.map +1 -0
  16. package/dist/coordinates.js +198 -0
  17. package/dist/coordinates.js.map +1 -0
  18. package/dist/crystalClasses.d.ts +170 -117
  19. package/dist/crystalClasses.d.ts.map +1 -1
  20. package/dist/crystalClasses.js +190 -121
  21. package/dist/crystalClasses.js.map +1 -1
  22. package/dist/freeze.d.ts +7 -0
  23. package/dist/freeze.d.ts.map +1 -0
  24. package/dist/freeze.js +15 -0
  25. package/dist/freeze.js.map +1 -0
  26. package/dist/index.d.ts +13 -10
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +5 -3
  29. package/dist/index.js.map +1 -1
  30. package/dist/indices.d.ts +30 -20
  31. package/dist/indices.d.ts.map +1 -1
  32. package/dist/indices.js +101 -31
  33. package/dist/indices.js.map +1 -1
  34. package/dist/lattice.d.ts +15 -1
  35. package/dist/lattice.d.ts.map +1 -1
  36. package/dist/lattice.js +30 -1
  37. package/dist/lattice.js.map +1 -1
  38. package/dist/linalg.d.ts +2 -2
  39. package/dist/linalg.d.ts.map +1 -1
  40. package/dist/linalg.js +3 -3
  41. package/dist/linalg.js.map +1 -1
  42. package/dist/magnetic.d.ts +14 -10
  43. package/dist/magnetic.d.ts.map +1 -1
  44. package/dist/magnetic.js +10 -6
  45. package/dist/magnetic.js.map +1 -1
  46. package/dist/notation.d.ts +16 -0
  47. package/dist/notation.d.ts.map +1 -0
  48. package/dist/notation.js +66 -0
  49. package/dist/notation.js.map +1 -0
  50. package/dist/operations.d.ts +40 -26
  51. package/dist/operations.d.ts.map +1 -1
  52. package/dist/operations.js +48 -60
  53. package/dist/operations.js.map +1 -1
  54. package/dist/plane.d.ts +297 -80
  55. package/dist/plane.d.ts.map +1 -1
  56. package/dist/plane.js +289 -94
  57. package/dist/plane.js.map +1 -1
  58. package/dist/pointGroups/crystalForms.d.ts +6 -21
  59. package/dist/pointGroups/crystalForms.d.ts.map +1 -1
  60. package/dist/pointGroups/crystalForms.js +9 -16
  61. package/dist/pointGroups/crystalForms.js.map +1 -1
  62. package/dist/pointGroups/crystalFormsData.d.ts +4 -1
  63. package/dist/pointGroups/crystalFormsData.d.ts.map +1 -1
  64. package/dist/pointGroups/crystalFormsData.js +64 -1
  65. package/dist/pointGroups/crystalFormsData.js.map +1 -1
  66. package/dist/pointGroups/elements.d.ts +19 -17
  67. package/dist/pointGroups/elements.d.ts.map +1 -1
  68. package/dist/pointGroups/elements.js +65 -83
  69. package/dist/pointGroups/elements.js.map +1 -1
  70. package/dist/pointGroups/identify.d.ts +10 -18
  71. package/dist/pointGroups/identify.d.ts.map +1 -1
  72. package/dist/pointGroups/identify.js +27 -79
  73. package/dist/pointGroups/identify.js.map +1 -1
  74. package/dist/pointGroups/itaOrder.d.ts +15 -14
  75. package/dist/pointGroups/itaOrder.d.ts.map +1 -1
  76. package/dist/pointGroups/itaOrder.js +116 -94
  77. package/dist/pointGroups/itaOrder.js.map +1 -1
  78. package/dist/pointGroups/itcData.d.ts +96 -0
  79. package/dist/pointGroups/itcData.d.ts.map +1 -0
  80. package/dist/pointGroups/itcData.js +336 -0
  81. package/dist/pointGroups/itcData.js.map +1 -0
  82. package/dist/pointGroups/itcMagneticData.d.ts +55 -0
  83. package/dist/pointGroups/itcMagneticData.d.ts.map +1 -0
  84. package/dist/pointGroups/itcMagneticData.js +172 -0
  85. package/dist/pointGroups/itcMagneticData.js.map +1 -0
  86. package/dist/pointGroups/keys.d.ts +32 -0
  87. package/dist/pointGroups/keys.d.ts.map +1 -0
  88. package/dist/pointGroups/keys.js +120 -0
  89. package/dist/pointGroups/keys.js.map +1 -0
  90. package/dist/pointGroups/magneticSymbols.d.ts +6 -5
  91. package/dist/pointGroups/magneticSymbols.d.ts.map +1 -1
  92. package/dist/pointGroups/magneticSymbols.js +15 -12
  93. package/dist/pointGroups/magneticSymbols.js.map +1 -1
  94. package/dist/pointGroups/orbits.d.ts +23 -42
  95. package/dist/pointGroups/orbits.d.ts.map +1 -1
  96. package/dist/pointGroups/orbits.js +20 -62
  97. package/dist/pointGroups/orbits.js.map +1 -1
  98. package/dist/pointGroups/pointGroups.d.ts +145 -68
  99. package/dist/pointGroups/pointGroups.d.ts.map +1 -1
  100. package/dist/pointGroups/pointGroups.js +455 -243
  101. package/dist/pointGroups/pointGroups.js.map +1 -1
  102. package/dist/pointGroups/properties.d.ts +21 -22
  103. package/dist/pointGroups/properties.d.ts.map +1 -1
  104. package/dist/pointGroups/properties.js +40 -37
  105. package/dist/pointGroups/properties.js.map +1 -1
  106. package/dist/pointGroups/seitzData.d.ts +26 -0
  107. package/dist/pointGroups/seitzData.d.ts.map +1 -0
  108. package/dist/pointGroups/seitzData.js +130 -0
  109. package/dist/pointGroups/seitzData.js.map +1 -0
  110. package/dist/pointGroups/shubnikovData.d.ts +11 -0
  111. package/dist/pointGroups/shubnikovData.d.ts.map +1 -0
  112. package/dist/pointGroups/shubnikovData.js +101 -0
  113. package/dist/pointGroups/shubnikovData.js.map +1 -0
  114. package/dist/pointGroups/wyckoff.d.ts +70 -40
  115. package/dist/pointGroups/wyckoff.d.ts.map +1 -1
  116. package/dist/pointGroups/wyckoff.js +98 -91
  117. package/dist/pointGroups/wyckoff.js.map +1 -1
  118. package/dist/pointGroups/wyckoffData.d.ts +7 -4
  119. package/dist/pointGroups/wyckoffData.d.ts.map +1 -1
  120. package/dist/pointGroups/wyckoffData.js +789 -168
  121. package/dist/pointGroups/wyckoffData.js.map +1 -1
  122. package/dist/siteSymmetry.d.ts +8 -16
  123. package/dist/siteSymmetry.d.ts.map +1 -1
  124. package/dist/siteSymmetry.js +34 -24
  125. package/dist/siteSymmetry.js.map +1 -1
  126. package/dist/spaceGroups/affine.d.ts.map +1 -1
  127. package/dist/spaceGroups/affine.js +3 -2
  128. package/dist/spaceGroups/affine.js.map +1 -1
  129. package/dist/spaceGroups/cell.d.ts +43 -31
  130. package/dist/spaceGroups/cell.d.ts.map +1 -1
  131. package/dist/spaceGroups/cell.js +173 -85
  132. package/dist/spaceGroups/cell.js.map +1 -1
  133. package/dist/spaceGroups/describe.d.ts +13 -10
  134. package/dist/spaceGroups/describe.d.ts.map +1 -1
  135. package/dist/spaceGroups/describe.js +11 -10
  136. package/dist/spaceGroups/describe.js.map +1 -1
  137. package/dist/spaceGroups/planeGroupData.d.ts +3 -1
  138. package/dist/spaceGroups/planeGroupData.d.ts.map +1 -1
  139. package/dist/spaceGroups/planeGroupData.js +25 -8
  140. package/dist/spaceGroups/planeGroupData.js.map +1 -1
  141. package/dist/spaceGroups/planeGroups.d.ts.map +1 -1
  142. package/dist/spaceGroups/planeGroups.js +2 -1
  143. package/dist/spaceGroups/planeGroups.js.map +1 -1
  144. package/dist/spaceGroups/planeLattice.d.ts +78 -0
  145. package/dist/spaceGroups/planeLattice.d.ts.map +1 -0
  146. package/dist/spaceGroups/planeLattice.js +143 -0
  147. package/dist/spaceGroups/planeLattice.js.map +1 -0
  148. package/dist/spaceGroups/planePointGroups.d.ts +6 -2
  149. package/dist/spaceGroups/planePointGroups.d.ts.map +1 -1
  150. package/dist/spaceGroups/planePointGroups.js +14 -2
  151. package/dist/spaceGroups/planePointGroups.js.map +1 -1
  152. package/dist/spaceGroups/positions.d.ts +48 -19
  153. package/dist/spaceGroups/positions.d.ts.map +1 -1
  154. package/dist/spaceGroups/positions.js +166 -67
  155. package/dist/spaceGroups/positions.js.map +1 -1
  156. package/dist/spaceGroups/rational.d.ts +18 -0
  157. package/dist/spaceGroups/rational.d.ts.map +1 -1
  158. package/dist/spaceGroups/rational.js +58 -0
  159. package/dist/spaceGroups/rational.js.map +1 -1
  160. package/dist/tensors/propertyTable.d.ts +3 -1
  161. package/dist/tensors/propertyTable.d.ts.map +1 -1
  162. package/dist/tensors/propertyTable.js +17 -10
  163. package/dist/tensors/propertyTable.js.map +1 -1
  164. package/dist/tensors/rowEchelon.d.ts +3 -3
  165. package/dist/tensors/rowEchelon.d.ts.map +1 -1
  166. package/dist/tensors/rowEchelon.js +4 -4
  167. package/dist/tensors/rowEchelon.js.map +1 -1
  168. package/dist/tensors/tensorForm.d.ts +75 -34
  169. package/dist/tensors/tensorForm.d.ts.map +1 -1
  170. package/dist/tensors/tensorForm.js +171 -67
  171. package/dist/tensors/tensorForm.js.map +1 -1
  172. package/dist/tensors/tensorProperties.d.ts +10 -9
  173. package/dist/tensors/tensorProperties.d.ts.map +1 -1
  174. package/dist/tensors/tensorProperties.js +22 -12
  175. package/dist/tensors/tensorProperties.js.map +1 -1
  176. package/dist/tensors/voigt.d.ts +56 -0
  177. package/dist/tensors/voigt.d.ts.map +1 -0
  178. package/dist/tensors/voigt.js +188 -0
  179. package/dist/tensors/voigt.js.map +1 -0
  180. package/dist/tolerances.d.ts +56 -1
  181. package/dist/tolerances.d.ts.map +1 -1
  182. package/dist/tolerances.js +51 -1
  183. package/dist/tolerances.js.map +1 -1
  184. package/dist/version.d.ts +1 -1
  185. package/dist/version.js +1 -1
  186. package/package.json +1 -1
  187. package/src/cell.ts +78 -51
  188. package/src/checks.ts +84 -0
  189. package/src/closure.ts +214 -0
  190. package/src/coordinates.ts +370 -0
  191. package/src/crystalClasses.ts +271 -157
  192. package/src/freeze.ts +14 -0
  193. package/src/index.ts +33 -12
  194. package/src/indices.ts +102 -42
  195. package/src/lattice.ts +41 -1
  196. package/src/linalg.ts +3 -3
  197. package/src/magnetic.ts +24 -11
  198. package/src/notation.ts +73 -0
  199. package/src/operations.ts +78 -71
  200. package/src/plane.ts +531 -151
  201. package/src/pointGroups/crystalForms.ts +11 -44
  202. package/src/pointGroups/crystalFormsData.ts +66 -1
  203. package/src/pointGroups/elements.ts +82 -92
  204. package/src/pointGroups/identify.ts +38 -97
  205. package/src/pointGroups/itaOrder.ts +117 -101
  206. package/src/pointGroups/itcData.ts +404 -0
  207. package/src/pointGroups/itcMagneticData.ts +206 -0
  208. package/src/pointGroups/keys.ts +144 -0
  209. package/src/pointGroups/magneticSymbols.ts +18 -17
  210. package/src/pointGroups/orbits.ts +41 -89
  211. package/src/pointGroups/pointGroups.ts +593 -298
  212. package/src/pointGroups/properties.ts +44 -40
  213. package/src/pointGroups/seitzData.ts +147 -0
  214. package/src/pointGroups/shubnikovData.ts +103 -0
  215. package/src/pointGroups/wyckoff.ts +137 -112
  216. package/src/pointGroups/wyckoffData.ts +793 -170
  217. package/src/siteSymmetry.ts +43 -40
  218. package/src/spaceGroups/affine.ts +3 -2
  219. package/src/spaceGroups/cell.ts +227 -116
  220. package/src/spaceGroups/describe.ts +23 -19
  221. package/src/spaceGroups/planeGroupData.ts +28 -9
  222. package/src/spaceGroups/planeGroups.ts +2 -1
  223. package/src/spaceGroups/planeLattice.ts +208 -0
  224. package/src/spaceGroups/planePointGroups.ts +23 -3
  225. package/src/spaceGroups/positions.ts +202 -78
  226. package/src/spaceGroups/rational.ts +59 -0
  227. package/src/tensors/propertyTable.ts +26 -14
  228. package/src/tensors/rowEchelon.ts +4 -3
  229. package/src/tensors/tensorForm.ts +258 -88
  230. package/src/tensors/tensorProperties.ts +34 -14
  231. package/src/tensors/voigt.ts +268 -0
  232. package/src/tolerances.ts +66 -1
  233. package/src/version.ts +1 -1
  234. package/dist/pointGroups/data.d.ts +0 -75
  235. package/dist/pointGroups/data.d.ts.map +0 -1
  236. package/dist/pointGroups/data.js +0 -212
  237. package/dist/pointGroups/data.js.map +0 -1
  238. package/dist/pointGroups/magneticData.d.ts +0 -66
  239. package/dist/pointGroups/magneticData.d.ts.map +0 -1
  240. package/dist/pointGroups/magneticData.js +0 -184
  241. package/dist/pointGroups/magneticData.js.map +0 -1
  242. package/dist/spaceGroups/snap.d.ts +0 -20
  243. package/dist/spaceGroups/snap.d.ts.map +0 -1
  244. package/dist/spaceGroups/snap.js +0 -103
  245. package/dist/spaceGroups/snap.js.map +0 -1
  246. package/src/pointGroups/data.ts +0 -305
  247. package/src/pointGroups/magneticData.ts +0 -328
  248. package/src/spaceGroups/snap.ts +0 -121
package/dist/index.d.ts CHANGED
@@ -6,18 +6,21 @@
6
6
  * SemVer (see CLAUDE.md); everything else is internal.
7
7
  */
8
8
  export { VERSION } from './version.js';
9
+ export { EPSILON, type ToleranceOptions } from './tolerances.js';
9
10
  export type { Mat3, Vec3 } from './linalg.js';
10
- export { crystalFamily, latticeBasis, type CrystalFamily, type CrystalSystem, type FixedAngleFamily, } from './lattice.js';
11
- export { angleBetweenDirections, angleBetweenPlanes, isValidCell, latticeFromParameters, latticeParameters, metricTensor, reciprocalBasis, type CellAngles, type CellOperation, type IsValidCellOptions, type LatticeParameters, type ResidualOperationsOptions, } from './cell.js';
12
- export { changeOfAxes, directionFromFourIndices, directionToFourIndices, planeFromFourIndices, planeToFourIndices, reduceIndices, zoneAxis, type AxisChange, type FourIndices, } from './indices.js';
13
- export type { Convention, PointGroupKey, Setting, SettingOptions, SymbolOptions } from './pointGroups/pointGroups.js';
11
+ export { crystalFamily, latticeBasis, type CrystalFamily, type CrystalSystem, type FixedAngleFamily, type LatticeSystem, } from './lattice.js';
12
+ export { angleBetweenDirections, angleBetweenPlanes, faceNormal, isValidCell, latticeFromParameters, latticeParameters, metricTensor, reciprocalBasis, type CellAngles, type CellOperation, type IsValidCellOptions, type LatticeParameters, } from './cell.js';
13
+ export { directionFromFourIndices, directionToFourIndices, planeFromFourIndices, planeToFourIndices, millerIndices, reduceIndices, zoneAxis, type FourIndices, type MillerValues, } from './indices.js';
14
+ export { changeOfCoordinates, type AffineOperation, type CoordinateChange, type CoordinateQuantities, type CoordinateTransformation, type InverseTransformation, type TransformedOperation, } from './coordinates.js';
15
+ export type { PointGroupKey, Setting, AxesOptions, SettingOptions, SymbolOptions } from './pointGroups/pointGroups.js';
14
16
  export { LATTICE_SYMMETRY_DIRECTIONS, type Uvw } from './symmetryDirections.js';
15
17
  export type { Axis, DirectionElements, OperationKind, SymmetryDirection } from './pointGroups/elements.js';
16
- export type { SiteSymmetry, SiteSymmetryOptions } from './siteSymmetry.js';
17
- export type { Hkl, WyckoffOptions, WyckoffPosition } from './pointGroups/wyckoff.js';
18
+ export type { SiteSymmetry } from './siteSymmetry.js';
19
+ export type { Hkl, WyckoffPosition } from './pointGroups/wyckoff.js';
18
20
  export type { CrystalForm, CrystalFormType } from './pointGroups/crystalForms.js';
19
- export type { DirectionOrbitEntry, FaceOrbitEntry, OrbitOptions, OrbitPole } from './pointGroups/orbits.js';
20
- export type { CartesianAxis, PointGroupOfOptions } from './pointGroups/identify.js';
21
- export type { IntrinsicSymmetry, TensorForm, TensorParity, TensorRank } from './tensors/tensorForm.js';
22
- export { CRYSTAL_FORM_TYPES, POINT_GROUP_KEYS, TENSOR_PROPERTIES, allowedProperties, allowedPropertiesOf, allowsProperty, allowsPropertyOf, crystalForms, describeOperations, describeOperationsOf, findPointGroup, generators, holohedry, isCentrosymmetricOf, isChiralOf, isPointGroupKey, latticeOperations, residualOperations, operations, orbit, orbitOf, pointGroup, pointGroupOf, pointGroups, rotateTensor, settings, siteSymmetry, symbol, symmetryDirections, tensorForm, tensorFormOf, wyckoffPositionOf, wyckoffPositions, type CartesianOperationDescription, type IdentifiedPointGroup, type Operation, type OperationDescription, type PointGroup, type PointGroupInSetting, type TensorProperty, type TensorPropertyName, type TensorSpec, } from './crystalClasses.js';
21
+ export type { DirectionIndices, DirectionOrbitEntry, FaceIndices, FaceOrbitEntry, OrbitPole, } from './pointGroups/orbits.js';
22
+ export type { CartesianAxis } from './pointGroups/identify.js';
23
+ export type { IntrinsicSymmetry, TensorForm, TensorKind, TensorRank } from './tensors/tensorForm.js';
24
+ export { CRYSTAL_FORM_TYPES, POINT_GROUP_KEYS, TENSOR_PROPERTIES, allowedProperties, allowedPropertiesOf, allowsProperty, allowsPropertyOf, crystalForms, describeOperations, describeOperationsOf, findPointGroup, generators, holohedry, isCentrosymmetricOf, isEnantiomorphicOf, isPointGroupKey, latticeSystems, residualOperations, operations, orbit, orbitOf, pointGroup, pointGroupOf, pointGroups, rotateTensor, toVoigt, fromVoigt, settings, siteSymmetry, siteSymmetryOf, symbol, symmetryDirections, tensorForm, tensorFormOf, wyckoffPosition, wyckoffPositions, type CartesianOperationDescription, type IdentifiedPointGroup, type Operation, type OperationDescription, type PointGroup, type PointGroupInSetting, type TensorProperty, type TensorPropertyName, type TensorSpec, } from './crystalClasses.js';
25
+ export type { VoigtFactor, VoigtOptions } from './tensors/voigt.js';
23
26
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EACL,aAAa,EACb,YAAY,EACZ,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,gBAAgB,GACtB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,WAAW,EACX,qBAAqB,EACrB,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,GAC/B,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,YAAY,EACZ,wBAAwB,EACxB,sBAAsB,EACtB,oBAAoB,EACpB,k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AqB,CAAC;AAC7B,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
package/dist/index.js CHANGED
@@ -6,9 +6,11 @@
6
6
  * SemVer (see CLAUDE.md); everything else is internal.
7
7
  */
8
8
  export { VERSION } from './version.js';
9
+ export { EPSILON } from './tolerances.js';
9
10
  export { crystalFamily, latticeBasis, } from './lattice.js';
10
- export { angleBetweenDirections, angleBetweenPlanes, isValidCell, latticeFromParameters, latticeParameters, metricTensor, reciprocalBasis, } from './cell.js';
11
- export { changeOfAxes, directionFromFourIndices, directionToFourIndices, planeFromFourIndices, planeToFourIndices, reduceIndices, zoneAxis, } from './indices.js';
11
+ export { angleBetweenDirections, angleBetweenPlanes, faceNormal, isValidCell, latticeFromParameters, latticeParameters, metricTensor, reciprocalBasis, } from './cell.js';
12
+ export { directionFromFourIndices, directionToFourIndices, planeFromFourIndices, planeToFourIndices, millerIndices, reduceIndices, zoneAxis, } from './indices.js';
13
+ export { changeOfCoordinates, } from './coordinates.js';
12
14
  export { LATTICE_SYMMETRY_DIRECTIONS } from './symmetryDirections.js';
13
- export { CRYSTAL_FORM_TYPES, POINT_GROUP_KEYS, TENSOR_PROPERTIES, allowedProperties, allowedPropertiesOf, allowsProperty, allowsPropertyOf, crystalForms, describeOperations, describeOperationsOf, findPointGroup, generators, holohedry, isCentrosymmetricOf, isChiralOf, isPointGroupKey, latticeOperations, residualOperations, operations, orbit, orbitOf, pointGroup, pointGroupOf, pointGroups, rotateTensor, settings, siteSymmetry, symbol, symmetryDirections, tensorForm, tensorFormOf, wyckoffPositionOf, wyckoffPositions, } from './crystalClasses.js';
15
+ export { CRYSTAL_FORM_TYPES, POINT_GROUP_KEYS, TENSOR_PROPERTIES, allowedProperties, allowedPropertiesOf, allowsProperty, allowsPropertyOf, crystalForms, describeOperations, describeOperationsOf, findPointGroup, generators, holohedry, isCentrosymmetricOf, isEnantiomorphicOf, isPointGroupKey, latticeSystems, residualOperations, operations, orbit, orbitOf, pointGroup, pointGroupOf, pointGroups, rotateTensor, toVoigt, fromVoigt, settings, siteSymmetry, siteSymmetryOf, symbol, symmetryDirections, tensorForm, tensorFormOf, wyckoffPosition, wyckoffPositions, } from './crystalClasses.js';
14
16
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC,OAAO,EACL,aAAa,EACb,YAAY,GAIb,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,WAAW,EACX,qBAAqB,EACrB,iBAAiB,EACjB,YAAY,EACZ,eAAe,GAMhB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,YAAY,EACZ,wBAAwB,EACxB,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,EACb,QAAQ,GAGT,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,2BAA2B,EAAY,MAAM,yBAAyB,CAAC;AAShF,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACd,UAAU,EACV,SAAS,EACT,mBAAmB,EACnB,UAAU,EACV,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,UAAU,EACV,KAAK,EACL,OAAO,EACP,UAAU,EACV,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,kBAAkB,EAClB,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,GAUjB,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,EAAyB,MAAM,iBAAiB,CAAC;AAGjE,OAAO,EACL,aAAa,EACb,YAAY,GAKb,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,UAAU,EACV,WAAW,EACX,qBAAqB,EACrB,iBAAiB,EACjB,YAAY,EACZ,eAAe,GAKhB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,QAAQ,GAGT,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,mBAAmB,GAOpB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,2BAA2B,EAAY,MAAM,yBAAyB,CAAC;AAehF,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACd,UAAU,EACV,SAAS,EACT,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,UAAU,EACV,KAAK,EACL,OAAO,EACP,UAAU,EACV,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,OAAO,EACP,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,MAAM,EACN,kBAAkB,EAClB,UAAU,EACV,YAAY,EACZ,eAAe,EACf,gBAAgB,GAUjB,MAAM,qBAAqB,CAAC"}
package/dist/indices.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  /**
2
- * Miller and Miller–Bravais indices, the zone law and the change of axes
3
- * (docs/conventions.md, "Cell, metric and indices"). Plain integers and matrices in and out.
2
+ * Miller and Bravais–Miller indices and the zone law (docs/conventions.md, "Cell, metric and
3
+ * indices"); the change of the coordinate system is in coordinates.ts. Plain integers and matrices in and out.
4
4
  */
5
- import { type Mat3, type Vec3 } from './linalg.js';
6
- /** A direction [UVTW] or a plane (hkil) in four indices (Miller–Bravais). */
5
+ import { type Vec3 } from './linalg.js';
6
+ /** A direction [UVTW] or a plane (hkil) in four indices (Bravais–Miller). */
7
7
  export type FourIndices = readonly [number, number, number, number];
8
8
  /** The indices divided by their greatest common divisor, signs kept. Throws a RangeError for non-integers and for all zeros. */
9
- export declare function reduceIndices(indices: readonly number[]): number[];
9
+ export declare function reduceIndices(indices: readonly number[]): readonly number[];
10
10
  /** The plane (hkl) of hexagonal axes as (hkil) with i = −(h + k). */
11
11
  export declare function planeToFourIndices(hkl: Vec3): FourIndices;
12
12
  /** The plane (hkil) as (hkl); throws a RangeError unless i = −(h + k). */
@@ -20,23 +20,33 @@ export declare function directionToFourIndices(uvw: Vec3): FourIndices;
20
20
  export declare function directionFromFourIndices(uvtw: FourIndices): Vec3;
21
21
  /**
22
22
  * The zone axis [uvw] of two planes (hkl), which must not be zero vectors: the solution of the zone law hu + kv + lw = 0, the
23
- * cross product h₁ × h₂ reduced (so its sign follows the order of the planes), or `null` for parallel planes.
23
+ * cross product h₁ × h₂ reduced (so its sign follows the order of the planes), or `undefined` for parallel planes.
24
24
  */
25
- export declare function zoneAxis(h1: Vec3, h2: Vec3): Vec3 | null;
26
- /** The matrices that carry coordinates of a direction and indices of a plane to a new basis. */
27
- export interface AxisChange {
28
- /** Q = P⁻¹: the coordinates [uvw]′ = Q·[uvw] of a direction in the new basis. */
29
- readonly direction: Mat3;
30
- /** Pᵀ: the indices (hkl)′ = Pᵀ·(hkl) of a plane, i.e. (h′ k′ l′) = (h k l)·P. */
31
- readonly plane: Mat3;
25
+ export declare function zoneAxis(h1: Vec3, h2: Vec3): Vec3 | undefined;
26
+ /** The values of h, k, l substituted into printed Miller indices. */
27
+ export interface MillerValues {
28
+ /** The value of h, an integer. */
29
+ readonly h?: number;
30
+ /** The value of k, an integer. */
31
+ readonly k?: number;
32
+ /** The value of l, an integer. */
33
+ readonly l?: number;
32
34
  }
33
35
  /**
34
- * The transformation of indices for a change of basis (a′, b′, c′) = (a, b, c)·P (ITA Vol. A, 2006,
35
- * Section 5.1.3): the columns of `P` are the new basis vectors in the old one. The coordinates of a
36
- * direction transform with Q = P⁻¹, the indices of a plane with Pᵀ, so that hu + kv + lw is the same in
37
- * both bases. Throws a RangeError unless det P > 0 (a right-handed basis), and for a P that is
38
- * singular within rounding (the absolute value of det P at most 10⁻⁹ times the product of its
39
- * column lengths).
36
+ * Printed Miller indices, three or four (Bravais–Miller, hexagonal axes) separated by commas, as
37
+ * three numbers (hkl) with the given values of h, k, l; four lose i, which must be −(h + k). Internal:
38
+ * `fail` makes the error.
40
39
  */
41
- export declare function changeOfAxes(P: Mat3): AxisChange;
40
+ export declare function substituteMillerIndices(printed: string, values: MillerValues, fail: (message: string) => Error): Vec3;
41
+ /**
42
+ * The face (hkl) of printed Miller indices with the caller's values of h, k, l substituted (#137 G3):
43
+ * the printed `h,h,-2h,l` with h = 3 and l = 1 gives (3, 3, 1). The printed strings are those of
44
+ * `wyckoffPositions` and `crystalForms` (`millerIndices`), as ITA prints them: three indices, or four
45
+ * for hexagonal axes, of which i = −(h + k) is dropped, so that the face can be passed to `orbit`
46
+ * (`planeToFourIndices` gives the four). Each value is an integer; only the letters the string uses
47
+ * are needed. The face is not reduced, and whether the values keep it in its position (a general
48
+ * face (hkl) with h = k lies on a special one) is the caller's choice. Throws a RangeError for an
49
+ * unreadable string, a missing or non-integer value, an unknown key and the face (000).
50
+ */
51
+ export declare function millerIndices(printed: string, values: MillerValues): Vec3;
42
52
  //# sourceMappingURL=indices.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"indices.d.ts","sourceRoot":"","sources":["../src/indices.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAuC,KAAK,IAAI,EAAE,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;AAExF,6EAA6E;AAC7E,MAAM,MA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,kBAAkB,CAAC,GAAG,EAAE,IAAI,GAAG,WAAW,CAIzD;AAED,0EAA0E;AAC1E,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAK5D;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,IAAI,GAAG,WAAW,CAK7D;AAED,oHAAoH;AACpH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAMhE;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,CAS7D;AAED,qEAAqE;AACrE,MAAM,WAAW,YAAY;IAC3B,kCAAkC;IAClC,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC;IACpB,kCAAkC;IAClC,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC;IACpB,kCAAkC;IAClC,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC;CACrB;AA8BD;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,KAAK,GAAG,IAAI,CAUrH;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAuBzE"}
package/dist/indices.js CHANGED
@@ -1,8 +1,10 @@
1
1
  /**
2
- * Miller and Miller–Bravais indices, the zone law and the change of axes
3
- * (docs/conventions.md, "Cell, metric and indices"). Plain integers and matrices in and out.
2
+ * Miller and Bravais–Miller indices and the zone law (docs/conventions.md, "Cell, metric and
3
+ * indices"); the change of the coordinate system is in coordinates.ts. Plain integers and matrices in and out.
4
4
  */
5
- import { det, inverse, isSingular, transpose } from './linalg.js';
5
+ import { shown } from './checks.js';
6
+ import {} from './linalg.js';
7
+ import { deepFreeze } from './freeze.js';
6
8
  function gcd(a, b) {
7
9
  a = Math.abs(a);
8
10
  b = Math.abs(b);
@@ -15,7 +17,7 @@ function integers(v, who, length) {
15
17
  (length !== undefined && v.length !== length) ||
16
18
  v.length === 0 ||
17
19
  !v.every((x) => Number.isSafeInteger(x))) {
18
- throw new RangeError(`${who}: ${length === undefined ? 'a list of' : length} integers expected, not ${JSON.stringify(v)}`);
20
+ throw new RangeError(`${who}: ${length === undefined ? 'a list of' : length} integers expected, not ${shown(v)}`);
19
21
  }
20
22
  }
21
23
  /** The indices divided by their greatest common divisor, signs kept. Throws a RangeError for non-integers and for all zeros. */
@@ -24,21 +26,21 @@ export function reduceIndices(indices) {
24
26
  const g = indices.reduce(gcd, 0);
25
27
  if (g === 0)
26
28
  throw new RangeError('reduceIndices: all indices are zero');
27
- return indices.map((x) => x / g + 0);
29
+ return deepFreeze(indices.map((x) => x / g + 0));
28
30
  }
29
31
  /** The plane (hkl) of hexagonal axes as (hkil) with i = −(h + k). */
30
32
  export function planeToFourIndices(hkl) {
31
33
  integers(hkl, 'planeToFourIndices', 3);
32
34
  if (hkl.every((x) => x === 0))
33
35
  throw new RangeError('planeToFourIndices: zero vector');
34
- return [hkl[0] + 0, hkl[1] + 0, -(hkl[0] + hkl[1]) + 0, hkl[2] + 0];
36
+ return deepFreeze([hkl[0] + 0, hkl[1] + 0, -(hkl[0] + hkl[1]) + 0, hkl[2] + 0]);
35
37
  }
36
38
  /** The plane (hkil) as (hkl); throws a RangeError unless i = −(h + k). */
37
39
  export function planeFromFourIndices(hkil) {
38
40
  integers(hkil, 'planeFromFourIndices', 4);
39
41
  if (hkil[2] !== -(hkil[0] + hkil[1]))
40
- throw new RangeError(`planeFromFourIndices: i must be −(h + k) in ${JSON.stringify(hkil)}`);
41
- return [hkil[0] + 0, hkil[1] + 0, hkil[3] + 0];
42
+ throw new RangeError(`planeFromFourIndices: i must be −(h + k) in ${shown(hkil)}`);
43
+ return deepFreeze([hkil[0] + 0, hkil[1] + 0, hkil[3] + 0]);
42
44
  }
43
45
  /**
44
46
  * The direction [uvw] of hexagonal axes as [UVTW], reduced: U = (2u − v)/3, V = (2v − u)/3,
@@ -49,7 +51,7 @@ export function directionToFourIndices(uvw) {
49
51
  const [u, v, w] = uvw;
50
52
  if (u === 0 && v === 0 && w === 0)
51
53
  throw new RangeError('directionToFourIndices: zero vector');
52
- return reduceIndices([2 * u - v, 2 * v - u, -(u + v), 3 * w]);
54
+ return deepFreeze(reduceIndices([2 * u - v, 2 * v - u, -(u + v), 3 * w]));
53
55
  }
54
56
  /** The direction [UVTW] as [uvw], reduced: u = U − T, v = V − T, w = W; throws a RangeError unless T = −(U + V). */
55
57
  export function directionFromFourIndices(uvtw) {
@@ -58,12 +60,12 @@ export function directionFromFourIndices(uvtw) {
58
60
  throw new RangeError('directionFromFourIndices: zero vector');
59
61
  const [U, V, T, W] = uvtw;
60
62
  if (T !== -(U + V))
61
- throw new RangeError(`directionFromFourIndices: T must be −(U + V) in ${JSON.stringify(uvtw)}`);
62
- return reduceIndices([U - T, V - T, W]);
63
+ throw new RangeError(`directionFromFourIndices: T must be −(U + V) in ${shown(uvtw)}`);
64
+ return deepFreeze(reduceIndices([U - T, V - T, W]));
63
65
  }
64
66
  /**
65
67
  * The zone axis [uvw] of two planes (hkl), which must not be zero vectors: the solution of the zone law hu + kv + lw = 0, the
66
- * cross product h₁ × h₂ reduced (so its sign follows the order of the planes), or `null` for parallel planes.
68
+ * cross product h₁ × h₂ reduced (so its sign follows the order of the planes), or `undefined` for parallel planes.
67
69
  */
68
70
  export function zoneAxis(h1, h2) {
69
71
  integers(h1, 'zoneAxis', 3);
@@ -74,28 +76,96 @@ export function zoneAxis(h1, h2) {
74
76
  if (!c.every((x) => Number.isSafeInteger(x)))
75
77
  throw new RangeError('zoneAxis: the cross product exceeds the safe integers');
76
78
  if (c.every((x) => x === 0))
77
- return null;
78
- return reduceIndices(c);
79
+ return undefined;
80
+ return deepFreeze(reduceIndices(c));
79
81
  }
80
82
  /**
81
- * The transformation of indices for a change of basis (a′, b′, c′) = (a, b, c)·P (ITA Vol. A, 2006,
82
- * Section 5.1.3): the columns of `P` are the new basis vectors in the old one. The coordinates of a
83
- * direction transform with Q = P⁻¹, the indices of a plane with Pᵀ, so that hu + kv + lw is the same in
84
- * both bases. Throws a RangeError unless det P > 0 (a right-handed basis), and for a P that is
85
- * singular within rounding (the absolute value of det P at most 10⁻⁹ times the product of its
86
- * column lengths).
83
+ * One printed index as a number: a term (`h`, `-2h`, `0`, `1`) or a sum of terms (`-h-k`, `2k-h`, as
84
+ * printed for rhombohedral axes); `i` is −(h + k). `fail` makes the error: a RangeError for a
85
+ * caller's string, a plain Error for the transcribed data.
87
86
  */
88
- export function changeOfAxes(P) {
89
- if (!Array.isArray(P) ||
90
- P.length !== 3 ||
91
- !P.every((r) => Array.isArray(r) && r.length === 3 && r.every((x) => Number.isFinite(x)))) {
92
- throw new RangeError('changeOfAxes: P must be a 3×3 matrix of finite numbers');
87
+ function printedIndex(component, values, fail) {
88
+ // A term is a signed number, or a signed letter with an optional factor; terms after the first
89
+ // begin with their sign, so that run-together terms (`hk`, `h2`) are unreadable.
90
+ if (!/^-?(\d+|\d*[hkil])([+-](\d+|\d*[hkil]))*$/.test(component))
91
+ throw fail(`Unreadable Miller index: ${component}`);
92
+ const terms = component.match(/[+-]?\d*[hkil]?/g).filter((t) => t !== '');
93
+ const value = (letter) => {
94
+ const v = values[letter];
95
+ if (v === undefined)
96
+ throw fail(`The Miller index ${component} needs a value of ${letter}`);
97
+ return v;
98
+ };
99
+ const result = terms.reduce((sum, term) => {
100
+ const m = /^([+-]?)(\d*)([hkil]?)$/.exec(term);
101
+ const sign = m[1] === '-' ? -1 : 1;
102
+ const factor = m[2] === '' ? 1 : Number(m[2]);
103
+ if (!Number.isSafeInteger(factor))
104
+ throw fail(`The factor in ${component} is not a safe integer`);
105
+ if (m[3] === '')
106
+ return sum + sign * factor;
107
+ if (m[3] === 'i')
108
+ return sum + sign * factor * -(value('h') + value('k'));
109
+ return sum + sign * factor * value(m[3]);
110
+ }, 0);
111
+ if (!Number.isSafeInteger(result))
112
+ throw fail(`The Miller index ${component} is not a safe integer: ${result}`);
113
+ return result;
114
+ }
115
+ /**
116
+ * Printed Miller indices, three or four (Bravais–Miller, hexagonal axes) separated by commas, as
117
+ * three numbers (hkl) with the given values of h, k, l; four lose i, which must be −(h + k). Internal:
118
+ * `fail` makes the error.
119
+ */
120
+ export function substituteMillerIndices(printed, values, fail) {
121
+ const components = printed.split(',').map((c) => c.trim());
122
+ // i is the third of four indices; ITA prints no i among three.
123
+ if (components.length === 3 && components.some((c) => c.includes('i'))) {
124
+ throw fail(`Unreadable Miller indices: ${printed} (i among three indices)`);
125
+ }
126
+ const parts = components.map((c) => printedIndex(c, values, fail) + 0);
127
+ if (parts.length === 3)
128
+ return [parts[0], parts[1], parts[2]];
129
+ if (parts.length === 4 && parts[2] === -(parts[0] + parts[1]))
130
+ return [parts[0], parts[1], parts[3]];
131
+ throw fail(`Unreadable Miller indices: ${printed}`);
132
+ }
133
+ /**
134
+ * The face (hkl) of printed Miller indices with the caller's values of h, k, l substituted (#137 G3):
135
+ * the printed `h,h,-2h,l` with h = 3 and l = 1 gives (3, 3, 1). The printed strings are those of
136
+ * `wyckoffPositions` and `crystalForms` (`millerIndices`), as ITA prints them: three indices, or four
137
+ * for hexagonal axes, of which i = −(h + k) is dropped, so that the face can be passed to `orbit`
138
+ * (`planeToFourIndices` gives the four). Each value is an integer; only the letters the string uses
139
+ * are needed. The face is not reduced, and whether the values keep it in its position (a general
140
+ * face (hkl) with h = k lies on a special one) is the caller's choice. Throws a RangeError for an
141
+ * unreadable string, a missing or non-integer value, an unknown key and the face (000).
142
+ */
143
+ export function millerIndices(printed, values) {
144
+ if (typeof printed !== 'string')
145
+ throw new RangeError(`millerIndices: printed Miller indices expected, not ${shown(printed)}`);
146
+ if (values === null || typeof values !== 'object' || Array.isArray(values)) {
147
+ throw new RangeError(`millerIndices: values { h, k, l } expected, not ${shown(values)}`);
148
+ }
149
+ for (const key of Object.keys(values)) {
150
+ if (!['h', 'k', 'l'].includes(key))
151
+ throw new RangeError(`millerIndices: unknown value ${shown(key)} (h, k or l)`);
93
152
  }
94
- if (!(det(P) > 0))
95
- throw new RangeError('changeOfAxes: det P must be positive (a right-handed basis)');
96
- if (isSingular(P))
97
- throw new RangeError('changeOfAxes: P is singular within rounding');
98
- const clean = (m) => m.map((r) => r.map((x) => x + 0)); // no −0
99
- return { direction: clean(inverse(P)), plane: clean(transpose(P)) };
153
+ // The own values only, each checked as it is read (an inherited or non-enumerable one included).
154
+ const own = {};
155
+ for (const letter of ['h', 'k', 'l']) {
156
+ if (!Object.hasOwn(values, letter))
157
+ continue;
158
+ const v = values[letter];
159
+ if (v === undefined)
160
+ continue;
161
+ if (!Number.isSafeInteger(v))
162
+ throw new RangeError(`millerIndices: ${letter} must be an integer, not ${shown(v)}`);
163
+ own[letter] = v;
164
+ }
165
+ // Spaces around the commas are allowed; a space inside an index is unreadable.
166
+ const hkl = substituteMillerIndices(printed, own, (m) => new RangeError(`millerIndices: ${m}`));
167
+ if (hkl.every((x) => x === 0))
168
+ throw new RangeError(`millerIndices: ${printed} gives the face (000) with ${shown(values)}`);
169
+ return deepFreeze(hkl);
100
170
  }
101
171
  //# sourceMappingURL=indices.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"indices.js","sourceRoot":"","sources":["../src/indices.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAwB,MAAM,aAAa,CAAC;AAKxF,SAAS,GAAG,CAAC,CAAS,EAAE,CAAS;IAC/B,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAChB,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAChB,OAAO,CAAC;QAAE,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC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AAC;IACrH,CAAC;IACD,iGAAiG;IACjG,MAAM,GAAG,GAA2C,EAAE,CAAC;IACvD,KAAK,MAAM,MAAM,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAU,EAAE,CAAC;QAC9C,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;YAAE,SAAS;QAC7C,MAAM,CAAC,GAAY,MAAM,CAAC,MAAM,CAAC,CAAC;QAClC,IAAI,CAAC,KAAK,SAAS;YAAE,SAAS;QAC9B,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;YAAE,MAAM,IAAI,UAAU,CAAC,kBAAkB,MAAM,4BAA4B,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACnH,GAAG,CAAC,MAAM,CAAC,GAAG,CAAW,CAAC;IAC5B,CAAC;IACD,+EAA+E;IAC/E,MAAM,GAAG,GAAG,uBAAuB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,UAAU,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC,CAAC;IAChG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;QAC3B,MAAM,IAAI,UAAU,CAAC,kBAAkB,OAAO,8BAA8B,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC/F,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC"}
package/dist/lattice.d.ts CHANGED
@@ -7,8 +7,22 @@ import type { Mat3 } from './linalg.js';
7
7
  export type CrystalSystem = 'triclinic' | 'monoclinic' | 'orthorhombic' | 'tetragonal' | 'trigonal' | 'hexagonal' | 'cubic';
8
8
  /** One of the six crystal families: the trigonal and the hexagonal system form the hexagonal family. */
9
9
  export type CrystalFamily = 'triclinic' | 'monoclinic' | 'orthorhombic' | 'tetragonal' | 'hexagonal' | 'cubic';
10
- /** The crystal family of a crystal system: trigonal and hexagonal form the hexagonal family. */
10
+ /**
11
+ * The crystal family of a crystal system: trigonal and hexagonal form the hexagonal family. Throws
12
+ * a RangeError for anything that is not one of the seven crystal systems.
13
+ */
11
14
  export declare function crystalFamily(system: CrystalSystem): CrystalFamily;
15
+ /**
16
+ * One of the seven lattice systems of ITA Table 1.3.4.1 (p. 39): the lattices whose point symmetry
17
+ * is the same holohedry. The hexagonal family has two, `'hexagonal'` (hP) and `'rhombohedral'` (hR).
18
+ */
19
+ export type LatticeSystem = 'triclinic' | 'monoclinic' | 'orthorhombic' | 'tetragonal' | 'hexagonal' | 'rhombohedral' | 'cubic';
20
+ /**
21
+ * The lattice systems on which the point groups of a crystal system act (ITA § 1.3.4.4.2, p. 39):
22
+ * both of the hexagonal family for the trigonal system, which belongs to either depending on the
23
+ * basis, otherwise the one of the same name.
24
+ */
25
+ export declare function latticeSystemsOfSystem(system: CrystalSystem): readonly LatticeSystem[];
12
26
  /** The families whose cell angles are fixed, so that their lattice basis is fixed up to edge lengths. */
13
27
  export type FixedAngleFamily = 'orthorhombic' | 'tetragonal' | 'hexagonal' | 'cubic';
14
28
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"lattice.d.ts","sourceRoot":"","sources":["../src/lattice.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAExC,wCAAwC;AACxC,MAAM,MAAM,aAAa,GACvB,WAAW,GAAG,YAAY,GAAG,cAAc,GAAG,YAAY,GAAG,UAAU,GAAG,WAAW,GAAG,OAAO,CAAC;AAElG,wGAAwG;AACxG,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,YAAY,GAAG,cAAc,GAAG,YAAY,GAAG,WAAW,GAAG,OAAO,CAAC;AAE/G,gGAAgG;AAChG,wBAAgB,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa,CAElE;AAED,yGAAyG;AACzG,MAAM,MAAM,gBAAgB,GAAG,cAAc,GAAG,YAAY,GAAG,WAAW,GAAG,OAAO,CAAC;AAoBrF;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAW3D"}
1
+ {"version":3,"file":"lattice.d.ts","sourceRoot":"","sources":["../src/lattice.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAExC,wCAAwC;AACxC,MAAM,MAAM,aAAa,GACvB,WAAW,GAAG,YAAY,GAAG,cAAc,GAAG,YAAY,GAAG,UAAU,GAAG,WAAW,GAAG,OAAO,CAAC;AAElG,wGAAwG;AACxG,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,YAAY,GAAG,cAAc,GAAG,YAAY,GAAG,WAAW,GAAG,OAAO,CAAC;AAY/G;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa,CAGlE;AAED;;;GAGG;AACH,MAAM,MAAM,aAAa,GACvB,WAAW,GAAG,YAAY,GAAG,cAAc,GAAG,YAAY,GAAG,WAAW,GAAG,cAAc,GAAG,OAAO,CAAC;AAEtG;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,aAAa,GAAG,SAAS,aAAa,EAAE,CAItF;AASD,yGAAyG;AACzG,MAAM,MAAM,gBAAgB,GAAG,cAAc,GAAG,YAAY,GAAG,WAAW,GAAG,OAAO,CAAC;AAoBrF;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAW3D"}
package/dist/lattice.js CHANGED
@@ -2,10 +2,39 @@
2
2
  * Crystal systems and families, and how the conventional lattice basis sits in the Cartesian frame
3
3
  * of symcrys (docs/conventions.md, "Cartesian frame").
4
4
  */
5
- /** The crystal family of a crystal system: trigonal and hexagonal form the hexagonal family. */
5
+ import { shown } from './checks.js';
6
+ const SYSTEMS = [
7
+ 'triclinic',
8
+ 'monoclinic',
9
+ 'orthorhombic',
10
+ 'tetragonal',
11
+ 'trigonal',
12
+ 'hexagonal',
13
+ 'cubic',
14
+ ];
15
+ /**
16
+ * The crystal family of a crystal system: trigonal and hexagonal form the hexagonal family. Throws
17
+ * a RangeError for anything that is not one of the seven crystal systems.
18
+ */
6
19
  export function crystalFamily(system) {
20
+ if (!SYSTEMS.includes(system))
21
+ throw new RangeError(`Unknown crystal system: ${shown(system)}`);
7
22
  return system === 'trigonal' ? 'hexagonal' : system;
8
23
  }
24
+ /**
25
+ * The lattice systems on which the point groups of a crystal system act (ITA § 1.3.4.4.2, p. 39):
26
+ * both of the hexagonal family for the trigonal system, which belongs to either depending on the
27
+ * basis, otherwise the one of the same name.
28
+ */
29
+ export function latticeSystemsOfSystem(system) {
30
+ if (!SYSTEMS.includes(system))
31
+ throw new RangeError(`Unknown crystal system: ${shown(system)}`);
32
+ if (system === 'trigonal')
33
+ return TRIGONAL;
34
+ return LATTICE_SYSTEM_OF[system];
35
+ }
36
+ const TRIGONAL = Object.freeze(['hexagonal', 'rhombohedral']);
37
+ const LATTICE_SYSTEM_OF = Object.freeze(Object.fromEntries(['triclinic', 'monoclinic', 'orthorhombic', 'tetragonal', 'hexagonal', 'cubic'].map((s) => [s, Object.freeze([s])])));
9
38
  const S3_2 = Math.sqrt(3) / 2;
10
39
  /** A deeply frozen matrix: the apps run dist/ as plain JavaScript, where `readonly` does not hold. */
11
40
  const frozen = (m) => Object.freeze(m.map((row) => Object.freeze(row)));
@@ -1 +1 @@
1
- {"version":3,"file":"lattice.js","sourceRoot":"","sources":["../src/lattice.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,gGAAgG;AAChG,MAAM,UAAU,aAAa,CAAC,MAAqB;IACjD,OAAO,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC;AACtD,CAAC;AAKD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI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CAAoB,CAAC;AAEvE,MAAM,WAAW,GAAG,MAAM,CAAC;IACzB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACT,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACT,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;CACV,CAAC,CAAC;AAEH,MAAM,SAAS,GAAG,MAAM,CAAC;IACvB,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;IACZ,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;IACZ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;CACV,CAAC,CAAC;AAEH;;;;;;;;;;GAUG;AACH,MAAM,UAAU,YAAY,CAAC,MAAwB;IACnD,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,WAAW;YACd,OAAO,SAAS,CAAC;QACnB,KAAK,cAAc,CAAC;QACpB,KAAK,YAAY,CAAC;QAClB,KAAK,OAAO;YACV,OAAO,WAAW,CAAC;QACrB;YACE,MAAM,IAAI,UAAU,CAAC,uDAAuD,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAClG,CAAC;AACH,CAAC"}
package/dist/linalg.d.ts CHANGED
@@ -21,8 +21,8 @@ export declare function rotationZ(angleDeg: number): Mat3;
21
21
  export declare function rotationX(angleDeg: number): Mat3;
22
22
  /** Proper rotation by `angleDeg` degrees about the y axis. */
23
23
  export declare function rotationY(angleDeg: number): Mat3;
24
- /** Replaces each entry within SNAP_EPSILON of an exact value by that value (this also turns −0 into 0). */
25
- export declare function snap(a: Mat3): Mat3;
24
+ /** Replaces each entry within `epsilon` (default SNAP_EPSILON) of an exact value by that value (this also turns −0 into 0). */
25
+ export declare function snap(a: Mat3, epsilon?: number): Mat3;
26
26
  /** True if all entries agree within EPSILON. */
27
27
  export declare function matricesEqual(a: Mat3, b: Mat3): boolean;
28
28
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"linalg.d.ts","sourceRo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E,OAAO,SAAe,GAAG,IAAI,CAM1D;AAED,gDAAgD;AAChD,wBAAgB,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,GAAG,OAAO,CAGvD;AAUD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,IAAI,GAAG,OAAO,CAI3C;AAED,sIAAsI;AACtI,wBAAgB,OAAO,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,CASrC;AAED,0DAA0D;AAC1D,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,GAAG,IAAI,CAEhD"}
package/dist/linalg.js CHANGED
@@ -83,12 +83,12 @@ export function rotationY(angleDeg) {
83
83
  * 45° setting frame (rotationZ(45), which is snapped as well).
84
84
  */
85
85
  const SNAP_VALUES = [0, 1, -1, 0.5, -0.5, Math.SQRT1_2, -Math.SQRT1_2, Math.sqrt(3) / 2, -Math.sqrt(3) / 2];
86
- /** Replaces each entry within SNAP_EPSILON of an exact value by that value (this also turns −0 into 0). */
87
- export function snap(a) {
86
+ /** Replaces each entry within `epsilon` (default SNAP_EPSILON) of an exact value by that value (this also turns −0 into 0). */
87
+ export function snap(a, epsilon = SNAP_EPSILON) {
88
88
  return build((i, j) => {
89
89
  const v = a[i][j];
90
90
  for (const s of SNAP_VALUES)
91
- if (Math.abs(v - s) < SNAP_EPSILON)
91
+ if (Math.abs(v - s) < epsilon)
92
92
  return s;
93
93
  return v;
94
94
  });
@@ -1 +1 @@
1
- {"version":3,"file":"linalg.js","sourceRoot":"","sources":["../src/linalg.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAQxD,MAAM,CAAC,MAAM,QAAQ,GAAS;IAC5B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACT,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACT,CAAC,CAAC,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AAO,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IACvD,CAAC,CAAC;IACF,OAAO,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACvE,CAAC;AAED,0DAA0D;AAC1D,MAAM,UAAU,SAAS,CAAC,CAAO,EAAE,CAAO;IACxC,OAAO,QAAQ,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAChD,CAAC"}
@@ -10,11 +10,13 @@
10
10
  * allows no time-odd property (docs/conventions.md, "Two entry points").
11
11
  */
12
12
  export { VERSION } from './version.js';
13
+ export { EPSILON, type ToleranceOptions } from './tolerances.js';
13
14
  export type { Mat3, Vec3 } from './linalg.js';
14
- export type { Operation } from './operations.js';
15
- export { crystalFamily, latticeBasis, type CrystalFamily, type CrystalSystem, type FixedAngleFamily, } from './lattice.js';
16
- export { angleBetweenDirections, angleBetweenPlanes, isValidCell, latticeFromParameters, latticeParameters, metricTensor, reciprocalBasis, type CellAngles, type CellOperation, type IsValidCellOptions, type LatticeParameters, type ResidualOperationsOptions, } from './cell.js';
17
- export { changeOfAxes, directionFromFourIndices, directionToFourIndices, planeFromFourIndices, planeToFourIndices, reduceIndices, zoneAxis, type AxisChange, type FourIndices, } from './indices.js';
15
+ export type { CartesianOperation, Operation } from './operations.js';
16
+ export { crystalFamily, latticeBasis, type CrystalFamily, type CrystalSystem, type FixedAngleFamily, type LatticeSystem, } from './lattice.js';
17
+ export { angleBetweenDirections, angleBetweenPlanes, faceNormal, isValidCell, latticeFromParameters, latticeParameters, metricTensor, reciprocalBasis, type CellAngles, type CellOperation, type IsValidCellOptions, type LatticeParameters, } from './cell.js';
18
+ export { directionFromFourIndices, directionToFourIndices, planeFromFourIndices, planeToFourIndices, millerIndices, reduceIndices, zoneAxis, type FourIndices, type MillerValues, } from './indices.js';
19
+ export { changeOfCoordinates, type AffineOperation, type CoordinateChange, type CoordinateQuantities, type CoordinateTransformation, type InverseTransformation, type TransformedOperation, } from './coordinates.js';
18
20
  import type { PointGroupKey as ClassKey, MagneticPointGroupKey, PointGroup as PointGroupOf, PointGroupInSetting as PointGroupInSettingOf } from './pointGroups/pointGroups.js';
19
21
  /**
20
22
  * The key of a crystal class, one of the 32: the type of `crystalClass` and `laueClass` of a point
@@ -27,15 +29,17 @@ export type PointGroupKey = MagneticPointGroupKey;
27
29
  export type PointGroup<K extends PointGroupKey = PointGroupKey> = PointGroupOf<K>;
28
30
  /** A point group in a given setting. */
29
31
  export type PointGroupInSetting = PointGroupInSettingOf<PointGroupKey>;
30
- export { MAGNETIC_POINT_GROUP_KEYS as POINT_GROUP_KEYS, findMagneticPointGroup as findPointGroup, generators, isMagneticPointGroupKey as isPointGroupKey, magneticPointGroups as pointGroups, operations, pointGroup, settings, symbol, type Convention, type PointGroupType, type Setting, type SettingOptions, type SymbolOptions, } from './pointGroups/pointGroups.js';
31
- export { holohedry, isCentrosymmetricOf, isChiralOf } from './pointGroups/properties.js';
32
+ export { MAGNETIC_POINT_GROUP_KEYS as POINT_GROUP_KEYS, findMagneticPointGroup as findPointGroup, generators, isMagneticPointGroupKey as isPointGroupKey, latticeSystems, magneticPointGroups as pointGroups, operations, pointGroup, settings, symbol, type PointGroupType, type Setting, type AxesOptions, type SettingOptions, type SymbolOptions, } from './pointGroups/pointGroups.js';
33
+ export { holohedry, isCentrosymmetricOf, isEnantiomorphicOf } from './pointGroups/properties.js';
32
34
  export { LATTICE_SYMMETRY_DIRECTIONS, type Uvw } from './symmetryDirections.js';
33
35
  export { describeOperations, symmetryDirections, type Axis, type DirectionElements, type OperationDescription, type OperationKind, type SymmetryDirection, } from './pointGroups/elements.js';
34
36
  export { residualMagneticOperations as residualOperations, type MagneticCellOperation } from './cell.js';
35
- export { siteSymmetry, type SiteSymmetry, type SiteSymmetryOptions } from './siteSymmetry.js';
36
- export { describeOperationsOf, pointGroupOf, type CartesianAxis, type CartesianOperationDescription, type IdentifiedPointGroup, type PointGroupOfOptions, } from './pointGroups/identify.js';
37
- export { latticeOperations, orbit, orbitOf, type DirectionOrbitEntry, type FaceOrbitEntry, type OrbitOptions, type OrbitPole, } from './pointGroups/orbits.js';
38
- export { rotateTensor, tensorForm, tensorFormOf, type IntrinsicSymmetry, type TensorForm, type TensorParity, type TensorRank, type TensorSpec, type TimeParity, } from './tensors/tensorForm.js';
37
+ export { siteSymmetryOf, type SiteSymmetry } from './siteSymmetry.js';
38
+ export { siteSymmetry } from './pointGroups/wyckoff.js';
39
+ export { describeOperationsOf, pointGroupOf, type CartesianAxis, type CartesianOperationDescription, type IdentifiedPointGroup, } from './pointGroups/identify.js';
40
+ export { orbit, orbitOf, type DirectionIndices, type DirectionOrbitEntry, type FaceIndices, type FaceOrbitEntry, type OrbitPole, } from './pointGroups/orbits.js';
41
+ export { rotateTensor, tensorForm, tensorFormOf, type IntrinsicSymmetry, type TensorForm, type TensorKind, type TensorRank, type TensorSpec, type TimeParity, } from './tensors/tensorForm.js';
39
42
  export { TENSOR_PROPERTIES, type TensorProperty, type TensorPropertyName } from './tensors/propertyTable.js';
43
+ export { fromVoigt, toVoigt, type VoigtFactor, type VoigtOptions } from './tensors/voigt.js';
40
44
  export { allowedProperties, allowedPropertiesOf, allowsProperty, allowsPropertyOf, } from './tensors/tensorProperties.js';
41
45
  //# sourceMappingURL=magnetic.d.ts.map