@molcrafts/molrs 0.0.6 → 0.0.8

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/molrs_bg.js CHANGED
@@ -2,14 +2,14 @@
2
2
  * Column-oriented data store with typed arrays.
3
3
  *
4
4
  * Each column is identified by a string key and has a fixed data type
5
- * (`f32`, `i32`, `u32`, `string`). All columns in a block must have
5
+ * (`F`, `i32`, `u32`, `string`). All columns in a block must have
6
6
  * the same number of rows.
7
7
  *
8
8
  * # Supported column types
9
9
  *
10
10
  * | JS type | Rust type | dtype string | Setter | Getter (copy) | Getter (view) |
11
11
  * |---------|-----------|-------------|--------|---------------|---------------|
12
- * | `Float32Array` | `f32` | `"f32"` | `setColF32` | `copyColF32` | `viewColF32` |
12
+ * | `Float32Array` / `Float64Array` | `F` | `"f32"` / `"f64"` | `setColF` | `copyColF` | `viewColF` |
13
13
  * | `Int32Array` | `i32` | `"i32"` | `setColI32` | `copyColI32` | `viewColI32` |
14
14
  * | `Uint32Array` | `u32` | `"u32"` | `setColU32` | `copyColU32` | `viewColU32` |
15
15
  * | `string[]` | `String` | `"string"` | `setColStr` | `copyColStr` | -- |
@@ -18,12 +18,12 @@
18
18
  *
19
19
  * ```js
20
20
  * const block = new Block();
21
- * block.setColF32("x", new Float32Array([1.0, 2.0, 3.0]));
22
- * block.setColF32("y", new Float32Array([0.0, 0.0, 0.0]));
21
+ * block.setColF("x", coordsX);
22
+ * block.setColF("y", coordsY);
23
23
  * console.log(block.nrows()); // 3
24
24
  * console.log(block.keys()); // ["x", "y"]
25
25
  *
26
- * const x = block.copyColF32("x"); // owned copy, safe to keep
26
+ * const x = block.copyColF("x"); // owned copy, safe to keep
27
27
  * ```
28
28
  */
29
29
  export class Block {
@@ -45,9 +45,9 @@ export class Block {
45
45
  wasm.__wbg_block_free(ptr, 0);
46
46
  }
47
47
  /**
48
- * Owned `Float32Array` copy of a column.
48
+ * Owned JS float typed-array copy of a column.
49
49
  *
50
- * Returns a new JS `Float32Array` that is an independent copy of
50
+ * Returns a new JS float typed array that is an independent copy of
51
51
  * the column data. Safe to store and use across allocations.
52
52
  *
53
53
  * # Arguments
@@ -56,25 +56,25 @@ export class Block {
56
56
  *
57
57
  * # Returns
58
58
  *
59
- * An owned `Float32Array` copy of the column.
59
+ * An owned JS float typed-array copy of the column.
60
60
  *
61
61
  * # Errors
62
62
  *
63
- * Throws if the column does not exist or is not of type `f32`.
63
+ * Throws if the column does not exist or is not of the active float type.
64
64
  *
65
65
  * # Example (JavaScript)
66
66
  *
67
67
  * ```js
68
- * const x = block.copyColF32("x");
68
+ * const x = block.copyColF("x");
69
69
  * console.log(x[0]); // 1.0
70
70
  * ```
71
71
  * @param {string} key
72
- * @returns {Float32Array}
72
+ * @returns {Float64Array}
73
73
  */
74
- copyColF32(key) {
74
+ copyColF(key) {
75
75
  const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
76
76
  const len0 = WASM_VECTOR_LEN;
77
- const ret = wasm.block_copyColF32(this.__wbg_ptr, ptr0, len0);
77
+ const ret = wasm.block_copyColF(this.__wbg_ptr, ptr0, len0);
78
78
  if (ret[2]) {
79
79
  throw takeFromExternrefTable0(ret[1]);
80
80
  }
@@ -172,7 +172,8 @@ export class Block {
172
172
  /**
173
173
  * Return the data type string for a column.
174
174
  *
175
- * Possible return values: `"f32"`, `"i32"`, `"u32"`, `"bool"`,
175
+ * Possible return values: `"f32"` or `"f64"` for float columns,
176
+ * plus `"i32"`, `"u32"`, `"bool"`,
176
177
  * `"string"`, `"u8"`. Returns `undefined` if the column does
177
178
  * not exist.
178
179
  *
@@ -187,7 +188,7 @@ export class Block {
187
188
  * # Example (JavaScript)
188
189
  *
189
190
  * ```js
190
- * console.log(block.dtype("x")); // "f32"
191
+ * console.log(block.dtype("x")); // "f32" or "f64"
191
192
  * console.log(block.dtype("symbol")); // "string"
192
193
  * ```
193
194
  * @param {string} key
@@ -282,7 +283,7 @@ export class Block {
282
283
  *
283
284
  * ```js
284
285
  * const block = new Block();
285
- * block.setColF32("values", new Float32Array([1, 2, 3]));
286
+ * block.setColF("values", values);
286
287
  * ```
287
288
  */
288
289
  constructor() {
@@ -354,12 +355,12 @@ export class Block {
354
355
  return ret[0] !== 0;
355
356
  }
356
357
  /**
357
- * Set a float column from a `Float32Array`.
358
+ * Set a float column from a JS float typed array.
358
359
  *
359
360
  * # Arguments
360
361
  *
361
362
  * * `key` - Column name (e.g., `"x"`, `"mass"`, `"charge"`)
362
- * * `data` - `Float32Array` with the column values
363
+ * * `data` - JS float typed array with the column values
363
364
  * * `shape` - Optional shape array for multi-dimensional data
364
365
  * (e.g., `[N, 3]` for an Nx3 matrix stored flat). If omitted,
365
366
  * the data is stored as a 1D column.
@@ -372,20 +373,20 @@ export class Block {
372
373
  * # Example (JavaScript)
373
374
  *
374
375
  * ```js
375
- * block.setColF32("x", new Float32Array([1.0, 2.0, 3.0]));
376
+ * block.setColF("x", xCoords);
376
377
  * // Multi-dimensional: 2 rows x 3 columns
377
- * block.setColF32("pos", new Float32Array([1,2,3, 4,5,6]), [2, 3]);
378
+ * block.setColF("pos", positions, [2, 3]);
378
379
  * ```
379
380
  * @param {string} key
380
- * @param {Float32Array} data
381
+ * @param {Float64Array} data
381
382
  * @param {Uint32Array | null} [shape]
382
383
  */
383
- setColF32(key, data, shape) {
384
+ setColF(key, data, shape) {
384
385
  const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
385
386
  const len0 = WASM_VECTOR_LEN;
386
387
  var ptr1 = isLikeNone(shape) ? 0 : passArray32ToWasm0(shape, wasm.__wbindgen_malloc_command_export);
387
388
  var len1 = WASM_VECTOR_LEN;
388
- const ret = wasm.block_setColF32(this.__wbg_ptr, ptr0, len0, data, ptr1, len1);
389
+ const ret = wasm.block_setColF(this.__wbg_ptr, ptr0, len0, data, ptr1, len1);
389
390
  if (ret[1]) {
390
391
  throw takeFromExternrefTable0(ret[0]);
391
392
  }
@@ -478,13 +479,13 @@ export class Block {
478
479
  }
479
480
  }
480
481
  /**
481
- * Zero-copy `Float32Array` view into WASM linear memory.
482
+ * Zero-copy JS float typed-array view into WASM linear memory.
482
483
  *
483
484
  * Returns a view backed directly by the block's storage in WASM
484
485
  * memory. This avoids copying but the view becomes **invalid**
485
486
  * if WASM linear memory grows (due to any allocation).
486
487
  *
487
- * Use [`copyColF32`](Block::copy_col_f32) for a safe, long-lived copy.
488
+ * Use [`copyColF`](Block::copy_col_f) for a safe, long-lived copy.
488
489
  *
489
490
  * # Arguments
490
491
  *
@@ -492,25 +493,25 @@ export class Block {
492
493
  *
493
494
  * # Returns
494
495
  *
495
- * A `Float32Array` view into WASM memory.
496
+ * A JS float typed-array view into WASM memory.
496
497
  *
497
498
  * # Errors
498
499
  *
499
- * Throws if the column does not exist or is not of type `f32`.
500
+ * Throws if the column does not exist or is not of the active float type.
500
501
  *
501
502
  * # Example (JavaScript)
502
503
  *
503
504
  * ```js
504
- * const view = block.viewColF32("x"); // zero-copy, use immediately
505
- * const copy = block.copyColF32("x"); // safe to keep
505
+ * const view = block.viewColF("x"); // zero-copy, use immediately
506
+ * const copy = block.copyColF("x"); // safe to keep
506
507
  * ```
507
508
  * @param {string} key
508
- * @returns {Float32Array}
509
+ * @returns {Float64Array}
509
510
  */
510
- viewColF32(key) {
511
+ viewColF(key) {
511
512
  const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
512
513
  const len0 = WASM_VECTOR_LEN;
513
- const ret = wasm.block_viewColF32(this.__wbg_ptr, ptr0, len0);
514
+ const ret = wasm.block_viewColF(this.__wbg_ptr, ptr0, len0);
514
515
  if (ret[2]) {
515
516
  throw takeFromExternrefTable0(ret[1]);
516
517
  }
@@ -594,8 +595,8 @@ if (Symbol.dispose) Block.prototype[Symbol.dispose] = Block.prototype.free;
594
595
  * # Example (JavaScript)
595
596
  *
596
597
  * ```js
597
- * const h = new Float32Array([10, 0, 0, 0, 10, 0, 0, 0, 10]);
598
- * const origin = new Float32Array([0, 0, 0]);
598
+ * const h = floatArrayH;
599
+ * const origin = floatArrayOrigin;
599
600
  * const box = new Box(h, origin, true, true, true);
600
601
  * console.log(box.volume()); // 1000.0
601
602
  * console.log(box.lengths().toCopy()); // [10, 10, 10]
@@ -625,7 +626,7 @@ export class Box {
625
626
  * # Arguments
626
627
  *
627
628
  * * `a` - Side length of the cube in angstrom (A)
628
- * * `origin` - 3D origin vector as `Float32Array` with 3 elements
629
+ * * `origin` - 3D origin vector as a float typed array with 3 elements
629
630
  * `[x, y, z]` in angstrom
630
631
  * * `pbc_x` - Enable periodic boundary in x direction
631
632
  * * `pbc_y` - Enable periodic boundary in y direction
@@ -642,12 +643,12 @@ export class Box {
642
643
  * # Example (JavaScript)
643
644
  *
644
645
  * ```js
645
- * const origin = new Float32Array([0, 0, 0]);
646
+ * const origin = originVec;
646
647
  * const box = Box.cube(10.0, origin, true, true, true);
647
648
  * console.log(box.volume()); // 1000.0
648
649
  * ```
649
650
  * @param {number} a
650
- * @param {Float32Array} origin
651
+ * @param {Float64Array} origin
651
652
  * @param {boolean} pbc_x
652
653
  * @param {boolean} pbc_y
653
654
  * @param {boolean} pbc_z
@@ -688,8 +689,8 @@ export class Box {
688
689
  * # Example (JavaScript)
689
690
  *
690
691
  * ```js
691
- * const a = WasmArray.from(new Float32Array([1,1,1]), [1,3]);
692
- * const b = WasmArray.from(new Float32Array([9,9,9]), [1,3]);
692
+ * const a = WasmArray.from(aCoords, [1, 3]);
693
+ * const b = WasmArray.from(bCoords, [1, 3]);
693
694
  * const d = box.delta(a, b, true); // minimum-image displacement
694
695
  * ```
695
696
  * @param {WasmArray} a
@@ -718,7 +719,7 @@ export class Box {
718
719
  * * `b` - `WasmArray` with shape `[N, 3]` (target positions in A)
719
720
  * * `minimum_image` - If `true`, apply minimum image convention
720
721
  * * `out_block` - Target [`Block`] to write the result into
721
- * * `out_key` - Column name for the result (f32, shape `[N, 3]`)
722
+ * * `out_key` - Column name for the result (float, shape `[N, 3]`)
722
723
  *
723
724
  * # Errors
724
725
  *
@@ -779,7 +780,7 @@ export class Box {
779
780
  * # Example (JavaScript)
780
781
  *
781
782
  * ```js
782
- * const L = box.lengths().toCopy(); // Float32Array [10, 10, 10]
783
+ * const L = box.lengths().toCopy(); // Float32Array or Float64Array [10, 10, 10]
783
784
  * ```
784
785
  * @returns {WasmArray}
785
786
  */
@@ -792,10 +793,10 @@ export class Box {
792
793
  *
793
794
  * # Arguments
794
795
  *
795
- * * `h` - 3x3 cell matrix as `Float32Array` with 9 elements in
796
+ * * `h` - 3x3 cell matrix as a float typed array with 9 elements in
796
797
  * row-major order: `[h00, h01, h02, h10, h11, h12, h20, h21, h22]`.
797
798
  * All values in angstrom (A).
798
- * * `origin` - 3D origin vector as `Float32Array` with 3 elements
799
+ * * `origin` - 3D origin vector as a float typed array with 3 elements
799
800
  * `[x, y, z]` in angstrom.
800
801
  * * `pbc_x` - Enable periodic boundary in x direction
801
802
  * * `pbc_y` - Enable periodic boundary in y direction
@@ -814,12 +815,12 @@ export class Box {
814
815
  *
815
816
  * ```js
816
817
  * // Triclinic box
817
- * const h = new Float32Array([10, 2, 0, 0, 10, 0, 0, 0, 10]);
818
- * const origin = new Float32Array([0, 0, 0]);
818
+ * const h = hMatrix;
819
+ * const origin = originVec;
819
820
  * const box = new Box(h, origin, true, true, true);
820
821
  * ```
821
- * @param {Float32Array} h
822
- * @param {Float32Array} origin
822
+ * @param {Float64Array} h
823
+ * @param {Float64Array} origin
823
824
  * @param {boolean} pbc_x
824
825
  * @param {boolean} pbc_y
825
826
  * @param {boolean} pbc_z
@@ -845,7 +846,7 @@ export class Box {
845
846
  * # Example (JavaScript)
846
847
  *
847
848
  * ```js
848
- * const o = box.origin().toCopy(); // Float32Array [0, 0, 0]
849
+ * const o = box.origin().toCopy(); // Float32Array or Float64Array [0, 0, 0]
849
850
  * ```
850
851
  * @returns {WasmArray}
851
852
  */
@@ -858,9 +859,9 @@ export class Box {
858
859
  *
859
860
  * # Arguments
860
861
  *
861
- * * `lengths` - Box dimensions as `Float32Array` with 3 elements
862
+ * * `lengths` - Box dimensions as a float typed array with 3 elements
862
863
  * `[lx, ly, lz]` in angstrom (A)
863
- * * `origin` - 3D origin vector as `Float32Array` with 3 elements
864
+ * * `origin` - 3D origin vector as a float typed array with 3 elements
864
865
  * `[x, y, z]` in angstrom
865
866
  * * `pbc_x` - Enable periodic boundary in x direction
866
867
  * * `pbc_y` - Enable periodic boundary in y direction
@@ -877,12 +878,12 @@ export class Box {
877
878
  * # Example (JavaScript)
878
879
  *
879
880
  * ```js
880
- * const origin = new Float32Array([0, 0, 0]);
881
- * const box = Box.ortho(new Float32Array([10, 20, 30]), origin, true, true, true);
881
+ * const origin = originVec;
882
+ * const box = Box.ortho(lengthsVec, origin, true, true, true);
882
883
  * console.log(box.volume()); // 6000.0
883
884
  * ```
884
- * @param {Float32Array} lengths
885
- * @param {Float32Array} origin
885
+ * @param {Float64Array} lengths
886
+ * @param {Float64Array} origin
886
887
  * @param {boolean} pbc_x
887
888
  * @param {boolean} pbc_y
888
889
  * @param {boolean} pbc_z
@@ -910,7 +911,7 @@ export class Box {
910
911
  * # Example (JavaScript)
911
912
  *
912
913
  * ```js
913
- * const t = box.tilts().toCopy(); // Float32Array [0, 0, 0]
914
+ * const t = box.tilts().toCopy(); // Float32Array or Float64Array [0, 0, 0]
914
915
  * ```
915
916
  * @returns {WasmArray}
916
917
  */
@@ -926,7 +927,7 @@ export class Box {
926
927
  *
927
928
  * * `coords` - `WasmArray` with shape `[N, 3]` (fractional, dimensionless)
928
929
  * * `out_block` - Target [`Block`]
929
- * * `out_key` - Column name for the result (f32, shape `[N, 3]`)
930
+ * * `out_key` - Column name for the result (float, shape `[N, 3]`)
930
931
  *
931
932
  * # Errors
932
933
  *
@@ -959,7 +960,7 @@ export class Box {
959
960
  *
960
961
  * * `coords` - `WasmArray` with shape `[N, 3]` (Cartesian, A)
961
962
  * * `out_block` - Target [`Block`]
962
- * * `out_key` - Column name for the result (f32, shape `[N, 3]`)
963
+ * * `out_key` - Column name for the result (float, shape `[N, 3]`)
963
964
  *
964
965
  * # Errors
965
966
  *
@@ -1004,7 +1005,7 @@ export class Box {
1004
1005
  * # Example (JavaScript)
1005
1006
  *
1006
1007
  * ```js
1007
- * const frac = WasmArray.from(new Float32Array([0.5, 0.5, 0.5]), [1, 3]);
1008
+ * const frac = WasmArray.from(fracCoords, [1, 3]);
1008
1009
  * const cart = box.toCart(frac);
1009
1010
  * console.log(cart.toCopy()); // [5, 5, 5] for a 10x10x10 box
1010
1011
  * ```
@@ -1042,7 +1043,7 @@ export class Box {
1042
1043
  * # Example (JavaScript)
1043
1044
  *
1044
1045
  * ```js
1045
- * const cart = WasmArray.from(new Float32Array([5, 5, 5]), [1, 3]);
1046
+ * const cart = WasmArray.from(coords, [1, 3]);
1046
1047
  * const frac = box.toFrac(cart);
1047
1048
  * console.log(frac.toCopy()); // [0.5, 0.5, 0.5] for a 10x10x10 box
1048
1049
  * ```
@@ -1095,7 +1096,7 @@ export class Box {
1095
1096
  * # Example (JavaScript)
1096
1097
  *
1097
1098
  * ```js
1098
- * const pos = WasmArray.from(new Float32Array([12, -1, 5]), [1, 3]);
1099
+ * const pos = WasmArray.from(positions, [1, 3]);
1099
1100
  * const wrapped = box.wrap(pos); // wraps into [0, lx) x [0, ly) x [0, lz)
1100
1101
  * ```
1101
1102
  * @param {WasmArray} coords
@@ -1120,7 +1121,7 @@ export class Box {
1120
1121
  * * `coords` - `WasmArray` with shape `[N, 3]` containing
1121
1122
  * Cartesian coordinates in angstrom (A)
1122
1123
  * * `out_block` - Target [`Block`] to write the result into
1123
- * * `out_key` - Column name for the result (f32, shape `[N, 3]`)
1124
+ * * `out_key` - Column name for the result (float, shape `[N, 3]`)
1124
1125
  *
1125
1126
  * # Errors
1126
1127
  *
@@ -1149,6 +1150,110 @@ export class Box {
1149
1150
  }
1150
1151
  if (Symbol.dispose) Box.prototype[Symbol.dispose] = Box.prototype.free;
1151
1152
 
1153
+ /**
1154
+ * Mass-weighted cluster center calculator.
1155
+ */
1156
+ export class CenterOfMass {
1157
+ __destroy_into_raw() {
1158
+ const ptr = this.__wbg_ptr;
1159
+ this.__wbg_ptr = 0;
1160
+ CenterOfMassFinalization.unregister(this);
1161
+ return ptr;
1162
+ }
1163
+ free() {
1164
+ const ptr = this.__destroy_into_raw();
1165
+ wasm.__wbg_centerofmass_free(ptr, 0);
1166
+ }
1167
+ /**
1168
+ * Compute centers of mass.
1169
+ * @param {Frame} frame
1170
+ * @param {ClusterResult} cluster_result
1171
+ * @returns {CenterOfMassResult}
1172
+ */
1173
+ compute(frame, cluster_result) {
1174
+ _assertClass(frame, Frame);
1175
+ _assertClass(cluster_result, ClusterResult);
1176
+ const ret = wasm.centerofmass_compute(this.__wbg_ptr, frame.__wbg_ptr, cluster_result.__wbg_ptr);
1177
+ if (ret[2]) {
1178
+ throw takeFromExternrefTable0(ret[1]);
1179
+ }
1180
+ return CenterOfMassResult.__wrap(ret[0]);
1181
+ }
1182
+ /**
1183
+ * Create a center-of-mass calculator.
1184
+ *
1185
+ * Pass `null` for uniform masses, or a float typed array of per-particle masses.
1186
+ * @param {Float64Array | null} [masses]
1187
+ */
1188
+ constructor(masses) {
1189
+ var ptr0 = isLikeNone(masses) ? 0 : passArrayF64ToWasm0(masses, wasm.__wbindgen_malloc_command_export);
1190
+ var len0 = WASM_VECTOR_LEN;
1191
+ const ret = wasm.centerofmass_new(ptr0, len0);
1192
+ this.__wbg_ptr = ret >>> 0;
1193
+ CenterOfMassFinalization.register(this, this.__wbg_ptr, this);
1194
+ return this;
1195
+ }
1196
+ }
1197
+ if (Symbol.dispose) CenterOfMass.prototype[Symbol.dispose] = CenterOfMass.prototype.free;
1198
+
1199
+ /**
1200
+ * Result of center-of-mass computation.
1201
+ *
1202
+ * # Example (JavaScript)
1203
+ *
1204
+ * ```js
1205
+ * const com = new CenterOfMass().compute(frame, clusterResult);
1206
+ * com.centersOfMass(); // Float32Array or Float64Array [x0,y0,z0, ...]
1207
+ * com.clusterMasses(); // Float32Array or Float64Array
1208
+ * ```
1209
+ */
1210
+ export class CenterOfMassResult {
1211
+ static __wrap(ptr) {
1212
+ ptr = ptr >>> 0;
1213
+ const obj = Object.create(CenterOfMassResult.prototype);
1214
+ obj.__wbg_ptr = ptr;
1215
+ CenterOfMassResultFinalization.register(obj, obj.__wbg_ptr, obj);
1216
+ return obj;
1217
+ }
1218
+ __destroy_into_raw() {
1219
+ const ptr = this.__wbg_ptr;
1220
+ this.__wbg_ptr = 0;
1221
+ CenterOfMassResultFinalization.unregister(this);
1222
+ return ptr;
1223
+ }
1224
+ free() {
1225
+ const ptr = this.__destroy_into_raw();
1226
+ wasm.__wbg_centerofmassresult_free(ptr, 0);
1227
+ }
1228
+ /**
1229
+ * Zero-copy `Float64Array` view of mass-weighted centers, flat
1230
+ * `[x0,y0,z0, x1,y1,z1, ...]`. **Invalidated** on WASM memory growth.
1231
+ * @returns {Float64Array}
1232
+ */
1233
+ centersOfMass() {
1234
+ const ret = wasm.centerofmassresult_centersOfMass(this.__wbg_ptr);
1235
+ return ret;
1236
+ }
1237
+ /**
1238
+ * Zero-copy `Float64Array` view of total mass per cluster.
1239
+ * **Invalidated** on WASM memory growth.
1240
+ * @returns {Float64Array}
1241
+ */
1242
+ clusterMasses() {
1243
+ const ret = wasm.centerofmassresult_clusterMasses(this.__wbg_ptr);
1244
+ return ret;
1245
+ }
1246
+ /**
1247
+ * Number of clusters.
1248
+ * @returns {number}
1249
+ */
1250
+ get numClusters() {
1251
+ const ret = wasm.centerofmassresult_numClusters(this.__wbg_ptr);
1252
+ return ret >>> 0;
1253
+ }
1254
+ }
1255
+ if (Symbol.dispose) CenterOfMassResult.prototype[Symbol.dispose] = CenterOfMassResult.prototype.free;
1256
+
1152
1257
  /**
1153
1258
  * Distance-based cluster analysis using BFS on the neighbor graph.
1154
1259
  *
@@ -1241,6 +1346,53 @@ export class Cluster {
1241
1346
  }
1242
1347
  if (Symbol.dispose) Cluster.prototype[Symbol.dispose] = Cluster.prototype.free;
1243
1348
 
1349
+ /**
1350
+ * Geometric cluster centers with minimum image convention.
1351
+ *
1352
+ * # Example (JavaScript)
1353
+ *
1354
+ * ```js
1355
+ * const centers = new ClusterCenters().compute(frame, clusterResult);
1356
+ * // Float32Array or Float64Array [x0,y0,z0, x1,y1,z1, ...]
1357
+ * ```
1358
+ */
1359
+ export class ClusterCenters {
1360
+ __destroy_into_raw() {
1361
+ const ptr = this.__wbg_ptr;
1362
+ this.__wbg_ptr = 0;
1363
+ ClusterCentersFinalization.unregister(this);
1364
+ return ptr;
1365
+ }
1366
+ free() {
1367
+ const ptr = this.__destroy_into_raw();
1368
+ wasm.__wbg_clustercenters_free(ptr, 0);
1369
+ }
1370
+ /**
1371
+ * Compute geometric centers. Returns a flat float typed array `[x0,y0,z0, ...]`.
1372
+ * @param {Frame} frame
1373
+ * @param {ClusterResult} cluster_result
1374
+ * @returns {Float64Array}
1375
+ */
1376
+ compute(frame, cluster_result) {
1377
+ _assertClass(frame, Frame);
1378
+ _assertClass(cluster_result, ClusterResult);
1379
+ const ret = wasm.clustercenters_compute(this.__wbg_ptr, frame.__wbg_ptr, cluster_result.__wbg_ptr);
1380
+ if (ret[3]) {
1381
+ throw takeFromExternrefTable0(ret[2]);
1382
+ }
1383
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1384
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
1385
+ return v1;
1386
+ }
1387
+ constructor() {
1388
+ const ret = wasm.clustercenters_new();
1389
+ this.__wbg_ptr = ret >>> 0;
1390
+ ClusterCentersFinalization.register(this, this.__wbg_ptr, this);
1391
+ return this;
1392
+ }
1393
+ }
1394
+ if (Symbol.dispose) ClusterCenters.prototype[Symbol.dispose] = ClusterCenters.prototype.free;
1395
+
1244
1396
  /**
1245
1397
  * Result of a distance-based cluster analysis.
1246
1398
  *
@@ -1327,10 +1479,10 @@ if (Symbol.dispose) ClusterResult.prototype[Symbol.dispose] = ClusterResult.prot
1327
1479
  * # Conventions
1328
1480
  *
1329
1481
  * - The `"atoms"` block should contain per-atom properties: `symbol`
1330
- * (string), `x`/`y`/`z` (f32, coordinates in angstrom), and optionally
1331
- * `mass` (f32, atomic mass units) and `charge` (f32, elementary charges).
1482
+ * (string), `x`/`y`/`z` (F, coordinates in angstrom), and optionally
1483
+ * `mass` (F, atomic mass units) and `charge` (F, elementary charges).
1332
1484
  * - The `"bonds"` block should contain bond topology: `i`/`j` (u32,
1333
- * zero-based atom indices) and `order` (f32, bond order: 1.0 = single,
1485
+ * zero-based atom indices) and `order` (F, bond order: 1.0 = single,
1334
1486
  * 1.5 = aromatic, 2.0 = double, 3.0 = triple).
1335
1487
  *
1336
1488
  * # Example (JavaScript)
@@ -1338,7 +1490,7 @@ if (Symbol.dispose) ClusterResult.prototype[Symbol.dispose] = ClusterResult.prot
1338
1490
  * ```js
1339
1491
  * const frame = new Frame();
1340
1492
  * const atoms = frame.createBlock("atoms");
1341
- * atoms.setColF32("x", new Float32Array([0.0, 1.54]));
1493
+ * atoms.setColF("x", xCoords);
1342
1494
  * ```
1343
1495
  */
1344
1496
  export class Frame {
@@ -1400,7 +1552,7 @@ export class Frame {
1400
1552
  *
1401
1553
  * ```js
1402
1554
  * const atoms = frame.createBlock("atoms");
1403
- * atoms.setColF32("x", new Float32Array([1.0, 2.0]));
1555
+ * atoms.setColF("x", xCoords);
1404
1556
  * ```
1405
1557
  * @param {string} key
1406
1558
  * @returns {Block}
@@ -1455,7 +1607,7 @@ export class Frame {
1455
1607
  * ```js
1456
1608
  * const atoms = frame.getBlock("atoms");
1457
1609
  * if (atoms) {
1458
- * const x = atoms.copyColF32("x");
1610
+ * const x = atoms.copyColF("x");
1459
1611
  * }
1460
1612
  * ```
1461
1613
  * @param {string} key
@@ -1467,6 +1619,79 @@ export class Frame {
1467
1619
  const ret = wasm.frame_getBlock(this.__wbg_ptr, ptr0, len0);
1468
1620
  return ret === 0 ? undefined : Block.__wrap(ret);
1469
1621
  }
1622
+ /**
1623
+ * Retrieve a named grid attached to this frame.
1624
+ *
1625
+ * Returns a cloned [`Grid`] wrapper, or `undefined` if the grid does
1626
+ * not exist. The returned object is independent of the frame — mutations
1627
+ * to it are not reflected in the frame without a subsequent
1628
+ * [`insertGrid`](Frame::insert_grid) call.
1629
+ *
1630
+ * # Arguments
1631
+ *
1632
+ * * `name` — Grid name to retrieve.
1633
+ *
1634
+ * # Example (JavaScript)
1635
+ *
1636
+ * ```js
1637
+ * const g = frame.getGrid("chgcar");
1638
+ * if (g) {
1639
+ * const arr = g.getArray("rho");
1640
+ * }
1641
+ * ```
1642
+ * @param {string} name
1643
+ * @returns {Grid | undefined}
1644
+ */
1645
+ getGrid(name) {
1646
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
1647
+ const len0 = WASM_VECTOR_LEN;
1648
+ const ret = wasm.frame_getGrid(this.__wbg_ptr, ptr0, len0);
1649
+ if (ret[2]) {
1650
+ throw takeFromExternrefTable0(ret[1]);
1651
+ }
1652
+ return ret[0] === 0 ? undefined : Grid.__wrap(ret[0]);
1653
+ }
1654
+ /**
1655
+ * Return the names of all grids attached to this frame.
1656
+ *
1657
+ * # Example (JavaScript)
1658
+ *
1659
+ * ```js
1660
+ * const names = frame.gridNames(); // e.g. ["chgcar", "spin"]
1661
+ * ```
1662
+ * @returns {Array<any>}
1663
+ */
1664
+ gridNames() {
1665
+ const ret = wasm.frame_gridNames(this.__wbg_ptr);
1666
+ if (ret[2]) {
1667
+ throw takeFromExternrefTable0(ret[1]);
1668
+ }
1669
+ return takeFromExternrefTable0(ret[0]);
1670
+ }
1671
+ /**
1672
+ * Returns `true` if a named grid is attached to this frame.
1673
+ *
1674
+ * # Arguments
1675
+ *
1676
+ * * `name` — Grid name to look up.
1677
+ *
1678
+ * # Example (JavaScript)
1679
+ *
1680
+ * ```js
1681
+ * frame.hasGrid("chgcar"); // true or false
1682
+ * ```
1683
+ * @param {string} name
1684
+ * @returns {boolean}
1685
+ */
1686
+ hasGrid(name) {
1687
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
1688
+ const len0 = WASM_VECTOR_LEN;
1689
+ const ret = wasm.frame_hasGrid(this.__wbg_ptr, ptr0, len0);
1690
+ if (ret[2]) {
1691
+ throw takeFromExternrefTable0(ret[1]);
1692
+ }
1693
+ return ret[0] !== 0;
1694
+ }
1470
1695
  /**
1471
1696
  * Insert a block by deep-copying its data into this frame's store.
1472
1697
  *
@@ -1505,6 +1730,42 @@ export class Frame {
1505
1730
  throw takeFromExternrefTable0(ret[0]);
1506
1731
  }
1507
1732
  }
1733
+ /**
1734
+ * Attach a grid to this frame under the given name.
1735
+ *
1736
+ * If a grid with the same name already exists it is replaced. The grid
1737
+ * data is moved into the frame; the JS `Grid` object becomes empty after
1738
+ * this call and should not be reused.
1739
+ *
1740
+ * # Arguments
1741
+ *
1742
+ * * `name` — Name to store the grid under (e.g., `"chgcar"`).
1743
+ * * `grid` — The [`Grid`] to attach.
1744
+ *
1745
+ * # Errors
1746
+ *
1747
+ * Throws a `JsValue` string if the frame has been dropped.
1748
+ *
1749
+ * # Example (JavaScript)
1750
+ *
1751
+ * ```js
1752
+ * const grid = new Grid(10, 10, 10, origin, cell, true, true, true);
1753
+ * grid.insertArray("rho", rhoData);
1754
+ * frame.insertGrid("chgcar", grid);
1755
+ * ```
1756
+ * @param {string} name
1757
+ * @param {Grid} grid
1758
+ */
1759
+ insertGrid(name, grid) {
1760
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
1761
+ const len0 = WASM_VECTOR_LEN;
1762
+ _assertClass(grid, Grid);
1763
+ var ptr1 = grid.__destroy_into_raw();
1764
+ const ret = wasm.frame_insertGrid(this.__wbg_ptr, ptr0, len0, ptr1);
1765
+ if (ret[1]) {
1766
+ throw takeFromExternrefTable0(ret[0]);
1767
+ }
1768
+ }
1508
1769
  /**
1509
1770
  * Create a new, empty `Frame` with no blocks and no simulation box.
1510
1771
  *
@@ -1547,6 +1808,32 @@ export class Frame {
1547
1808
  throw takeFromExternrefTable0(ret[0]);
1548
1809
  }
1549
1810
  }
1811
+ /**
1812
+ * Remove a named grid from this frame.
1813
+ *
1814
+ * # Arguments
1815
+ *
1816
+ * * `name` — Grid name to remove.
1817
+ *
1818
+ * # Errors
1819
+ *
1820
+ * Throws a `JsValue` string if the frame has been dropped.
1821
+ *
1822
+ * # Example (JavaScript)
1823
+ *
1824
+ * ```js
1825
+ * frame.removeGrid("chgcar");
1826
+ * ```
1827
+ * @param {string} name
1828
+ */
1829
+ removeGrid(name) {
1830
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
1831
+ const len0 = WASM_VECTOR_LEN;
1832
+ const ret = wasm.frame_removeGrid(this.__wbg_ptr, ptr0, len0);
1833
+ if (ret[1]) {
1834
+ throw takeFromExternrefTable0(ret[0]);
1835
+ }
1836
+ }
1550
1837
  /**
1551
1838
  * Rename a block from `old_key` to `new_key`.
1552
1839
  *
@@ -1642,7 +1929,7 @@ export class Frame {
1642
1929
  * # Example (JavaScript)
1643
1930
  *
1644
1931
  * ```js
1645
- * const origin = new Float32Array([0, 0, 0]);
1932
+ * const origin = originVec;
1646
1933
  * frame.simbox = Box.cube(10.0, origin, true, true, true);
1647
1934
  * ```
1648
1935
  * @param {Box | null} [simbox]
@@ -1684,82 +1971,546 @@ export class Frame {
1684
1971
  if (Symbol.dispose) Frame.prototype[Symbol.dispose] = Frame.prototype.free;
1685
1972
 
1686
1973
  /**
1687
- * LAMMPS data file reader.
1688
- *
1689
- * Reads LAMMPS data files (the format written by `write_data`). The
1690
- * reader produces a [`Frame`] containing:
1974
+ * A uniform spatial grid storing multiple named scalar arrays.
1691
1975
  *
1692
- * - `"atoms"` block: `type` (i32), `x`, `y`, `z` (f32, angstrom),
1693
- * and optionally `charge` (f32)
1694
- * - `"bonds"` block (if present): `i`, `j` (u32), `type` (i32)
1695
- * - Simulation box (`simbox`) with PBC
1696
- *
1697
- * Only a single frame is supported (`step = 0`).
1976
+ * All arrays in a `Grid` share the same spatial definition: dimensions
1977
+ * (`[nx, ny, nz]`), Cartesian origin, cell matrix (columns are lattice
1978
+ * vectors, matching VASP/molrs convention), and periodic boundary flags.
1698
1979
  *
1699
1980
  * # Example (JavaScript)
1700
1981
  *
1701
1982
  * ```js
1702
- * const reader = new LAMMPSReader(dataFileContent);
1703
- * const frame = reader.read(0);
1704
- * const atoms = frame.getBlock("atoms");
1705
- * const bonds = frame.getBlock("bonds");
1706
- * const box = frame.simbox;
1983
+ * // Create a 10×10×10 cubic grid
1984
+ * const origin = new Float32Array([0, 0, 0]);
1985
+ * const cell = new Float32Array([
1986
+ * 10, 0, 0, // first column (a vector)
1987
+ * 0,10, 0, // second column (b vector)
1988
+ * 0, 0,10, // third column (c vector)
1989
+ * ]);
1990
+ * const grid = new Grid(10, 10, 10, origin, cell, true, true, true);
1991
+ *
1992
+ * // Insert a density array (must have length = 10*10*10 = 1000)
1993
+ * const rho = new Float32Array(1000).fill(1.0);
1994
+ * grid.insertArray("rho", rho);
1995
+ *
1996
+ * // Retrieve it
1997
+ * const arr = grid.getArray("rho");
1998
+ * console.log(arr.toCopy());
1707
1999
  * ```
1708
2000
  */
1709
- export class LAMMPSReader {
2001
+ export class Grid {
2002
+ static __wrap(ptr) {
2003
+ ptr = ptr >>> 0;
2004
+ const obj = Object.create(Grid.prototype);
2005
+ obj.__wbg_ptr = ptr;
2006
+ GridFinalization.register(obj, obj.__wbg_ptr, obj);
2007
+ return obj;
2008
+ }
1710
2009
  __destroy_into_raw() {
1711
2010
  const ptr = this.__wbg_ptr;
1712
2011
  this.__wbg_ptr = 0;
1713
- LAMMPSReaderFinalization.unregister(this);
2012
+ GridFinalization.unregister(this);
1714
2013
  return ptr;
1715
2014
  }
1716
2015
  free() {
1717
2016
  const ptr = this.__destroy_into_raw();
1718
- wasm.__wbg_lammpsreader_free(ptr, 0);
2017
+ wasm.__wbg_grid_free(ptr, 0);
1719
2018
  }
1720
2019
  /**
1721
- * Check whether the file contains no valid frames.
2020
+ * Names of all scalar arrays stored in this grid.
1722
2021
  *
1723
- * # Errors
2022
+ * # Example (JavaScript)
1724
2023
  *
1725
- * Throws a `JsValue` string on parse errors.
1726
- * @returns {boolean}
2024
+ * ```js
2025
+ * const names = grid.arrayNames(); // e.g. ["rho", "spin"]
2026
+ * ```
2027
+ * @returns {Array<any>}
1727
2028
  */
1728
- isEmpty() {
1729
- const ret = wasm.lammpsreader_isEmpty(this.__wbg_ptr);
1730
- if (ret[2]) {
1731
- throw takeFromExternrefTable0(ret[1]);
1732
- }
1733
- return ret[0] !== 0;
2029
+ arrayNames() {
2030
+ const ret = wasm.grid_arrayNames(this.__wbg_ptr);
2031
+ return ret;
1734
2032
  }
1735
2033
  /**
1736
- * Return the number of frames (always 0 or 1 for LAMMPS data files).
2034
+ * Cell matrix in Ångström as a flat array of length 9 in column-major
2035
+ * order (columns are lattice vectors, matching VASP/molrs convention).
1737
2036
  *
1738
- * # Errors
2037
+ * Layout: `[col0_x, col0_y, col0_z, col1_x, col1_y, col1_z, col2_x, col2_y, col2_z]`
1739
2038
  *
1740
- * Throws a `JsValue` string on parse errors.
1741
- * @returns {number}
2039
+ * # Example (JavaScript)
2040
+ *
2041
+ * ```js
2042
+ * const c = grid.cell();
2043
+ * const flat = c.toCopy(); // Float32Array of length 9
2044
+ * ```
2045
+ * @returns {WasmArray}
1742
2046
  */
1743
- len() {
1744
- const ret = wasm.lammpsreader_len(this.__wbg_ptr);
1745
- if (ret[2]) {
1746
- throw takeFromExternrefTable0(ret[1]);
1747
- }
1748
- return ret[0] >>> 0;
2047
+ cell() {
2048
+ const ret = wasm.grid_cell(this.__wbg_ptr);
2049
+ return WasmArray.__wrap(ret);
1749
2050
  }
1750
2051
  /**
1751
- * Create a new LAMMPS data file reader from string content.
2052
+ * Grid dimensions `[nx, ny, nz]`.
1752
2053
  *
1753
- * # Arguments
2054
+ * # Example (JavaScript)
1754
2055
  *
1755
- * * `content` - The full text content of a LAMMPS data file
2056
+ * ```js
2057
+ * console.log(grid.dim()); // [10, 10, 10]
2058
+ * ```
2059
+ * @returns {Uint32Array}
2060
+ */
2061
+ dim() {
2062
+ const ret = wasm.grid_dim(this.__wbg_ptr);
2063
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
2064
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
2065
+ return v1;
2066
+ }
2067
+ /**
2068
+ * Retrieve a named scalar array as a zero-copy `Float64Array` view
2069
+ * over the underlying WASM memory. Flat row-major order, length
2070
+ * `nx * ny * nz`. Use [`Grid::dim`] for shape.
2071
+ *
2072
+ * **Warning**: the view is invalidated on any WASM memory growth.
2073
+ * Copy it in JS (`new Float64Array(view)`) if it needs to outlive
2074
+ * subsequent allocations.
2075
+ *
2076
+ * Returns `undefined` if the named array does not exist.
1756
2077
  *
1757
2078
  * # Example (JavaScript)
1758
2079
  *
1759
2080
  * ```js
1760
- * const reader = new LAMMPSReader(dataFileString);
2081
+ * const view = grid.getArray("rho"); // zero-copy
2082
+ * const copy = new Float64Array(view); // owned copy if needed
1761
2083
  * ```
1762
- * @param {string} content
2084
+ * @param {string} name
2085
+ * @returns {Float64Array | undefined}
2086
+ */
2087
+ getArray(name) {
2088
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
2089
+ const len0 = WASM_VECTOR_LEN;
2090
+ const ret = wasm.grid_getArray(this.__wbg_ptr, ptr0, len0);
2091
+ return ret;
2092
+ }
2093
+ /**
2094
+ * Returns `true` if a named array is present in this grid.
2095
+ *
2096
+ * # Arguments
2097
+ *
2098
+ * * `name` — Array name to look up.
2099
+ *
2100
+ * # Example (JavaScript)
2101
+ *
2102
+ * ```js
2103
+ * grid.hasArray("rho"); // true or false
2104
+ * ```
2105
+ * @param {string} name
2106
+ * @returns {boolean}
2107
+ */
2108
+ hasArray(name) {
2109
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
2110
+ const len0 = WASM_VECTOR_LEN;
2111
+ const ret = wasm.grid_hasArray(this.__wbg_ptr, ptr0, len0);
2112
+ return ret !== 0;
2113
+ }
2114
+ /**
2115
+ * Insert (or replace) a named scalar array.
2116
+ *
2117
+ * The provided `data` must have exactly `nx * ny * nz` elements in
2118
+ * row-major `(ix, iy, iz)` order.
2119
+ *
2120
+ * # Arguments
2121
+ *
2122
+ * * `name` — Array name.
2123
+ * * `data` — Float32Array with length equal to `grid.total()`.
2124
+ *
2125
+ * # Errors
2126
+ *
2127
+ * Throws if `data.length != nx * ny * nz`.
2128
+ *
2129
+ * # Example (JavaScript)
2130
+ *
2131
+ * ```js
2132
+ * const rho = new Float32Array(grid.total()).fill(0.5);
2133
+ * grid.insertArray("rho", rho);
2134
+ * ```
2135
+ * @param {string} name
2136
+ * @param {Float64Array} data
2137
+ */
2138
+ insertArray(name, data) {
2139
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
2140
+ const len0 = WASM_VECTOR_LEN;
2141
+ const ptr1 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc_command_export);
2142
+ const len1 = WASM_VECTOR_LEN;
2143
+ const ret = wasm.grid_insertArray(this.__wbg_ptr, ptr0, len0, ptr1, len1);
2144
+ if (ret[1]) {
2145
+ throw takeFromExternrefTable0(ret[0]);
2146
+ }
2147
+ }
2148
+ /**
2149
+ * Returns `true` if no arrays are stored.
2150
+ *
2151
+ * # Example (JavaScript)
2152
+ *
2153
+ * ```js
2154
+ * console.log(grid.isEmpty()); // true for a freshly created grid
2155
+ * ```
2156
+ * @returns {boolean}
2157
+ */
2158
+ isEmpty() {
2159
+ const ret = wasm.grid_isEmpty(this.__wbg_ptr);
2160
+ return ret !== 0;
2161
+ }
2162
+ /**
2163
+ * Number of named arrays stored in this grid.
2164
+ *
2165
+ * # Example (JavaScript)
2166
+ *
2167
+ * ```js
2168
+ * console.log(grid.len()); // e.g. 2
2169
+ * ```
2170
+ * @returns {number}
2171
+ */
2172
+ len() {
2173
+ const ret = wasm.grid_len(this.__wbg_ptr);
2174
+ return ret >>> 0;
2175
+ }
2176
+ /**
2177
+ * Create a new empty grid with the given spatial definition.
2178
+ *
2179
+ * # Arguments
2180
+ *
2181
+ * * `dim_x`, `dim_y`, `dim_z` — Number of grid points along each axis.
2182
+ * * `origin` — Float32Array of length 3: Cartesian origin in Ångström.
2183
+ * * `cell` — Float32Array of length 9: cell matrix in column-major order.
2184
+ * `cell[0..3]` is the first lattice vector (a), `cell[3..6]` is b,
2185
+ * `cell[6..9]` is c (matching VASP/molrs convention where columns are
2186
+ * lattice vectors).
2187
+ * * `pbc_x`, `pbc_y`, `pbc_z` — Periodic boundary flags for each axis.
2188
+ *
2189
+ * # Errors
2190
+ *
2191
+ * Throws if `origin` does not have length 3, or `cell` does not have
2192
+ * length 9.
2193
+ *
2194
+ * # Example (JavaScript)
2195
+ *
2196
+ * ```js
2197
+ * const origin = new Float32Array([0, 0, 0]);
2198
+ * const cell = new Float32Array([10,0,0, 0,10,0, 0,0,10]);
2199
+ * const grid = new Grid(10, 10, 10, origin, cell, true, true, true);
2200
+ * ```
2201
+ * @param {number} dim_x
2202
+ * @param {number} dim_y
2203
+ * @param {number} dim_z
2204
+ * @param {Float64Array} origin
2205
+ * @param {Float64Array} cell
2206
+ * @param {boolean} pbc_x
2207
+ * @param {boolean} pbc_y
2208
+ * @param {boolean} pbc_z
2209
+ */
2210
+ constructor(dim_x, dim_y, dim_z, origin, cell, pbc_x, pbc_y, pbc_z) {
2211
+ const ptr0 = passArrayF64ToWasm0(origin, wasm.__wbindgen_malloc_command_export);
2212
+ const len0 = WASM_VECTOR_LEN;
2213
+ const ptr1 = passArrayF64ToWasm0(cell, wasm.__wbindgen_malloc_command_export);
2214
+ const len1 = WASM_VECTOR_LEN;
2215
+ const ret = wasm.grid_new(dim_x, dim_y, dim_z, ptr0, len0, ptr1, len1, pbc_x, pbc_y, pbc_z);
2216
+ if (ret[2]) {
2217
+ throw takeFromExternrefTable0(ret[1]);
2218
+ }
2219
+ this.__wbg_ptr = ret[0] >>> 0;
2220
+ GridFinalization.register(this, this.__wbg_ptr, this);
2221
+ return this;
2222
+ }
2223
+ /**
2224
+ * Cartesian origin in Ångström as a 1-D array of length 3.
2225
+ *
2226
+ * # Example (JavaScript)
2227
+ *
2228
+ * ```js
2229
+ * const o = grid.origin();
2230
+ * const arr = o.toCopy(); // Float32Array [ox, oy, oz]
2231
+ * ```
2232
+ * @returns {WasmArray}
2233
+ */
2234
+ origin() {
2235
+ const ret = wasm.grid_origin(this.__wbg_ptr);
2236
+ return WasmArray.__wrap(ret);
2237
+ }
2238
+ /**
2239
+ * Periodic boundary flags as a `Uint8Array`-compatible slice.
2240
+ *
2241
+ * Each element is `1` (periodic) or `0` (not periodic).
2242
+ *
2243
+ * # Example (JavaScript)
2244
+ *
2245
+ * ```js
2246
+ * console.log(grid.pbc()); // [1, 1, 1]
2247
+ * ```
2248
+ * @returns {Uint8Array}
2249
+ */
2250
+ pbc() {
2251
+ const ret = wasm.grid_pbc(this.__wbg_ptr);
2252
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
2253
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
2254
+ return v1;
2255
+ }
2256
+ /**
2257
+ * Total number of voxels: `nx * ny * nz`.
2258
+ *
2259
+ * # Example (JavaScript)
2260
+ *
2261
+ * ```js
2262
+ * console.log(grid.total()); // 1000 for a 10×10×10 grid
2263
+ * ```
2264
+ * @returns {number}
2265
+ */
2266
+ total() {
2267
+ const ret = wasm.grid_total(this.__wbg_ptr);
2268
+ return ret >>> 0;
2269
+ }
2270
+ }
2271
+ if (Symbol.dispose) Grid.prototype[Symbol.dispose] = Grid.prototype.free;
2272
+
2273
+ /**
2274
+ * Gyration tensor per cluster.
2275
+ *
2276
+ * Returns flat array: `[g00,g01,g02, g10,g11,g12, g20,g21,g22, ...]` per cluster.
2277
+ */
2278
+ export class GyrationTensor {
2279
+ __destroy_into_raw() {
2280
+ const ptr = this.__wbg_ptr;
2281
+ this.__wbg_ptr = 0;
2282
+ GyrationTensorFinalization.unregister(this);
2283
+ return ptr;
2284
+ }
2285
+ free() {
2286
+ const ptr = this.__destroy_into_raw();
2287
+ wasm.__wbg_gyrationtensor_free(ptr, 0);
2288
+ }
2289
+ /**
2290
+ * Compute gyration tensors. Returns a flat float typed array (9 values per cluster).
2291
+ * @param {Frame} frame
2292
+ * @param {ClusterResult} cluster_result
2293
+ * @returns {Float64Array}
2294
+ */
2295
+ compute(frame, cluster_result) {
2296
+ _assertClass(frame, Frame);
2297
+ _assertClass(cluster_result, ClusterResult);
2298
+ const ret = wasm.gyrationtensor_compute(this.__wbg_ptr, frame.__wbg_ptr, cluster_result.__wbg_ptr);
2299
+ if (ret[3]) {
2300
+ throw takeFromExternrefTable0(ret[2]);
2301
+ }
2302
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2303
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
2304
+ return v1;
2305
+ }
2306
+ constructor() {
2307
+ const ret = wasm.gyrationtensor_new();
2308
+ this.__wbg_ptr = ret >>> 0;
2309
+ GyrationTensorFinalization.register(this, this.__wbg_ptr, this);
2310
+ return this;
2311
+ }
2312
+ }
2313
+ if (Symbol.dispose) GyrationTensor.prototype[Symbol.dispose] = GyrationTensor.prototype.free;
2314
+
2315
+ /**
2316
+ * Moment of inertia tensor per cluster.
2317
+ */
2318
+ export class InertiaTensor {
2319
+ __destroy_into_raw() {
2320
+ const ptr = this.__wbg_ptr;
2321
+ this.__wbg_ptr = 0;
2322
+ InertiaTensorFinalization.unregister(this);
2323
+ return ptr;
2324
+ }
2325
+ free() {
2326
+ const ptr = this.__destroy_into_raw();
2327
+ wasm.__wbg_inertiatensor_free(ptr, 0);
2328
+ }
2329
+ /**
2330
+ * Compute inertia tensors. Returns a flat float typed array (9 values per cluster).
2331
+ * @param {Frame} frame
2332
+ * @param {ClusterResult} cluster_result
2333
+ * @returns {Float64Array}
2334
+ */
2335
+ compute(frame, cluster_result) {
2336
+ _assertClass(frame, Frame);
2337
+ _assertClass(cluster_result, ClusterResult);
2338
+ const ret = wasm.inertiatensor_compute(this.__wbg_ptr, frame.__wbg_ptr, cluster_result.__wbg_ptr);
2339
+ if (ret[3]) {
2340
+ throw takeFromExternrefTable0(ret[2]);
2341
+ }
2342
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2343
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
2344
+ return v1;
2345
+ }
2346
+ /**
2347
+ * @param {Float64Array | null} [masses]
2348
+ */
2349
+ constructor(masses) {
2350
+ var ptr0 = isLikeNone(masses) ? 0 : passArrayF64ToWasm0(masses, wasm.__wbindgen_malloc_command_export);
2351
+ var len0 = WASM_VECTOR_LEN;
2352
+ const ret = wasm.inertiatensor_new(ptr0, len0);
2353
+ this.__wbg_ptr = ret >>> 0;
2354
+ InertiaTensorFinalization.register(this, this.__wbg_ptr, this);
2355
+ return this;
2356
+ }
2357
+ }
2358
+ if (Symbol.dispose) InertiaTensor.prototype[Symbol.dispose] = InertiaTensor.prototype.free;
2359
+
2360
+ /**
2361
+ * LAMMPS dump trajectory file reader.
2362
+ *
2363
+ * Reads multi-frame LAMMPS dump files (the format produced by the
2364
+ * `dump` command). Each frame produces a [`Frame`] containing an
2365
+ * `"atoms"` block with columns matching the dump header (e.g.
2366
+ * `id`, `type`, `x`, `y`, `z`, `vx`, `vy`, `vz`).
2367
+ *
2368
+ * # Example (JavaScript)
2369
+ *
2370
+ * ```js
2371
+ * const reader = new LAMMPSDumpReader(dumpContent);
2372
+ * console.log(reader.len()); // number of timesteps
2373
+ * const frame = reader.read(0);
2374
+ * const atoms = frame.getBlock("atoms");
2375
+ * ```
2376
+ */
2377
+ export class LAMMPSDumpReader {
2378
+ __destroy_into_raw() {
2379
+ const ptr = this.__wbg_ptr;
2380
+ this.__wbg_ptr = 0;
2381
+ LAMMPSDumpReaderFinalization.unregister(this);
2382
+ return ptr;
2383
+ }
2384
+ free() {
2385
+ const ptr = this.__destroy_into_raw();
2386
+ wasm.__wbg_lammpsdumpreader_free(ptr, 0);
2387
+ }
2388
+ /**
2389
+ * Check whether the file contains no frames.
2390
+ * @returns {boolean}
2391
+ */
2392
+ isEmpty() {
2393
+ const ret = wasm.lammpsdumpreader_isEmpty(this.__wbg_ptr);
2394
+ if (ret[2]) {
2395
+ throw takeFromExternrefTable0(ret[1]);
2396
+ }
2397
+ return ret[0] !== 0;
2398
+ }
2399
+ /**
2400
+ * Return the number of frames in the dump file.
2401
+ * @returns {number}
2402
+ */
2403
+ len() {
2404
+ const ret = wasm.lammpsdumpreader_len(this.__wbg_ptr);
2405
+ if (ret[2]) {
2406
+ throw takeFromExternrefTable0(ret[1]);
2407
+ }
2408
+ return ret[0] >>> 0;
2409
+ }
2410
+ /**
2411
+ * Create a new LAMMPS dump reader from string content.
2412
+ * @param {string} content
2413
+ */
2414
+ constructor(content) {
2415
+ const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
2416
+ const len0 = WASM_VECTOR_LEN;
2417
+ const ret = wasm.lammpsdumpreader_new(ptr0, len0);
2418
+ this.__wbg_ptr = ret >>> 0;
2419
+ LAMMPSDumpReaderFinalization.register(this, this.__wbg_ptr, this);
2420
+ return this;
2421
+ }
2422
+ /**
2423
+ * Read a frame at the given step index.
2424
+ * @param {number} step
2425
+ * @returns {Frame | undefined}
2426
+ */
2427
+ read(step) {
2428
+ const ret = wasm.lammpsdumpreader_read(this.__wbg_ptr, step);
2429
+ if (ret[2]) {
2430
+ throw takeFromExternrefTable0(ret[1]);
2431
+ }
2432
+ return ret[0] === 0 ? undefined : Frame.__wrap(ret[0]);
2433
+ }
2434
+ }
2435
+ if (Symbol.dispose) LAMMPSDumpReader.prototype[Symbol.dispose] = LAMMPSDumpReader.prototype.free;
2436
+
2437
+ /**
2438
+ * LAMMPS data file reader.
2439
+ *
2440
+ * Reads LAMMPS data files (the format written by `write_data`). The
2441
+ * reader produces a [`Frame`] containing:
2442
+ *
2443
+ * - `"atoms"` block: `type` (i32), `x`, `y`, `z` (F, angstrom),
2444
+ * and optionally `charge` (F)
2445
+ * - `"bonds"` block (if present): `i`, `j` (u32), `type` (i32)
2446
+ * - Simulation box (`simbox`) with PBC
2447
+ *
2448
+ * Only a single frame is supported (`step = 0`).
2449
+ *
2450
+ * # Example (JavaScript)
2451
+ *
2452
+ * ```js
2453
+ * const reader = new LAMMPSReader(dataFileContent);
2454
+ * const frame = reader.read(0);
2455
+ * const atoms = frame.getBlock("atoms");
2456
+ * const bonds = frame.getBlock("bonds");
2457
+ * const box = frame.simbox;
2458
+ * ```
2459
+ */
2460
+ export class LAMMPSReader {
2461
+ __destroy_into_raw() {
2462
+ const ptr = this.__wbg_ptr;
2463
+ this.__wbg_ptr = 0;
2464
+ LAMMPSReaderFinalization.unregister(this);
2465
+ return ptr;
2466
+ }
2467
+ free() {
2468
+ const ptr = this.__destroy_into_raw();
2469
+ wasm.__wbg_lammpsreader_free(ptr, 0);
2470
+ }
2471
+ /**
2472
+ * Check whether the file contains no valid frames.
2473
+ *
2474
+ * # Errors
2475
+ *
2476
+ * Throws a `JsValue` string on parse errors.
2477
+ * @returns {boolean}
2478
+ */
2479
+ isEmpty() {
2480
+ const ret = wasm.lammpsreader_isEmpty(this.__wbg_ptr);
2481
+ if (ret[2]) {
2482
+ throw takeFromExternrefTable0(ret[1]);
2483
+ }
2484
+ return ret[0] !== 0;
2485
+ }
2486
+ /**
2487
+ * Return the number of frames (always 0 or 1 for LAMMPS data files).
2488
+ *
2489
+ * # Errors
2490
+ *
2491
+ * Throws a `JsValue` string on parse errors.
2492
+ * @returns {number}
2493
+ */
2494
+ len() {
2495
+ const ret = wasm.lammpsreader_len(this.__wbg_ptr);
2496
+ if (ret[2]) {
2497
+ throw takeFromExternrefTable0(ret[1]);
2498
+ }
2499
+ return ret[0] >>> 0;
2500
+ }
2501
+ /**
2502
+ * Create a new LAMMPS data file reader from string content.
2503
+ *
2504
+ * # Arguments
2505
+ *
2506
+ * * `content` - The full text content of a LAMMPS data file
2507
+ *
2508
+ * # Example (JavaScript)
2509
+ *
2510
+ * ```js
2511
+ * const reader = new LAMMPSReader(dataFileString);
2512
+ * ```
2513
+ * @param {string} content
1763
2514
  */
1764
2515
  constructor(content) {
1765
2516
  const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
@@ -1841,7 +2592,7 @@ export class LinkedCell {
1841
2592
  * Finds all unique pairs `(i < j)` of atoms within the cutoff
1842
2593
  * distance using the cell-list algorithm.
1843
2594
  *
1844
- * The frame must have an `"atoms"` block with `x`, `y`, `z` (f32) columns.
2595
+ * The frame must have an `"atoms"` block with `x`, `y`, `z` (F) columns.
1845
2596
  * If the frame has a `simbox`, periodic boundary conditions are used.
1846
2597
  * Otherwise, a free-boundary bounding box is auto-generated.
1847
2598
  *
@@ -1862,7 +2613,7 @@ export class LinkedCell {
1862
2613
  * ```js
1863
2614
  * const lc = new LinkedCell(3.0);
1864
2615
  * const nlist = lc.build(frame);
1865
- * const dists = nlist.distances(); // Float32Array
2616
+ * const dists = nlist.distances(); // Float32Array or Float64Array
1866
2617
  * ```
1867
2618
  * @param {Frame} frame
1868
2619
  * @returns {NeighborList}
@@ -1989,7 +2740,7 @@ export class MSD {
1989
2740
  * # Arguments
1990
2741
  *
1991
2742
  * * `frame` - Frame with `"atoms"` block containing
1992
- * `x`, `y`, `z` (f32) columns
2743
+ * `x`, `y`, `z` (F) columns
1993
2744
  *
1994
2745
  * # Errors
1995
2746
  *
@@ -2067,7 +2818,7 @@ if (Symbol.dispose) MSD.prototype[Symbol.dispose] = MSD.prototype.free;
2067
2818
  * ```js
2068
2819
  * const result = msd.compute(frame);
2069
2820
  * console.log(result.mean); // number (A^2)
2070
- * console.log(result.perParticle()); // Float32Array (A^2)
2821
+ * console.log(result.perParticle()); // Float32Array or Float64Array (A^2)
2071
2822
  * ```
2072
2823
  */
2073
2824
  export class MSDResult {
@@ -2100,21 +2851,78 @@ export class MSDResult {
2100
2851
  return ret;
2101
2852
  }
2102
2853
  /**
2103
- * Per-particle squared displacements as `Float32Array` in A^2.
2104
- *
2105
- * `perParticle()[i]` is `|r_i(t) - r_i(0)|^2` for particle `i`.
2106
- * Length equals the number of atoms.
2107
- * @returns {Float32Array}
2854
+ * Zero-copy `Float64Array` view of per-particle squared displacements
2855
+ * in A². `perParticle()[i]` is `|r_i(t) - r_i(0)|²` for particle `i`.
2856
+ * **Invalidated** on WASM memory growth; copy in JS if needed.
2857
+ * @returns {Float64Array}
2108
2858
  */
2109
2859
  perParticle() {
2110
2860
  const ret = wasm.msdresult_perParticle(this.__wbg_ptr);
2111
- var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
2112
- wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
2113
- return v1;
2861
+ return ret;
2114
2862
  }
2115
2863
  }
2116
2864
  if (Symbol.dispose) MSDResult.prototype[Symbol.dispose] = MSDResult.prototype.free;
2117
2865
 
2866
+ /**
2867
+ * Reader for MolRec Zarr v3 archives.
2868
+ */
2869
+ export class MolRecReader {
2870
+ __destroy_into_raw() {
2871
+ const ptr = this.__wbg_ptr;
2872
+ this.__wbg_ptr = 0;
2873
+ MolRecReaderFinalization.unregister(this);
2874
+ return ptr;
2875
+ }
2876
+ free() {
2877
+ const ptr = this.__destroy_into_raw();
2878
+ wasm.__wbg_molrecreader_free(ptr, 0);
2879
+ }
2880
+ /**
2881
+ * @returns {number}
2882
+ */
2883
+ countAtoms() {
2884
+ const ret = wasm.molrecreader_countAtoms(this.__wbg_ptr);
2885
+ return ret >>> 0;
2886
+ }
2887
+ /**
2888
+ * @returns {number}
2889
+ */
2890
+ countFrames() {
2891
+ const ret = wasm.molrecreader_countFrames(this.__wbg_ptr);
2892
+ if (ret[2]) {
2893
+ throw takeFromExternrefTable0(ret[1]);
2894
+ }
2895
+ return ret[0] >>> 0;
2896
+ }
2897
+ free() {
2898
+ wasm.molrecreader_free(this.__wbg_ptr);
2899
+ }
2900
+ /**
2901
+ * @param {Map<any, any>} files
2902
+ */
2903
+ constructor(files) {
2904
+ const ret = wasm.molrecreader_new(files);
2905
+ if (ret[2]) {
2906
+ throw takeFromExternrefTable0(ret[1]);
2907
+ }
2908
+ this.__wbg_ptr = ret[0] >>> 0;
2909
+ MolRecReaderFinalization.register(this, this.__wbg_ptr, this);
2910
+ return this;
2911
+ }
2912
+ /**
2913
+ * @param {number} t
2914
+ * @returns {Frame | undefined}
2915
+ */
2916
+ readFrame(t) {
2917
+ const ret = wasm.molrecreader_readFrame(this.__wbg_ptr, t);
2918
+ if (ret[2]) {
2919
+ throw takeFromExternrefTable0(ret[1]);
2920
+ }
2921
+ return ret[0] === 0 ? undefined : Frame.__wrap(ret[0]);
2922
+ }
2923
+ }
2924
+ if (Symbol.dispose) MolRecReader.prototype[Symbol.dispose] = MolRecReader.prototype.free;
2925
+
2118
2926
  /**
2119
2927
  * Result of a neighbor search: all atom pairs within a distance cutoff.
2120
2928
  *
@@ -2139,7 +2947,7 @@ if (Symbol.dispose) MSDResult.prototype[Symbol.dispose] = MSDResult.prototype.fr
2139
2947
  *
2140
2948
  * const i = nlist.queryPointIndices(); // Uint32Array
2141
2949
  * const j = nlist.pointIndices(); // Uint32Array
2142
- * const d = nlist.distances(); // Float32Array (in A)
2950
+ * const d = nlist.distances(); // Float32Array or Float64Array (in A)
2143
2951
  * ```
2144
2952
  */
2145
2953
  export class NeighborList {
@@ -2161,29 +2969,25 @@ export class NeighborList {
2161
2969
  wasm.__wbg_neighborlist_free(ptr, 0);
2162
2970
  }
2163
2971
  /**
2164
- * Squared pairwise distances in A^2, as a `Float32Array`.
2165
- *
2166
- * More efficient than `distances()` when you only need to
2167
- * compare or threshold distances.
2168
- * @returns {Float32Array}
2972
+ * Zero-copy `Float64Array` view of squared pairwise distances in A^2.
2973
+ * Same invalidation caveat as [`queryPointIndices`](Self::query_point_indices).
2974
+ * @returns {Float64Array}
2169
2975
  */
2170
2976
  distSq() {
2171
2977
  const ret = wasm.neighborlist_distSq(this.__wbg_ptr);
2172
- var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
2173
- wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
2174
- return v1;
2978
+ return ret;
2175
2979
  }
2176
2980
  /**
2177
- * Pairwise distances in angstrom (A), as a `Float32Array`.
2981
+ * Pairwise distances in angstrom (A). Computed lazily from `distSq`.
2178
2982
  *
2179
- * `distances()[k]` is the distance between query point
2180
- * `queryPointIndices()[k]` and reference point `pointIndices()[k]`.
2181
- * @returns {Float32Array}
2983
+ * Returns an owned copy because distances are derived on the fly
2984
+ * (`sqrt` per pair) rather than stored.
2985
+ * @returns {Float64Array}
2182
2986
  */
2183
2987
  distances() {
2184
2988
  const ret = wasm.neighborlist_distances(this.__wbg_ptr);
2185
- var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
2186
- wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
2989
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2990
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
2187
2991
  return v1;
2188
2992
  }
2189
2993
  /**
@@ -2223,27 +3027,23 @@ export class NeighborList {
2223
3027
  return ret >>> 0;
2224
3028
  }
2225
3029
  /**
2226
- * Reference point indices (`j`) for each pair, as a `Uint32Array`.
3030
+ * Zero-copy `Uint32Array` view of reference point indices (`j`).
3031
+ * Same invalidation caveat as [`queryPointIndices`](Self::query_point_indices).
2227
3032
  * @returns {Uint32Array}
2228
3033
  */
2229
3034
  pointIndices() {
2230
3035
  const ret = wasm.neighborlist_pointIndices(this.__wbg_ptr);
2231
- var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
2232
- wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
2233
- return v1;
3036
+ return ret;
2234
3037
  }
2235
3038
  /**
2236
- * Query point indices (`i`) for each pair, as a `Uint32Array`.
2237
- *
2238
- * The `k`-th pair connects query point `queryPointIndices()[k]`
2239
- * to reference point `pointIndices()[k]`.
3039
+ * Zero-copy `Uint32Array` view of query point indices (`i`) over
3040
+ * WASM memory. **Invalidated** on any WASM memory growth — copy
3041
+ * in JS (`new Uint32Array(view)`) if it needs to outlive later calls.
2240
3042
  * @returns {Uint32Array}
2241
3043
  */
2242
3044
  queryPointIndices() {
2243
3045
  const ret = wasm.neighborlist_queryPointIndices(this.__wbg_ptr);
2244
- var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
2245
- wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
2246
- return v1;
3046
+ return ret;
2247
3047
  }
2248
3048
  }
2249
3049
  if (Symbol.dispose) NeighborList.prototype[Symbol.dispose] = NeighborList.prototype.free;
@@ -2253,8 +3053,8 @@ if (Symbol.dispose) NeighborList.prototype[Symbol.dispose] = NeighborList.protot
2253
3053
  *
2254
3054
  * PDB files contain a single molecular structure. The reader produces
2255
3055
  * a [`Frame`] with an `"atoms"` block containing columns such as
2256
- * `name` (string), `resname` (string), `x`, `y`, `z` (f32, angstrom),
2257
- * and optionally `occupancy` and `bfactor` (f32).
3056
+ * `name` (string), `resname` (string), `x`, `y`, `z` (F, angstrom),
3057
+ * and optionally `occupancy` and `bfactor` (F).
2258
3058
  *
2259
3059
  * # Example (JavaScript)
2260
3060
  *
@@ -2263,7 +3063,7 @@ if (Symbol.dispose) NeighborList.prototype[Symbol.dispose] = NeighborList.protot
2263
3063
  * const frame = reader.read(0);
2264
3064
  * const atoms = frame.getBlock("atoms");
2265
3065
  * const names = atoms.copyColStr("name"); // ["CA", "CB", ...]
2266
- * const x = atoms.copyColF32("x");
3066
+ * const x = atoms.copyColF("x");
2267
3067
  * ```
2268
3068
  */
2269
3069
  export class PDBReader {
@@ -2388,8 +3188,8 @@ if (Symbol.dispose) PDBReader.prototype[Symbol.dispose] = PDBReader.prototype.fr
2388
3188
  * const rdf = new RDF(100, 5.0);
2389
3189
  * const result = rdf.compute(frame, nlist);
2390
3190
  *
2391
- * const r = result.binCenters(); // Float32Array, bin centers in A
2392
- * const gr = result.rdf(); // Float32Array, g(r) values
3191
+ * const r = result.binCenters(); // Float32Array or Float64Array, bin centers in A
3192
+ * const gr = result.rdf(); // Float32Array or Float64Array, g(r) values
2393
3193
  * ```
2394
3194
  */
2395
3195
  export class RDF {
@@ -2427,7 +3227,7 @@ export class RDF {
2427
3227
  *
2428
3228
  * ```js
2429
3229
  * const result = rdf.compute(frame, nlist);
2430
- * const gr = result.rdf(); // Float32Array
3230
+ * const gr = result.rdf(); // Float32Array or Float64Array
2431
3231
  * ```
2432
3232
  * @param {Frame} frame
2433
3233
  * @param {NeighborList} neighbors
@@ -2478,9 +3278,9 @@ if (Symbol.dispose) RDF.prototype[Symbol.dispose] = RDF.prototype.free;
2478
3278
  *
2479
3279
  * ```js
2480
3280
  * const result = rdf.compute(frame, nlist);
2481
- * const r = result.binCenters(); // Float32Array [0.025, 0.075, ...]
2482
- * const gr = result.rdf(); // Float32Array, normalized g(r)
2483
- * const nr = result.pairCounts(); // Float32Array, raw counts
3281
+ * const r = result.binCenters(); // Float32Array or Float64Array [0.025, 0.075, ...]
3282
+ * const gr = result.rdf(); // Float32Array or Float64Array, normalized g(r)
3283
+ * const nr = result.pairCounts(); // Float32Array or Float64Array, raw counts
2484
3284
  * console.log("Volume:", result.volume, "A^3");
2485
3285
  * console.log("N_ref:", result.numPoints);
2486
3286
  * ```
@@ -2504,28 +3304,23 @@ export class RDFResult {
2504
3304
  wasm.__wbg_rdfresult_free(ptr, 0);
2505
3305
  }
2506
3306
  /**
2507
- * Bin center positions as `Float32Array` in angstrom (A).
2508
- *
2509
- * Length equals `n_bins` (the value passed to the `RDF` constructor).
2510
- * @returns {Float32Array}
3307
+ * Zero-copy `Float64Array` view of bin center positions in A.
3308
+ * Length equals `n_bins`. **Invalidated** on WASM memory growth;
3309
+ * copy in JS if it needs to outlive later calls.
3310
+ * @returns {Float64Array}
2511
3311
  */
2512
3312
  binCenters() {
2513
3313
  const ret = wasm.rdfresult_binCenters(this.__wbg_ptr);
2514
- var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
2515
- wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
2516
- return v1;
3314
+ return ret;
2517
3315
  }
2518
3316
  /**
2519
- * Bin edge positions as `Float32Array` in angstrom (A).
2520
- *
2521
- * Length is `n_bins + 1` (one more than bin centers).
2522
- * @returns {Float32Array}
3317
+ * Zero-copy `Float64Array` view of bin edge positions in A.
3318
+ * Length is `n_bins + 1`. Same invalidation caveat.
3319
+ * @returns {Float64Array}
2523
3320
  */
2524
3321
  binEdges() {
2525
3322
  const ret = wasm.rdfresult_binEdges(this.__wbg_ptr);
2526
- var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
2527
- wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
2528
- return v1;
3323
+ return ret;
2529
3324
  }
2530
3325
  /**
2531
3326
  * Number of reference points used in the normalization.
@@ -2536,27 +3331,22 @@ export class RDFResult {
2536
3331
  return ret >>> 0;
2537
3332
  }
2538
3333
  /**
2539
- * Raw (un-normalized) pair counts per bin as `Float32Array`.
2540
- * @returns {Float32Array}
3334
+ * Zero-copy `Float64Array` view of raw (un-normalized) pair counts
3335
+ * per bin. Same invalidation caveat.
3336
+ * @returns {Float64Array}
2541
3337
  */
2542
3338
  pairCounts() {
2543
3339
  const ret = wasm.rdfresult_pairCounts(this.__wbg_ptr);
2544
- var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
2545
- wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
2546
- return v1;
3340
+ return ret;
2547
3341
  }
2548
3342
  /**
2549
- * Normalized g(r) values as `Float32Array` (dimensionless).
2550
- *
2551
- * A uniform ideal gas has g(r) = 1.0 everywhere. Peaks indicate
2552
- * preferred interatomic distances (coordination shells).
2553
- * @returns {Float32Array}
3343
+ * Zero-copy `Float64Array` view of normalized g(r). Same invalidation
3344
+ * caveat.
3345
+ * @returns {Float64Array}
2554
3346
  */
2555
3347
  rdf() {
2556
3348
  const ret = wasm.rdfresult_rdf(this.__wbg_ptr);
2557
- var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
2558
- wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
2559
- return v1;
3349
+ return ret;
2560
3350
  }
2561
3351
  /**
2562
3352
  * Simulation box volume used in the normalization, in A^3.
@@ -2570,150 +3360,135 @@ export class RDFResult {
2570
3360
  if (Symbol.dispose) RDFResult.prototype[Symbol.dispose] = RDFResult.prototype.free;
2571
3361
 
2572
3362
  /**
2573
- * Reader for Zarr V3 simulation archives.
3363
+ * Radius of gyration per cluster.
3364
+ */
3365
+ export class RadiusOfGyration {
3366
+ __destroy_into_raw() {
3367
+ const ptr = this.__wbg_ptr;
3368
+ this.__wbg_ptr = 0;
3369
+ RadiusOfGyrationFinalization.unregister(this);
3370
+ return ptr;
3371
+ }
3372
+ free() {
3373
+ const ptr = this.__destroy_into_raw();
3374
+ wasm.__wbg_radiusofgyration_free(ptr, 0);
3375
+ }
3376
+ /**
3377
+ * Compute radii of gyration. Returns a float typed array of length `numClusters`.
3378
+ * @param {Frame} frame
3379
+ * @param {ClusterResult} cluster_result
3380
+ * @returns {Float64Array}
3381
+ */
3382
+ compute(frame, cluster_result) {
3383
+ _assertClass(frame, Frame);
3384
+ _assertClass(cluster_result, ClusterResult);
3385
+ const ret = wasm.radiusofgyration_compute(this.__wbg_ptr, frame.__wbg_ptr, cluster_result.__wbg_ptr);
3386
+ if (ret[3]) {
3387
+ throw takeFromExternrefTable0(ret[2]);
3388
+ }
3389
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
3390
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
3391
+ return v1;
3392
+ }
3393
+ /**
3394
+ * @param {Float64Array | null} [masses]
3395
+ */
3396
+ constructor(masses) {
3397
+ var ptr0 = isLikeNone(masses) ? 0 : passArrayF64ToWasm0(masses, wasm.__wbindgen_malloc_command_export);
3398
+ var len0 = WASM_VECTOR_LEN;
3399
+ const ret = wasm.radiusofgyration_new(ptr0, len0);
3400
+ this.__wbg_ptr = ret >>> 0;
3401
+ RadiusOfGyrationFinalization.register(this, this.__wbg_ptr, this);
3402
+ return this;
3403
+ }
3404
+ }
3405
+ if (Symbol.dispose) RadiusOfGyration.prototype[Symbol.dispose] = RadiusOfGyration.prototype.free;
3406
+
3407
+ /**
3408
+ * MDL molfile / SDF (V2000 CTAB) reader.
2574
3409
  *
2575
- * Wraps [`SimulationStore`] from `molrs-core` for reading trajectory
2576
- * frames and system metadata from an in-memory Zarr store. The store
2577
- * is populated from a `Map<string, Uint8Array>` of file paths to
2578
- * binary content.
3410
+ * Parses the connection table found in `.mol` files and the record
3411
+ * blocks of `.sdf` files. Coordinates come directly from the file
3412
+ * no 3D generation is performed. Only V2000 is supported; V3000
3413
+ * records throw on read.
3414
+ *
3415
+ * Produces a [`Frame`] with:
3416
+ * - `"atoms"` block: `element` (string), `id` (u32, 1-based),
3417
+ * `x`, `y`, `z` (F, angstrom)
3418
+ * - `"bonds"` block (if present): `atomi`, `atomj` (u32, 0-based),
3419
+ * `order` (u32)
3420
+ *
3421
+ * Multi-record SDF files expose each record as a separate frame via
3422
+ * `read(step)`.
2579
3423
  *
2580
3424
  * # Example (JavaScript)
2581
3425
  *
2582
3426
  * ```js
2583
- * const files = new Map();
2584
- * files.set("zarr.json", new Uint8Array([...]));
2585
- * files.set("system/.zarray", new Uint8Array([...]));
2586
- * // ... etc.
2587
- *
2588
- * const reader = new SimulationReader(files);
2589
- * const frame = reader.readFrame(0);
3427
+ * const reader = new SDFReader(sdfContent);
3428
+ * const frame = reader.read(0);
3429
+ * const atoms = frame.getBlock("atoms");
3430
+ * const x = atoms.copyColF("x");
2590
3431
  * ```
2591
3432
  */
2592
- export class SimulationReader {
3433
+ export class SDFReader {
2593
3434
  __destroy_into_raw() {
2594
3435
  const ptr = this.__wbg_ptr;
2595
3436
  this.__wbg_ptr = 0;
2596
- SimulationReaderFinalization.unregister(this);
3437
+ SDFReaderFinalization.unregister(this);
2597
3438
  return ptr;
2598
3439
  }
2599
3440
  free() {
2600
3441
  const ptr = this.__destroy_into_raw();
2601
- wasm.__wbg_simulationreader_free(ptr, 0);
3442
+ wasm.__wbg_sdfreader_free(ptr, 0);
2602
3443
  }
2603
3444
  /**
2604
- * Return the number of atoms in the system topology.
2605
- *
2606
- * # Example (JavaScript)
2607
- *
2608
- * ```js
2609
- * console.log(reader.countAtoms()); // e.g., 256
2610
- * ```
2611
- * @returns {number}
2612
- */
2613
- countAtoms() {
2614
- const ret = wasm.simulationreader_countAtoms(this.__wbg_ptr);
2615
- return ret >>> 0;
2616
- }
2617
- /**
2618
- * Return the number of trajectory frames in the archive.
2619
- *
2620
- * Returns `0` if no trajectory data is present.
2621
- *
2622
- * # Errors
2623
- *
2624
- * Throws a `JsValue` string on I/O errors.
2625
- *
2626
- * # Example (JavaScript)
2627
- *
2628
- * ```js
2629
- * console.log(reader.countFrames()); // e.g., 1000
2630
- * ```
2631
- * @returns {number}
3445
+ * Check whether the file contains no records.
3446
+ * @returns {boolean}
2632
3447
  */
2633
- countFrames() {
2634
- const ret = wasm.simulationreader_countFrames(this.__wbg_ptr);
3448
+ isEmpty() {
3449
+ const ret = wasm.sdfreader_isEmpty(this.__wbg_ptr);
2635
3450
  if (ret[2]) {
2636
3451
  throw takeFromExternrefTable0(ret[1]);
2637
- }
2638
- return ret[0] >>> 0;
2639
- }
2640
- /**
2641
- * Create a reader from a map of file paths to binary content.
2642
- *
2643
- * The map keys are relative paths within the Zarr archive
2644
- * (e.g., `"zarr.json"`, `"system/.zarray"`). Values are the
2645
- * raw bytes of each file as `Uint8Array`.
2646
- *
2647
- * # Arguments
2648
- *
2649
- * * `files` - `Map<string, Uint8Array>` mapping archive paths
2650
- * to their binary content
2651
- *
2652
- * # Returns
2653
- *
2654
- * A new `SimulationReader` ready to read frames.
2655
- *
2656
- * # Errors
2657
- *
2658
- * Throws a `JsValue` string if the archive cannot be opened
2659
- * (e.g., missing required metadata files).
2660
- *
2661
- * # Example (JavaScript)
2662
- *
2663
- * ```js
2664
- * const reader = new SimulationReader(filesMap);
2665
- * ```
2666
- * @param {Map<any, any>} files
3452
+ }
3453
+ return ret[0] !== 0;
3454
+ }
3455
+ /**
3456
+ * Return the total number of records in the SDF file.
3457
+ * @returns {number}
2667
3458
  */
2668
- constructor(files) {
2669
- const ret = wasm.simulationreader_new(files);
3459
+ len() {
3460
+ const ret = wasm.sdfreader_len(this.__wbg_ptr);
2670
3461
  if (ret[2]) {
2671
3462
  throw takeFromExternrefTable0(ret[1]);
2672
3463
  }
2673
- this.__wbg_ptr = ret[0] >>> 0;
2674
- SimulationReaderFinalization.register(this, this.__wbg_ptr, this);
3464
+ return ret[0] >>> 0;
3465
+ }
3466
+ /**
3467
+ * Create a new SDF reader from a string containing the file content.
3468
+ * @param {string} content
3469
+ */
3470
+ constructor(content) {
3471
+ const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
3472
+ const len0 = WASM_VECTOR_LEN;
3473
+ const ret = wasm.sdfreader_new(ptr0, len0);
3474
+ this.__wbg_ptr = ret >>> 0;
3475
+ SDFReaderFinalization.register(this, this.__wbg_ptr, this);
2675
3476
  return this;
2676
3477
  }
2677
3478
  /**
2678
- * Read a trajectory frame at the given time index.
2679
- *
2680
- * The returned [`Frame`] merges the static system topology
2681
- * (atoms, bonds) with the per-frame trajectory data (positions,
2682
- * velocities, etc.) at time step `t`.
2683
- *
2684
- * # Arguments
2685
- *
2686
- * * `t` - Zero-based time step index
2687
- *
2688
- * # Returns
2689
- *
2690
- * A [`Frame`] with merged system + trajectory data, or `undefined`
2691
- * if no trajectory is present.
2692
- *
2693
- * # Errors
2694
- *
2695
- * Throws a `JsValue` string on I/O or deserialization errors.
2696
- *
2697
- * # Example (JavaScript)
2698
- *
2699
- * ```js
2700
- * const frame = reader.readFrame(0);
2701
- * if (frame) {
2702
- * const x = frame.getBlock("atoms").copyColF32("x");
2703
- * }
2704
- * ```
2705
- * @param {number} t
3479
+ * Read the frame (SDF record) at the given step index.
3480
+ * @param {number} step
2706
3481
  * @returns {Frame | undefined}
2707
3482
  */
2708
- readFrame(t) {
2709
- const ret = wasm.simulationreader_readFrame(this.__wbg_ptr, t);
3483
+ read(step) {
3484
+ const ret = wasm.sdfreader_read(this.__wbg_ptr, step);
2710
3485
  if (ret[2]) {
2711
3486
  throw takeFromExternrefTable0(ret[1]);
2712
3487
  }
2713
3488
  return ret[0] === 0 ? undefined : Frame.__wrap(ret[0]);
2714
3489
  }
2715
3490
  }
2716
- if (Symbol.dispose) SimulationReader.prototype[Symbol.dispose] = SimulationReader.prototype.free;
3491
+ if (Symbol.dispose) SDFReader.prototype[Symbol.dispose] = SDFReader.prototype.free;
2717
3492
 
2718
3493
  /**
2719
3494
  * Intermediate representation of a parsed SMILES string.
@@ -2733,7 +3508,7 @@ if (Symbol.dispose) SimulationReader.prototype[Symbol.dispose] = SimulationReade
2733
3508
  *
2734
3509
  * const frame = ir.toFrame();
2735
3510
  * const atoms = frame.getBlock("atoms");
2736
- * console.log(atoms.copyColStr("symbol")); // ["C", "C", "O", "H", ...]
3511
+ * console.log(atoms.copyColStr("element")); // ["C", "C", "O", "H", ...]
2737
3512
  * ```
2738
3513
  */
2739
3514
  export class SmilesIR {
@@ -2781,7 +3556,7 @@ export class SmilesIR {
2781
3556
  * are added. No 3D coordinates are present -- use
2782
3557
  * [`generate3D`](crate::generate_3d_wasm) to embed coordinates.
2783
3558
  * - `"bonds"` block: `i`, `j` (u32, zero-based atom indices),
2784
- * `order` (f32, bond order: 1.0 = single, 1.5 = aromatic,
3559
+ * `order` (F, bond order: 1.0 = single, 1.5 = aromatic,
2785
3560
  * 2.0 = double, 3.0 = triple).
2786
3561
  *
2787
3562
  * # Returns
@@ -2798,7 +3573,7 @@ export class SmilesIR {
2798
3573
  * ```js
2799
3574
  * const frame = ir.toFrame();
2800
3575
  * const bonds = frame.getBlock("bonds");
2801
- * const order = bonds.copyColF32("order");
3576
+ * const order = bonds.copyColF("order");
2802
3577
  * ```
2803
3578
  * @returns {Frame}
2804
3579
  */
@@ -2813,26 +3588,346 @@ export class SmilesIR {
2813
3588
  if (Symbol.dispose) SmilesIR.prototype[Symbol.dispose] = SmilesIR.prototype.free;
2814
3589
 
2815
3590
  /**
2816
- * Owned f32 array with ndarray-compatible shape metadata.
3591
+ * Graph-based molecular topology with automated detection of angles,
3592
+ * dihedrals, impropers, connected components, and rings (SSSR).
3593
+ *
3594
+ * API mirrors igraph / molpy conventions.
3595
+ *
3596
+ * # Example (JavaScript)
3597
+ *
3598
+ * ```js
3599
+ * const topo = Topology.fromFrame(frame);
3600
+ * console.log(topo.nAtoms, topo.nBonds);
3601
+ *
3602
+ * const angles = topo.angles(); // Uint32Array [i,j,k, ...]
3603
+ * const dihedrals = topo.dihedrals(); // Uint32Array [i,j,k,l, ...]
3604
+ * const cc = topo.connectedComponents(); // Int32Array per-atom labels
3605
+ *
3606
+ * const rings = topo.findRings();
3607
+ * console.log(rings.numRings);
3608
+ * ```
3609
+ */
3610
+ export class Topology {
3611
+ static __wrap(ptr) {
3612
+ ptr = ptr >>> 0;
3613
+ const obj = Object.create(Topology.prototype);
3614
+ obj.__wbg_ptr = ptr;
3615
+ TopologyFinalization.register(obj, obj.__wbg_ptr, obj);
3616
+ return obj;
3617
+ }
3618
+ __destroy_into_raw() {
3619
+ const ptr = this.__wbg_ptr;
3620
+ this.__wbg_ptr = 0;
3621
+ TopologyFinalization.unregister(this);
3622
+ return ptr;
3623
+ }
3624
+ free() {
3625
+ const ptr = this.__destroy_into_raw();
3626
+ wasm.__wbg_topology_free(ptr, 0);
3627
+ }
3628
+ /**
3629
+ * Add a single atom.
3630
+ */
3631
+ addAtom() {
3632
+ wasm.topology_addAtom(this.__wbg_ptr);
3633
+ }
3634
+ /**
3635
+ * Add a bond between atoms `i` and `j`.
3636
+ * @param {number} i
3637
+ * @param {number} j
3638
+ */
3639
+ addBond(i, j) {
3640
+ wasm.topology_addBond(this.__wbg_ptr, i, j);
3641
+ }
3642
+ /**
3643
+ * All angle triplets as flat `Uint32Array` `[i,j,k, ...]`.
3644
+ * @returns {Uint32Array}
3645
+ */
3646
+ angles() {
3647
+ const ret = wasm.topology_angles(this.__wbg_ptr);
3648
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
3649
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
3650
+ return v1;
3651
+ }
3652
+ /**
3653
+ * Whether atoms `i` and `j` are directly bonded.
3654
+ * @param {number} i
3655
+ * @param {number} j
3656
+ * @returns {boolean}
3657
+ */
3658
+ areBonded(i, j) {
3659
+ const ret = wasm.topology_areBonded(this.__wbg_ptr, i, j);
3660
+ return ret !== 0;
3661
+ }
3662
+ /**
3663
+ * All bond pairs as flat `Uint32Array` `[i0,j0, i1,j1, ...]`.
3664
+ * @returns {Uint32Array}
3665
+ */
3666
+ bonds() {
3667
+ const ret = wasm.topology_bonds(this.__wbg_ptr);
3668
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
3669
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
3670
+ return v1;
3671
+ }
3672
+ /**
3673
+ * Per-atom connected component labels as `Int32Array`.
3674
+ *
3675
+ * Labels are 0-based and contiguous. Each atom gets a component ID.
3676
+ * Atoms in the same connected subgraph share the same label.
3677
+ * @returns {Int32Array}
3678
+ */
3679
+ connectedComponents() {
3680
+ const ret = wasm.topology_connectedComponents(this.__wbg_ptr);
3681
+ var v1 = getArrayI32FromWasm0(ret[0], ret[1]).slice();
3682
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
3683
+ return v1;
3684
+ }
3685
+ /**
3686
+ * Degree (number of bonds) of atom `idx`.
3687
+ * @param {number} idx
3688
+ * @returns {number}
3689
+ */
3690
+ degree(idx) {
3691
+ const ret = wasm.topology_degree(this.__wbg_ptr, idx);
3692
+ return ret >>> 0;
3693
+ }
3694
+ /**
3695
+ * Delete an atom by index.
3696
+ * @param {number} idx
3697
+ */
3698
+ deleteAtom(idx) {
3699
+ wasm.topology_deleteAtom(this.__wbg_ptr, idx);
3700
+ }
3701
+ /**
3702
+ * Delete a bond by edge index.
3703
+ * @param {number} idx
3704
+ */
3705
+ deleteBond(idx) {
3706
+ wasm.topology_deleteBond(this.__wbg_ptr, idx);
3707
+ }
3708
+ /**
3709
+ * All proper dihedral quartets as flat `Uint32Array` `[i,j,k,l, ...]`.
3710
+ * @returns {Uint32Array}
3711
+ */
3712
+ dihedrals() {
3713
+ const ret = wasm.topology_dihedrals(this.__wbg_ptr);
3714
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
3715
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
3716
+ return v1;
3717
+ }
3718
+ /**
3719
+ * Compute the Smallest Set of Smallest Rings (SSSR).
3720
+ * @returns {TopologyRingInfo}
3721
+ */
3722
+ findRings() {
3723
+ const ret = wasm.topology_findRings(this.__wbg_ptr);
3724
+ return TopologyRingInfo.__wrap(ret);
3725
+ }
3726
+ /**
3727
+ * Build a topology from a Frame's `bonds` block.
3728
+ *
3729
+ * Reads the `atoms` block for atom count and `bonds` block for
3730
+ * `i`, `j` columns (Uint32).
3731
+ * @param {Frame} frame
3732
+ * @returns {Topology}
3733
+ */
3734
+ static fromFrame(frame) {
3735
+ _assertClass(frame, Frame);
3736
+ const ret = wasm.topology_fromFrame(frame.__wbg_ptr);
3737
+ if (ret[2]) {
3738
+ throw takeFromExternrefTable0(ret[1]);
3739
+ }
3740
+ return Topology.__wrap(ret[0]);
3741
+ }
3742
+ /**
3743
+ * All improper dihedral quartets as flat `Uint32Array` `[center,i,j,k, ...]`.
3744
+ * @returns {Uint32Array}
3745
+ */
3746
+ impropers() {
3747
+ const ret = wasm.topology_impropers(this.__wbg_ptr);
3748
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
3749
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
3750
+ return v1;
3751
+ }
3752
+ /**
3753
+ * Number of unique angles.
3754
+ * @returns {number}
3755
+ */
3756
+ get nAngles() {
3757
+ const ret = wasm.topology_nAngles(this.__wbg_ptr);
3758
+ return ret >>> 0;
3759
+ }
3760
+ /**
3761
+ * Number of atoms (vertices).
3762
+ * @returns {number}
3763
+ */
3764
+ get nAtoms() {
3765
+ const ret = wasm.topology_nAtoms(this.__wbg_ptr);
3766
+ return ret >>> 0;
3767
+ }
3768
+ /**
3769
+ * Number of bonds (edges).
3770
+ * @returns {number}
3771
+ */
3772
+ get nBonds() {
3773
+ const ret = wasm.topology_nBonds(this.__wbg_ptr);
3774
+ return ret >>> 0;
3775
+ }
3776
+ /**
3777
+ * Number of connected components.
3778
+ * @returns {number}
3779
+ */
3780
+ get nComponents() {
3781
+ const ret = wasm.topology_nComponents(this.__wbg_ptr);
3782
+ return ret >>> 0;
3783
+ }
3784
+ /**
3785
+ * Number of unique proper dihedrals.
3786
+ * @returns {number}
3787
+ */
3788
+ get nDihedrals() {
3789
+ const ret = wasm.topology_nDihedrals(this.__wbg_ptr);
3790
+ return ret >>> 0;
3791
+ }
3792
+ /**
3793
+ * Neighbor atom indices of atom `idx` as `Uint32Array`.
3794
+ * @param {number} idx
3795
+ * @returns {Uint32Array}
3796
+ */
3797
+ neighbors(idx) {
3798
+ const ret = wasm.topology_neighbors(this.__wbg_ptr, idx);
3799
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
3800
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
3801
+ return v1;
3802
+ }
3803
+ /**
3804
+ * Create a topology with `n` atoms and no bonds.
3805
+ * @param {number} n_atoms
3806
+ */
3807
+ constructor(n_atoms) {
3808
+ const ret = wasm.topology_new(n_atoms);
3809
+ this.__wbg_ptr = ret >>> 0;
3810
+ TopologyFinalization.register(this, this.__wbg_ptr, this);
3811
+ return this;
3812
+ }
3813
+ }
3814
+ if (Symbol.dispose) Topology.prototype[Symbol.dispose] = Topology.prototype.free;
3815
+
3816
+ /**
3817
+ * Result of ring detection (SSSR) on a topology graph.
3818
+ *
3819
+ * # Example (JavaScript)
3820
+ *
3821
+ * ```js
3822
+ * const rings = topo.findRings();
3823
+ * console.log(rings.numRings);
3824
+ * console.log(rings.ringSizes()); // Uint32Array
3825
+ * console.log(rings.isAtomInRing(0));
3826
+ *
3827
+ * // Get all rings as flat array [size0, idx0_0, idx0_1, ..., size1, ...]
3828
+ * const data = rings.rings();
3829
+ * ```
3830
+ */
3831
+ export class TopologyRingInfo {
3832
+ static __wrap(ptr) {
3833
+ ptr = ptr >>> 0;
3834
+ const obj = Object.create(TopologyRingInfo.prototype);
3835
+ obj.__wbg_ptr = ptr;
3836
+ TopologyRingInfoFinalization.register(obj, obj.__wbg_ptr, obj);
3837
+ return obj;
3838
+ }
3839
+ __destroy_into_raw() {
3840
+ const ptr = this.__wbg_ptr;
3841
+ this.__wbg_ptr = 0;
3842
+ TopologyRingInfoFinalization.unregister(this);
3843
+ return ptr;
3844
+ }
3845
+ free() {
3846
+ const ptr = this.__destroy_into_raw();
3847
+ wasm.__wbg_topologyringinfo_free(ptr, 0);
3848
+ }
3849
+ /**
3850
+ * Per-atom boolean mask as `Uint8Array` (0 or 1). 1 if atom is in any ring.
3851
+ * @param {number} n_atoms
3852
+ * @returns {Uint8Array}
3853
+ */
3854
+ atomRingMask(n_atoms) {
3855
+ const ret = wasm.topologyringinfo_atomRingMask(this.__wbg_ptr, n_atoms);
3856
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
3857
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
3858
+ return v1;
3859
+ }
3860
+ /**
3861
+ * Whether atom `idx` belongs to any ring.
3862
+ * @param {number} idx
3863
+ * @returns {boolean}
3864
+ */
3865
+ isAtomInRing(idx) {
3866
+ const ret = wasm.topologyringinfo_isAtomInRing(this.__wbg_ptr, idx);
3867
+ return ret !== 0;
3868
+ }
3869
+ /**
3870
+ * Number of rings containing atom `idx`.
3871
+ * @param {number} idx
3872
+ * @returns {number}
3873
+ */
3874
+ numAtomRings(idx) {
3875
+ const ret = wasm.topologyringinfo_numAtomRings(this.__wbg_ptr, idx);
3876
+ return ret >>> 0;
3877
+ }
3878
+ /**
3879
+ * Total number of rings detected.
3880
+ * @returns {number}
3881
+ */
3882
+ get numRings() {
3883
+ const ret = wasm.topologyringinfo_numRings(this.__wbg_ptr);
3884
+ return ret >>> 0;
3885
+ }
3886
+ /**
3887
+ * Size of each ring as `Uint32Array`.
3888
+ * @returns {Uint32Array}
3889
+ */
3890
+ ringSizes() {
3891
+ const ret = wasm.topologyringinfo_ringSizes(this.__wbg_ptr);
3892
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
3893
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
3894
+ return v1;
3895
+ }
3896
+ /**
3897
+ * All rings as flat `Uint32Array` with length-prefixed encoding:
3898
+ * `[size0, atom0, atom1, ..., size1, atom0, atom1, ...]`.
3899
+ * @returns {Uint32Array}
3900
+ */
3901
+ rings() {
3902
+ const ret = wasm.topologyringinfo_rings(this.__wbg_ptr);
3903
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
3904
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
3905
+ return v1;
3906
+ }
3907
+ }
3908
+ if (Symbol.dispose) TopologyRingInfo.prototype[Symbol.dispose] = TopologyRingInfo.prototype.free;
3909
+
3910
+ /**
3911
+ * Owned float array with ndarray-compatible shape metadata.
2817
3912
  *
2818
- * Stores a flat `Vec<f32>` together with a shape descriptor (e.g.,
3913
+ * Stores a flat `Vec<F>` together with a shape descriptor (e.g.,
2819
3914
  * `[N, 3]` for an Nx3 coordinate matrix). Used for passing
2820
3915
  * multi-dimensional numeric data across the WASM boundary.
2821
3916
  *
2822
3917
  * # Memory layout
2823
3918
  *
2824
3919
  * Data is stored in row-major (C) order, matching ndarray's default
2825
- * and JavaScript's `Float32Array` convention.
3920
+ * and JavaScript's float typed-array convention.
2826
3921
  *
2827
3922
  * # Example (JavaScript)
2828
3923
  *
2829
3924
  * ```js
2830
3925
  * // Create a 2x3 zero array
2831
3926
  * const arr = new WasmArray([2, 3]);
2832
- * arr.writeFrom(new Float32Array([1,2,3, 4,5,6]));
3927
+ * arr.writeFrom(floatArray);
2833
3928
  *
2834
3929
  * // Or from existing data
2835
- * const arr2 = WasmArray.from(new Float32Array([1,2,3]), [1, 3]);
3930
+ * const arr2 = WasmArray.from(floatArray, [1, 3]);
2836
3931
  *
2837
3932
  * // Get data back
2838
3933
  * const copy = arr.toCopy(); // safe owned copy
@@ -2858,7 +3953,7 @@ export class WasmArray {
2858
3953
  wasm.__wbg_wasmarray_free(ptr, 0);
2859
3954
  }
2860
3955
  /**
2861
- * Return the data type string. Always `"float"` for `WasmArray`.
3956
+ * Return the concrete float dtype string for this build.
2862
3957
  * @returns {string}
2863
3958
  */
2864
3959
  dtype() {
@@ -2874,11 +3969,11 @@ export class WasmArray {
2874
3969
  }
2875
3970
  }
2876
3971
  /**
2877
- * Create a `WasmArray` from an existing JS `Float32Array`.
3972
+ * Create a `WasmArray` from an existing JS float typed array.
2878
3973
  *
2879
3974
  * # Arguments
2880
3975
  *
2881
- * * `data` - Source `Float32Array`
3976
+ * * `data` - Source float typed array (`Float32Array` or `Float64Array`)
2882
3977
  * * `shape` - Optional shape. If omitted, defaults to `[data.length]` (1D).
2883
3978
  *
2884
3979
  * # Returns
@@ -2892,10 +3987,10 @@ export class WasmArray {
2892
3987
  * # Example (JavaScript)
2893
3988
  *
2894
3989
  * ```js
2895
- * const arr = WasmArray.from(new Float32Array([1,2,3,4,5,6]), [2, 3]);
3990
+ * const arr = WasmArray.from(floatArray, [2, 3]);
2896
3991
  * console.log(arr.shape()); // [2, 3]
2897
3992
  * ```
2898
- * @param {Float32Array} data
3993
+ * @param {Float64Array} data
2899
3994
  * @param {Uint32Array | null} [shape]
2900
3995
  * @returns {WasmArray}
2901
3996
  */
@@ -2993,7 +4088,7 @@ export class WasmArray {
2993
4088
  * # Example (JavaScript)
2994
4089
  *
2995
4090
  * ```js
2996
- * const arr = WasmArray.from(new Float32Array([1, 2, 3]));
4091
+ * const arr = WasmArray.from(floatArray);
2997
4092
  * console.log(arr.sum()); // 6.0
2998
4093
  * ```
2999
4094
  * @returns {number}
@@ -3003,7 +4098,7 @@ export class WasmArray {
3003
4098
  return ret;
3004
4099
  }
3005
4100
  /**
3006
- * Create an owned JS `Float32Array` copy of the data.
4101
+ * Create an owned JS float typed-array copy of the data.
3007
4102
  *
3008
4103
  * The returned array is an independent copy that is safe to store
3009
4104
  * and use regardless of subsequent WASM memory operations.
@@ -3013,14 +4108,14 @@ export class WasmArray {
3013
4108
  * ```js
3014
4109
  * const copy = arr.toCopy(); // safe to keep indefinitely
3015
4110
  * ```
3016
- * @returns {Float32Array}
4111
+ * @returns {Float64Array}
3017
4112
  */
3018
4113
  toCopy() {
3019
4114
  const ret = wasm.wasmarray_toCopy(this.__wbg_ptr);
3020
4115
  return ret;
3021
4116
  }
3022
4117
  /**
3023
- * Zero-copy `Float32Array` view over this array's backing storage.
4118
+ * Zero-copy float typed-array view over this array's backing storage.
3024
4119
  *
3025
4120
  * **Warning**: The returned view becomes **invalid** if WASM linear
3026
4121
  * memory grows (due to any allocation). Use [`toCopy`](WasmArray::to_copy)
@@ -3028,7 +4123,8 @@ export class WasmArray {
3028
4123
  *
3029
4124
  * # Safety (internal)
3030
4125
  *
3031
- * Uses `Float32Array::view` which creates an unowned view into
4126
+ * Uses the corresponding JS float typed-array `view` constructor,
4127
+ * which creates an unowned view into
3032
4128
  * WASM memory. The view must not outlive the `WasmArray` and must
3033
4129
  * not be used after any allocation that could trigger memory growth.
3034
4130
  *
@@ -3038,21 +4134,21 @@ export class WasmArray {
3038
4134
  * const view = arr.toTypedArray(); // use immediately
3039
4135
  * // Do NOT allocate between view creation and use
3040
4136
  * ```
3041
- * @returns {Float32Array}
4137
+ * @returns {Float64Array}
3042
4138
  */
3043
4139
  toTypedArray() {
3044
4140
  const ret = wasm.wasmarray_toTypedArray(this.__wbg_ptr);
3045
4141
  return ret;
3046
4142
  }
3047
4143
  /**
3048
- * Overwrite the array contents from a JS `Float32Array`.
4144
+ * Overwrite the array contents from a JS float typed array.
3049
4145
  *
3050
4146
  * The source array must have exactly the same number of elements
3051
4147
  * as this `WasmArray` (i.e., the shape is preserved).
3052
4148
  *
3053
4149
  * # Arguments
3054
4150
  *
3055
- * * `arr` - Source `Float32Array` with matching length
4151
+ * * `arr` - Source float typed array with matching length
3056
4152
  *
3057
4153
  * # Errors
3058
4154
  *
@@ -3062,9 +4158,9 @@ export class WasmArray {
3062
4158
  *
3063
4159
  * ```js
3064
4160
  * const wa = new WasmArray([3]);
3065
- * wa.writeFrom(new Float32Array([1.0, 2.0, 3.0]));
4161
+ * wa.writeFrom(floatArray);
3066
4162
  * ```
3067
- * @param {Float32Array} arr
4163
+ * @param {Float64Array} arr
3068
4164
  */
3069
4165
  write_from(arr) {
3070
4166
  const ret = wasm.wasmarray_write_from(this.__wbg_ptr, arr);
@@ -3080,7 +4176,7 @@ if (Symbol.dispose) WasmArray.prototype[Symbol.dispose] = WasmArray.prototype.fr
3080
4176
  *
3081
4177
  * Supports multi-frame trajectory files. Each frame produces a
3082
4178
  * [`Frame`] with an `"atoms"` block containing `element` (string)
3083
- * and `x`, `y`, `z` (f32, coordinates in angstrom) columns.
4179
+ * and `x`, `y`, `z` (F, coordinates in angstrom) columns.
3084
4180
  *
3085
4181
  * # Example (JavaScript)
3086
4182
  *
@@ -3091,7 +4187,7 @@ if (Symbol.dispose) WasmArray.prototype[Symbol.dispose] = WasmArray.prototype.fr
3091
4187
  *
3092
4188
  * const frame = reader.read(0); // first frame
3093
4189
  * const atoms = frame.getBlock("atoms");
3094
- * const x = atoms.copyColF32("x");
4190
+ * const x = atoms.copyColF("x");
3095
4191
  * ```
3096
4192
  */
3097
4193
  export class XYZReader {
@@ -3207,13 +4303,13 @@ if (Symbol.dispose) XYZReader.prototype[Symbol.dispose] = XYZReader.prototype.fr
3207
4303
  /**
3208
4304
  * Generate 3D coordinates for a molecular [`Frame`].
3209
4305
  *
3210
- * The input frame must have an `"atoms"` block with a `"symbol"`
4306
+ * The input frame must have an `"atoms"` block with a `"element"`
3211
4307
  * string column (element symbols like `"C"`, `"N"`, `"O"`). A
3212
- * `"bonds"` block with `i`, `j` (u32) and `order` (f32) columns
4308
+ * `"bonds"` block with `i`, `j` (u32) and `order` (F) columns
3213
4309
  * is required for correct geometry.
3214
4310
  *
3215
4311
  * Returns a **new** [`Frame`] with 3D coordinates added as `x`, `y`,
3216
- * `z` (f32, angstrom) columns in the `"atoms"` block.
4312
+ * `z` (F, angstrom) columns in the `"atoms"` block.
3217
4313
  *
3218
4314
  * # Arguments
3219
4315
  *
@@ -3246,9 +4342,9 @@ if (Symbol.dispose) XYZReader.prototype[Symbol.dispose] = XYZReader.prototype.fr
3246
4342
  * const frame3d = generate3D(frame2d, "fast", 42);
3247
4343
  *
3248
4344
  * const atoms = frame3d.getBlock("atoms");
3249
- * const x = atoms.copyColF32("x"); // Float32Array with 3D x-coords
3250
- * const y = atoms.copyColF32("y");
3251
- * const z = atoms.copyColF32("z");
4345
+ * const x = atoms.copyColF("x"); // Float32Array or Float64Array with 3D x-coords
4346
+ * const y = atoms.copyColF("y");
4347
+ * const z = atoms.copyColF("z");
3252
4348
  * ```
3253
4349
  * @param {Frame} frame
3254
4350
  * @param {string | null} [speed]
@@ -3325,7 +4421,7 @@ export function start() {
3325
4421
  *
3326
4422
  * ```js
3327
4423
  * const mem = wasmMemory();
3328
- * const buf = new Float32Array(mem.buffer, ptr, len);
4424
+ * const buf = new Float64Array(mem.buffer, ptr, len); // or Float32Array in default builds
3329
4425
  * ```
3330
4426
  * @returns {WebAssembly.Memory}
3331
4427
  */
@@ -3396,18 +4492,18 @@ export function writeFrame(frame, format) {
3396
4492
  wasm.__wbindgen_free_command_export(deferred3_0, deferred3_1, 1);
3397
4493
  }
3398
4494
  }
3399
- export function __wbg___wbindgen_debug_string_5398f5bb970e0daa(arg0, arg1) {
4495
+ export function __wbg___wbindgen_debug_string_ab4b34d23d6778bd(arg0, arg1) {
3400
4496
  const ret = debugString(arg1);
3401
4497
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
3402
4498
  const len1 = WASM_VECTOR_LEN;
3403
4499
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
3404
4500
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
3405
4501
  }
3406
- export function __wbg___wbindgen_memory_edb3f01e3930bbf6() {
4502
+ export function __wbg___wbindgen_memory_dfa12096f400c9bd() {
3407
4503
  const ret = wasm.memory;
3408
4504
  return ret;
3409
4505
  }
3410
- export function __wbg___wbindgen_string_get_395e606bd0ee4427(arg0, arg1) {
4506
+ export function __wbg___wbindgen_string_get_7ed5322991caaec5(arg0, arg1) {
3411
4507
  const obj = arg1;
3412
4508
  const ret = typeof(obj) === 'string' ? obj : undefined;
3413
4509
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
@@ -3415,10 +4511,10 @@ export function __wbg___wbindgen_string_get_395e606bd0ee4427(arg0, arg1) {
3415
4511
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
3416
4512
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
3417
4513
  }
3418
- export function __wbg___wbindgen_throw_6ddd609b62940d55(arg0, arg1) {
4514
+ export function __wbg___wbindgen_throw_6b64449b9b9ed33c(arg0, arg1) {
3419
4515
  throw new Error(getStringFromWasm0(arg0, arg1));
3420
4516
  }
3421
- export function __wbg_done_08ce71ee07e3bd17(arg0) {
4517
+ export function __wbg_done_9158f7cc8751ba32(arg0) {
3422
4518
  const ret = arg0.done;
3423
4519
  return ret;
3424
4520
  }
@@ -3436,35 +4532,35 @@ export function __wbg_error_a6fa202b58aa1cd3(arg0, arg1) {
3436
4532
  export function __wbg_getRandomValues_3f44b700395062e5() { return handleError(function (arg0, arg1) {
3437
4533
  globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
3438
4534
  }, arguments); }
3439
- export function __wbg_get_10ee87d86a58fb49(arg0, arg1) {
4535
+ export function __wbg_get_ef70f6ce70a05af6(arg0, arg1) {
3440
4536
  const ret = arg0.get(arg1);
3441
4537
  return ret;
3442
4538
  }
3443
- export function __wbg_get_unchecked_329cfe50afab7352(arg0, arg1) {
4539
+ export function __wbg_get_unchecked_17f53dad852b9588(arg0, arg1) {
3444
4540
  const ret = arg0[arg1 >>> 0];
3445
4541
  return ret;
3446
4542
  }
3447
- export function __wbg_keys_3fff7686656d707e(arg0) {
4543
+ export function __wbg_keys_7fc58fd5f4899356(arg0) {
3448
4544
  const ret = arg0.keys();
3449
4545
  return ret;
3450
4546
  }
3451
- export function __wbg_length_259ee9d041e381ad(arg0) {
4547
+ export function __wbg_length_3d4ecd04bd8d22f1(arg0) {
3452
4548
  const ret = arg0.length;
3453
4549
  return ret;
3454
4550
  }
3455
- export function __wbg_length_27280eca2d70010e(arg0) {
4551
+ export function __wbg_length_7da87610a31a2ef9(arg0) {
3456
4552
  const ret = arg0.length;
3457
4553
  return ret;
3458
4554
  }
3459
- export function __wbg_length_76eefdd571f24b00(arg0) {
4555
+ export function __wbg_length_9f1775224cf1d815(arg0) {
3460
4556
  const ret = arg0.length;
3461
4557
  return ret;
3462
4558
  }
3463
- export function __wbg_length_b3416cf66a5452c8(arg0) {
4559
+ export function __wbg_length_d807629e96c741b8(arg0) {
3464
4560
  const ret = arg0.length;
3465
4561
  return ret;
3466
4562
  }
3467
- export function __wbg_length_ea16607d7b61445b(arg0) {
4563
+ export function __wbg_length_fab29957ea6bdb8c(arg0) {
3468
4564
  const ret = arg0.length;
3469
4565
  return ret;
3470
4566
  }
@@ -3472,47 +4568,47 @@ export function __wbg_msdresult_new(arg0) {
3472
4568
  const ret = MSDResult.__wrap(arg0);
3473
4569
  return ret;
3474
4570
  }
3475
- export function __wbg_new_227d7c05414eb861() {
3476
- const ret = new Error();
4571
+ export function __wbg_new_0c7403db6e782f19(arg0) {
4572
+ const ret = new Uint8Array(arg0);
3477
4573
  return ret;
3478
4574
  }
3479
- export function __wbg_new_5f486cdf45a04d78(arg0) {
3480
- const ret = new Uint8Array(arg0);
4575
+ export function __wbg_new_227d7c05414eb861() {
4576
+ const ret = new Error();
3481
4577
  return ret;
3482
4578
  }
3483
- export function __wbg_new_a70fbab9066b301f() {
4579
+ export function __wbg_new_682678e2f47e32bc() {
3484
4580
  const ret = new Array();
3485
4581
  return ret;
3486
4582
  }
3487
- export function __wbg_new_from_slice_898ac63cbd46f332(arg0, arg1) {
4583
+ export function __wbg_new_from_slice_01793f7edd3b321a(arg0, arg1) {
3488
4584
  const ret = new Uint32Array(getArrayU32FromWasm0(arg0, arg1));
3489
4585
  return ret;
3490
4586
  }
3491
- export function __wbg_new_from_slice_c62f8165d6102476(arg0, arg1) {
3492
- const ret = new Int32Array(getArrayI32FromWasm0(arg0, arg1));
4587
+ export function __wbg_new_from_slice_3115b094b1002246(arg0, arg1) {
4588
+ const ret = new Float64Array(getArrayF64FromWasm0(arg0, arg1));
3493
4589
  return ret;
3494
4590
  }
3495
- export function __wbg_new_from_slice_ff2c15e8e05ffdfc(arg0, arg1) {
3496
- const ret = new Float32Array(getArrayF32FromWasm0(arg0, arg1));
4591
+ export function __wbg_new_from_slice_ede497d29b90a4ad(arg0, arg1) {
4592
+ const ret = new Int32Array(getArrayI32FromWasm0(arg0, arg1));
3497
4593
  return ret;
3498
4594
  }
3499
- export function __wbg_next_11b99ee6237339e3() { return handleError(function (arg0) {
4595
+ export function __wbg_next_0340c4ae324393c3() { return handleError(function (arg0) {
3500
4596
  const ret = arg0.next();
3501
4597
  return ret;
3502
4598
  }, arguments); }
3503
- export function __wbg_prototypesetcall_247ac4333d4d3cb4(arg0, arg1, arg2) {
3504
- Float32Array.prototype.set.call(getArrayF32FromWasm0(arg0, arg1), arg2);
3505
- }
3506
- export function __wbg_prototypesetcall_52ca14fb142bc37b(arg0, arg1, arg2) {
3507
- Int32Array.prototype.set.call(getArrayI32FromWasm0(arg0, arg1), arg2);
3508
- }
3509
- export function __wbg_prototypesetcall_d62e5099504357e6(arg0, arg1, arg2) {
4599
+ export function __wbg_prototypesetcall_a6b02eb00b0f4ce2(arg0, arg1, arg2) {
3510
4600
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
3511
4601
  }
3512
- export function __wbg_prototypesetcall_f04613188bde902d(arg0, arg1, arg2) {
4602
+ export function __wbg_prototypesetcall_c5875dab42ff6b97(arg0, arg1, arg2) {
4603
+ Float64Array.prototype.set.call(getArrayF64FromWasm0(arg0, arg1), arg2);
4604
+ }
4605
+ export function __wbg_prototypesetcall_d412f763861ea165(arg0, arg1, arg2) {
3513
4606
  Uint32Array.prototype.set.call(getArrayU32FromWasm0(arg0, arg1), arg2);
3514
4607
  }
3515
- export function __wbg_push_e87b0e732085a946(arg0, arg1) {
4608
+ export function __wbg_prototypesetcall_db677c7a1d7d3039(arg0, arg1, arg2) {
4609
+ Int32Array.prototype.set.call(getArrayI32FromWasm0(arg0, arg1), arg2);
4610
+ }
4611
+ export function __wbg_push_471a5b068a5295f6(arg0, arg1) {
3516
4612
  const ret = arg0.push(arg1);
3517
4613
  return ret;
3518
4614
  }
@@ -3523,13 +4619,13 @@ export function __wbg_stack_3b0d974bbf31e44f(arg0, arg1) {
3523
4619
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
3524
4620
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
3525
4621
  }
3526
- export function __wbg_value_21fc78aab0322612(arg0) {
4622
+ export function __wbg_value_ee3a06f4579184fa(arg0) {
3527
4623
  const ret = arg0.value;
3528
4624
  return ret;
3529
4625
  }
3530
4626
  export function __wbindgen_cast_0000000000000001(arg0, arg1) {
3531
- // Cast intrinsic for `Ref(Slice(F32)) -> NamedExternref("Float32Array")`.
3532
- const ret = getArrayF32FromWasm0(arg0, arg1);
4627
+ // Cast intrinsic for `Ref(Slice(F64)) -> NamedExternref("Float64Array")`.
4628
+ const ret = getArrayF64FromWasm0(arg0, arg1);
3533
4629
  return ret;
3534
4630
  }
3535
4631
  export function __wbindgen_cast_0000000000000002(arg0, arg1) {
@@ -3562,15 +4658,36 @@ const BlockFinalization = (typeof FinalizationRegistry === 'undefined')
3562
4658
  const BoxFinalization = (typeof FinalizationRegistry === 'undefined')
3563
4659
  ? { register: () => {}, unregister: () => {} }
3564
4660
  : new FinalizationRegistry(ptr => wasm.__wbg_box_free(ptr >>> 0, 1));
4661
+ const CenterOfMassFinalization = (typeof FinalizationRegistry === 'undefined')
4662
+ ? { register: () => {}, unregister: () => {} }
4663
+ : new FinalizationRegistry(ptr => wasm.__wbg_centerofmass_free(ptr >>> 0, 1));
4664
+ const CenterOfMassResultFinalization = (typeof FinalizationRegistry === 'undefined')
4665
+ ? { register: () => {}, unregister: () => {} }
4666
+ : new FinalizationRegistry(ptr => wasm.__wbg_centerofmassresult_free(ptr >>> 0, 1));
3565
4667
  const ClusterFinalization = (typeof FinalizationRegistry === 'undefined')
3566
4668
  ? { register: () => {}, unregister: () => {} }
3567
4669
  : new FinalizationRegistry(ptr => wasm.__wbg_cluster_free(ptr >>> 0, 1));
4670
+ const ClusterCentersFinalization = (typeof FinalizationRegistry === 'undefined')
4671
+ ? { register: () => {}, unregister: () => {} }
4672
+ : new FinalizationRegistry(ptr => wasm.__wbg_clustercenters_free(ptr >>> 0, 1));
3568
4673
  const ClusterResultFinalization = (typeof FinalizationRegistry === 'undefined')
3569
4674
  ? { register: () => {}, unregister: () => {} }
3570
4675
  : new FinalizationRegistry(ptr => wasm.__wbg_clusterresult_free(ptr >>> 0, 1));
3571
4676
  const FrameFinalization = (typeof FinalizationRegistry === 'undefined')
3572
4677
  ? { register: () => {}, unregister: () => {} }
3573
4678
  : new FinalizationRegistry(ptr => wasm.__wbg_frame_free(ptr >>> 0, 1));
4679
+ const GridFinalization = (typeof FinalizationRegistry === 'undefined')
4680
+ ? { register: () => {}, unregister: () => {} }
4681
+ : new FinalizationRegistry(ptr => wasm.__wbg_grid_free(ptr >>> 0, 1));
4682
+ const GyrationTensorFinalization = (typeof FinalizationRegistry === 'undefined')
4683
+ ? { register: () => {}, unregister: () => {} }
4684
+ : new FinalizationRegistry(ptr => wasm.__wbg_gyrationtensor_free(ptr >>> 0, 1));
4685
+ const InertiaTensorFinalization = (typeof FinalizationRegistry === 'undefined')
4686
+ ? { register: () => {}, unregister: () => {} }
4687
+ : new FinalizationRegistry(ptr => wasm.__wbg_inertiatensor_free(ptr >>> 0, 1));
4688
+ const LAMMPSDumpReaderFinalization = (typeof FinalizationRegistry === 'undefined')
4689
+ ? { register: () => {}, unregister: () => {} }
4690
+ : new FinalizationRegistry(ptr => wasm.__wbg_lammpsdumpreader_free(ptr >>> 0, 1));
3574
4691
  const LAMMPSReaderFinalization = (typeof FinalizationRegistry === 'undefined')
3575
4692
  ? { register: () => {}, unregister: () => {} }
3576
4693
  : new FinalizationRegistry(ptr => wasm.__wbg_lammpsreader_free(ptr >>> 0, 1));
@@ -3583,6 +4700,9 @@ const MSDFinalization = (typeof FinalizationRegistry === 'undefined')
3583
4700
  const MSDResultFinalization = (typeof FinalizationRegistry === 'undefined')
3584
4701
  ? { register: () => {}, unregister: () => {} }
3585
4702
  : new FinalizationRegistry(ptr => wasm.__wbg_msdresult_free(ptr >>> 0, 1));
4703
+ const MolRecReaderFinalization = (typeof FinalizationRegistry === 'undefined')
4704
+ ? { register: () => {}, unregister: () => {} }
4705
+ : new FinalizationRegistry(ptr => wasm.__wbg_molrecreader_free(ptr >>> 0, 1));
3586
4706
  const NeighborListFinalization = (typeof FinalizationRegistry === 'undefined')
3587
4707
  ? { register: () => {}, unregister: () => {} }
3588
4708
  : new FinalizationRegistry(ptr => wasm.__wbg_neighborlist_free(ptr >>> 0, 1));
@@ -3595,15 +4715,24 @@ const RDFFinalization = (typeof FinalizationRegistry === 'undefined')
3595
4715
  const RDFResultFinalization = (typeof FinalizationRegistry === 'undefined')
3596
4716
  ? { register: () => {}, unregister: () => {} }
3597
4717
  : new FinalizationRegistry(ptr => wasm.__wbg_rdfresult_free(ptr >>> 0, 1));
3598
- const SimulationReaderFinalization = (typeof FinalizationRegistry === 'undefined')
4718
+ const RadiusOfGyrationFinalization = (typeof FinalizationRegistry === 'undefined')
4719
+ ? { register: () => {}, unregister: () => {} }
4720
+ : new FinalizationRegistry(ptr => wasm.__wbg_radiusofgyration_free(ptr >>> 0, 1));
4721
+ const SDFReaderFinalization = (typeof FinalizationRegistry === 'undefined')
3599
4722
  ? { register: () => {}, unregister: () => {} }
3600
- : new FinalizationRegistry(ptr => wasm.__wbg_simulationreader_free(ptr >>> 0, 1));
4723
+ : new FinalizationRegistry(ptr => wasm.__wbg_sdfreader_free(ptr >>> 0, 1));
4724
+ const TopologyRingInfoFinalization = (typeof FinalizationRegistry === 'undefined')
4725
+ ? { register: () => {}, unregister: () => {} }
4726
+ : new FinalizationRegistry(ptr => wasm.__wbg_topologyringinfo_free(ptr >>> 0, 1));
3601
4727
  const WasmArrayFinalization = (typeof FinalizationRegistry === 'undefined')
3602
4728
  ? { register: () => {}, unregister: () => {} }
3603
4729
  : new FinalizationRegistry(ptr => wasm.__wbg_wasmarray_free(ptr >>> 0, 1));
3604
4730
  const SmilesIRFinalization = (typeof FinalizationRegistry === 'undefined')
3605
4731
  ? { register: () => {}, unregister: () => {} }
3606
4732
  : new FinalizationRegistry(ptr => wasm.__wbg_smilesir_free(ptr >>> 0, 1));
4733
+ const TopologyFinalization = (typeof FinalizationRegistry === 'undefined')
4734
+ ? { register: () => {}, unregister: () => {} }
4735
+ : new FinalizationRegistry(ptr => wasm.__wbg_topology_free(ptr >>> 0, 1));
3607
4736
  const XYZReaderFinalization = (typeof FinalizationRegistry === 'undefined')
3608
4737
  ? { register: () => {}, unregister: () => {} }
3609
4738
  : new FinalizationRegistry(ptr => wasm.__wbg_xyzreader_free(ptr >>> 0, 1));
@@ -3685,9 +4814,9 @@ function debugString(val) {
3685
4814
  return className;
3686
4815
  }
3687
4816
 
3688
- function getArrayF32FromWasm0(ptr, len) {
4817
+ function getArrayF64FromWasm0(ptr, len) {
3689
4818
  ptr = ptr >>> 0;
3690
- return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
4819
+ return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
3691
4820
  }
3692
4821
 
3693
4822
  function getArrayI32FromWasm0(ptr, len) {
@@ -3724,12 +4853,12 @@ function getDataViewMemory0() {
3724
4853
  return cachedDataViewMemory0;
3725
4854
  }
3726
4855
 
3727
- let cachedFloat32ArrayMemory0 = null;
3728
- function getFloat32ArrayMemory0() {
3729
- if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
3730
- cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
4856
+ let cachedFloat64ArrayMemory0 = null;
4857
+ function getFloat64ArrayMemory0() {
4858
+ if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
4859
+ cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
3731
4860
  }
3732
- return cachedFloat32ArrayMemory0;
4861
+ return cachedFloat64ArrayMemory0;
3733
4862
  }
3734
4863
 
3735
4864
  let cachedInt32ArrayMemory0 = null;
@@ -3781,6 +4910,13 @@ function passArray32ToWasm0(arg, malloc) {
3781
4910
  return ptr;
3782
4911
  }
3783
4912
 
4913
+ function passArrayF64ToWasm0(arg, malloc) {
4914
+ const ptr = malloc(arg.length * 8, 8) >>> 0;
4915
+ getFloat64ArrayMemory0().set(arg, ptr / 8);
4916
+ WASM_VECTOR_LEN = arg.length;
4917
+ return ptr;
4918
+ }
4919
+
3784
4920
  function passStringToWasm0(arg, malloc, realloc) {
3785
4921
  if (realloc === undefined) {
3786
4922
  const buf = cachedTextEncoder.encode(arg);