matsci-parse 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/main.js +359 -338
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -1,4 +1,4 @@
1
- class v {
1
+ class S {
2
2
  constructor(s, e, t = {}) {
3
3
  this.speciesIndex = s, this.cart = e, this.props = t;
4
4
  }
@@ -9,34 +9,53 @@ class v {
9
9
  this.props[s] = e;
10
10
  }
11
11
  }
12
- function B(m) {
13
- return m.sites.some((s) => Array.isArray(s.props.selectiveDynamics));
12
+ function B(i) {
13
+ return i.sites.some((s) => Array.isArray(s.props.selectiveDynamics));
14
14
  }
15
- function M(m) {
16
- return m * Math.PI / 180;
15
+ function M(i) {
16
+ return i * Math.PI / 180;
17
17
  }
18
- function j(m, s) {
19
- return m.map(
18
+ function O(i, s) {
19
+ return i.map(
20
20
  (e) => e[0] * s[0] + e[1] * s[1] + e[2] * s[2]
21
21
  );
22
22
  }
23
- function k(m, s, e, t, i, o) {
24
- const a = M(t), b = M(i), n = M(o), u = [m, 0, 0], h = [
25
- s * Math.cos(n),
26
- s * Math.sin(n),
23
+ function k(i, s, e, t, m, o) {
24
+ const n = M(t), u = M(m), a = M(o), b = [i, 0, 0], h = [
25
+ s * Math.cos(a),
26
+ s * Math.sin(a),
27
27
  0
28
- ], c = e * Math.cos(b), l = e * (Math.cos(a) - Math.cos(b) * Math.cos(n)) / Math.sin(n), f = Math.sqrt(e * e - c * c - l * l);
29
- return [u, h, [c, l, f]];
28
+ ], r = e * Math.cos(u), l = e * (Math.cos(n) - Math.cos(u) * Math.cos(a)) / Math.sin(a), y = Math.sqrt(e * e - r * r - l * l);
29
+ return [b, h, [r, l, y]];
30
30
  }
31
- function U(m, s) {
32
- const [e, t, i] = s;
31
+ function U(i, s) {
32
+ const [e, t, m] = s;
33
33
  return [
34
- m[0] * e[0] + m[1] * t[0] + m[2] * i[0],
35
- m[0] * e[1] + m[1] * t[1] + m[2] * i[1],
36
- m[0] * e[2] + m[1] * t[2] + m[2] * i[2]
34
+ i[0] * e[0] + i[1] * t[0] + i[2] * m[0],
35
+ i[0] * e[1] + i[1] * t[1] + i[2] * m[1],
36
+ i[0] * e[2] + i[1] * t[2] + i[2] * m[2]
37
37
  ];
38
38
  }
39
- class I {
39
+ function X(i) {
40
+ const [[s, e, t], [m, o, n], [u, a, b]] = i, h = o * b - n * a, r = -(m * b - n * u), l = m * a - o * u, y = -(e * b - t * a), c = s * b - t * u, p = -(s * a - e * u), N = e * n - t * o, g = -(s * n - t * m), _ = s * o - e * m, v = s * h + e * r + t * l;
41
+ if (Math.abs(v) < 1e-12)
42
+ throw new Error("Matrix is singular and cannot be inverted");
43
+ const f = 1 / v;
44
+ return [
45
+ [h * f, y * f, N * f],
46
+ [r * f, c * f, g * f],
47
+ [l * f, p * f, _ * f]
48
+ ];
49
+ }
50
+ function J(i, s) {
51
+ const [e, t, m] = s, o = [
52
+ [e[0], t[0], m[0]],
53
+ [e[1], t[1], m[1]],
54
+ [e[2], t[2], m[2]]
55
+ ], n = X(o);
56
+ return O(n, i);
57
+ }
58
+ class F {
40
59
  /**
41
60
  * Creates a new CrystalStructure.
42
61
  *
@@ -93,9 +112,9 @@ class I {
93
112
  * @param position - Optional index at which to insert the site. Defaults to appending at the end.
94
113
  */
95
114
  addSite(s, e, t) {
96
- let i = this.species.indexOf(s);
97
- i === -1 && (this.species.push(s), i = this.species.length - 1);
98
- const o = new v(i, e);
115
+ let m = this.species.indexOf(s);
116
+ m === -1 && (this.species.push(s), m = this.species.length - 1);
117
+ const o = new S(m, e);
99
118
  t === void 0 || t >= this.sites.length ? this.sites.push(o) : t < 0 ? this.sites.unshift(o) : this.sites.splice(t, 0, o);
100
119
  }
101
120
  /**
@@ -167,18 +186,18 @@ class I {
167
186
  "Scale must be a number, a 3-element array, or a 3x3 matrix"
168
187
  );
169
188
  const t = this.lattice.map(
170
- (o) => j(e, o)
171
- ), i = this.sites.map((o) => {
172
- const a = j(
189
+ (o) => O(e, o)
190
+ ), m = this.sites.map((o) => {
191
+ const n = O(
173
192
  e,
174
193
  o.cart
175
194
  );
176
- return new v(o.speciesIndex, a, o.props);
195
+ return new S(o.speciesIndex, n, o.props);
177
196
  });
178
- return new I({
197
+ return new F({
179
198
  lattice: t,
180
199
  species: [...this.species],
181
- sites: i
200
+ sites: m
182
201
  });
183
202
  }
184
203
  // ---------- Internal validation ----------
@@ -212,9 +231,9 @@ class I {
212
231
  _validateSites(s) {
213
232
  if (!Array.isArray(s)) throw new Error("Sites must be an array");
214
233
  return s.map((e) => {
215
- if (e instanceof v) return e;
234
+ if (e instanceof S) return e;
216
235
  if (typeof e == "object" && typeof e.speciesIndex == "number" && Array.isArray(e.cart) && e.cart.length === 3)
217
- return this._validateSpeciesIndex(e.speciesIndex), new v(
236
+ return this._validateSpeciesIndex(e.speciesIndex), new S(
218
237
  e.speciesIndex,
219
238
  e.cart,
220
239
  e.props ?? {}
@@ -233,27 +252,27 @@ class I {
233
252
  throw new Error("speciesIndex out of bounds");
234
253
  }
235
254
  }
236
- class X {
255
+ class Z {
237
256
  constructor(s) {
238
257
  this.spatialUnits = "angstrom", this._invalid = !0;
239
- const { origin: e, basis: t, shape: i, values: o, components: a = 1, units: b } = s, [n, u, h] = i;
240
- if (o.length !== n * u * h * a)
258
+ const { origin: e, basis: t, shape: m, values: o, components: n = 1, units: u } = s, [a, b, h] = m;
259
+ if (o.length !== a * b * h * n)
241
260
  throw new Error(
242
- `Invalid values length: expected ${n * u * h * a}, got ${o.length}`
261
+ `Invalid values length: expected ${a * b * h * n}, got ${o.length}`
243
262
  );
244
- this.origin = e, this.basis = t, this.shape = i, this.values = o, this.components = a, this.units = b;
263
+ this.origin = e, this.basis = t, this.shape = m, this.values = o, this.components = n, this.units = u;
245
264
  }
246
265
  invalidate() {
247
266
  this._invalid = !0;
248
267
  }
249
268
  map(s) {
250
- const [e, t, i] = this.shape;
251
- for (let o = 0; o < i; o++)
252
- for (let a = 0; a < t; a++)
253
- for (let b = 0; b < e; b++)
254
- for (let n = 0; n < this.components; n++) {
255
- const u = this.index(b, a, o, n);
256
- this.values[u] = s(this.values[u], b, a, o, n);
269
+ const [e, t, m] = this.shape;
270
+ for (let o = 0; o < m; o++)
271
+ for (let n = 0; n < t; n++)
272
+ for (let u = 0; u < e; u++)
273
+ for (let a = 0; a < this.components; a++) {
274
+ const b = this.index(u, n, o, a);
275
+ this.values[b] = s(this.values[b], u, n, o, a);
257
276
  }
258
277
  this.invalidate();
259
278
  }
@@ -266,15 +285,15 @@ class X {
266
285
  mean() {
267
286
  return (this._invalid || this._mean === void 0) && this.computeStats(), this._mean;
268
287
  }
269
- index(s, e, t, i = 0) {
270
- const [o, a] = this.shape;
271
- return (s + o * (e + a * t)) * this.components + i;
288
+ index(s, e, t, m = 0) {
289
+ const [o, n] = this.shape;
290
+ return (s + o * (e + n * t)) * this.components + m;
272
291
  }
273
- get(s, e, t, i = 0) {
274
- return this.values[this.index(s, e, t, i)];
292
+ get(s, e, t, m = 0) {
293
+ return this.values[this.index(s, e, t, m)];
275
294
  }
276
- set(s, e, t, i, o) {
277
- this.values[this.index(s, e, t, i)] = o, this.invalidate();
295
+ set(s, e, t, m, o = 0) {
296
+ this.values[this.index(s, e, t, o)] = m, this.invalidate();
278
297
  }
279
298
  normalize() {
280
299
  const s = this.min(), e = this.max();
@@ -282,11 +301,11 @@ class X {
282
301
  }
283
302
  /** Convert grid index → Cartesian position */
284
303
  position(s, e, t) {
285
- const [i, o, a] = this.basis;
304
+ const [m, o, n] = this.basis;
286
305
  return [
287
- this.origin[0] + s * i[0] + e * o[0] + t * a[0],
288
- this.origin[1] + s * i[1] + e * o[1] + t * a[1],
289
- this.origin[2] + s * i[2] + e * o[2] + t * a[2]
306
+ this.origin[0] + s * m[0] + e * o[0] + t * n[0],
307
+ this.origin[1] + s * m[1] + e * o[1] + t * n[1],
308
+ this.origin[2] + s * m[2] + e * o[2] + t * n[2]
290
309
  ];
291
310
  }
292
311
  voxelVolume() {
@@ -300,114 +319,114 @@ class X {
300
319
  }
301
320
  computeStats() {
302
321
  const s = this.values.length;
303
- let e = 1 / 0, t = -1 / 0, i = 0;
322
+ let e = 1 / 0, t = -1 / 0, m = 0;
304
323
  for (let o = 0; o < s; o++) {
305
- const a = this.values[o];
306
- a < e && (e = a), a > t && (t = a), i += a;
324
+ const n = this.values[o];
325
+ n < e && (e = n), n > t && (t = n), m += n;
307
326
  }
308
- this._min = e, this._max = t, this._mean = i / s, this._invalid = !1;
327
+ this._min = e, this._max = t, this._mean = m / s, this._invalid = !1;
309
328
  }
310
329
  }
311
- function F(m) {
312
- return m.split(/\r?\n/).map((s) => s.trim()).filter(Boolean);
330
+ function I(i) {
331
+ return i.split(/\r?\n/).map((s) => s.trim()).filter(Boolean);
313
332
  }
314
- function K(m, s = 6) {
315
- const e = [], t = B(m);
316
- e.push("Generated by matsci-parse"), e.push("1.0"), m.lattice.forEach((a) => {
317
- e.push(a.map((b) => b.toFixed(s)).join(" "));
333
+ function Q(i, s = 6) {
334
+ const e = [], t = B(i);
335
+ e.push("Generated by matsci-parse"), e.push("1.0"), i.lattice.forEach((n) => {
336
+ e.push(n.map((u) => u.toFixed(s)).join(" "));
318
337
  });
319
- const i = Array.from(
320
- new Set(m.sites.map((a) => m.species[a.speciesIndex]))
321
- ), o = i.map(
322
- (a) => m.sites.filter((b) => m.species[b.speciesIndex] === a).length
338
+ const m = Array.from(
339
+ new Set(i.sites.map((n) => i.species[n.speciesIndex]))
340
+ ), o = m.map(
341
+ (n) => i.sites.filter((u) => i.species[u.speciesIndex] === n).length
323
342
  );
324
- return e.push(i.join(" ")), e.push(o.join(" ")), t && e.push("Selective dynamics"), e.push("Cartesian"), i.forEach((a) => {
325
- m.sites.filter((b) => m.species[b.speciesIndex] === a).forEach((b) => {
326
- const n = b.cart.map((u) => u.toFixed(s)).join(" ");
343
+ return e.push(m.join(" ")), e.push(o.join(" ")), t && e.push("Selective dynamics"), e.push("Cartesian"), m.forEach((n) => {
344
+ i.sites.filter((u) => i.species[u.speciesIndex] === n).forEach((u) => {
345
+ const a = u.cart.map((b) => b.toFixed(s)).join(" ");
327
346
  if (t) {
328
- const h = (Array.isArray(b.props?.selectiveDynamics) ? b.props.selectiveDynamics : [!0, !0, !0]).map((c) => c ? "T" : "F").join(" ");
329
- e.push(`${n} ${h}`);
347
+ const h = (Array.isArray(u.props?.selectiveDynamics) ? u.props.selectiveDynamics : [!0, !0, !0]).map((r) => r ? "T" : "F").join(" ");
348
+ e.push(`${a} ${h}`);
330
349
  } else
331
- e.push(n);
350
+ e.push(a);
332
351
  });
333
352
  }), e.join(`
334
353
  `);
335
354
  }
336
- function Z(m) {
355
+ function z(i) {
337
356
  let s = 0;
338
357
  s++;
339
- const e = parseFloat(m[s++]), t = [];
340
- for (let c = 0; c < 3; c++)
358
+ const e = parseFloat(i[s++]), t = [];
359
+ for (let r = 0; r < 3; r++)
341
360
  t.push(
342
- m[s++].split(/\s+/).map((l) => parseFloat(l) * e)
361
+ i[s++].split(/\s+/).map((l) => parseFloat(l) * e)
343
362
  );
344
- let i = m[s].trim(), o;
345
- /^[A-Za-z]/.test(i) && (o = i.split(/\s+/), s++);
346
- const a = m[s++].split(/\s+/).map(Number);
347
- o || (o = a.map((c, l) => `X${l + 1}`));
348
- let b = !1;
349
- m[s]?.toLowerCase().startsWith("s") && (b = !0, s++);
350
- const u = m[s++].toLowerCase().startsWith("d"), h = [];
351
- return o.forEach((c, l) => {
352
- for (let f = 0; f < a[l]; f++) {
353
- const r = m[s++].split(/\s+/).map(Number);
363
+ let m = i[s].trim(), o;
364
+ /^[A-Za-z]/.test(m) && (o = m.split(/\s+/), s++);
365
+ const n = i[s++].split(/\s+/).map(Number);
366
+ o || (o = n.map((r, l) => `X${l + 1}`));
367
+ let u = !1;
368
+ i[s]?.toLowerCase().startsWith("s") && (u = !0, s++);
369
+ const b = i[s++].toLowerCase().startsWith("d"), h = [];
370
+ return o.forEach((r, l) => {
371
+ for (let y = 0; y < n[l]; y++) {
372
+ const c = i[s++].split(/\s+/).map(Number);
354
373
  let p;
355
- u ? p = [
356
- r[0] * t[0][0] + r[1] * t[1][0] + r[2] * t[2][0],
357
- r[0] * t[0][1] + r[1] * t[1][1] + r[2] * t[2][1],
358
- r[0] * t[0][2] + r[1] * t[1][2] + r[2] * t[2][2]
359
- ] : p = r.slice(0, 3);
374
+ b ? p = [
375
+ c[0] * t[0][0] + c[1] * t[1][0] + c[2] * t[2][0],
376
+ c[0] * t[0][1] + c[1] * t[1][1] + c[2] * t[2][1],
377
+ c[0] * t[0][2] + c[1] * t[1][2] + c[2] * t[2][2]
378
+ ] : p = c.slice(0, 3);
360
379
  const N = {};
361
- if (b) {
362
- const g = r.slice(3, 6).map((_) => _ === 1);
380
+ if (u) {
381
+ const g = c.slice(3, 6).map((_) => _ === 1);
363
382
  g.length === 3 && (N.selectiveDynamics = g);
364
383
  }
365
- h.push(new v(l, p, N));
384
+ h.push(new S(l, p, N));
366
385
  }
367
386
  }), {
368
- structure: new I({ lattice: t, species: o, sites: h }),
387
+ structure: new F({ lattice: t, species: o, sites: h }),
369
388
  linesConsumed: s
370
389
  };
371
390
  }
372
- function J(m) {
373
- const s = F(m);
374
- return Z(s).structure;
391
+ function ss(i) {
392
+ const s = I(i);
393
+ return z(s).structure;
375
394
  }
376
- function Q(m, s = 6) {
395
+ function es(i, s = 6) {
377
396
  const e = [];
378
- return e.push("CRYSTAL"), e.push("PRIMVEC"), m.lattice.forEach((t) => {
379
- e.push(t.map((i) => i.toFixed(s)).join(" "));
380
- }), e.push("PRIMCOORD"), e.push(`${m.numSites} 1`), m.sites.forEach((t) => {
381
- const i = m.species[t.speciesIndex];
397
+ return e.push("CRYSTAL"), e.push("PRIMVEC"), i.lattice.forEach((t) => {
398
+ e.push(t.map((m) => m.toFixed(s)).join(" "));
399
+ }), e.push("PRIMCOORD"), e.push(`${i.numSites} 1`), i.sites.forEach((t) => {
400
+ const m = i.species[t.speciesIndex];
382
401
  e.push(
383
- `${i} ${t.cart.map((o) => o.toFixed(s)).join(" ")}`
402
+ `${m} ${t.cart.map((o) => o.toFixed(s)).join(" ")}`
384
403
  );
385
404
  }), e.join(`
386
405
  `);
387
406
  }
388
- function ss(m) {
389
- const s = F(m), e = [], t = [], i = [];
407
+ function ts(i) {
408
+ const s = I(i), e = [], t = [], m = [];
390
409
  let o = 0;
391
410
  for (; o < s.length && s[o].toUpperCase() !== "PRIMVEC"; ) o++;
392
411
  if (o === s.length) throw new Error("PRIMVEC block not found in XSF");
393
412
  o++;
394
- for (let b = 0; b < 3; b++)
413
+ for (let u = 0; u < 3; u++)
395
414
  e.push(s[o++].split(/\s+/).map(Number));
396
415
  for (; o < s.length && s[o].toUpperCase() !== "PRIMCOORD"; ) o++;
397
416
  if (o === s.length) throw new Error("PRIMCOORD block not found in XSF");
398
417
  o++;
399
- const [a] = s[o++].split(/\s+/).map(Number);
400
- for (let b = 0; b < a; b++) {
401
- const n = s[o++].split(/\s+/), u = n[0], h = n.slice(1, 4).map(Number);
402
- let c = t.indexOf(u);
403
- c === -1 && (t.push(u), c = t.length - 1), i.push(new v(c, h));
418
+ const [n] = s[o++].split(/\s+/).map(Number);
419
+ for (let u = 0; u < n; u++) {
420
+ const a = s[o++].split(/\s+/), b = a[0], h = a.slice(1, 4).map(Number);
421
+ let r = t.indexOf(b);
422
+ r === -1 && (t.push(b), r = t.length - 1), m.push(new S(r, h));
404
423
  }
405
- return new I({ lattice: e, species: t, sites: i });
424
+ return new F({ lattice: e, species: t, sites: m });
406
425
  }
407
- function es(m, s = 6) {
408
- const e = [], t = m.sites.length;
426
+ function os(i, s = 6) {
427
+ const e = [], t = i.sites.length;
409
428
  e.push(String(t));
410
- const i = B(m), o = m.lattice, a = [
429
+ const m = B(i), o = i.lattice, n = [
411
430
  o[0][0],
412
431
  o[1][0],
413
432
  o[2][0],
@@ -417,115 +436,115 @@ function es(m, s = 6) {
417
436
  o[0][2],
418
437
  o[1][2],
419
438
  o[2][2]
420
- ].join(" "), b = [
439
+ ].join(" "), u = [
421
440
  "species:S:1",
422
441
  "pos:R:3",
423
- i ? "selectiveDynamics:L:3" : null
442
+ m ? "selectiveDynamics:L:3" : null
424
443
  ].filter(Boolean).join(":");
425
- e.push(`Lattice="${a}" Properties=${b}`);
426
- for (const n of m.sites) {
427
- const u = m.species[n.speciesIndex], [h, c, l] = n.cart;
428
- let f = `${u} ${h.toFixed(s)} ${c.toFixed(s)} ${l.toFixed(s)}`;
429
- if (i) {
430
- const r = Array.isArray(n.props?.selectiveDynamics) ? n.props.selectiveDynamics : [!0, !0, !0];
431
- f += " " + r.map((p) => p ? "T" : "F").join(" ");
444
+ e.push(`Lattice="${n}" Properties=${u}`);
445
+ for (const a of i.sites) {
446
+ const b = i.species[a.speciesIndex], [h, r, l] = a.cart;
447
+ let y = `${b} ${h.toFixed(s)} ${r.toFixed(s)} ${l.toFixed(s)}`;
448
+ if (m) {
449
+ const c = Array.isArray(a.props?.selectiveDynamics) ? a.props.selectiveDynamics : [!0, !0, !0];
450
+ y += " " + c.map((p) => p ? "T" : "F").join(" ");
432
451
  }
433
- e.push(f);
452
+ e.push(y);
434
453
  }
435
454
  return e.join(`
436
455
  `);
437
456
  }
438
- function ts(m) {
439
- const s = F(m);
457
+ function is(i) {
458
+ const s = I(i);
440
459
  let e = 0;
441
460
  const t = parseInt(s[e++], 10);
442
461
  if (!Number.isFinite(t))
443
462
  throw new Error("Invalid XYZ: first line must be atom count");
444
- const i = s[e++], o = {}, a = /(\w+)=(".*?"|\S+)/g;
445
- for (const r of i.matchAll(a)) {
446
- let p = r[2];
447
- p.startsWith('"') && (p = p.slice(1, -1)), o[r[1]] = p;
463
+ const m = s[e++], o = {}, n = /(\w+)=(".*?"|\S+)/g;
464
+ for (const c of m.matchAll(n)) {
465
+ let p = c[2];
466
+ p.startsWith('"') && (p = p.slice(1, -1)), o[c[1]] = p;
448
467
  }
449
- let b;
468
+ let u;
450
469
  if (o.Lattice) {
451
- const r = o.Lattice.split(/\s+/).map(Number);
452
- if (r.length !== 9) throw new Error("Invalid Lattice in extended XYZ");
453
- b = [
454
- [r[0], r[3], r[6]],
455
- [r[1], r[4], r[7]],
456
- [r[2], r[5], r[8]]
470
+ const c = o.Lattice.split(/\s+/).map(Number);
471
+ if (c.length !== 9) throw new Error("Invalid Lattice in extended XYZ");
472
+ u = [
473
+ [c[0], c[3], c[6]],
474
+ [c[1], c[4], c[7]],
475
+ [c[2], c[5], c[8]]
457
476
  ];
458
477
  } else
459
478
  throw new Error("Lattice must be present in extended XYZ format");
460
- let n = 0, u = 1, h = null;
479
+ let a = 0, b = 1, h = null;
461
480
  if (o.Properties) {
462
- const r = o.Properties.split(":");
481
+ const c = o.Properties.split(":");
463
482
  let p = 0;
464
- for (let N = 0; N < r.length; N += 3) {
465
- const g = r[N], _ = parseInt(r[N + 2], 10);
466
- g === "species" && (n = p), g === "pos" && (u = p), g === "selectiveDynamics" && (h = p), p += _;
483
+ for (let N = 0; N < c.length; N += 3) {
484
+ const g = c[N], _ = parseInt(c[N + 2], 10);
485
+ g === "species" && (a = p), g === "pos" && (b = p), g === "selectiveDynamics" && (h = p), p += _;
467
486
  }
468
487
  }
469
- const c = [], l = /* @__PURE__ */ new Map(), f = [];
470
- for (let r = 0; r < t; r++) {
471
- const p = s[e++].split(/\s+/), N = p[n];
472
- l.has(N) || (l.set(N, c.length), c.push(N));
473
- const g = l.get(N), _ = p.slice(u, u + 3).map(Number), S = {};
488
+ const r = [], l = /* @__PURE__ */ new Map(), y = [];
489
+ for (let c = 0; c < t; c++) {
490
+ const p = s[e++].split(/\s+/), N = p[a];
491
+ l.has(N) || (l.set(N, r.length), r.push(N));
492
+ const g = l.get(N), _ = p.slice(b, b + 3).map(Number), v = {};
474
493
  if (h !== null) {
475
- const y = p.slice(h, h + 3).map((d) => d.toUpperCase() === "T");
476
- y.length === 3 && (S.selectiveDynamics = y);
494
+ const f = p.slice(h, h + 3).map((d) => d.toUpperCase() === "T");
495
+ f.length === 3 && (v.selectiveDynamics = f);
477
496
  }
478
- f.push(new v(g, _, S));
497
+ y.push(new S(g, _, v));
479
498
  }
480
- return new I({ lattice: b, species: c, sites: f });
499
+ return new F({ lattice: u, species: r, sites: y });
481
500
  }
482
- function C(m, s) {
483
- return m[0] * s[0] + m[1] * s[1] + m[2] * s[2];
501
+ function C(i, s) {
502
+ return i[0] * s[0] + i[1] * s[1] + i[2] * s[2];
484
503
  }
485
- function L(m) {
486
- return Math.sqrt(C(m, m));
504
+ function L(i) {
505
+ return Math.sqrt(C(i, i));
487
506
  }
488
- function P(m) {
489
- return m * 180 / Math.PI;
507
+ function P(i) {
508
+ return i * 180 / Math.PI;
490
509
  }
491
- function z(m, s) {
492
- const [e, t, i] = s, o = e[0] * (t[1] * i[2] - t[2] * i[1]) - e[1] * (t[0] * i[2] - t[2] * i[0]) + e[2] * (t[0] * i[1] - t[1] * i[0]);
510
+ function G(i, s) {
511
+ const [e, t, m] = s, o = e[0] * (t[1] * m[2] - t[2] * m[1]) - e[1] * (t[0] * m[2] - t[2] * m[0]) + e[2] * (t[0] * m[1] - t[1] * m[0]);
493
512
  if (Math.abs(o) < 1e-12)
494
513
  throw new Error("Singular lattice matrix");
495
- const a = [
514
+ const n = [
496
515
  [
497
- (t[1] * i[2] - t[2] * i[1]) / o,
498
- (e[2] * i[1] - e[1] * i[2]) / o,
516
+ (t[1] * m[2] - t[2] * m[1]) / o,
517
+ (e[2] * m[1] - e[1] * m[2]) / o,
499
518
  (e[1] * t[2] - e[2] * t[1]) / o
500
519
  ],
501
520
  [
502
- (t[2] * i[0] - t[0] * i[2]) / o,
503
- (e[0] * i[2] - e[2] * i[0]) / o,
521
+ (t[2] * m[0] - t[0] * m[2]) / o,
522
+ (e[0] * m[2] - e[2] * m[0]) / o,
504
523
  (e[2] * t[0] - e[0] * t[2]) / o
505
524
  ],
506
525
  [
507
- (t[0] * i[1] - t[1] * i[0]) / o,
508
- (e[1] * i[0] - e[0] * i[1]) / o,
526
+ (t[0] * m[1] - t[1] * m[0]) / o,
527
+ (e[1] * m[0] - e[0] * m[1]) / o,
509
528
  (e[0] * t[1] - e[1] * t[0]) / o
510
529
  ]
511
530
  ];
512
531
  return [
513
- m[0] * a[0][0] + m[1] * a[1][0] + m[2] * a[2][0],
514
- m[0] * a[0][1] + m[1] * a[1][1] + m[2] * a[2][1],
515
- m[0] * a[0][2] + m[1] * a[1][2] + m[2] * a[2][2]
532
+ i[0] * n[0][0] + i[1] * n[1][0] + i[2] * n[2][0],
533
+ i[0] * n[0][1] + i[1] * n[1][1] + i[2] * n[2][1],
534
+ i[0] * n[0][2] + i[1] * n[1][2] + i[2] * n[2][2]
516
535
  ];
517
536
  }
518
- function ms(m, s = 6) {
519
- const [e, t, i] = m.lattice, o = L(e), a = L(t), b = L(i), n = P(Math.acos(C(t, i) / (a * b))), u = P(Math.acos(C(e, i) / (o * b))), h = P(Math.acos(C(e, t) / (o * a)));
520
- let c = `data_made_with_matsci-parse
537
+ function ms(i, s = 6) {
538
+ const [e, t, m] = i.lattice, o = L(e), n = L(t), u = L(m), a = P(Math.acos(C(t, m) / (n * u))), b = P(Math.acos(C(e, m) / (o * u))), h = P(Math.acos(C(e, t) / (o * n)));
539
+ let r = `data_made_with_matsci-parse
521
540
  _symmetry_space_group_name_H-M 'P 1'
522
541
  _symmetry_Int_Tables_number 1
523
542
 
524
543
  _cell_length_a ${o.toFixed(s)}
525
- _cell_length_b ${a.toFixed(s)}
526
- _cell_length_c ${b.toFixed(s)}
527
- _cell_angle_alpha ${n.toFixed(s)}
528
- _cell_angle_beta ${u.toFixed(s)}
544
+ _cell_length_b ${n.toFixed(s)}
545
+ _cell_length_c ${u.toFixed(s)}
546
+ _cell_angle_alpha ${a.toFixed(s)}
547
+ _cell_angle_beta ${b.toFixed(s)}
529
548
  _cell_angle_gamma ${h.toFixed(s)}
530
549
 
531
550
  loop_
@@ -535,73 +554,73 @@ function ms(m, s = 6) {
535
554
  _atom_site_fract_y
536
555
  _atom_site_fract_z
537
556
  `;
538
- return m.sites.forEach((l, f) => {
539
- const r = m.species[l.speciesIndex], p = z(l.cart, m.lattice);
540
- c += `${r}${f + 1} ${r} ${p[0].toFixed(s)} ${p[1].toFixed(
557
+ return i.sites.forEach((l, y) => {
558
+ const c = i.species[l.speciesIndex], p = G(l.cart, i.lattice);
559
+ r += `${c}${y + 1} ${c} ${p[0].toFixed(s)} ${p[1].toFixed(
541
560
  6
542
561
  )} ${p[2].toFixed(s)}
543
562
  `;
544
- }), c;
563
+ }), r;
545
564
  }
546
- function os(m) {
547
- const s = F(m);
548
- let e = 0, t = 0, i = 0, o = 0, a = 0, b = 0, n = [];
549
- const u = [];
550
- let h = !1, c = [], l = !1;
551
- for (const y of s) {
552
- const d = y.trim();
565
+ function ns(i) {
566
+ const s = I(i);
567
+ let e = 0, t = 0, m = 0, o = 0, n = 0, u = 0, a = [];
568
+ const b = [];
569
+ let h = !1, r = [], l = !1;
570
+ for (const f of s) {
571
+ const d = f.trim();
553
572
  if (d) {
554
573
  if (d.startsWith("_cell_length_a")) e = parseFloat(d.split(/\s+/)[1]);
555
574
  else if (d.startsWith("_cell_length_b"))
556
575
  t = parseFloat(d.split(/\s+/)[1]);
557
576
  else if (d.startsWith("_cell_length_c"))
558
- i = parseFloat(d.split(/\s+/)[1]);
577
+ m = parseFloat(d.split(/\s+/)[1]);
559
578
  else if (d.startsWith("_cell_angle_alpha"))
560
579
  o = parseFloat(d.split(/\s+/)[1]);
561
580
  else if (d.startsWith("_cell_angle_beta"))
562
- a = parseFloat(d.split(/\s+/)[1]);
581
+ n = parseFloat(d.split(/\s+/)[1]);
563
582
  else if (d.startsWith("_cell_angle_gamma"))
564
- b = parseFloat(d.split(/\s+/)[1]);
583
+ u = parseFloat(d.split(/\s+/)[1]);
565
584
  else if (d.startsWith("loop_")) {
566
- h = !0, c = [], l = !1;
585
+ h = !0, r = [], l = !1;
567
586
  continue;
568
587
  }
569
588
  if (h && d.startsWith("_")) {
570
- c.push(d), d.includes("_atom_site_") && (l = !0);
589
+ r.push(d), d.includes("_atom_site_") && (l = !0);
571
590
  continue;
572
591
  }
573
592
  if (h && !d.startsWith("_")) {
574
- l && (n.length === 0 && (n = [...c]), u.push(d.split(/\s+/)));
593
+ l && (a.length === 0 && (a = [...r]), b.push(d.split(/\s+/)));
575
594
  continue;
576
595
  }
577
596
  }
578
597
  }
579
- if (n.length === 0)
598
+ if (a.length === 0)
580
599
  throw new Error("No _atom_site loop found in CIF");
581
- const f = k(e, t, i, o, a, b), r = [], p = [], N = n.findIndex((y) => y.includes("fract_x")), g = n.findIndex((y) => y.includes("fract_y")), _ = n.findIndex((y) => y.includes("fract_z")), S = n.findIndex((y) => y.includes("type_symbol"));
582
- if (N < 0 || g < 0 || _ < 0 || S < 0)
600
+ const y = k(e, t, m, o, n, u), c = [], p = [], N = a.findIndex((f) => f.includes("fract_x")), g = a.findIndex((f) => f.includes("fract_y")), _ = a.findIndex((f) => f.includes("fract_z")), v = a.findIndex((f) => f.includes("type_symbol"));
601
+ if (N < 0 || g < 0 || _ < 0 || v < 0)
583
602
  throw new Error("CIF missing required _atom_site columns");
584
- for (const y of u) {
603
+ for (const f of b) {
585
604
  const d = [
586
- parseFloat(y[N]),
587
- parseFloat(y[g]),
588
- parseFloat(y[_])
589
- ], w = U(d, f);
590
- let x = r.indexOf(y[S]);
591
- x === -1 && (x = r.length, r.push(y[S])), p.push(new v(x, w));
592
- }
593
- return new I({ lattice: f, species: r, sites: p });
605
+ parseFloat(f[N]),
606
+ parseFloat(f[g]),
607
+ parseFloat(f[_])
608
+ ], w = U(d, y);
609
+ let x = c.indexOf(f[v]);
610
+ x === -1 && (x = c.length, c.push(f[v])), p.push(new S(x, w));
611
+ }
612
+ return new F({ lattice: y, species: c, sites: p });
594
613
  }
595
- function G(m) {
614
+ function Y(i) {
596
615
  let s = [];
597
616
  const e = [];
598
- for (let n = 0; n < m.length; n++) {
599
- const u = m[n].trim();
600
- if (!(!u || u.startsWith("&")) && /^CELL_PARAMETERS/i.test(u)) {
601
- let h = 0, c = n + 1;
602
- for (; h < 3 && c < m.length; ) {
603
- const l = m[c].trim();
604
- l !== "" && (s.push(l.split(/\s+/).map(Number)), h++), c++;
617
+ for (let a = 0; a < i.length; a++) {
618
+ const b = i[a].trim();
619
+ if (!(!b || b.startsWith("&")) && /^CELL_PARAMETERS/i.test(b)) {
620
+ let h = 0, r = a + 1;
621
+ for (; h < 3 && r < i.length; ) {
622
+ const l = i[r].trim();
623
+ l !== "" && (s.push(l.split(/\s+/).map(Number)), h++), r++;
605
624
  }
606
625
  if (h < 3) throw new Error("Incomplete CELL_PARAMETERS block");
607
626
  break;
@@ -609,49 +628,49 @@ function G(m) {
609
628
  }
610
629
  if (s.length !== 3)
611
630
  throw new Error("CELL_PARAMETERS block not found or incomplete");
612
- let t = !1, i = "angstrom";
613
- for (let n = 0; n < m.length; n++) {
614
- const u = m[n].trim();
615
- if (!(!u || u.startsWith("&"))) {
616
- if (/^ATOMIC_POSITIONS/i.test(u)) {
631
+ let t = !1, m = "angstrom";
632
+ for (let a = 0; a < i.length; a++) {
633
+ const b = i[a].trim();
634
+ if (!(!b || b.startsWith("&"))) {
635
+ if (/^ATOMIC_POSITIONS/i.test(b)) {
617
636
  t = !0;
618
- const h = u.match(/^ATOMIC_POSITIONS\s+(\w+)/i);
619
- i = h ? h[1].toLowerCase() : "angstrom";
637
+ const h = b.match(/^ATOMIC_POSITIONS\s+(\w+)/i);
638
+ m = h ? h[1].toLowerCase() : "angstrom";
620
639
  continue;
621
640
  }
622
641
  if (t) {
623
- const h = u.split(/\s+/);
624
- if (h.length < 4 || !/^[A-Za-z]/.test(h[0]) || h.slice(1, 4).some((c) => Number.isNaN(Number(c))))
642
+ const h = b.split(/\s+/);
643
+ if (h.length < 4 || !/^[A-Za-z]/.test(h[0]) || h.slice(1, 4).some((r) => Number.isNaN(Number(r))))
625
644
  break;
626
- e.push(u);
645
+ e.push(b);
627
646
  }
628
647
  }
629
648
  }
630
649
  if (e.length === 0)
631
650
  throw new Error("ATOMIC_POSITIONS block not found");
632
- const o = i === "crystal", a = [];
633
- for (const n of e) {
634
- const u = n.split(/\s+/)[0];
635
- a.includes(u) || a.push(u);
651
+ const o = m === "crystal", n = [];
652
+ for (const a of e) {
653
+ const b = a.split(/\s+/)[0];
654
+ n.includes(b) || n.push(b);
636
655
  }
637
- const b = [];
638
- for (const n of e) {
639
- const u = n.split(/\s+/), h = u[0], c = u.slice(1, 4).map(Number);
656
+ const u = [];
657
+ for (const a of e) {
658
+ const b = a.split(/\s+/), h = b[0], r = b.slice(1, 4).map(Number);
640
659
  let l;
641
660
  o ? l = [
642
- c[0] * s[0][0] + c[1] * s[1][0] + c[2] * s[2][0],
643
- c[0] * s[0][1] + c[1] * s[1][1] + c[2] * s[2][1],
644
- c[0] * s[0][2] + c[1] * s[1][2] + c[2] * s[2][2]
645
- ] : l = c, b.push(new v(a.indexOf(h), l));
661
+ r[0] * s[0][0] + r[1] * s[1][0] + r[2] * s[2][0],
662
+ r[0] * s[0][1] + r[1] * s[1][1] + r[2] * s[2][1],
663
+ r[0] * s[0][2] + r[1] * s[1][2] + r[2] * s[2][2]
664
+ ] : l = r, u.push(new S(n.indexOf(h), l));
646
665
  }
647
666
  return {
648
- structure: new I({ lattice: s, species: a, sites: b }),
649
- linesConsumed: m.length
667
+ structure: new F({ lattice: s, species: n, sites: u }),
668
+ linesConsumed: i.length
650
669
  };
651
670
  }
652
- function is(m) {
653
- const s = F(m);
654
- return G(s).structure;
671
+ function as(i) {
672
+ const s = I(i);
673
+ return Y(s).structure;
655
674
  }
656
675
  const D = {
657
676
  1: { atomicNumber: 1, symbol: "H", name: "Hydrogen", mass: 1.008 },
@@ -772,7 +791,7 @@ const D = {
772
791
  116: { atomicNumber: 116, symbol: "Lv", name: "Livermorium", mass: 293 },
773
792
  117: { atomicNumber: 117, symbol: "Ts", name: "Tennessine", mass: 294 },
774
793
  118: { atomicNumber: 118, symbol: "Og", name: "Oganesson", mass: 294 }
775
- }, Y = {
794
+ }, q = {
776
795
  angstrom: 1,
777
796
  // canonical
778
797
  bohr: 0.529177,
@@ -782,70 +801,70 @@ const D = {
782
801
  cm: 1e8,
783
802
  m: 1e10,
784
803
  fm: 1e-5
785
- }, q = {
804
+ }, K = {
786
805
  Å: "angstrom",
787
806
  μm: "um"
788
- }, R = {
789
- conversions: Y,
790
- aliases: q,
791
- convert(m, s, e) {
792
- const t = (a) => this.aliases[a] ?? a, i = t(s), o = t(e);
793
- return i === o ? m : m * this.conversions[i] / this.conversions[o];
807
+ }, $ = {
808
+ conversions: q,
809
+ aliases: K,
810
+ convert(i, s, e) {
811
+ const t = (n) => this.aliases[n] ?? n, m = t(s), o = t(e);
812
+ return m === o ? i : i * this.conversions[m] / this.conversions[o];
794
813
  },
795
- convertArray(m, s, e) {
796
- return m.map((t) => this.convert(t, s, e));
814
+ convertArray(i, s, e) {
815
+ return i.map((t) => this.convert(t, s, e));
797
816
  }
798
- }, $ = 1.8897268;
799
- function as(m, s) {
817
+ }, R = 1.8897268;
818
+ function rs(i, s) {
800
819
  const e = [];
801
820
  e.push("Generated by matsci-parse"), e.push("Volumetric data export");
802
- const i = [...s.origin].map((l) => l * $);
821
+ const m = [...s.origin].map((l) => l * R);
803
822
  e.push(
804
- `${m.numSites} ${i.map((l) => l.toFixed(6)).join(" ")}`
823
+ `${i.numSites} ${m.map((l) => l.toFixed(6)).join(" ")}`
805
824
  );
806
- const o = s.shape, a = s.basis;
825
+ const o = s.shape, n = s.basis;
807
826
  for (let l = 0; l < 3; l++) {
808
- a[l];
809
- const f = a[l].map((r) => r * $);
810
- e.push(`${o[l]} ${f.map((r) => r.toFixed(6)).join(" ")}`);
827
+ n[l];
828
+ const y = n[l].map((c) => c * R);
829
+ e.push(`${o[l]} ${y.map((c) => c.toFixed(6)).join(" ")}`);
811
830
  }
812
- for (const l of m.sites) {
813
- const f = m.species[l.speciesIndex], r = Object.values(D).find(
814
- (g) => g.symbol === f
831
+ for (const l of i.sites) {
832
+ const y = i.species[l.speciesIndex], c = Object.values(D).find(
833
+ (g) => g.symbol === y
815
834
  )?.atomicNumber;
816
- if (!r)
817
- throw new Error(`Unknown element symbol: ${f}`);
835
+ if (!c)
836
+ throw new Error(`Unknown element symbol: ${y}`);
818
837
  [...l.cart];
819
- const p = l.cart.map((g) => g * $), N = (l.getProp("charge") ?? 0).toFixed(6);
838
+ const p = l.cart.map((g) => g * R), N = (l.getProp("charge") ?? 0).toFixed(6);
820
839
  e.push(
821
- `${r} ${N} ${p.map((g) => g.toFixed(6)).join(" ")}`
840
+ `${c} ${N} ${p.map((g) => g.toFixed(6)).join(" ")}`
822
841
  );
823
842
  }
824
- const b = s.values, [n, u, h] = o;
825
- let c = [];
843
+ const u = s.values, [a, b, h] = o;
844
+ let r = [];
826
845
  for (let l = 0; l < h; l++)
827
- for (let f = 0; f < u; f++)
828
- for (let r = 0; r < n; r++) {
829
- const p = s.index(r, f, l);
830
- c.push(b[p].toExponential(8)), c.length === 6 && (e.push(c.join(" ")), c = []);
846
+ for (let y = 0; y < b; y++)
847
+ for (let c = 0; c < a; c++) {
848
+ const p = s.index(c, y, l);
849
+ r.push(u[p].toExponential(8)), r.length === 6 && (e.push(r.join(" ")), r = []);
831
850
  }
832
- return c.length > 0 && e.push(c.join(" ")), e.join(`
851
+ return r.length > 0 && e.push(r.join(" ")), e.join(`
833
852
  `);
834
853
  }
835
- function V(m, s = "bohr", e = "bohr", t = "bohr") {
836
- let i = 0;
837
- i += 2;
838
- const o = m[i].split(/\s+/), a = parseInt(o[0]);
839
- let b = [
854
+ function H(i, s = "bohr", e = "bohr", t = "bohr") {
855
+ let m = 0;
856
+ m += 2;
857
+ const o = i[m].split(/\s+/), n = parseInt(o[0]);
858
+ let u = [
840
859
  parseFloat(o[1]),
841
860
  parseFloat(o[2]),
842
861
  parseFloat(o[3])
843
862
  ];
844
- i++;
845
- const n = m[i++].split(/\s+/), u = m[i++].split(/\s+/), h = m[i++].split(/\s+/);
846
- let c = [
847
- [parseFloat(n[1]), parseFloat(n[2]), parseFloat(n[3])],
848
- [parseFloat(u[1]), parseFloat(u[2]), parseFloat(u[3])],
863
+ m++;
864
+ const a = i[m++].split(/\s+/), b = i[m++].split(/\s+/), h = i[m++].split(/\s+/);
865
+ let r = [
866
+ [parseFloat(a[1]), parseFloat(a[2]), parseFloat(a[3])],
867
+ [parseFloat(b[1]), parseFloat(b[2]), parseFloat(b[3])],
849
868
  [
850
869
  parseFloat(h[1]),
851
870
  parseFloat(h[2]),
@@ -853,87 +872,89 @@ function V(m, s = "bohr", e = "bohr", t = "bohr") {
853
872
  ]
854
873
  ];
855
874
  const l = [
856
- parseInt(n[0], 10),
857
- parseInt(u[0], 10),
875
+ parseInt(a[0], 10),
876
+ parseInt(b[0], 10),
858
877
  parseInt(h[0], 10)
859
- ], f = [], r = /* @__PURE__ */ new Map(), p = [];
860
- for (let w = 0; w < a; w++, i++) {
861
- const x = m[i].trim().split(/\s+/);
862
- if (x.length < 5) throw new Error(`Malformed atom line: "${m[i]}"`);
863
- const A = parseInt(x[0], 10), H = parseFloat(x[1]), W = [
878
+ ], y = [], c = /* @__PURE__ */ new Map(), p = [];
879
+ for (let w = 0; w < n; w++, m++) {
880
+ const x = i[m].trim().split(/\s+/);
881
+ if (x.length < 5) throw new Error(`Malformed atom line: "${i[m]}"`);
882
+ const A = parseInt(x[0], 10), V = parseFloat(x[1]), W = [
864
883
  parseFloat(x[2]),
865
884
  parseFloat(x[3]),
866
885
  parseFloat(x[4])
867
- ], O = D[A];
868
- if (!O) throw new Error(`Unknown atomic number: ${A}`);
869
- const E = O.symbol;
870
- let T = r.get(E);
871
- T === void 0 && (T = f.length, f.push(E), r.set(E, T)), p.push(new v(T, W, { charge: H }));
872
- }
873
- b = R.convertArray(
874
- b,
886
+ ], j = D[A];
887
+ if (!j) throw new Error(`Unknown atomic number: ${A}`);
888
+ const E = j.symbol;
889
+ let T = c.get(E);
890
+ T === void 0 && (T = y.length, y.push(E), c.set(E, T)), p.push(new S(T, W, { charge: V }));
891
+ }
892
+ u = $.convertArray(
893
+ u,
875
894
  s,
876
895
  "angstrom"
877
- ), c = c.map(
878
- (w) => R.convertArray(
896
+ ), r = r.map(
897
+ (w) => $.convertArray(
879
898
  w,
880
899
  t,
881
900
  "angstrom"
882
901
  )
883
902
  ), p.forEach((w) => {
884
- w.cart = R.convertArray(
903
+ w.cart = $.convertArray(
885
904
  w.cart,
886
905
  e,
887
906
  "angstrom"
888
907
  );
889
908
  });
890
- const N = c.map(
909
+ const N = r.map(
891
910
  (w, x) => w.map((A) => A * l[x])
892
- ), g = new I({
911
+ ), g = new F({
893
912
  lattice: N,
894
- species: f,
913
+ species: y,
895
914
  sites: p
896
- }), _ = l[0] * l[1] * l[2], S = new Float32Array(_);
897
- let y = 0;
898
- for (; i < m.length && y < _; ) {
899
- const w = m[i++].trim().split(/\s+/);
915
+ }), _ = l[0] * l[1] * l[2], v = new Float32Array(_);
916
+ let f = 0;
917
+ for (; m < i.length && f < _; ) {
918
+ const w = i[m++].trim().split(/\s+/);
900
919
  for (const x of w)
901
- x && y < _ && (S[y] = parseFloat(x), y++);
920
+ x && f < _ && (v[f] = parseFloat(x), f++);
902
921
  }
903
- if (console.log("numVals", _), y !== _)
904
- throw new Error(`Cube file truncated: expected ${_}, got ${y}`);
905
- const d = new X({
906
- origin: b,
907
- basis: c,
922
+ if (f !== _)
923
+ throw new Error(`Cube file truncated: expected ${_}, got ${f}`);
924
+ const d = new Z({
925
+ origin: u,
926
+ basis: r,
908
927
  shape: l,
909
- values: S,
928
+ values: v,
910
929
  units: "e/ų"
911
930
  });
912
- return { structure: g, volumetricData: d, linesConsumed: i };
931
+ return { structure: g, volumetricData: d, linesConsumed: m };
913
932
  }
914
- function ns(m) {
915
- const s = F(m);
916
- return V(s).volumetricData;
933
+ function cs(i) {
934
+ const s = I(i);
935
+ return H(s).volumetricData;
917
936
  }
918
- function rs(m) {
919
- const s = F(m);
920
- return V(s).structure;
937
+ function ls(i) {
938
+ const s = I(i);
939
+ return H(s).structure;
921
940
  }
922
941
  export {
923
- I as CrystalStructure,
924
- v as Site,
925
- X as VolumetricData,
926
- os as cifToStructure,
927
- rs as cubeToStructure,
928
- ns as cubeToVolumetric,
929
- V as parseCube,
930
- J as poscarToStructure,
931
- is as pwToStructure,
942
+ F as CrystalStructure,
943
+ S as Site,
944
+ Z as VolumetricData,
945
+ J as cartesianToFractional,
946
+ ns as cifToStructure,
947
+ ls as cubeToStructure,
948
+ cs as cubeToVolumetric,
949
+ U as fractionalToCartesian,
950
+ H as parseCube,
951
+ ss as poscarToStructure,
952
+ as as pwToStructure,
932
953
  ms as structureToCif,
933
- K as structureToPoscar,
934
- Q as structureToXsf,
935
- es as structureToXyz,
936
- as as volumetricToCube,
937
- ss as xsfToStructure,
938
- ts as xyzToStructure
954
+ Q as structureToPoscar,
955
+ es as structureToXsf,
956
+ os as structureToXyz,
957
+ rs as volumetricToCube,
958
+ ts as xsfToStructure,
959
+ is as xyzToStructure
939
960
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "matsci-parse",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "main": "dist/main.js",
6
6
  "module": "dist/main.js",