symcrys 0.4.0 → 0.5.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.
package/README.md CHANGED
@@ -1,149 +1,21 @@
1
1
  # symcrys
2
2
 
3
- Crystallographic symmetry calculations in TypeScript: point groups, both crystallographic and
4
- magnetic, with their settings, symbols and properties, and the property tensors they allow. A
5
- library without runtime dependencies that runs unbundled in browsers and in Node.
6
-
7
- > **Status: pre-release.** So far: the 32 crystallographic point groups with their symmetry elements,
8
- > site symmetry and Wyckoff positions, and the forms of property tensors of rank 0 to 4.
9
- > The API will change without notice until 1.0.0.
10
-
11
- ## Scope
12
-
13
- symcrys holds calculations, not presentation. Planned, in this order:
14
-
15
- 1. Point groups: the 32 crystallographic and the 122 magnetic point groups as data (generators),
16
- group generation, settings, Hermann–Mauguin, Schoenflies and Shubnikov symbols, derived
17
- properties (centrosymmetric, polar, chiral, magnetoelectric …), subgroups.
18
- 2. Plane groups.
19
- 3. Space groups.
20
-
21
- Property tensors: the symmetry-reduced form of a tensor of rank 0 to 4 under a point group or any
22
- set of operations, from birss-app; results are numbers (coefficient matrices). Rendering (LaTeX,
23
- SVG, relation strings, view models) and translated display names stay in the applications that use
24
- symcrys.
25
-
26
- **Conventions.** Point groups follow the _International Tables for Crystallography_ by default
27
- (Vol. A for the crystal classes, Vol. D Ch. 1.5 for the magnetic point groups). The convention of
28
- Birss, _Symmetry and Magnetism_ (1966), is available as an option. Where the two differ is
29
- documented in [`docs/conventions.md`](docs/conventions.md).
30
-
31
- symcrys is the computational core of the crystallography teaching apps
32
- ([stereography](https://github.com/manganite/stereography),
33
- [plane-groups](https://github.com/manganite/plane-groups)) and of
34
- [birss-app](https://github.com/manganite/birss-app); its calculations start from those of
35
- birss-app.
36
-
37
- ## Use
3
+ Crystallographic symmetry calculations in TypeScript: point groups with their settings, symbols,
4
+ symmetry elements, site symmetry and Wyckoff positions, and the forms of property tensors they
5
+ allow. A library without runtime dependencies that runs unbundled in browsers and in Node.
38
6
 
39
7
  ```bash
40
8
  npm install symcrys
41
9
  ```
42
10
 
43
- Each release on GitHub also carries the package as `symcrys-X.Y.Z.tgz`.
44
-
45
11
  ```ts
46
- import {
47
- describeOperations,
48
- isPiezoelectric,
49
- operations,
50
- settings,
51
- siteSymmetry,
52
- symbol,
53
- symmetryDirections,
54
- tensorForm,
55
- tensorFormOf,
56
- wyckoffPositionOf,
57
- wyckoffPositions,
58
- } from 'symcrys';
12
+ import { operations, symbol, tensorForm } from 'symcrys';
59
13
 
60
14
  symbol('32'); // '321': ITC short symbol of the default setting
61
- symbol('32', { convention: 'birss' }); // '32'
62
- settings('32'); // setting 1: 312, setting 2: 321 (the ITC default)
63
15
  operations('-3m'); // 12 operations, Cartesian matrices; x ∥ a, z ∥ c
64
- describeOperations('4')[2]; // { kind: 'rotation', order: 4, sense: '+', axis: { lattice: [0, 0, 1], … } }
65
- symmetryDirections('4mm')[1]; // position 2: symbol 'm', directions [100] and [010], each with a mirror
66
- wyckoffPositions('4mm')[2]; // { letter: 'b', multiplicity: 4, siteSymmetry: '..m', millerIndices: 'h,h,l', … }
67
- wyckoffPositionOf('4mm', [0, 0, -1]).letter; // 'a'
68
-
69
- const SHG = { rank: 3, parity: 'polar', timeParity: 'i', intrinsic: 'jk' } as const;
70
- tensorForm('mm2', SHG).parameters; // [[0,0,2], [1,1,2], [2,0,0], [2,1,1], [2,2,2]]: xxz, yyz, zxx, zyy, zzz
71
- tensorForm('3m', SHG, { convention: 'birss' }).parameters[0]; // [0, 0, 0]: xxx (ITC default 3m1: xxy)
72
- isPiezoelectric('432'); // false
73
- // SHG at the (111) surface of an m-3m crystal: the form under the site symmetry of the normal
74
- const ops = operations('m-3m');
75
- tensorFormOf(
76
- siteSymmetry(ops, [1, 1, 1]).operations.map((i) => ops[i]),
77
- SHG,
78
- ).basis.length; // 4
79
- ```
80
-
81
- A form gives the components by flat index (first index slowest: xyz of rank 3 is 5), the basis in
82
- reduced row echelon form and the relations as coefficient rows; see
83
- [`docs/conventions.md`](docs/conventions.md), "Tensors".
84
-
85
- Conventions, frames and symbols: [`docs/conventions.md`](docs/conventions.md).
86
-
87
- Without a build step, copy `dist/` (from the tarball, or built with `npm run build`) next to your
88
- code and import `dist/index.js` directly: every module in `dist/` imports only relative `.js`
89
- paths.
90
-
91
- ## Development
92
-
93
- Development requires Node 22 (22.13 or later) or 24; CI runs on both. The library itself needs only
94
- an ES2022 runtime with ES modules.
95
-
96
- ```bash
97
- npm install
98
- npm run typecheck # TypeScript 6: tests and scripts with Node types, library code without
99
- npm run typecheck:ts7 # the same with TypeScript 7
100
- npm run lint # ESLint
101
- npm run format:check # Prettier (npm run format fixes)
102
- npm test # vitest
103
- npm run build # dist/: JavaScript, .d.ts, source maps
104
- npm run check:dist # dist/ loads, imports only relative .js paths, has no test-only code
16
+ tensorForm('mm2', { rank: 3, parity: 'polar', timeParity: 'i', intrinsic: 'jk' }).parameters;
17
+ // [[0,0,2], [1,1,2], [2,0,0], [2,1,1], [2,2,2]]: xxz, yyz, zxx, zyy, zzz
105
18
  ```
106
19
 
107
- Audits under `audit/` compare the code bases symcrys draws on. They are run by hand, with
108
- [birss-app](https://github.com/manganite/birss-app) and
109
- [stereography](https://github.com/manganite/stereography) checked out next to this repository:
110
- `npm run audit:point-groups` writes `audit/point-groups/report.md`, and `npm run audit:birss-app`
111
- captures the pins of the Birss convention as JSON (`src/pointGroups/birssApp.pins.json` for the
112
- operations, `src/tensors/birssApp.pins.json` for the tensor forms).
113
-
114
- CI runs these seven gates on every pull request, on Node 22 and 24. Tests sit next to their
115
- module (`foo.ts`, `foo.test.ts`). Working rules for contributors, human or agent: `CLAUDE.md`.
116
-
117
- ## Releases
118
-
119
- 1. Release PR: version in `package.json`, `package-lock.json` (`npm install --package-lock-only`)
120
- and `src/version.ts`; move the `Unreleased` entries of `CHANGELOG.md` under
121
- `## [X.Y.Z] - YYYY-MM-DD` and update the link definitions at the bottom (`[Unreleased]` compares
122
- `vX.Y.Z...HEAD`, `[X.Y.Z]` compares the previous tag with `vX.Y.Z`).
123
- 2. After the merge: `git fetch origin`, check that `origin/main` is the merge commit of the release PR,
124
- then `git tag -a vX.Y.Z -m "symcrys X.Y.Z" origin/main && git push origin vX.Y.Z`.
125
- 3. The tag runs `.github/workflows/release.yml`: it checks that the tag matches `package.json`,
126
- runs all gates, and creates the GitHub release with the `CHANGELOG.md` section as notes and the
127
- `npm pack` tarball attached. Check that the workflow is green and the release carries
128
- `symcrys-X.Y.Z.tgz`.
129
-
130
- **npm.** The `npm` job of `release.yml` submits the same tarball to npm as a staged version
131
- (trusted publishing, no token). Its log shows the tarball's shasum and integrity and the stage id. The version
132
- goes live only after approval with two-factor authentication (npm 11.15 or later):
133
-
134
- 1. `npm stage list symcrys`, then `npm stage view <stage-id>`: version and shasum must match the log
135
- of the `npm` job (or "Staged Packages" on npmjs.com).
136
- 2. `npm stage approve <stage-id>`. npm first runs an automated review of the staged version; until
137
- it has finished, approval fails with `E409 … automated review hasn't finished`. Then approve again
138
- a little later (for 0.1.1 it took a few minutes).
139
- 3. `npm view symcrys` shows the version as `latest`.
140
-
141
- If staging fails, re-run the `npm` job (a staged version cannot be staged twice, so check
142
- `npm stage list` first). An authentication error usually means the trusted publisher on npmjs.com
143
- does not match (repository, workflow `release.yml`); the stage step runs with `--loglevel verbose`,
144
- so its log shows the OIDC exchange. As a fallback, stage the release asset by hand:
145
- `npm stage publish ./symcrys-X.Y.Z.tgz` (then without provenance, which only CI can attest).
146
-
147
- ## Licence
148
-
149
- [MIT](LICENSE) © 2026 Thomas Lottermoser
20
+ Documentation, conventions (ITC and Birss) and their print sources, and the Python package of the
21
+ same version: [github.com/manganite/symcrys](https://github.com/manganite/symcrys).
package/dist/version.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  /** Version of symcrys. Kept equal to `version` in package.json (checked by version.test.ts). */
2
- export declare const VERSION = "0.4.0";
2
+ export declare const VERSION = "0.5.0";
3
3
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  /** Version of symcrys. Kept equal to `version` in package.json (checked by version.test.ts). */
2
- export const VERSION = '0.4.0';
2
+ export const VERSION = '0.5.0';
3
3
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "symcrys",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Crystallographic symmetry calculations: point groups (crystallographic and magnetic), their settings, symbols and properties, and property tensors. TypeScript library without dependencies.",
5
5
  "keywords": [
6
6
  "crystallography",
@@ -13,7 +13,8 @@
13
13
  "license": "MIT",
14
14
  "repository": {
15
15
  "type": "git",
16
- "url": "git+https://github.com/manganite/symcrys.git"
16
+ "url": "git+https://github.com/manganite/symcrys.git",
17
+ "directory": "packages/ts"
17
18
  },
18
19
  "bugs": "https://github.com/manganite/symcrys/issues",
19
20
  "homepage": "https://github.com/manganite/symcrys#readme",
@@ -37,30 +38,8 @@
37
38
  ],
38
39
  "sideEffects": false,
39
40
  "scripts": {
40
- "typecheck": "node node_modules/typescript/bin/tsc -p tsconfig.json && node node_modules/typescript/bin/tsc -p tsconfig.build.json --noEmit",
41
- "typecheck:ts7": "node node_modules/typescript7/bin/tsc -p tsconfig.json && node node_modules/typescript7/bin/tsc -p tsconfig.build.json --noEmit",
42
- "lint": "eslint .",
43
- "format": "prettier --write .",
44
- "format:check": "prettier --check .",
45
- "test": "vitest run",
46
- "test:watch": "vitest",
47
41
  "prebuild": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"",
48
- "build": "node node_modules/typescript/bin/tsc -p tsconfig.build.json",
49
- "check:dist": "node scripts/check-dist.mjs",
50
- "prepack": "npm run build",
51
- "audit:point-groups": "vitest run --config audit/point-groups/vitest.config.ts",
52
- "audit:birss-app": "vitest run --config audit/birss-app/vitest.config.ts",
53
- "audit:wyckoff-2006": "vitest run --config audit/wyckoff-2006/vitest.config.ts"
54
- },
55
- "devDependencies": {
56
- "@eslint/js": "10.0.1",
57
- "@types/node": "22.20.5",
58
- "eslint": "10.15.0",
59
- "globals": "17.14.0",
60
- "prettier": "3.9.10",
61
- "typescript": "6.0.3",
62
- "typescript-eslint": "8.73.0",
63
- "typescript7": "npm:typescript@7.0.2",
64
- "vitest": "5.1.0"
42
+ "build": "node ../../node_modules/typescript/bin/tsc -p tsconfig.build.json",
43
+ "prepack": "npm run build"
65
44
  }
66
45
  }
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  /** Version of symcrys. Kept equal to `version` in package.json (checked by version.test.ts). */
2
- export const VERSION = '0.4.0';
2
+ export const VERSION = '0.5.0';