matsci-parse 0.5.0 → 0.5.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 +26 -21
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -520,11 +520,11 @@ function qA(I) {
520
520
  }
521
521
  return new J({ lattice: i, species: G, sites: k });
522
522
  }
523
- function T(I, A) {
523
+ function P(I, A) {
524
524
  return I[0] * A[0] + I[1] * A[1] + I[2] * A[2];
525
525
  }
526
526
  function z(I) {
527
- return Math.sqrt(T(I, I));
527
+ return Math.sqrt(P(I, I));
528
528
  }
529
529
  function p(I) {
530
530
  return I * 180 / Math.PI;
@@ -557,7 +557,7 @@ function oA(I, A) {
557
557
  ];
558
558
  }
559
559
  function xA(I, A = 6) {
560
- const [g, B, C] = I.lattice, Q = z(g), E = z(B), i = z(C), D = p(Math.acos(T(B, C) / (E * i))), w = p(Math.acos(T(g, C) / (Q * i))), N = p(Math.acos(T(g, B) / (Q * E)));
560
+ const [g, B, C] = I.lattice, Q = z(g), E = z(B), i = z(C), D = p(Math.acos(P(B, C) / (E * i))), w = p(Math.acos(P(g, C) / (Q * i))), N = p(Math.acos(P(g, B) / (Q * E)));
561
561
  let G = `data_made_with_matsci-parse
562
562
  _symmetry_space_group_name_H-M 'P 1'
563
563
  _symmetry_Int_Tables_number 1
@@ -694,7 +694,7 @@ function tA(I) {
694
694
  const A = H(I);
695
695
  return MA(A).structure;
696
696
  }
697
- const j = {
697
+ const t = {
698
698
  1: { atomicNumber: 1, symbol: "H", name: "Hydrogen", mass: 1.008 },
699
699
  2: { atomicNumber: 2, symbol: "He", name: "Helium", mass: 4.0026 },
700
700
  3: { atomicNumber: 3, symbol: "Li", name: "Lithium", mass: 6.94 },
@@ -813,7 +813,12 @@ const j = {
813
813
  116: { atomicNumber: 116, symbol: "Lv", name: "Livermorium", mass: 293 },
814
814
  117: { atomicNumber: 117, symbol: "Ts", name: "Tennessine", mass: 294 },
815
815
  118: { atomicNumber: 118, symbol: "Og", name: "Oganesson", mass: 294 }
816
- }, NA = {
816
+ };
817
+ Object.values(t).reduce(
818
+ (I, A) => (I[A.symbol] = A, I),
819
+ {}
820
+ );
821
+ const NA = {
817
822
  angstrom: 1,
818
823
  // canonical
819
824
  bohr: 0.529177,
@@ -851,7 +856,7 @@ function bA(I, A) {
851
856
  g.push(`${Q[M]} ${k.map((o) => o.toFixed(6)).join(" ")}`);
852
857
  }
853
858
  for (const M of I.sites) {
854
- const k = I.species[M.speciesIndex], o = Object.values(j).find(
859
+ const k = I.species[M.speciesIndex], o = Object.values(t).find(
855
860
  (Y) => Y.symbol === k
856
861
  )?.atomicNumber;
857
862
  if (!o)
@@ -901,15 +906,15 @@ function BA(I, A = "bohr", g = "bohr", B = "bohr") {
901
906
  for (let S = 0; S < E; S++, C++) {
902
907
  const s = I[C].trim().split(/\s+/);
903
908
  if (s.length < 5) throw new Error(`Malformed atom line: "${I[C]}"`);
904
- const t = parseInt(s[0], 10), QA = parseFloat(s[1]), CA = [
909
+ const b = parseInt(s[0], 10), QA = parseFloat(s[1]), CA = [
905
910
  parseFloat(s[2]),
906
911
  parseFloat(s[3]),
907
912
  parseFloat(s[4])
908
- ], X = j[t];
909
- if (!X) throw new Error(`Unknown atomic number: ${t}`);
913
+ ], X = t[b];
914
+ if (!X) throw new Error(`Unknown atomic number: ${b}`);
910
915
  const m = X.symbol;
911
- let b = o.get(m);
912
- b === void 0 && (b = k.length, k.push(m), o.set(m, b)), R.push(new K(b, CA, { charge: QA }));
916
+ let T = o.get(m);
917
+ T === void 0 && (T = k.length, k.push(m), o.set(m, T)), R.push(new K(T, CA, { charge: QA }));
913
918
  }
914
919
  i = l.convertArray(
915
920
  i,
@@ -929,7 +934,7 @@ function BA(I, A = "bohr", g = "bohr", B = "bohr") {
929
934
  );
930
935
  });
931
936
  const y = G.map(
932
- (S, s) => S.map((t) => t * M[s])
937
+ (S, s) => S.map((b) => b * M[s])
933
938
  ), Y = new J({
934
939
  lattice: y,
935
940
  species: k,
@@ -1017,16 +1022,16 @@ function n(I, A) {
1017
1022
  return I = I >>> 0, yA(I, A);
1018
1023
  }
1019
1024
  let q = null;
1020
- function P() {
1025
+ function Z() {
1021
1026
  return (q === null || q.byteLength === 0) && (q = new Uint8Array(c.memory.buffer)), q;
1022
1027
  }
1023
1028
  function f(I, A, g) {
1024
1029
  if (g === void 0) {
1025
1030
  const i = x.encode(I), D = A(i.length, 1) >>> 0;
1026
- return P().subarray(D, D + i.length).set(i), O = i.length, D;
1031
+ return Z().subarray(D, D + i.length).set(i), O = i.length, D;
1027
1032
  }
1028
1033
  let B = I.length, C = A(B, 1) >>> 0;
1029
- const Q = P();
1034
+ const Q = Z();
1030
1035
  let E = 0;
1031
1036
  for (; E < B; E++) {
1032
1037
  const i = I.charCodeAt(E);
@@ -1035,7 +1040,7 @@ function f(I, A, g) {
1035
1040
  }
1036
1041
  if (E !== B) {
1037
1042
  E !== 0 && (I = I.slice(E)), C = g(C, B, B = E + I.length * 3, 1) >>> 0;
1038
- const i = P().subarray(C + E, C + B), D = x.encodeInto(I, i);
1043
+ const i = Z().subarray(C + E, C + B), D = x.encodeInto(I, i);
1039
1044
  E += D.written, C = g(C, B, E, 1) >>> 0;
1040
1045
  }
1041
1046
  return O = E, C;
@@ -1044,12 +1049,12 @@ function u(I) {
1044
1049
  const A = c.__wbindgen_externrefs.get(I);
1045
1050
  return c.__externref_table_dealloc(I), A;
1046
1051
  }
1047
- let Z = new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 });
1048
- Z.decode();
1052
+ let j = new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 });
1053
+ j.decode();
1049
1054
  const hA = 2146435072;
1050
1055
  let W = 0;
1051
1056
  function yA(I, A) {
1052
- return W += A, W >= hA && (Z = new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 }), Z.decode(), W = A), Z.decode(P().subarray(I, I + A));
1057
+ return W += A, W >= hA && (j = new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 }), j.decode(), W = A), j.decode(Z().subarray(I, I + A));
1053
1058
  }
1054
1059
  const x = new TextEncoder();
1055
1060
  "encodeInto" in x || (x.encodeInto = function(I, A) {
@@ -1118,9 +1123,9 @@ function UA() {
1118
1123
  })()), e;
1119
1124
  }
1120
1125
  const sA = new Map(
1121
- Object.values(j).map((I) => [I.symbol, I.atomicNumber])
1126
+ Object.values(t).map((I) => [I.symbol, I.atomicNumber])
1122
1127
  ), $ = new Map(
1123
- Object.values(j).map((I) => [I.atomicNumber, I.symbol])
1128
+ Object.values(t).map((I) => [I.atomicNumber, I.symbol])
1124
1129
  );
1125
1130
  function SA(I) {
1126
1131
  const A = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "matsci-parse",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "type": "module",
5
5
  "main": "dist/main.js",
6
6
  "module": "dist/main.js",