bravais 0.1.4 → 0.2.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.
- package/CHANGELOG.md +19 -0
- package/README.md +12 -2
- package/THIRD_PARTY_NOTICES.md +11 -3
- package/dist/bravais.js +600 -545
- package/dist/bravais.js.map +1 -1
- package/dist/types/cif/errors.d.ts +6 -0
- package/dist/types/cif/structure.d.ts +2 -4
- package/dist/types/cif/{symmetry-operators.d.ts → symmetry-operations.d.ts} +1 -1
- package/dist/types/cif/tokenizer.d.ts +0 -6
- package/dist/types/index.d.ts +6 -8
- package/dist/types/render/camera.d.ts +1 -11
- package/dist/types/render/gizmo.d.ts +0 -1
- package/dist/types/render/materials.d.ts +0 -4
- package/dist/types/render/model.d.ts +11 -5
- package/dist/types/render/oklab.d.ts +0 -1
- package/dist/types/render/viewer.d.ts +4 -2
- package/dist/types/structure/bonds.d.ts +0 -2
- package/dist/types/structure/elements.d.ts +0 -3
- package/dist/types/structure/fractional.d.ts +2 -4
- package/dist/types/symmetry/resolve.d.ts +1 -1
- package/examples/CoO.cif +254 -0
- package/package.json +2 -1
package/dist/bravais.js
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
import { ACESFilmicToneMapping as e, AlwaysStencilFunc as t, AmbientLight as n, Box3 as r, BoxGeometry as i, BufferGeometry as a, CanvasTexture as o, Color as s, ConeGeometry as c, Controls as l, CylinderGeometry as u, DataTexture as d, DirectionalLight as f, DoubleSide as p, EqualStencilFunc as m, Float32BufferAttribute as h, FloatType as g, Fog as
|
|
2
|
-
//#region src/cif/
|
|
1
|
+
import { ACESFilmicToneMapping as e, AlwaysStencilFunc as t, AmbientLight as n, Box3 as r, BoxGeometry as i, BufferGeometry as a, CanvasTexture as o, Color as s, ConeGeometry as c, Controls as l, CylinderGeometry as u, DataTexture as d, DirectionalLight as f, DoubleSide as p, EqualStencilFunc as m, Float32BufferAttribute as h, FloatType as g, Fog as ee, Group as _, InstancedMesh as v, LineBasicMaterial as y, LineSegments as b, LinearFilter as x, LinearMipmapLinearFilter as te, MOUSE as S, MathUtils as ne, Matrix4 as re, Mesh as C, MeshStandardMaterial as w, NearestFilter as T, NotEqualStencilFunc as ie, Object3D as E, OrthographicCamera as D, PlaneGeometry as ae, Quaternion as O, RGBAFormat as oe, ReplaceStencilOp as se, SRGBColorSpace as ce, Scene as le, SphereGeometry as ue, Sprite as de, SpriteMaterial as fe, Vector2 as k, Vector3 as A, WebGLRenderer as j } from "three";
|
|
2
|
+
//#region src/cif/errors.ts
|
|
3
3
|
var M = class extends Error {
|
|
4
4
|
line;
|
|
5
5
|
constructor(e, t) {
|
|
6
6
|
super(`CIF line ${t}: ${e}`), this.name = "CifSyntaxError", this.line = t;
|
|
7
7
|
}
|
|
8
|
+
}, N = class extends Error {
|
|
9
|
+
constructor(e) {
|
|
10
|
+
super(e), this.name = "CifStructureError";
|
|
11
|
+
}
|
|
8
12
|
};
|
|
9
|
-
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/cif/tokenizer.ts
|
|
15
|
+
function P(e) {
|
|
10
16
|
return e === " " || e === " " || e === "\r" || e === "\n";
|
|
11
17
|
}
|
|
12
|
-
function
|
|
18
|
+
function pe(e, t) {
|
|
13
19
|
let n = e.toLowerCase();
|
|
14
20
|
return e.startsWith("_") ? {
|
|
15
21
|
kind: "tag",
|
|
@@ -37,7 +43,7 @@ function me(e, t) {
|
|
|
37
43
|
line: t
|
|
38
44
|
};
|
|
39
45
|
}
|
|
40
|
-
function
|
|
46
|
+
function me(e) {
|
|
41
47
|
let t = [], n = e.split(/\r\n|\r|\n/), r = 0;
|
|
42
48
|
for (; r < n.length;) {
|
|
43
49
|
let e = n[r] ?? "", i = r + 1;
|
|
@@ -65,7 +71,7 @@ function he(e) {
|
|
|
65
71
|
let a = 0;
|
|
66
72
|
for (; a < e.length;) {
|
|
67
73
|
let n = e.charAt(a);
|
|
68
|
-
if (
|
|
74
|
+
if (P(n)) {
|
|
69
75
|
a += 1;
|
|
70
76
|
continue;
|
|
71
77
|
}
|
|
@@ -76,7 +82,7 @@ function he(e) {
|
|
|
76
82
|
let t = e.indexOf(n, r);
|
|
77
83
|
if (t === -1) throw new M("unterminated quoted string", i);
|
|
78
84
|
let a = e.charAt(t + 1);
|
|
79
|
-
if (t + 1 >= e.length ||
|
|
85
|
+
if (t + 1 >= e.length || P(a)) {
|
|
80
86
|
r = t;
|
|
81
87
|
break;
|
|
82
88
|
}
|
|
@@ -91,8 +97,8 @@ function he(e) {
|
|
|
91
97
|
continue;
|
|
92
98
|
}
|
|
93
99
|
let r = a;
|
|
94
|
-
for (; r < e.length && !
|
|
95
|
-
t.push(
|
|
100
|
+
for (; r < e.length && !P(e.charAt(r));) r += 1;
|
|
101
|
+
t.push(pe(e.slice(a, r), i)), a = r;
|
|
96
102
|
}
|
|
97
103
|
r += 1;
|
|
98
104
|
}
|
|
@@ -100,10 +106,10 @@ function he(e) {
|
|
|
100
106
|
}
|
|
101
107
|
//#endregion
|
|
102
108
|
//#region src/cif/parser.ts
|
|
103
|
-
function
|
|
109
|
+
function he(e) {
|
|
104
110
|
return typeof e == "string" ? [e] : e;
|
|
105
111
|
}
|
|
106
|
-
var
|
|
112
|
+
var ge = class {
|
|
107
113
|
name;
|
|
108
114
|
items = /* @__PURE__ */ new Map();
|
|
109
115
|
loops = [];
|
|
@@ -111,41 +117,41 @@ var _e = class {
|
|
|
111
117
|
this.name = e;
|
|
112
118
|
}
|
|
113
119
|
get(e) {
|
|
114
|
-
for (let t of
|
|
120
|
+
for (let t of he(e)) {
|
|
115
121
|
let e = this.items.get(t.toLowerCase());
|
|
116
122
|
if (e !== void 0) return e;
|
|
117
123
|
}
|
|
118
124
|
return null;
|
|
119
125
|
}
|
|
120
126
|
findLoop(e) {
|
|
121
|
-
for (let t of
|
|
127
|
+
for (let t of he(e)) {
|
|
122
128
|
let e = t.toLowerCase(), n = this.loops.find((t) => t.tags.includes(e));
|
|
123
129
|
if (n) return n;
|
|
124
130
|
}
|
|
125
131
|
return null;
|
|
126
132
|
}
|
|
127
133
|
};
|
|
128
|
-
function
|
|
129
|
-
for (let n of
|
|
134
|
+
function F(e, t) {
|
|
135
|
+
for (let n of he(t)) {
|
|
130
136
|
let t = e.tags.indexOf(n.toLowerCase());
|
|
131
137
|
if (t !== -1) return e.rows.map((e) => e[t] ?? "?");
|
|
132
138
|
}
|
|
133
139
|
return null;
|
|
134
140
|
}
|
|
135
|
-
function
|
|
141
|
+
function I(e) {
|
|
136
142
|
return e === "?" || e === ".";
|
|
137
143
|
}
|
|
138
|
-
function
|
|
139
|
-
if (e == null ||
|
|
144
|
+
function L(e) {
|
|
145
|
+
if (e == null || I(e)) return null;
|
|
140
146
|
let t = e.replace(/\(\d+\)$/, "").trim();
|
|
141
147
|
return /^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(t) ? Number(t) : null;
|
|
142
148
|
}
|
|
143
|
-
function
|
|
149
|
+
function _e(e) {
|
|
144
150
|
return e === void 0 || e.kind !== "value";
|
|
145
151
|
}
|
|
146
|
-
function
|
|
147
|
-
let t =
|
|
148
|
-
if (r || (r = new
|
|
152
|
+
function ve(e) {
|
|
153
|
+
let t = me(e), n = [], r = null, i = 0, a = 0, o = (e) => {
|
|
154
|
+
if (r || (r = new ge(""), n.push(r)), a > 0) throw new M(`unexpected ${e.kind} inside a save frame`, e.line);
|
|
149
155
|
return r;
|
|
150
156
|
};
|
|
151
157
|
for (; i < t.length;) {
|
|
@@ -153,7 +159,7 @@ function ye(e) {
|
|
|
153
159
|
if (!e) break;
|
|
154
160
|
switch (e.kind) {
|
|
155
161
|
case "data":
|
|
156
|
-
r = new
|
|
162
|
+
r = new ge(e.text), n.push(r), a = 0, i += 1;
|
|
157
163
|
break;
|
|
158
164
|
case "save":
|
|
159
165
|
a = e.text === "" ? Math.max(0, a - 1) : a + 1, i += 1;
|
|
@@ -176,7 +182,7 @@ function ye(e) {
|
|
|
176
182
|
for (i += 1; t[i]?.kind === "tag";) n.push(t[i].text.toLowerCase()), i += 1;
|
|
177
183
|
if (n.length === 0) throw new M("loop_ without tags", e.line);
|
|
178
184
|
let r = [];
|
|
179
|
-
for (; !
|
|
185
|
+
for (; !_e(t[i]);) r.push(t[i].text), i += 1;
|
|
180
186
|
if (a > 0) break;
|
|
181
187
|
if (r.length % n.length !== 0) throw new M(`loop with ${n.length} tags has ${r.length} values`, e.line);
|
|
182
188
|
let s = [];
|
|
@@ -194,53 +200,53 @@ function ye(e) {
|
|
|
194
200
|
}
|
|
195
201
|
//#endregion
|
|
196
202
|
//#region src/structure/elements.ts
|
|
197
|
-
var
|
|
198
|
-
function xe(e) {
|
|
199
|
-
return be.has(e) || e === "D";
|
|
200
|
-
}
|
|
203
|
+
var ye = /* @__PURE__ */ "H.He.Li.Be.B.C.N.O.F.Ne.Na.Mg.Al.Si.P.S.Cl.Ar.K.Ca.Sc.Ti.V.Cr.Mn.Fe.Co.Ni.Cu.Zn.Ga.Ge.As.Se.Br.Kr.Rb.Sr.Y.Zr.Nb.Mo.Tc.Ru.Rh.Pd.Ag.Cd.In.Sn.Sb.Te.I.Xe.Cs.Ba.La.Ce.Pr.Nd.Pm.Sm.Eu.Gd.Tb.Dy.Ho.Er.Tm.Yb.Lu.Hf.Ta.W.Re.Os.Ir.Pt.Au.Hg.Tl.Pb.Bi.Po.At.Rn.Fr.Ra.Ac.Th.Pa.U.Np.Pu.Am.Cm.Bk.Cf.Es.Fm.Md.No.Lr.Rf.Db.Sg.Bh.Hs.Mt.Ds.Rg.Cn.Nh.Fl.Mc.Lv.Ts.Og".split("."), be = new Set(ye), xe = "D";
|
|
201
204
|
function Se(e) {
|
|
202
|
-
return
|
|
205
|
+
return be.has(e) || e === xe;
|
|
203
206
|
}
|
|
204
207
|
function Ce(e) {
|
|
208
|
+
return e.charAt(0).toUpperCase() + e.slice(1).toLowerCase();
|
|
209
|
+
}
|
|
210
|
+
function we(e) {
|
|
205
211
|
let t = e.match(/^[A-Za-z]{1,2}/)?.[0];
|
|
206
212
|
if (!t) return null;
|
|
207
|
-
let n =
|
|
208
|
-
if (t.length === 2 &&
|
|
213
|
+
let n = Ce(t);
|
|
214
|
+
if (t.length === 2 && Se(n)) return n;
|
|
209
215
|
let r = t.charAt(0).toUpperCase();
|
|
210
|
-
return
|
|
216
|
+
return Se(r) ? r : null;
|
|
211
217
|
}
|
|
212
|
-
function
|
|
213
|
-
return e ===
|
|
218
|
+
function Te(e) {
|
|
219
|
+
return e === xe ? "H" : e;
|
|
214
220
|
}
|
|
215
221
|
//#endregion
|
|
216
222
|
//#region src/structure/fractional.ts
|
|
217
|
-
var
|
|
218
|
-
function
|
|
223
|
+
var Ee = .001, De = 1e-9;
|
|
224
|
+
function R(e, t = De) {
|
|
219
225
|
let n = e - Math.floor(e);
|
|
220
226
|
return n >= 1 - t ? 0 : n;
|
|
221
227
|
}
|
|
222
|
-
function
|
|
228
|
+
function Oe(e) {
|
|
223
229
|
return [
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
230
|
+
R(e[0]),
|
|
231
|
+
R(e[1]),
|
|
232
|
+
R(e[2])
|
|
227
233
|
];
|
|
228
234
|
}
|
|
229
|
-
function
|
|
235
|
+
function ke(e, t, n) {
|
|
230
236
|
for (let r = 0; r < 3; r += 1) {
|
|
231
237
|
let i = Math.abs(e[r] - t[r]);
|
|
232
238
|
if (i -= Math.round(i), Math.abs(i) > n) return !1;
|
|
233
239
|
}
|
|
234
240
|
return !0;
|
|
235
241
|
}
|
|
236
|
-
var
|
|
237
|
-
function
|
|
238
|
-
return Math.floor(
|
|
242
|
+
var z = 100;
|
|
243
|
+
function B(e) {
|
|
244
|
+
return Math.floor(R(e) * z) % z;
|
|
239
245
|
}
|
|
240
|
-
function
|
|
241
|
-
return (e *
|
|
246
|
+
function Ae(e, t, n) {
|
|
247
|
+
return (e * z + t) * z + n;
|
|
242
248
|
}
|
|
243
|
-
var
|
|
249
|
+
var je = class {
|
|
244
250
|
tolerance;
|
|
245
251
|
buckets = /* @__PURE__ */ new Map();
|
|
246
252
|
positions = [];
|
|
@@ -250,25 +256,25 @@ var Ae = class {
|
|
|
250
256
|
add(e) {
|
|
251
257
|
let t = this.positions.length;
|
|
252
258
|
this.positions.push(e);
|
|
253
|
-
let n =
|
|
259
|
+
let n = Ae(B(e[0]), B(e[1]), B(e[2])), r = this.buckets.get(n);
|
|
254
260
|
return r ? r.push(t) : this.buckets.set(n, [t]), t;
|
|
255
261
|
}
|
|
256
262
|
near(e) {
|
|
257
|
-
let t =
|
|
263
|
+
let t = Oe(e), [n, r, i] = t.map(B), a = [];
|
|
258
264
|
for (let e = -1; e <= 1; e += 1) {
|
|
259
|
-
let o = (n + e +
|
|
265
|
+
let o = (n + e + z) % z;
|
|
260
266
|
for (let e = -1; e <= 1; e += 1) {
|
|
261
|
-
let n = (r + e +
|
|
267
|
+
let n = (r + e + z) % z;
|
|
262
268
|
for (let e = -1; e <= 1; e += 1) {
|
|
263
|
-
let r = (i + e +
|
|
264
|
-
for (let e of this.buckets.get(
|
|
269
|
+
let r = (i + e + z) % z;
|
|
270
|
+
for (let e of this.buckets.get(Ae(o, n, r)) ?? []) ke(this.positions[e], t, this.tolerance) && a.push(e);
|
|
265
271
|
}
|
|
266
272
|
}
|
|
267
273
|
}
|
|
268
274
|
return a.sort((e, t) => e - t);
|
|
269
275
|
}
|
|
270
276
|
};
|
|
271
|
-
function
|
|
277
|
+
function Me(e, t) {
|
|
272
278
|
let n = e.rotation, [r, i, a] = t, o = e.translation;
|
|
273
279
|
return [
|
|
274
280
|
(n[0] ?? 0) * r + (n[1] ?? 0) * i + (n[2] ?? 0) * a + o[0],
|
|
@@ -278,12 +284,12 @@ function je(e, t) {
|
|
|
278
284
|
}
|
|
279
285
|
//#endregion
|
|
280
286
|
//#region src/structure/lattice.ts
|
|
281
|
-
var
|
|
282
|
-
function
|
|
287
|
+
var V = Math.PI / 180;
|
|
288
|
+
function Ne(e, t, n) {
|
|
283
289
|
return Math.min(n, Math.max(t, e));
|
|
284
290
|
}
|
|
285
|
-
function
|
|
286
|
-
let { a: t, b: n, c: r } = e, i = e.alpha *
|
|
291
|
+
function Pe(e) {
|
|
292
|
+
let { a: t, b: n, c: r } = e, i = e.alpha * V, a = e.beta * V, o = e.gamma * V, s = Math.cos(i), c = Math.cos(a), l = Math.cos(o), u = Math.sin(i), d = Math.sin(a), f = Math.acos(Ne((s * c - l) / (u * d), -1, 1)), p = [
|
|
287
293
|
t * d,
|
|
288
294
|
0,
|
|
289
295
|
t * c
|
|
@@ -305,8 +311,8 @@ function Ne(e) {
|
|
|
305
311
|
]
|
|
306
312
|
};
|
|
307
313
|
}
|
|
308
|
-
function
|
|
309
|
-
let [t, n, r] = e, i = (e) => Math.hypot(e[0], e[1], e[2]), a = (e, t) => Math.acos(
|
|
314
|
+
function Fe(e) {
|
|
315
|
+
let [t, n, r] = e, i = (e) => Math.hypot(e[0], e[1], e[2]), a = (e, t) => Math.acos(Ne((e[0] * t[0] + e[1] * t[1] + e[2] * t[2]) / (i(e) * i(t)), -1, 1)) / V;
|
|
310
316
|
return {
|
|
311
317
|
a: i(t),
|
|
312
318
|
b: i(n),
|
|
@@ -317,7 +323,7 @@ function Pe(e) {
|
|
|
317
323
|
vectors: e
|
|
318
324
|
};
|
|
319
325
|
}
|
|
320
|
-
function
|
|
326
|
+
function Ie(e, t) {
|
|
321
327
|
let [n, r, i] = e.vectors, [a, o, s] = t;
|
|
322
328
|
return [
|
|
323
329
|
a * n[0] + o * r[0] + s * i[0],
|
|
@@ -325,49 +331,45 @@ function Fe(e, t) {
|
|
|
325
331
|
a * n[2] + o * r[2] + s * i[2]
|
|
326
332
|
];
|
|
327
333
|
}
|
|
328
|
-
function
|
|
334
|
+
function Le(e, t) {
|
|
329
335
|
let n = e[0] - t[0], r = e[1] - t[1], i = e[2] - t[2];
|
|
330
336
|
return Math.sqrt(n * n + r * r + i * i);
|
|
331
337
|
}
|
|
332
338
|
//#endregion
|
|
333
|
-
//#region src/cif/
|
|
334
|
-
var
|
|
335
|
-
constructor(e) {
|
|
336
|
-
super(e), this.name = "CifStructureError";
|
|
337
|
-
}
|
|
338
|
-
}, Le = [
|
|
339
|
+
//#region src/cif/symmetry-operations.ts
|
|
340
|
+
var Re = [
|
|
339
341
|
"x",
|
|
340
342
|
"y",
|
|
341
343
|
"z"
|
|
342
344
|
];
|
|
343
|
-
function
|
|
345
|
+
function ze(e) {
|
|
344
346
|
if (e === "" || e === "+") return 1;
|
|
345
347
|
if (e === "-") return -1;
|
|
346
348
|
let t = e.match(/^([+-]?\d+)\/(\d+)$/), n = t ? Number(t[1]) / Number(t[2]) : Number(e);
|
|
347
|
-
if (!Number.isFinite(n)) throw new
|
|
349
|
+
if (!Number.isFinite(n)) throw new N(`Cannot read the number ${JSON.stringify(e)} in a symmetry operation.`);
|
|
348
350
|
return n;
|
|
349
351
|
}
|
|
350
|
-
function
|
|
352
|
+
function Be(e) {
|
|
351
353
|
let t = e.split(",").map((e) => e.toLowerCase().replace(/[^xyz0-9./+-]/g, ""));
|
|
352
|
-
if (t.length !== 3) throw new
|
|
354
|
+
if (t.length !== 3) throw new N(`A symmetry operation needs three components: ${JSON.stringify(e)}.`);
|
|
353
355
|
let n = [], r = [];
|
|
354
356
|
for (let i of t) {
|
|
355
357
|
let t = i.match(/[+-]?[^+-]+/g);
|
|
356
|
-
if (!t || t.join("") !== i) throw new
|
|
358
|
+
if (!t || t.join("") !== i) throw new N(`Cannot read the symmetry operation ${JSON.stringify(e)}.`);
|
|
357
359
|
let a = [
|
|
358
360
|
0,
|
|
359
361
|
0,
|
|
360
362
|
0
|
|
361
363
|
], o = 0;
|
|
362
364
|
for (let e of t) {
|
|
363
|
-
let t =
|
|
364
|
-
if (t === -1) o +=
|
|
365
|
+
let t = Re.findIndex((t) => e.includes(t));
|
|
366
|
+
if (t === -1) o += ze(e);
|
|
365
367
|
else {
|
|
366
|
-
let n =
|
|
368
|
+
let n = ze(e.replace(Re[t], "").replace(/\*$/, ""));
|
|
367
369
|
a[t] = (a[t] ?? 0) + n;
|
|
368
370
|
}
|
|
369
371
|
}
|
|
370
|
-
n.push(...a), r.push(
|
|
372
|
+
n.push(...a), r.push(R(o));
|
|
371
373
|
}
|
|
372
374
|
return {
|
|
373
375
|
rotation: n,
|
|
@@ -376,78 +378,78 @@ function ze(e) {
|
|
|
376
378
|
}
|
|
377
379
|
//#endregion
|
|
378
380
|
//#region src/cif/structure.ts
|
|
379
|
-
var
|
|
381
|
+
var Ve = 1e-4, He = ["_space_group_symop_operation_xyz", "_symmetry_equiv_pos_as_xyz"], Ue = ["_space_group_it_number", "_symmetry_int_tables_number"], We = [
|
|
380
382
|
"_space_group_name_h-m_alt",
|
|
381
383
|
"_symmetry_space_group_name_h-m",
|
|
382
384
|
"_space_group_name_h-m_full"
|
|
383
|
-
],
|
|
385
|
+
], Ge = ["_space_group_name_hall", "_symmetry_space_group_name_hall"];
|
|
384
386
|
function H(e, t) {
|
|
385
|
-
let n =
|
|
386
|
-
if (n === null) throw new
|
|
387
|
+
let n = L(e.get(t));
|
|
388
|
+
if (n === null) throw new N(`${e.name || "The CIF"} has no usable ${t}.`);
|
|
387
389
|
return n;
|
|
388
390
|
}
|
|
389
|
-
function
|
|
391
|
+
function Ke(e, t, n) {
|
|
390
392
|
let r = e.find((e) => e.element === t);
|
|
391
393
|
r ? r.occupancy += n : e.push({
|
|
392
394
|
element: t,
|
|
393
395
|
occupancy: n
|
|
394
396
|
}), e.sort((e, t) => t.occupancy - e.occupancy);
|
|
395
397
|
}
|
|
396
|
-
function
|
|
398
|
+
function qe(e) {
|
|
397
399
|
for (let t of e) {
|
|
398
400
|
let e = t.species.reduce((e, t) => e + t.occupancy, 0);
|
|
399
401
|
if (e > 1.000001) for (let n of t.species) n.occupancy /= e;
|
|
400
402
|
}
|
|
401
403
|
}
|
|
402
|
-
function
|
|
404
|
+
function Je(e) {
|
|
403
405
|
let t = e.findLoop("_atom_site_fract_x");
|
|
404
|
-
if (!t) throw new
|
|
405
|
-
let n =
|
|
406
|
+
if (!t) throw new N(`${e.name || "The CIF"} has no atom sites.`);
|
|
407
|
+
let n = F(t, "_atom_site_fract_x") ?? [], r = F(t, "_atom_site_fract_y") ?? [], i = F(t, "_atom_site_fract_z") ?? [], a = F(t, "_atom_site_label"), o = F(t, "_atom_site_type_symbol"), s = F(t, "_atom_site_occupancy"), c = [], l = new je(Ve);
|
|
406
408
|
for (let e = 0; e < t.rows.length; e += 1) {
|
|
407
|
-
let t =
|
|
409
|
+
let t = L(n[e]), u = L(r[e]), d = L(i[e]);
|
|
408
410
|
if (t === null || u === null || d === null) continue;
|
|
409
|
-
let f = a?.[e] ?? o?.[e] ?? `site${e + 1}`, p = o?.[e], m = (p && !
|
|
410
|
-
if (!m) throw new
|
|
411
|
-
let h =
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
], [
|
|
416
|
-
|
|
411
|
+
let f = a?.[e] ?? o?.[e] ?? `site${e + 1}`, p = o?.[e], m = (p && !I(p) ? we(p) : null) ?? we(f);
|
|
412
|
+
if (!m) throw new N(`Atom site ${JSON.stringify(f)} names no element (type symbol ${JSON.stringify(p ?? "")}).`);
|
|
413
|
+
let h = L(s?.[e]) ?? 1, g = [
|
|
414
|
+
R(t),
|
|
415
|
+
R(u),
|
|
416
|
+
R(d)
|
|
417
|
+
], [ee] = l.near(g);
|
|
418
|
+
ee === void 0 ? (l.add(g), c.push({
|
|
417
419
|
label: f,
|
|
418
420
|
species: [{
|
|
419
421
|
element: m,
|
|
420
422
|
occupancy: h
|
|
421
423
|
}],
|
|
422
424
|
fractional: g
|
|
423
|
-
})) :
|
|
425
|
+
})) : Ke(c[ee].species, m, h);
|
|
424
426
|
}
|
|
425
|
-
if (c.length === 0) throw new
|
|
426
|
-
return
|
|
427
|
+
if (c.length === 0) throw new N(`${e.name || "The CIF"} has no atom sites with coordinates.`);
|
|
428
|
+
return qe(c), c;
|
|
427
429
|
}
|
|
428
|
-
function
|
|
429
|
-
let t = e.findLoop(
|
|
430
|
+
function Ye(e) {
|
|
431
|
+
let t = e.findLoop(He);
|
|
430
432
|
if (!t) {
|
|
431
|
-
let t = e.get(
|
|
432
|
-
return t === null ? null : [
|
|
433
|
+
let t = e.get(He);
|
|
434
|
+
return t === null ? null : [Be(t)];
|
|
433
435
|
}
|
|
434
|
-
let n = (
|
|
436
|
+
let n = (F(t, He) ?? []).filter((e) => !I(e)).map(Be);
|
|
435
437
|
return n.length > 0 ? n : null;
|
|
436
438
|
}
|
|
437
|
-
function
|
|
438
|
-
let t = e.get(
|
|
439
|
+
function Xe(e) {
|
|
440
|
+
let t = L(e.get(Ue)), n = e.get(We), r = e.get(Ge);
|
|
439
441
|
return {
|
|
440
|
-
number:
|
|
441
|
-
symbol:
|
|
442
|
-
hallSymbol:
|
|
442
|
+
number: t !== null && Number.isInteger(t) && t >= 1 && t <= 230 ? t : null,
|
|
443
|
+
symbol: n !== null && !I(n) ? n.trim() : null,
|
|
444
|
+
hallSymbol: r !== null && !I(r) ? r.trim() : null
|
|
443
445
|
};
|
|
444
446
|
}
|
|
445
|
-
function
|
|
447
|
+
function Ze(e) {
|
|
446
448
|
return e.findLoop("_atom_site_fract_x") !== null;
|
|
447
449
|
}
|
|
448
|
-
function
|
|
450
|
+
function Qe(e) {
|
|
449
451
|
return {
|
|
450
|
-
lattice:
|
|
452
|
+
lattice: Pe({
|
|
451
453
|
a: H(e, "_cell_length_a"),
|
|
452
454
|
b: H(e, "_cell_length_b"),
|
|
453
455
|
c: H(e, "_cell_length_c"),
|
|
@@ -455,20 +457,20 @@ function Ze(e) {
|
|
|
455
457
|
beta: H(e, "_cell_angle_beta"),
|
|
456
458
|
gamma: H(e, "_cell_angle_gamma")
|
|
457
459
|
}),
|
|
458
|
-
sites:
|
|
459
|
-
operations:
|
|
460
|
-
spaceGroup:
|
|
460
|
+
sites: Je(e),
|
|
461
|
+
operations: Ye(e),
|
|
462
|
+
spaceGroup: Xe(e)
|
|
461
463
|
};
|
|
462
464
|
}
|
|
463
465
|
//#endregion
|
|
464
466
|
//#region src/structure/closure.ts
|
|
465
|
-
function
|
|
466
|
-
let n = new
|
|
467
|
+
function $e(e, t) {
|
|
468
|
+
let n = new je(Ee);
|
|
467
469
|
for (let t of e) n.add(t.fractional);
|
|
468
470
|
let r = !1, i = !0;
|
|
469
471
|
return e.forEach((e, a) => {
|
|
470
472
|
for (let o of t) {
|
|
471
|
-
let t = n.near(
|
|
473
|
+
let t = n.near(Me(o, e.fractional));
|
|
472
474
|
t.some((e) => e !== a) && (r = !0), t.length === 0 && (i = !1);
|
|
473
475
|
}
|
|
474
476
|
}), {
|
|
@@ -478,7 +480,7 @@ function Qe(e, t) {
|
|
|
478
480
|
}
|
|
479
481
|
//#endregion
|
|
480
482
|
//#region src/structure/types.ts
|
|
481
|
-
var
|
|
483
|
+
var et = {
|
|
482
484
|
rotation: [
|
|
483
485
|
1,
|
|
484
486
|
0,
|
|
@@ -495,29 +497,29 @@ var $e = {
|
|
|
495
497
|
0,
|
|
496
498
|
0
|
|
497
499
|
]
|
|
498
|
-
},
|
|
499
|
-
function
|
|
500
|
-
return
|
|
501
|
-
await e.instantiate(),
|
|
500
|
+
}, tt = null, nt = null;
|
|
501
|
+
function rt() {
|
|
502
|
+
return nt ||= import("./moyo-wasm.js").then(async (e) => {
|
|
503
|
+
await e.instantiate(), tt = e;
|
|
502
504
|
}).catch((e) => {
|
|
503
|
-
throw
|
|
504
|
-
}),
|
|
505
|
+
throw nt = null, e;
|
|
506
|
+
}), nt;
|
|
505
507
|
}
|
|
506
508
|
function U() {
|
|
507
|
-
if (!
|
|
508
|
-
return
|
|
509
|
+
if (!tt) throw Error("moyo is not loaded yet; await ensureMoyo() first.");
|
|
510
|
+
return tt;
|
|
509
511
|
}
|
|
510
512
|
//#endregion
|
|
511
513
|
//#region src/symmetry/moyo.ts
|
|
512
|
-
var
|
|
514
|
+
var it = class extends Error {
|
|
513
515
|
constructor(e) {
|
|
514
516
|
super(e), this.name = "SpaceGroupLookupError";
|
|
515
517
|
}
|
|
516
518
|
}, W = null;
|
|
517
|
-
function
|
|
518
|
-
return
|
|
519
|
+
function at() {
|
|
520
|
+
return rt();
|
|
519
521
|
}
|
|
520
|
-
function
|
|
522
|
+
function ot(e) {
|
|
521
523
|
let t = e.rotation;
|
|
522
524
|
return {
|
|
523
525
|
rotation: [
|
|
@@ -538,7 +540,7 @@ function at(e) {
|
|
|
538
540
|
]
|
|
539
541
|
};
|
|
540
542
|
}
|
|
541
|
-
function
|
|
543
|
+
function st() {
|
|
542
544
|
if (!W) {
|
|
543
545
|
W = [];
|
|
544
546
|
for (let e = 1; e <= 230; e += 1) W.push(...U().hall_symbol_entries_from_number(e));
|
|
@@ -548,7 +550,7 @@ function ot() {
|
|
|
548
550
|
function G(e) {
|
|
549
551
|
return e.replace(/[\s_]/g, "").toLowerCase();
|
|
550
552
|
}
|
|
551
|
-
function
|
|
553
|
+
function ct(e) {
|
|
552
554
|
let t = e.trim(), n = t.match(/^(.*?)\s*:\s*(\S+)$/);
|
|
553
555
|
if (n && n[1] && n[2]) return {
|
|
554
556
|
base: G(n[1]),
|
|
@@ -563,94 +565,94 @@ function st(e) {
|
|
|
563
565
|
setting: null
|
|
564
566
|
};
|
|
565
567
|
}
|
|
566
|
-
function
|
|
568
|
+
function lt(e) {
|
|
567
569
|
let t = e[0];
|
|
568
570
|
if (!t) return e;
|
|
569
571
|
let n = U().space_group_type(t.number).hall_number;
|
|
570
572
|
return [...e].sort((e, t) => Number(t.hall_number === n) - Number(e.hall_number === n));
|
|
571
573
|
}
|
|
572
|
-
function
|
|
573
|
-
let t =
|
|
574
|
+
function ut(e) {
|
|
575
|
+
let t = st().filter((t) => e.number === null || t.number === e.number);
|
|
574
576
|
if (e.hallSymbol) {
|
|
575
577
|
let n = G(e.hallSymbol), r = t.filter((e) => G(e.hall_symbol) === n);
|
|
576
578
|
if (r.length > 0) return r;
|
|
577
579
|
}
|
|
578
580
|
if (e.symbol) {
|
|
579
|
-
let { base: n, setting: r } =
|
|
581
|
+
let { base: n, setting: r } = ct(e.symbol), i = t.filter((e) => G(e.hm_short) === n || G(e.hm_full) === n);
|
|
580
582
|
if (r) {
|
|
581
583
|
let e = i.filter((e) => e.setting.toLowerCase() === r);
|
|
582
584
|
if (e.length > 0) return e;
|
|
583
585
|
}
|
|
584
|
-
return
|
|
586
|
+
return lt(i);
|
|
585
587
|
}
|
|
586
588
|
return [];
|
|
587
589
|
}
|
|
588
|
-
function
|
|
590
|
+
function dt(e) {
|
|
589
591
|
return [
|
|
590
592
|
e.hallSymbol,
|
|
591
593
|
e.symbol,
|
|
592
594
|
e.number
|
|
593
595
|
].filter((e) => e !== null).join(" / ");
|
|
594
596
|
}
|
|
595
|
-
async function
|
|
596
|
-
await
|
|
597
|
+
async function ft(e) {
|
|
598
|
+
await at();
|
|
597
599
|
let { operations_from_number: t } = U();
|
|
598
600
|
if (e.hallSymbol || e.symbol) {
|
|
599
|
-
let n =
|
|
600
|
-
if (n.length === 0) throw new
|
|
601
|
+
let n = ut(e);
|
|
602
|
+
if (n.length === 0) throw new it(`Space group ${dt(e)} is not in the symmetry table.`);
|
|
601
603
|
return n.map((e) => ({
|
|
602
604
|
setting: e.setting,
|
|
603
605
|
operations: t(e.number, {
|
|
604
606
|
type: "HallNumber",
|
|
605
607
|
value: e.hall_number
|
|
606
|
-
}, !1).map(
|
|
608
|
+
}, !1).map(ot)
|
|
607
609
|
}));
|
|
608
610
|
}
|
|
609
|
-
if (e.number === null) throw new
|
|
611
|
+
if (e.number === null) throw new it("The CIF names no space group.");
|
|
610
612
|
return [{
|
|
611
613
|
setting: "",
|
|
612
|
-
operations: t(e.number, { type: "Spglib" }, !1).map(
|
|
614
|
+
operations: t(e.number, { type: "Spglib" }, !1).map(ot)
|
|
613
615
|
}];
|
|
614
616
|
}
|
|
615
|
-
async function
|
|
616
|
-
let [t] = await
|
|
617
|
+
async function pt(e) {
|
|
618
|
+
let [t] = await ft(e);
|
|
617
619
|
return t.operations;
|
|
618
620
|
}
|
|
619
621
|
//#endregion
|
|
620
622
|
//#region src/symmetry/resolve.ts
|
|
621
|
-
var
|
|
622
|
-
function
|
|
623
|
-
return new
|
|
623
|
+
var mt = .001, ht = .01;
|
|
624
|
+
function gt() {
|
|
625
|
+
return new N("The symmetry does not fit the listed atoms: they are already expanded, yet the operations generate positions the file does not list.");
|
|
624
626
|
}
|
|
625
|
-
function
|
|
626
|
-
let n =
|
|
627
|
-
if (n.preExpanded && !n.closed) throw
|
|
627
|
+
function _t(e, t) {
|
|
628
|
+
let n = $e(e, t);
|
|
629
|
+
if (n.preExpanded && !n.closed) throw gt();
|
|
628
630
|
}
|
|
629
|
-
function
|
|
630
|
-
let o = (e, t) => Math.abs(e - t) <=
|
|
631
|
+
function vt({ a: e, b: t, c: n, alpha: r, beta: i, gamma: a }) {
|
|
632
|
+
let o = (e, t) => Math.abs(e - t) <= mt * Math.max(e, t), s = (e, t) => Math.abs(e - t) <= ht;
|
|
631
633
|
return o(e, t) && o(t, n) && s(r, i) && s(i, a) && !s(r, 90) ? "R" : o(e, t) && s(r, 90) && s(i, 90) && s(a, 120) ? "H" : null;
|
|
632
634
|
}
|
|
633
|
-
async function
|
|
634
|
-
if (e.operations) return
|
|
635
|
+
async function yt(e) {
|
|
636
|
+
if (e.operations) return _t(e.sites, e.operations), e.operations;
|
|
635
637
|
let { spaceGroup: t } = e;
|
|
636
|
-
if (t.hallSymbol === null && t.symbol === null && t.number === null) return [
|
|
637
|
-
let n = await
|
|
638
|
+
if (t.hallSymbol === null && t.symbol === null && t.number === null) return [et];
|
|
639
|
+
let n = await ft(t);
|
|
638
640
|
if (n.length === 1) {
|
|
639
641
|
let [t] = n;
|
|
640
|
-
return
|
|
642
|
+
return _t(e.sites, t.operations), t.operations;
|
|
641
643
|
}
|
|
642
|
-
let r = n.map((t) =>
|
|
644
|
+
let r = n.map((t) => $e(e.sites, t.operations)), i = n.find((e, t) => r[t].preExpanded && r[t].closed);
|
|
643
645
|
if (i) return i.operations;
|
|
644
|
-
if (r.some((e) => e.preExpanded)) throw
|
|
645
|
-
let a =
|
|
646
|
+
if (r.some((e) => e.preExpanded)) throw gt();
|
|
647
|
+
let a = vt(e.lattice);
|
|
646
648
|
return ((a === null ? void 0 : n.find((e) => e.setting.toUpperCase() === a)) ?? n[0]).operations;
|
|
647
649
|
}
|
|
648
650
|
//#endregion
|
|
649
651
|
//#region src/structure/expand.ts
|
|
650
|
-
function
|
|
651
|
-
let t = [], n = new
|
|
652
|
+
function bt(e) {
|
|
653
|
+
let t = [], n = new je(Ee);
|
|
652
654
|
for (let r of e.sites) for (let i of e.operations) {
|
|
653
|
-
let e =
|
|
655
|
+
let e = Oe(Me(i, r.fractional));
|
|
654
656
|
n.near(e).length === 0 && (n.add(e), t.push({
|
|
655
657
|
label: r.label,
|
|
656
658
|
species: r.species,
|
|
@@ -660,17 +662,17 @@ function yt(e) {
|
|
|
660
662
|
return {
|
|
661
663
|
...e,
|
|
662
664
|
sites: t,
|
|
663
|
-
operations: [
|
|
665
|
+
operations: [et]
|
|
664
666
|
};
|
|
665
667
|
}
|
|
666
668
|
//#endregion
|
|
667
669
|
//#region src/symmetry/dataset.ts
|
|
668
|
-
var
|
|
670
|
+
var xt = .01, St = class extends Error {
|
|
669
671
|
constructor(e) {
|
|
670
672
|
super(e), this.name = "SymmetryAnalysisError";
|
|
671
673
|
}
|
|
672
674
|
};
|
|
673
|
-
function
|
|
675
|
+
function Ct(e) {
|
|
674
676
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
675
677
|
return {
|
|
676
678
|
numbers: e.map((e) => {
|
|
@@ -680,7 +682,7 @@ function St(e) {
|
|
|
680
682
|
speciesByLabel: n
|
|
681
683
|
};
|
|
682
684
|
}
|
|
683
|
-
function
|
|
685
|
+
function wt(e, t, n) {
|
|
684
686
|
let r = e.std_cell.lattice.basis, i = [
|
|
685
687
|
[
|
|
686
688
|
r[0],
|
|
@@ -702,13 +704,13 @@ function Ct(e, t, n) {
|
|
|
702
704
|
return a.set(s, c), {
|
|
703
705
|
label: `${s}${c}`,
|
|
704
706
|
species: o,
|
|
705
|
-
fractional:
|
|
707
|
+
fractional: Oe(n)
|
|
706
708
|
};
|
|
707
709
|
});
|
|
708
710
|
return {
|
|
709
|
-
lattice:
|
|
711
|
+
lattice: Fe(i),
|
|
710
712
|
sites: o,
|
|
711
|
-
operations: [
|
|
713
|
+
operations: [et],
|
|
712
714
|
spaceGroup: {
|
|
713
715
|
number: e.number,
|
|
714
716
|
symbol: e.hm_symbol,
|
|
@@ -716,9 +718,9 @@ function Ct(e, t, n) {
|
|
|
716
718
|
}
|
|
717
719
|
};
|
|
718
720
|
}
|
|
719
|
-
async function
|
|
720
|
-
await
|
|
721
|
-
let { analyze_cell: n, hall_symbol_entry: r, space_group_type: i } = U(), a =
|
|
721
|
+
async function Tt(e, t = {}) {
|
|
722
|
+
await at();
|
|
723
|
+
let { analyze_cell: n, hall_symbol_entry: r, space_group_type: i } = U(), a = bt(e), { numbers: o, speciesByLabel: s } = Ct(a.sites), [c, l, u] = a.lattice.vectors, d = {
|
|
722
724
|
lattice: { basis: [
|
|
723
725
|
...c,
|
|
724
726
|
...l,
|
|
@@ -728,11 +730,11 @@ async function wt(e, t = {}) {
|
|
|
728
730
|
numbers: o
|
|
729
731
|
}, f;
|
|
730
732
|
try {
|
|
731
|
-
f = n(JSON.stringify(d), t.symprec ??
|
|
733
|
+
f = n(JSON.stringify(d), t.symprec ?? xt, "Standard");
|
|
732
734
|
} catch (e) {
|
|
733
|
-
throw new
|
|
735
|
+
throw new St(`moyo could not analyse the structure: ${e instanceof Error ? e.message : String(e)}`);
|
|
734
736
|
}
|
|
735
|
-
let p = r(f.hall_number), m = i(f.number), h =
|
|
737
|
+
let p = r(f.hall_number), m = i(f.number), h = wt(f, s, p);
|
|
736
738
|
return {
|
|
737
739
|
number: f.number,
|
|
738
740
|
symbol: f.hm_symbol,
|
|
@@ -741,7 +743,7 @@ async function wt(e, t = {}) {
|
|
|
741
743
|
hallNumber: f.hall_number,
|
|
742
744
|
setting: p.setting,
|
|
743
745
|
crystalSystem: m.crystal_system,
|
|
744
|
-
operations: f.operations.map(
|
|
746
|
+
operations: f.operations.map(ot),
|
|
745
747
|
wyckoffs: f.wyckoffs,
|
|
746
748
|
siteSymmetries: f.site_symmetry_symbols,
|
|
747
749
|
structure: a,
|
|
@@ -750,34 +752,34 @@ async function wt(e, t = {}) {
|
|
|
750
752
|
}
|
|
751
753
|
//#endregion
|
|
752
754
|
//#region src/symmetry/symbol.ts
|
|
753
|
-
var
|
|
754
|
-
function Dt(e) {
|
|
755
|
-
return Tt[Number(e)] ?? e;
|
|
756
|
-
}
|
|
755
|
+
var Et = "₀₁₂₃₄₅₆₇₈₉", Dt = "̅";
|
|
757
756
|
function Ot(e) {
|
|
757
|
+
return Et[Number(e)] ?? e;
|
|
758
|
+
}
|
|
759
|
+
function kt(e) {
|
|
758
760
|
let t = e.trim(), n = t.indexOf(":"), r = n === -1 ? t : t.slice(0, n).trim(), i = n === -1 ? "" : ` ${t.slice(n)}`, a = r.split(/\s+/);
|
|
759
|
-
return a.map((e) => a.length > 1 ? e.replace(/^([2346])([1-5])(?=$|\/)/, (e, t, n) => Number(n) < Number(t) ? t +
|
|
761
|
+
return a.map((e) => a.length > 1 ? e.replace(/^([2346])([1-5])(?=$|\/)/, (e, t, n) => Number(n) < Number(t) ? t + Ot(n) : e) : e).join("").replace(/(\d)_(\d)/g, (e, t, n) => t + Ot(n)).replace(/-(\d)/g, (e, t) => t + Dt) + i;
|
|
760
762
|
}
|
|
761
763
|
//#endregion
|
|
762
764
|
//#region src/structure/bonds.ts
|
|
763
|
-
var
|
|
765
|
+
var At = {
|
|
764
766
|
source: "VESTA bond-search cutoffs (K. Momma and F. Izumi), as distributed in pymatgen's vesta_cutoffs.yaml (MIT). Where VESTA lists a pair twice (H-O, D-O), the shorter cutoff is kept.",
|
|
765
767
|
pairs: /* @__PURE__ */ JSON.parse("{\"Ac-Br\":3.22726,\"Ac-Cl\":3.08646,\"Ac-F\":2.58646,\"Ac-O\":2.7326,\"Ag-As\":2.45642,\"Ag-Br\":2.37642,\"Ag-Cl\":3.05939,\"Ag-F\":2.76939,\"Ag-H\":1.65642,\"Ag-I\":2.53642,\"Ag-N\":2.00642,\"Ag-O\":2.81139,\"Ag-P\":2.37642,\"Ag-S\":3.08839,\"Ag-Se\":2.41642,\"Ag-Te\":2.66642,\"Al-As\":2.75646,\"Al-Br\":2.65646,\"Al-Cl\":2.48846,\"Al-F\":2.00146,\"Al-H\":1.90646,\"Al-I\":2.86646,\"Al-N\":2.24646,\"Al-O\":2.1074,\"Al-P\":2.69646,\"Al-S\":2.66646,\"Al-Se\":2.72646,\"Al-Te\":2.93646,\"Am-Br\":3.22944,\"Am-Cl\":3.08945,\"Am-F\":2.61945,\"Am-O\":2.71649,\"As-Au\":2.26998,\"As-B\":2.42646,\"As-Ba\":3.69,\"As-Be\":2.60649,\"As-Bi\":2.87642,\"As-Br\":2.80646,\"As-C\":2.38646,\"As-Ca\":3.48295,\"As-Cd\":3.29295,\"As-Ce\":3.08644,\"As-Cl\":2.61646,\"As-Co\":2.43642,\"As-Cr\":2.49642,\"As-Cs\":4.15942,\"As-Cu\":2.71895,\"As-Dy\":3.14,\"As-Er\":3.18,\"As-Eu\":2.93898,\"As-F\":2.15646,\"As-Fe\":2.50642,\"As-Ga\":2.38998,\"As-Gd\":3.18,\"As-Ge\":2.47998,\"As-Hf\":2.71642,\"As-Hg\":2.65642,\"As-Ho\":2.87898,\"As-I\":3.03646,\"As-In\":2.66642,\"As-Ir\":2.58998,\"As-K\":3.94942,\"As-La\":3.51293,\"As-Lu\":3.19649,\"As-Mg\":3.09293,\"As-Mn\":2.51642,\"As-Mo\":2.62701,\"As-Na\":3.64942,\"As-Nb\":2.69642,\"As-Ni\":2.28998,\"As-O\":2.24546,\"As-P\":2.29998,\"As-Pb\":3.02644,\"As-Pd\":2.34998,\"As-Pr\":3.35649,\"As-Pt\":2.30998,\"As-Rb\":4.04645,\"As-Re\":2.61998,\"As-Rh\":2.41998,\"As-Ru\":2.40998,\"As-S\":2.84649,\"As-Sb\":2.64998,\"As-Sc\":3.04291,\"As-Se\":2.98649,\"As-Si\":2.66002,\"As-Sm\":3.30649,\"As-Sn\":2.77642,\"As-Sr\":3.62295,\"As-Ta\":2.70642,\"As-Tb\":3.26649,\"As-Te\":3.10646,\"As-Th\":3.40649,\"As-Ti\":2.87642,\"As-Tl\":3.09644,\"As-Tm\":3.22649,\"As-U\":3.02644,\"As-V\":2.54642,\"As-W\":2.58998,\"As-Y\":3.24649,\"As-Yb\":3.19649,\"As-Zn\":2.95293,\"As-Zr\":3.07004,\"Au-Br\":2.77646,\"Au-Cl\":2.88295,\"Au-F\":2.34646,\"Au-H\":1.41998,\"Au-I\":3.21295,\"Au-N\":2.3826,\"Au-O\":2.34646,\"Au-P\":2.18998,\"Au-S\":2.8326,\"Au-Se\":2.22998,\"Au-Te\":2.45998,\"B-B\":1.85846,\"B-Br\":2.33646,\"B-Cl\":2.19646,\"B-F\":1.76646,\"B-H\":1.59646,\"B-I\":2.55646,\"B-N\":1.93846,\"B-O\":1.82746,\"B-P\":2.37646,\"B-S\":2.27646,\"B-Se\":2.40646,\"B-Te\":2.65646,\"Ba-Br\":3.74295,\"Ba-Cl\":3.55295,\"Ba-F\":3.05095,\"Ba-H\":3.08295,\"Ba-I\":3.99295,\"Ba-N\":3.33295,\"Ba-O\":3.14795,\"Ba-P\":3.48295,\"Ba-S\":3.66195,\"Ba-Se\":3.74295,\"Ba-Te\":3.94295,\"Be-Br\":2.50649,\"Be-Cl\":2.36649,\"Be-F\":1.88749,\"Be-H\":1.71649,\"Be-I\":2.70649,\"Be-N\":2.10649,\"Be-O\":1.98749,\"Be-P\":2.55649,\"Be-S\":2.43649,\"Be-Se\":2.57649,\"Be-Te\":2.81649,\"Bi-Br\":3.17993,\"Bi-Cl\":3.04291,\"Bi-F\":2.55291,\"Bi-H\":2.12642,\"Bi-I\":3.38291,\"Bi-N\":2.56329,\"Bi-O\":2.6608,\"Bi-P\":2.78642,\"Bi-S\":3.13291,\"Bi-Se\":3.24329,\"Bi-Te\":3.02642,\"Bk-Br\":3.15233,\"Bk-Cl\":3.02291,\"Bk-F\":2.54233,\"Bk-O\":2.64329,\"Br-C\":2.26002,\"Br-Ca\":3.36995,\"Br-Cd\":3.21295,\"Br-Ce\":3.40452,\"Br-Cf\":3.14233,\"Br-Cl\":2.33296,\"Br-Co\":2.33642,\"Br-Cr\":2.97293,\"Br-Cs\":4.06942,\"Br-Cu\":2.89295,\"Br-Dy\":3.16945,\"Br-Er\":3.14945,\"Br-Eu\":3.46549,\"Br-F\":2.20646,\"Br-Fe\":2.8952,\"Br-Ga\":2.6426,\"Br-Gd\":3.19945,\"Br-Ge\":2.34998,\"Br-Hf\":2.62642,\"Br-Hg\":3.09293,\"Br-Ho\":3.20159,\"Br-In\":3.05329,\"Br-Ir\":2.49998,\"Br-K\":3.8513,\"Br-La\":3.43293,\"Br-Li\":3.11654,\"Br-Lu\":3.11945,\"Br-Mg\":2.99293,\"Br-Mn\":3.05293,\"Br-Mo\":2.8535,\"Br-Na\":3.57715,\"Br-Nb\":3.07646,\"Br-Nd\":3.37293,\"Br-Ni\":2.80649,\"Br-Np\":3.21233,\"Br-O\":2.35646,\"Br-Os\":2.72002,\"Br-P\":2.44293,\"Br-Pa\":3.18437,\"Br-Pb\":3.62451,\"Br-Pd\":2.80649,\"Br-Pm\":3.18233,\"Br-Pr\":3.27649,\"Br-Pt\":2.94191,\"Br-Pu\":3.19233,\"Br-Rb\":4.05498,\"Br-Re\":2.70002,\"Br-Rh\":2.7126,\"Br-Ru\":2.30998,\"Br-S\":2.21998,\"Br-Sb\":2.96646,\"Br-Sc\":2.94291,\"Br-Se\":2.78002,\"Br-Si\":2.55002,\"Br-Sm\":3.26649,\"Br-Sn\":3.2152,\"Br-Sr\":3.54295,\"Br-Ta\":2.60642,\"Br-Tb\":3.18649,\"Br-Te\":2.90002,\"Br-Th\":3.31945,\"Br-Ti\":3.20293,\"Br-Tl\":3.80942,\"Br-Tm\":3.13945,\"Br-U\":3.39452,\"Br-V\":2.87329,\"Br-W\":2.49998,\"Br-Y\":3.15649,\"Br-Yb\":3.12945,\"Br-Zn\":2.86293,\"Br-Zr\":2.98004,\"C-C\":1.89002,\"C-Cl\":2.11002,\"C-Co\":2.19691,\"C-Cu\":2.32649,\"C-F\":1.76002,\"C-Fe\":2.25191,\"C-H\":1.2,\"C-I\":2.16998,\"C-N\":1.79202,\"C-O\":1.97249,\"C-P\":1.93998,\"C-Pd\":2.33649,\"C-Pt\":2.36649,\"C-S\":2.15002,\"C-Se\":2.01998,\"C-Si\":2.23302,\"C-Te\":2.25998,\"Ca-Cl\":3.23295,\"Ca-F\":2.70495,\"Ca-H\":2.69295,\"Ca-I\":3.58295,\"Ca-N\":3.00295,\"Ca-O\":2.83062,\"Ca-P\":3.41295,\"Ca-S\":3.31295,\"Ca-Se\":3.42295,\"Ca-Te\":3.62295,\"Cd-Cl\":3.09295,\"Cd-F\":2.67395,\"Cd-H\":2.52295,\"Cd-I\":3.46295,\"Cd-N\":2.82295,\"Cd-O\":2.76695,\"Cd-P\":3.20295,\"Cd-S\":3.16695,\"Cd-Se\":3.26295,\"Cd-Te\":3.45295,\"Ce-Cl\":3.25293,\"Ce-F\":2.75452,\"Ce-H\":2.34644,\"Ce-I\":3.62452,\"Ce-N\":2.78549,\"Ce-O\":2.86393,\"Ce-P\":3.00644,\"Ce-S\":3.36293,\"Ce-Se\":3.04644,\"Ce-Te\":3.22644,\"Cf-Cl\":3.01291,\"Cf-F\":2.53233,\"Cf-O\":2.63291,\"Cl-Cl\":2.14296,\"Cl-Cm\":3.18291,\"Cl-Co\":2.74593,\"Cl-Cr\":2.80293,\"Cl-Cs\":3.91042,\"Cl-Cu\":2.75295,\"Cl-D\":1.5,\"Cl-Dy\":3.01945,\"Cl-Er\":2.99944,\"Cl-Eu\":3.32549,\"Cl-F\":2.14646,\"Cl-Fe\":2.86293,\"Cl-Ga\":2.52646,\"Cl-Gd\":3.06349,\"Cl-Ge\":2.49002,\"Cl-H\":1.5,\"Cl-Hf\":2.75646,\"Cl-Hg\":3.24939,\"Cl-Ho\":3.05159,\"Cl-I\":3.33295,\"Cl-In\":3.52939,\"Cl-Ir\":2.56746,\"Cl-K\":3.65976,\"Cl-La\":3.33452,\"Cl-Li\":2.91814,\"Cl-Lu\":2.96944,\"Cl-Mg\":2.79293,\"Cl-Mn\":2.84593,\"Cl-Mo\":2.80447,\"Cl-N\":2.20646,\"Cl-NH\":3.48195,\"Cl-Na\":3.39412,\"Cl-Nb\":2.76291,\"Cl-Nd\":3.22493,\"Cl-Ni\":2.62649,\"Cl-Np\":3.07233,\"Cl-O\":2.16646,\"Cl-Os\":2.54002,\"Cl-P\":2.28746,\"Cl-Pa\":3.01437,\"Cl-Pb\":3.39295,\"Cl-Pd\":2.65649,\"Cl-Pm\":3.41233,\"Cl-Pr\":3.12749,\"Cl-Pt\":2.75646,\"Cl-Pu\":3.05233,\"Cl-Rb\":3.86664,\"Cl-Re\":3.44712,\"Cl-Rh\":2.62646,\"Cl-Ru\":2.70646,\"Cl-S\":2.37002,\"Cl-Sb\":2.80646,\"Cl-Sc\":2.92291,\"Cl-Se\":2.57002,\"Cl-Si\":2.38002,\"Cl-Sm\":3.08749,\"Cl-Sn\":3.13111,\"Cl-Sr\":3.37295,\"Cl-Ta\":2.6739,\"Cl-Tb\":3.04349,\"Cl-Tc\":2.56002,\"Cl-Te\":2.73906,\"Cl-Th\":3.15945,\"Cl-Ti\":3.02293,\"Cl-Tl\":3.72942,\"Cl-Tm\":2.98944,\"Cl-U\":3.24452,\"Cl-V\":3.15293,\"Cl-W\":2.47,\"Cl-Y\":3.00649,\"Cl-Yb\":2.98249,\"Cl-Zn\":2.72293,\"Cl-Zr\":3.33651,\"Cm-F\":2.68291,\"Cm-O\":2.79291,\"Co-F\":2.35293,\"Co-H\":1.9278,\"Co-I\":2.52878,\"Co-In\":3.13629,\"Co-N\":2.36293,\"Co-O\":2.40493,\"Co-P\":2.36642,\"Co-S\":2.65293,\"Co-Se\":2.39642,\"Co-Te\":2.61642,\"Cr-F\":2.45293,\"Cr-H\":1.67642,\"Cr-I\":3.19293,\"Cr-N\":2.5152,\"Cr-O\":2.44293,\"Cr-P\":2.42642,\"Cr-S\":2.72491,\"Cr-Se\":2.44642,\"Cr-Te\":2.67642,\"Cs-F\":3.49942,\"Cs-H\":3.55942,\"Cs-I\":4.40942,\"Cs-N\":3.94942,\"Cs-O\":3.53642,\"Cs-P\":3.64194,\"Cs-S\":4.24942,\"Cs-Se\":4.21655,\"Cs-Te\":4.4631,\"Cu-F\":2.46295,\"Cu-H\":1.81649,\"Cu-I\":3.01795,\"Cu-N\":2.49295,\"Cu-O\":2.47295,\"Cu-P\":2.65649,\"Cu-S\":2.76095,\"Cu-Se\":2.76295,\"Cu-Te\":2.87649,\"D-F\":1.1,\"D-N\":1.2,\"D-O\":1.2,\"Dy-F\":2.52944,\"Dy-H\":2.09,\"Dy-I\":3.39945,\"Dy-N\":2.38,\"Dy-O\":2.65651,\"Dy-P\":2.77,\"Dy-S\":2.823,\"Dy-Se\":2.81,\"Dy-Te\":3.22,\"Er-F\":2.51049,\"Er-H\":2.06,\"Er-I\":3.38945,\"Er-N\":2.36,\"Er-O\":2.63651,\"Er-P\":2.75,\"Er-S\":3.27651,\"Er-Se\":3.18649,\"Er-Te\":3.22,\"Es-O\":2.70139,\"Eu-F\":2.83549,\"Eu-H\":2.18898,\"Eu-I\":3.69549,\"Eu-N\":2.95549,\"Eu-O\":2.94249,\"Eu-P\":2.85898,\"Eu-S\":3.37949,\"Eu-Se\":2.89898,\"Eu-Te\":3.08898,\"F-Fe\":2.36293,\"F-Ga\":2.14646,\"F-Gd\":3.15651,\"F-Ge\":2.01002,\"F-H\":1.1,\"F-Hf\":3.18291,\"F-Hg\":2.88293,\"F-Ho\":2.56159,\"F-I\":3.18295,\"F-In\":2.35491,\"F-Ir\":2.15002,\"F-K\":3.11142,\"F-Kr\":2.67549,\"F-La\":2.79293,\"F-Li\":2.34276,\"F-Lu\":2.48249,\"F-Mg\":2.29093,\"F-Mn\":2.41093,\"F-Mo\":2.2998,\"F-N\":1.82646,\"F-NH\":2.99195,\"F-Na\":2.80398,\"F-Nb\":2.35646,\"F-Nd\":2.73452,\"F-Ni\":2.20249,\"F-Np\":2.59233,\"F-Os\":2.07746,\"F-P\":2.01002,\"F-Pa\":2.54437,\"F-Pb\":2.92045,\"F-Pd\":2.34649,\"F-Pm\":2.55233,\"F-Po\":2.83646,\"F-Pr\":2.62945,\"F-Pt\":2.54002,\"F-Pu\":2.58233,\"F-Rb\":3.37645,\"F-Re\":2.16002,\"F-Rh\":2.16646,\"F-Ru\":2.57646,\"F-S\":1.95002,\"F-Sb\":2.35646,\"F-Sc\":2.32291,\"F-Se\":2.08002,\"F-Si\":1.93002,\"F-Sm\":2.60649,\"F-Sn\":2.63793,\"F-Sr\":2.88195,\"F-Ta\":2.2539,\"F-Tb\":2.54249,\"F-Tc\":2.24219,\"F-Te\":2.22002,\"F-Th\":2.68945,\"F-Ti\":2.86293,\"F-Tl\":3.26942,\"F-Tm\":2.51649,\"F-U\":2.80293,\"F-V\":2.87293,\"F-W\":2.03,\"F-Xe\":2.62649,\"F-Y\":2.51049,\"F-Yb\":2.50649,\"F-Zn\":2.38293,\"F-Zr\":2.99651,\"Fe-H\":1.68642,\"Fe-I\":3.1552,\"Fe-N\":2.48193,\"Fe-O\":2.44693,\"Fe-P\":2.42642,\"Fe-S\":2.83793,\"Fe-Se\":2.43642,\"Fe-Te\":2.68642,\"Ga-H\":1.55998,\"Ga-I\":2.91646,\"Ga-N\":1.96,\"Ga-O\":2.18646,\"Ga-P\":2.46998,\"Ga-S\":2.61946,\"Ga-Se\":3.41295,\"Ga-Te\":2.58998,\"Gd-H\":2.13,\"Gd-I\":3.41945,\"Gd-N\":2.42,\"Gd-O\":2.76651,\"Gd-P\":2.81,\"Gd-S\":3.13649,\"Gd-Se\":2.85,\"Gd-Te\":3.24,\"Ge-Ge\":2.6,\"Ge-H\":1.59998,\"Ge-I\":2.54998,\"Ge-N\":1.92998,\"Ge-O\":2.09802,\"Ge-P\":2.36998,\"Ge-S\":2.56702,\"Ge-Se\":2.70002,\"Ge-Te\":2.60998,\"H-Hf\":1.93642,\"H-Hg\":1.86642,\"H-Ho\":2.11898,\"H-In\":1.87642,\"H-Ir\":1.80998,\"H-K\":3.21942,\"H-La\":2.77293,\"H-Lu\":2.42649,\"H-Mg\":2.24293,\"H-Mn\":1.70642,\"H-Mo\":1.83701,\"H-N\":1.2,\"H-Na\":2.79942,\"H-Nb\":1.90642,\"H-Ni\":1.44998,\"H-O\":1.2,\"H-P\":1.45998,\"H-Pb\":2.27644,\"H-Pd\":1.51998,\"H-Pr\":2.62649,\"H-Pt\":1.44998,\"H-Rb\":3.43645,\"H-Re\":1.79998,\"H-Rh\":1.59998,\"H-Ru\":1.65998,\"H-S\":1.42998,\"H-Sb\":2.81998,\"H-Sc\":2.24291,\"H-Se\":1.58998,\"H-Si\":1.82002,\"H-Sm\":2.56649,\"H-Sn\":2.00642,\"H-Sr\":2.87295,\"H-Ta\":1.91642,\"H-Tb\":2.51649,\"H-Te\":1.87998,\"H-Th\":2.67649,\"H-Ti\":1.76642,\"H-Tl\":2.35644,\"H-Tm\":2.45649,\"H-U\":2.27644,\"H-V\":1.73642,\"H-W\":1.80998,\"H-Y\":2.46649,\"H-Yb\":2.42649,\"H-Zn\":2.13293,\"H-Zr\":2.29004,\"Hf-I\":2.83642,\"Hf-N\":2.24642,\"Hf-O\":2.37946,\"Hf-P\":2.63642,\"Hf-S\":2.64642,\"Hf-Se\":2.67642,\"Hf-Te\":2.87642,\"Hg-Hg\":3.1952,\"Hg-I\":3.33293,\"Hg-N\":2.17642,\"Hg-O\":2.86939,\"Hg-P\":2.57642,\"Hg-S\":3.42093,\"Hg-Se\":2.82642,\"Hg-Te\":2.76642,\"Ho-I\":3.44159,\"Ho-N\":2.41898,\"Ho-O\":2.67047,\"Ho-P\":2.79898,\"Ho-S\":3.13547,\"Ho-Se\":2.84898,\"Ho-Te\":3.03898,\"I-I\":2.4,\"I-In\":3.19291,\"I-Ir\":2.70998,\"I-K\":4.11717,\"I-La\":3.64293,\"I-Li\":3.37676,\"I-Lu\":3.36945,\"I-Mg\":3.17293,\"I-Mn\":3.23293,\"I-Mo\":2.74701,\"I-Na\":3.88251,\"I-Nb\":3.1439,\"I-Nd\":3.59452,\"I-Ni\":3.00649,\"I-Np\":3.44233,\"I-O\":2.47646,\"I-P\":2.44998,\"I-Pb\":3.69562,\"I-Pd\":2.96649,\"I-Pr\":3.49649,\"I-Pt\":2.41998,\"I-Pu\":3.43233,\"I-Rb\":4.33462,\"I-Re\":2.65998,\"I-Rh\":2.52998,\"I-Ru\":2.52998,\"I-S\":2.40998,\"I-Sb\":3.21646,\"I-Sc\":3.15291,\"I-Se\":2.58998,\"I-Si\":2.76002,\"I-Sm\":3.44649,\"I-Sn\":3.52293,\"I-Sr\":3.74295,\"I-Ta\":2.81642,\"I-Tb\":3.40945,\"I-Te\":3.13702,\"I-Th\":3.56649,\"I-Ti\":3.08291,\"I-Tl\":3.94142,\"I-Tm\":3.37945,\"I-U\":3.62452,\"I-V\":2.66642,\"I-W\":2.70998,\"I-Y\":3.37649,\"I-Yb\":3.37945,\"I-Zn\":3.07293,\"I-Zr\":3.19004,\"In-Mn\":3.14729,\"In-N\":2.18642,\"In-O\":2.46491,\"In-P\":2.68642,\"In-S\":2.93291,\"In-Se\":2.62642,\"In-Te\":2.84642,\"Ir-N\":2.10998,\"Ir-O\":2.27746,\"Ir-P\":2.50998,\"Ir-S\":2.42998,\"Ir-Se\":2.55998,\"Ir-Te\":2.75998,\"K-N\":3.41942,\"K-O\":3.25142,\"K-P\":3.44942,\"K-S\":3.79285,\"K-Se\":4.00186,\"K-Te\":4.23284,\"La-N\":3.05293,\"La-O\":2.90983,\"La-P\":3.32293,\"La-S\":3.35593,\"La-Se\":3.45293,\"La-Te\":3.65293,\"Li-N\":2.66213,\"Li-O\":2.60087,\"Li-S\":3.02481,\"Li-Se\":3.2433,\"Li-Te\":3.42496,\"Lu-N\":2.71649,\"Lu-O\":2.57749,\"Lu-P\":3.11649,\"Lu-S\":3.03649,\"Lu-Se\":3.16649,\"Lu-Te\":3.35649,\"Mg-N\":2.56293,\"Mg-O\":2.41824,\"Mg-P\":3.00293,\"Mg-S\":2.89293,\"Mg-Se\":3.03293,\"Mg-Te\":3.24293,\"Mn-N\":2.56193,\"Mn-O\":2.51652,\"Mn-P\":2.39642,\"Mn-S\":2.93293,\"Mn-Se\":2.47642,\"Mn-Te\":2.70642,\"Mo-N\":2.4735,\"Mo-O\":2.3475,\"Mo-P\":2.54701,\"Mo-S\":2.80067,\"Mo-Se\":2.59701,\"Mo-Te\":2.79701,\"N-N\":1.8826,\"N-Na\":3.12942,\"N-Nb\":2.46046,\"N-Nd\":3.01293,\"N-Ni\":2.30649,\"N-O\":1.81746,\"N-P\":1.97146,\"N-Pb\":3.0967,\"N-Pd\":2.40451,\"N-Pr\":2.90649,\"N-Pt\":2.41649,\"N-Rb\":3.79645,\"N-Re\":2.10998,\"N-Rh\":2.2626,\"N-Ru\":2.2626,\"N-S\":2.28849,\"N-Sb\":2.56446,\"N-Sc\":2.54291,\"N-Se\":2.1,\"N-Si\":2.12002,\"N-Sm\":3.02351,\"N-Sn\":2.7152,\"N-Sr\":3.09295,\"N-Ta\":2.16642,\"N-Tb\":2.80649,\"N-Te\":2.16998,\"N-Th\":2.94649,\"N-Ti\":2.08642,\"N-Tl\":2.59644,\"N-Tm\":2.74649,\"N-U\":2.78649,\"N-V\":2.38329,\"N-W\":2.10998,\"N-Y\":2.77649,\"N-Yb\":2.84851,\"N-Zn\":2.43293,\"N-Zr\":2.65004,\"NH-O\":3.08895,\"Na-O\":2.95693,\"Na-P\":3.47942,\"Na-S\":3.57685,\"Na-Se\":3.71593,\"Na-Te\":3.95459,\"Nb-O\":2.45329,\"Nb-P\":2.61642,\"Nb-S\":2.74,\"Nb-Se\":2.66642,\"Nb-Te\":2.85642,\"Nd-O\":2.8587,\"Nd-S\":3.42712,\"Nd-Se\":3.42293,\"Nd-Te\":3.60293,\"Ni-O\":2.28149,\"Ni-P\":2.31998,\"Ni-S\":2.58649,\"Ni-Se\":2.18998,\"Ni-Te\":2.47998,\"Np-O\":2.63646,\"Np-S\":3.2,\"O-O\":1.7,\"O-Os\":2.23,\"O-P\":2.08646,\"O-Pa\":2.63383,\"O-Pb\":3.04096,\"O-Pd\":2.39849,\"O-Po\":2.64646,\"O-Pr\":2.74449,\"O-Pt\":2.40649,\"O-Pu\":2.68329,\"O-Rb\":3.43945,\"O-Re\":2.3426,\"O-Rh\":2.24946,\"O-Ru\":2.22646,\"O-S\":1.8,\"O-Sb\":2.45237,\"O-Sc\":2.42029,\"O-Se\":2.16102,\"O-Si\":1.99002,\"O-Sm\":2.88251,\"O-Sn\":2.82146,\"O-Sr\":2.98095,\"O-Ta\":2.74646,\"O-Tb\":2.65549,\"O-Tc\":2.22446,\"O-Te\":2.3334,\"O-Th\":2.77349,\"O-Ti\":2.35391,\"O-Tl\":3.36945,\"O-Tm\":2.60649,\"O-U\":2.94295,\"O-V\":2.84939,\"O-W\":2.20102,\"O-Xe\":2.63451,\"O-Y\":2.62549,\"O-Yb\":2.74551,\"O-Zn\":2.41693,\"O-Zr\":3.09651,\"Os-S\":2.56002,\"P-P\":2.48381,\"P-Pb\":2.94644,\"P-Pd\":2.46998,\"P-Pr\":3.28649,\"P-Pt\":2.23998,\"P-Rb\":3.50645,\"P-Re\":2.50998,\"P-Rh\":2.43998,\"P-Ru\":2.33998,\"P-S\":2.57646,\"P-Sb\":2.56998,\"P-Sc\":2.96291,\"P-Se\":2.69646,\"P-Si\":2.58002,\"P-Sm\":3.23649,\"P-Sn\":2.60642,\"P-Sr\":3.43295,\"P-Ta\":2.62642,\"P-Tb\":3.19649,\"P-Te\":2.56998,\"P-Th\":3.33649,\"P-Ti\":2.51642,\"P-Tl\":3.01644,\"P-Tm\":3.13649,\"P-U\":2.94644,\"P-V\":2.46642,\"P-W\":2.50998,\"P-Y\":3.17649,\"P-Yb\":3.13649,\"P-Zn\":2.86293,\"P-Zr\":3.02004,\"Pb-S\":3.40395,\"Pb-Se\":3.55295,\"Pb-Te\":3.14644,\"Pd-S\":2.69649,\"Pd-Se\":2.26998,\"Pd-Te\":2.52998,\"Pr-S\":3.20649,\"Pr-Se\":3.32649,\"Pr-Te\":3.50649,\"Pt-S\":2.76649,\"Pt-Se\":2.23998,\"Pt-Te\":2.49998,\"Pu-S\":3.3,\"Rb-S\":3.97645,\"Rb-Se\":4.13773,\"Rb-Te\":4.28802,\"Re-S\":2.61998,\"Re-Se\":2.54998,\"Re-Te\":2.74998,\"Rh-S\":2.19998,\"Rh-Se\":2.37998,\"Rh-Te\":2.59998,\"Ru-S\":2.6426,\"Ru-Se\":2.69451,\"Ru-Te\":2.58998,\"S-S\":2.2,\"S-Sb\":3.05,\"S-Sc\":2.88391,\"S-Se\":2.81649,\"S-Si\":2.47602,\"S-Sm\":3.15649,\"S-Sn\":3.15293,\"S-Sr\":3.51295,\"S-Ta\":2.8439,\"S-Tb\":3.11649,\"S-Te\":2.79002,\"S-Th\":3.24649,\"S-Ti\":2.74646,\"S-Tl\":3.66442,\"S-Tm\":3.05649,\"S-U\":3.25293,\"S-V\":2.82293,\"S-W\":2.43998,\"S-Y\":3.08649,\"S-Yb\":3.03649,\"S-Zn\":2.80293,\"S-Zr\":2.91004,\"Sb-Se\":3.05646,\"Sb-Te\":2.82998,\"Sc-Se\":3.00291,\"Sc-Te\":3.20291,\"Se-Se\":2.93649,\"Se-Si\":2.61002,\"Se-Sm\":3.27649,\"Se-Sn\":2.96646,\"Se-Sr\":3.58295,\"Se-Ta\":2.66642,\"Se-Tb\":3.23649,\"Se-Te\":2.57998,\"Se-Th\":3.36649,\"Se-Ti\":2.53642,\"Se-Tl\":3.00644,\"Se-Tm\":3.18649,\"Se-U\":3.00644,\"Se-V\":2.48642,\"Se-W\":2.55998,\"Se-Y\":3.21649,\"Se-Yb\":3.16649,\"Se-Zn\":2.93293,\"Se-Zr\":3.03004,\"Si-Si\":2.6,\"Si-Te\":2.84002,\"Sm-Te\":3.46649,\"Sn-Te\":2.91642,\"Sr-Te\":3.73295,\"Ta-Te\":2.85642,\"Tb-Te\":3.42649,\"Te-Te\":2.80998,\"Te-Th\":3.54649,\"Te-Ti\":2.95642,\"Te-Tl\":3.23644,\"Te-Tm\":3.37649,\"Te-U\":3.16644,\"Te-V\":2.72642,\"Te-W\":2.75998,\"Te-Y\":3.40649,\"Te-Yb\":3.36649,\"Te-Zn\":3.16293,\"Te-Zr\":3.17004}")
|
|
766
|
-
}.pairs,
|
|
767
|
-
function
|
|
768
|
-
return
|
|
768
|
+
}.pairs, jt = .4;
|
|
769
|
+
function Mt(e, t) {
|
|
770
|
+
return At[e < t ? `${e}-${t}` : `${t}-${e}`] ?? null;
|
|
769
771
|
}
|
|
770
|
-
function
|
|
772
|
+
function Nt(e) {
|
|
771
773
|
let t = /* @__PURE__ */ new Map(), n = e.map((e) => {
|
|
772
774
|
let n = t.get(e.element);
|
|
773
775
|
return n === void 0 && (n = t.size, t.set(e.element, n)), n;
|
|
774
776
|
}), r = [...t.keys()], i = new Float64Array(r.length * r.length), a = 0;
|
|
775
777
|
if (r.forEach((e, t) => {
|
|
776
778
|
r.forEach((n, o) => {
|
|
777
|
-
let s =
|
|
779
|
+
let s = Mt(e, n) ?? 0;
|
|
778
780
|
i[t * r.length + o] = s, a = Math.max(a, s);
|
|
779
781
|
});
|
|
780
|
-
}), a <
|
|
782
|
+
}), a < jt) return [];
|
|
781
783
|
let o = e.map((e) => e.position.map((e) => Math.floor(e / a) | 0)), s = [
|
|
782
784
|
Infinity,
|
|
783
785
|
Infinity,
|
|
@@ -799,9 +801,9 @@ function Mt(e) {
|
|
|
799
801
|
m.length = 0;
|
|
800
802
|
for (let r = -1; r <= 1; r += 1) for (let o = -1; o <= 1; o += 1) for (let p = -1; p <= 1; p += 1) for (let h of f.get(d(s + r, c + o, l + p)) ?? []) {
|
|
801
803
|
let r = i[u + n[h]];
|
|
802
|
-
if (h <= a || r <
|
|
803
|
-
let o =
|
|
804
|
-
o >=
|
|
804
|
+
if (h <= a || r < jt) continue;
|
|
805
|
+
let o = Le(t.position, e[h].position);
|
|
806
|
+
o >= jt && o <= r && m.push({
|
|
805
807
|
start: a,
|
|
806
808
|
end: h,
|
|
807
809
|
length: o
|
|
@@ -812,11 +814,11 @@ function Mt(e) {
|
|
|
812
814
|
}
|
|
813
815
|
//#endregion
|
|
814
816
|
//#region src/structure/images.ts
|
|
815
|
-
var
|
|
816
|
-
function
|
|
817
|
+
var Pt = 1e-4;
|
|
818
|
+
function Ft(e, t) {
|
|
817
819
|
let n = [];
|
|
818
820
|
return e.forEach((e, r) => {
|
|
819
|
-
let i = e.fractional.map((e) =>
|
|
821
|
+
let i = e.fractional.map((e) => R(e, Pt));
|
|
820
822
|
if (n.push({
|
|
821
823
|
siteIndex: r,
|
|
822
824
|
fractional: i,
|
|
@@ -826,7 +828,7 @@ function Pt(e, t) {
|
|
|
826
828
|
0,
|
|
827
829
|
1,
|
|
828
830
|
2
|
|
829
|
-
].filter((e) => i[e] <
|
|
831
|
+
].filter((e) => i[e] < Pt), o = 1 << a.length;
|
|
830
832
|
for (let e = 1; e < o; e += 1) {
|
|
831
833
|
let t = [
|
|
832
834
|
i[0],
|
|
@@ -845,25 +847,23 @@ function Pt(e, t) {
|
|
|
845
847
|
}
|
|
846
848
|
//#endregion
|
|
847
849
|
//#region src/scene/build.ts
|
|
848
|
-
function
|
|
850
|
+
function It(e) {
|
|
849
851
|
let t = [];
|
|
850
852
|
for (let n of e.sites) for (let e of n.species) {
|
|
851
|
-
let n =
|
|
853
|
+
let n = Te(e.element);
|
|
852
854
|
t.includes(n) || t.push(n);
|
|
853
855
|
}
|
|
854
856
|
return t;
|
|
855
857
|
}
|
|
856
|
-
function
|
|
857
|
-
let n =
|
|
858
|
-
let n = e.sites[t.siteIndex];
|
|
859
|
-
if (!n) throw Error(`Site ${t.siteIndex} is missing.`);
|
|
860
|
-
let r = n.species[0];
|
|
858
|
+
function Lt(e, t = {}) {
|
|
859
|
+
let n = Ft(e.sites, t.imageAtoms ?? !0).map((t) => {
|
|
860
|
+
let n = e.sites[t.siteIndex], r = n.species[0];
|
|
861
861
|
if (!r) throw Error(`Site ${n.label} has no species.`);
|
|
862
862
|
return {
|
|
863
863
|
siteIndex: t.siteIndex,
|
|
864
864
|
element: r.element,
|
|
865
865
|
species: n.species,
|
|
866
|
-
position:
|
|
866
|
+
position: Ie(e.lattice, t.fractional),
|
|
867
867
|
fractional: t.fractional,
|
|
868
868
|
isImage: t.isImage
|
|
869
869
|
};
|
|
@@ -871,20 +871,20 @@ function It(e, t = {}) {
|
|
|
871
871
|
return {
|
|
872
872
|
cell: e.lattice.vectors,
|
|
873
873
|
atoms: n,
|
|
874
|
-
bonds:
|
|
875
|
-
elements:
|
|
874
|
+
bonds: Nt(n),
|
|
875
|
+
elements: It(e)
|
|
876
876
|
};
|
|
877
877
|
}
|
|
878
878
|
//#endregion
|
|
879
879
|
//#region node_modules/three/examples/jsm/controls/TrackballControls.js
|
|
880
|
-
var
|
|
880
|
+
var Rt = { type: "change" }, zt = { type: "start" }, Bt = { type: "end" }, K = 1e-6, q = {
|
|
881
881
|
NONE: -1,
|
|
882
882
|
ROTATE: 0,
|
|
883
883
|
ZOOM: 1,
|
|
884
884
|
PAN: 2,
|
|
885
885
|
TOUCH_ROTATE: 3,
|
|
886
886
|
TOUCH_ZOOM_PAN: 4
|
|
887
|
-
},
|
|
887
|
+
}, Vt = new k(), J = new k(), Ht = new A(), Ut = new A(), Wt = new A(), Y = new O(), Gt = new A(), Kt = new A(), qt = new A(), Jt = new A(), Yt = class extends l {
|
|
888
888
|
constructor(e, t = null) {
|
|
889
889
|
super(e, t), this.screen = {
|
|
890
890
|
left: 0,
|
|
@@ -896,10 +896,10 @@ var Lt = { type: "change" }, Rt = { type: "start" }, zt = { type: "end" }, K = 1
|
|
|
896
896
|
"KeyS",
|
|
897
897
|
"KeyD"
|
|
898
898
|
], this.mouseButtons = {
|
|
899
|
-
LEFT:
|
|
900
|
-
MIDDLE:
|
|
901
|
-
RIGHT:
|
|
902
|
-
}, this.target = new
|
|
899
|
+
LEFT: S.ROTATE,
|
|
900
|
+
MIDDLE: S.DOLLY,
|
|
901
|
+
RIGHT: S.PAN
|
|
902
|
+
}, this.target = new A(), this.state = q.NONE, this.keyState = q.NONE, this._lastPosition = new A(), this._lastUp = new A(), this._lastZoom = 1, this._touchZoomDistanceStart = 0, this._touchZoomDistanceEnd = 0, this._touchRollAngle = 0, this._touchRollPointerIds = "", this._lastAngle = 0, this._lastRollAngle = 0, this._eye = new A(), this._movePrev = new k(), this._moveCurr = new k(), this._lastAxis = new A(), this._zoomStart = new k(), this._zoomEnd = new k(), this._panStart = new k(), this._panEnd = new k(), this._pointers = [], this._pointerPositions = {}, this._onPointerMove = Zt.bind(this), this._onPointerDown = Xt.bind(this), this._onPointerUp = Qt.bind(this), this._onPointerCancel = $t.bind(this), this._onContextMenu = sn.bind(this), this._onMouseWheel = on.bind(this), this._onKeyDown = tn.bind(this), this._onKeyUp = en.bind(this), this._onTouchStart = cn.bind(this), this._onTouchMove = ln.bind(this), this._onTouchEnd = un.bind(this), this._onMouseDown = nn.bind(this), this._onMouseMove = rn.bind(this), this._onMouseUp = an.bind(this), this._target0 = this.target.clone(), this._position0 = this.object.position.clone(), this._up0 = this.object.up.clone(), this._zoom0 = this.object.zoom, t !== null && (this.connect(t), this.handleResize()), this.update();
|
|
903
903
|
}
|
|
904
904
|
connect(e) {
|
|
905
905
|
super.connect(e), window.addEventListener("keydown", this._onKeyDown), window.addEventListener("keyup", this._onKeyUp), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointercancel", this._onPointerCancel), this.domElement.addEventListener("wheel", this._onMouseWheel, { passive: !1 }), this.domElement.addEventListener("contextmenu", this._onContextMenu), this.domElement.style.touchAction = "none";
|
|
@@ -918,15 +918,15 @@ var Lt = { type: "change" }, Rt = { type: "start" }, zt = { type: "end" }, K = 1
|
|
|
918
918
|
if (this._eye.subVectors(this.object.position, this.target), this.noRotate || (this._rotateCamera(), this.multiTouchRoll === !0 && this._rollCamera()), this.noZoom || this._zoomCamera(), this.noPan || this._panCamera(), this.object.position.addVectors(this.target, this._eye), this.object.isPerspectiveCamera) {
|
|
919
919
|
this._checkDistances(), this.object.lookAt(this.target);
|
|
920
920
|
let e = this._lastPosition.distanceToSquared(this.object.position) > K, t = this._lastUp.distanceToSquared(this.object.up) > K;
|
|
921
|
-
(e || t) && (this.dispatchEvent(
|
|
921
|
+
(e || t) && (this.dispatchEvent(Rt), this._lastPosition.copy(this.object.position), this._lastUp.copy(this.object.up));
|
|
922
922
|
} else if (this.object.isOrthographicCamera) {
|
|
923
923
|
this.object.lookAt(this.target);
|
|
924
924
|
let e = this._lastPosition.distanceToSquared(this.object.position) > K, t = this._lastUp.distanceToSquared(this.object.up) > K, n = this._lastZoom !== this.object.zoom;
|
|
925
|
-
(e || t || n) && (this.dispatchEvent(
|
|
925
|
+
(e || t || n) && (this.dispatchEvent(Rt), this._lastPosition.copy(this.object.position), this._lastUp.copy(this.object.up), this._lastZoom = this.object.zoom);
|
|
926
926
|
} else console.warn("THREE.TrackballControls: Unsupported camera type.");
|
|
927
927
|
}
|
|
928
928
|
reset() {
|
|
929
|
-
this.state = q.NONE, this.keyState = q.NONE, this.target.copy(this._target0), this.object.position.copy(this._position0), this.object.up.copy(this._up0), this.object.zoom = this._zoom0, this.object.updateProjectionMatrix(), this._eye.subVectors(this.object.position, this.target), this.object.lookAt(this.target), this.dispatchEvent(
|
|
929
|
+
this.state = q.NONE, this.keyState = q.NONE, this.target.copy(this._target0), this.object.position.copy(this._position0), this.object.up.copy(this._up0), this.object.zoom = this._zoom0, this.object.updateProjectionMatrix(), this._eye.subVectors(this.object.position, this.target), this.object.lookAt(this.target), this.dispatchEvent(Rt), this._lastPosition.copy(this.object.position), this._lastUp.copy(this.object.up), this._lastZoom = this.object.zoom;
|
|
930
930
|
}
|
|
931
931
|
_panCamera() {
|
|
932
932
|
if (J.copy(this._panEnd).sub(this._panStart), J.lengthSq()) {
|
|
@@ -934,20 +934,20 @@ var Lt = { type: "change" }, Rt = { type: "start" }, zt = { type: "end" }, K = 1
|
|
|
934
934
|
let e = (this.object.right - this.object.left) / this.object.zoom / this.domElement.clientWidth, t = (this.object.top - this.object.bottom) / this.object.zoom / this.domElement.clientWidth;
|
|
935
935
|
J.x *= e, J.y *= t;
|
|
936
936
|
}
|
|
937
|
-
J.multiplyScalar(this._eye.length() * this.panSpeed),
|
|
937
|
+
J.multiplyScalar(this._eye.length() * this.panSpeed), Ut.copy(this._eye).cross(this.object.up).setLength(J.x), Ut.add(Ht.copy(this.object.up).setLength(J.y)), this.object.position.add(Ut), this.target.add(Ut), this.staticMoving ? this._panStart.copy(this._panEnd) : this._panStart.add(J.subVectors(this._panEnd, this._panStart).multiplyScalar(this.dynamicDampingFactor));
|
|
938
938
|
}
|
|
939
939
|
}
|
|
940
940
|
_rotateCamera() {
|
|
941
|
-
|
|
942
|
-
let e =
|
|
943
|
-
e ? (this._eye.copy(this.object.position).sub(this.target),
|
|
941
|
+
Jt.set(this._moveCurr.x - this._movePrev.x, this._moveCurr.y - this._movePrev.y, 0);
|
|
942
|
+
let e = Jt.length();
|
|
943
|
+
e ? (this._eye.copy(this.object.position).sub(this.target), Gt.copy(this._eye).normalize(), Kt.copy(this.object.up).normalize(), qt.crossVectors(Kt, Gt).normalize(), Kt.setLength(this._moveCurr.y - this._movePrev.y), qt.setLength(this._moveCurr.x - this._movePrev.x), Jt.copy(Kt.add(qt)), Wt.crossVectors(Jt, this._eye).normalize(), e *= this.rotateSpeed, Y.setFromAxisAngle(Wt, e), this._eye.applyQuaternion(Y), this.object.up.applyQuaternion(Y), this._lastAxis.copy(Wt), this._lastAngle = e) : !this.staticMoving && this._lastAngle && (this._lastAngle *= Math.sqrt(1 - this.dynamicDampingFactor), this._eye.copy(this.object.position).sub(this.target), Y.setFromAxisAngle(this._lastAxis, this._lastAngle), this._eye.applyQuaternion(Y), this.object.up.applyQuaternion(Y)), this._movePrev.copy(this._moveCurr);
|
|
944
944
|
}
|
|
945
945
|
_rollCamera() {
|
|
946
946
|
let e = this._getTouchRollAngle();
|
|
947
947
|
if (e) this._lastRollAngle = e * this.rollSpeed;
|
|
948
948
|
else if (!this.staticMoving && this._lastRollAngle) this._lastRollAngle *= Math.sqrt(1 - this.dynamicDampingFactor);
|
|
949
949
|
else return;
|
|
950
|
-
|
|
950
|
+
Gt.copy(this._eye).normalize(), Y.setFromAxisAngle(Gt, this._lastRollAngle), this.object.up.applyQuaternion(Y);
|
|
951
951
|
}
|
|
952
952
|
_getTouchRollAngle() {
|
|
953
953
|
let e = this._pointers[0], t = this._pointers[1];
|
|
@@ -959,13 +959,13 @@ var Lt = { type: "change" }, Rt = { type: "start" }, zt = { type: "end" }, K = 1
|
|
|
959
959
|
}
|
|
960
960
|
_zoomCamera() {
|
|
961
961
|
let e;
|
|
962
|
-
this.state === q.TOUCH_ZOOM_PAN ? (e = this._touchZoomDistanceStart / this._touchZoomDistanceEnd, this._touchZoomDistanceStart = this._touchZoomDistanceEnd, this.object.isPerspectiveCamera ? this._eye.multiplyScalar(e) : this.object.isOrthographicCamera ? (this.object.zoom =
|
|
962
|
+
this.state === q.TOUCH_ZOOM_PAN ? (e = this._touchZoomDistanceStart / this._touchZoomDistanceEnd, this._touchZoomDistanceStart = this._touchZoomDistanceEnd, this.object.isPerspectiveCamera ? this._eye.multiplyScalar(e) : this.object.isOrthographicCamera ? (this.object.zoom = ne.clamp(this.object.zoom / e, this.minZoom, this.maxZoom), this._lastZoom !== this.object.zoom && this.object.updateProjectionMatrix()) : console.warn("THREE.TrackballControls: Unsupported camera type")) : (e = 1 + (this._zoomEnd.y - this._zoomStart.y) * this.zoomSpeed, e !== 1 && e > 0 && (this.object.isPerspectiveCamera ? this._eye.multiplyScalar(e) : this.object.isOrthographicCamera ? (this.object.zoom = ne.clamp(this.object.zoom / e, this.minZoom, this.maxZoom), this._lastZoom !== this.object.zoom && this.object.updateProjectionMatrix()) : console.warn("THREE.TrackballControls: Unsupported camera type")), this.staticMoving ? this._zoomStart.copy(this._zoomEnd) : this._zoomStart.y += (this._zoomEnd.y - this._zoomStart.y) * this.dynamicDampingFactor);
|
|
963
963
|
}
|
|
964
964
|
_getMouseOnScreen(e, t) {
|
|
965
|
-
return
|
|
965
|
+
return Vt.set((e - this.screen.left) / this.screen.width, (t - this.screen.top) / this.screen.height), Vt;
|
|
966
966
|
}
|
|
967
967
|
_getMouseOnCircle(e, t) {
|
|
968
|
-
return
|
|
968
|
+
return Vt.set((e - this.screen.width * .5 - this.screen.left) / (this.screen.width * .5), (this.screen.height + 2 * (this.screen.top - t)) / this.screen.width), Vt;
|
|
969
969
|
}
|
|
970
970
|
_addPointer(e) {
|
|
971
971
|
this._pointers.push(e);
|
|
@@ -979,7 +979,7 @@ var Lt = { type: "change" }, Rt = { type: "start" }, zt = { type: "end" }, K = 1
|
|
|
979
979
|
}
|
|
980
980
|
_trackPointer(e) {
|
|
981
981
|
let t = this._pointerPositions[e.pointerId];
|
|
982
|
-
t === void 0 && (t = new
|
|
982
|
+
t === void 0 && (t = new k(), this._pointerPositions[e.pointerId] = t), t.set(e.pageX, e.pageY);
|
|
983
983
|
}
|
|
984
984
|
_getSecondPointerPosition(e) {
|
|
985
985
|
let t = e.pointerId === this._pointers[0].pointerId ? this._pointers[1] : this._pointers[0];
|
|
@@ -989,25 +989,25 @@ var Lt = { type: "change" }, Rt = { type: "start" }, zt = { type: "end" }, K = 1
|
|
|
989
989
|
(!this.noZoom || !this.noPan) && (this._eye.lengthSq() > this.maxDistance * this.maxDistance && (this.object.position.addVectors(this.target, this._eye.setLength(this.maxDistance)), this._zoomStart.copy(this._zoomEnd)), this._eye.lengthSq() < this.minDistance * this.minDistance && (this.object.position.addVectors(this.target, this._eye.setLength(this.minDistance)), this._zoomStart.copy(this._zoomEnd)));
|
|
990
990
|
}
|
|
991
991
|
};
|
|
992
|
-
function
|
|
992
|
+
function Xt(e) {
|
|
993
993
|
this.enabled !== !1 && (this._pointers.length === 0 && (this.domElement.setPointerCapture(e.pointerId), this.domElement.ownerDocument.addEventListener("pointermove", this._onPointerMove), this.domElement.ownerDocument.addEventListener("pointerup", this._onPointerUp)), this._addPointer(e), e.pointerType === "touch" ? this._onTouchStart(e) : this._onMouseDown(e));
|
|
994
994
|
}
|
|
995
|
-
function
|
|
995
|
+
function Zt(e) {
|
|
996
996
|
this.enabled !== !1 && (e.pointerType === "touch" ? this._onTouchMove(e) : this._onMouseMove(e));
|
|
997
997
|
}
|
|
998
|
-
function
|
|
998
|
+
function Qt(e) {
|
|
999
999
|
this.enabled !== !1 && (e.pointerType === "touch" ? this._onTouchEnd(e) : this._onMouseUp(), this._removePointer(e), this._pointers.length === 0 && (this.domElement.releasePointerCapture(e.pointerId), this.domElement.ownerDocument.removeEventListener("pointermove", this._onPointerMove), this.domElement.ownerDocument.removeEventListener("pointerup", this._onPointerUp)));
|
|
1000
1000
|
}
|
|
1001
|
-
function
|
|
1001
|
+
function $t(e) {
|
|
1002
1002
|
this._removePointer(e);
|
|
1003
1003
|
}
|
|
1004
|
-
function
|
|
1004
|
+
function en() {
|
|
1005
1005
|
this.enabled !== !1 && (this.keyState = q.NONE, window.addEventListener("keydown", this._onKeyDown));
|
|
1006
1006
|
}
|
|
1007
|
-
function
|
|
1007
|
+
function tn(e) {
|
|
1008
1008
|
this.enabled !== !1 && (window.removeEventListener("keydown", this._onKeyDown), this.keyState === q.NONE && (e.code === this.keys[q.ROTATE] && !this.noRotate ? this.keyState = q.ROTATE : e.code === this.keys[q.ZOOM] && !this.noZoom ? this.keyState = q.ZOOM : e.code === this.keys[q.PAN] && !this.noPan && (this.keyState = q.PAN)));
|
|
1009
1009
|
}
|
|
1010
|
-
function
|
|
1010
|
+
function nn(e) {
|
|
1011
1011
|
let t;
|
|
1012
1012
|
switch (e.button) {
|
|
1013
1013
|
case 0:
|
|
@@ -1022,28 +1022,28 @@ function tn(e) {
|
|
|
1022
1022
|
default: t = -1;
|
|
1023
1023
|
}
|
|
1024
1024
|
switch (t) {
|
|
1025
|
-
case
|
|
1025
|
+
case S.DOLLY:
|
|
1026
1026
|
this.state = q.ZOOM;
|
|
1027
1027
|
break;
|
|
1028
|
-
case
|
|
1028
|
+
case S.ROTATE:
|
|
1029
1029
|
this.state = q.ROTATE;
|
|
1030
1030
|
break;
|
|
1031
|
-
case
|
|
1031
|
+
case S.PAN:
|
|
1032
1032
|
this.state = q.PAN;
|
|
1033
1033
|
break;
|
|
1034
1034
|
default: this.state = q.NONE;
|
|
1035
1035
|
}
|
|
1036
1036
|
let n = this.keyState === q.NONE ? this.state : this.keyState;
|
|
1037
|
-
n === q.ROTATE && !this.noRotate ? (this._moveCurr.copy(this._getMouseOnCircle(e.pageX, e.pageY)), this._movePrev.copy(this._moveCurr)) : n === q.ZOOM && !this.noZoom ? (this._zoomStart.copy(this._getMouseOnScreen(e.pageX, e.pageY)), this._zoomEnd.copy(this._zoomStart)) : n === q.PAN && !this.noPan && (this._panStart.copy(this._getMouseOnScreen(e.pageX, e.pageY)), this._panEnd.copy(this._panStart)), this.dispatchEvent(
|
|
1037
|
+
n === q.ROTATE && !this.noRotate ? (this._moveCurr.copy(this._getMouseOnCircle(e.pageX, e.pageY)), this._movePrev.copy(this._moveCurr)) : n === q.ZOOM && !this.noZoom ? (this._zoomStart.copy(this._getMouseOnScreen(e.pageX, e.pageY)), this._zoomEnd.copy(this._zoomStart)) : n === q.PAN && !this.noPan && (this._panStart.copy(this._getMouseOnScreen(e.pageX, e.pageY)), this._panEnd.copy(this._panStart)), this.dispatchEvent(zt);
|
|
1038
1038
|
}
|
|
1039
|
-
function
|
|
1039
|
+
function rn(e) {
|
|
1040
1040
|
let t = this.keyState === q.NONE ? this.state : this.keyState;
|
|
1041
1041
|
t === q.ROTATE && !this.noRotate ? this._moveCurr.copy(this._getMouseOnCircle(e.pageX, e.pageY)) : t === q.ZOOM && !this.noZoom ? this._zoomEnd.copy(this._getMouseOnScreen(e.pageX, e.pageY)) : t === q.PAN && !this.noPan && this._panEnd.copy(this._getMouseOnScreen(e.pageX, e.pageY));
|
|
1042
1042
|
}
|
|
1043
|
-
function
|
|
1044
|
-
this.state = q.NONE, this.dispatchEvent(
|
|
1043
|
+
function an() {
|
|
1044
|
+
this.state = q.NONE, this.dispatchEvent(Bt);
|
|
1045
1045
|
}
|
|
1046
|
-
function
|
|
1046
|
+
function on(e) {
|
|
1047
1047
|
if (this.enabled !== !1 && this.noZoom !== !0) {
|
|
1048
1048
|
switch (e.preventDefault(), e.deltaMode) {
|
|
1049
1049
|
case 2:
|
|
@@ -1054,13 +1054,13 @@ function an(e) {
|
|
|
1054
1054
|
break;
|
|
1055
1055
|
default: this._zoomStart.y -= e.deltaY * 25e-5;
|
|
1056
1056
|
}
|
|
1057
|
-
this.dispatchEvent(
|
|
1057
|
+
this.dispatchEvent(zt), this.dispatchEvent(Bt);
|
|
1058
1058
|
}
|
|
1059
1059
|
}
|
|
1060
|
-
function
|
|
1060
|
+
function sn(e) {
|
|
1061
1061
|
this.enabled !== !1 && e.preventDefault();
|
|
1062
1062
|
}
|
|
1063
|
-
function
|
|
1063
|
+
function cn(e) {
|
|
1064
1064
|
switch (this._trackPointer(e), this._pointers.length) {
|
|
1065
1065
|
case 1:
|
|
1066
1066
|
this.state = q.TOUCH_ROTATE, this._moveCurr.copy(this._getMouseOnCircle(this._pointers[0].pageX, this._pointers[0].pageY)), this._movePrev.copy(this._moveCurr);
|
|
@@ -1072,9 +1072,9 @@ function sn(e) {
|
|
|
1072
1072
|
let n = (this._pointers[0].pageX + this._pointers[1].pageX) / 2, r = (this._pointers[0].pageY + this._pointers[1].pageY) / 2;
|
|
1073
1073
|
this._panStart.copy(this._getMouseOnScreen(n, r)), this._panEnd.copy(this._panStart);
|
|
1074
1074
|
}
|
|
1075
|
-
this.dispatchEvent(
|
|
1075
|
+
this.dispatchEvent(zt);
|
|
1076
1076
|
}
|
|
1077
|
-
function
|
|
1077
|
+
function ln(e) {
|
|
1078
1078
|
switch (this._trackPointer(e), this._pointers.length) {
|
|
1079
1079
|
case 1:
|
|
1080
1080
|
this._moveCurr.copy(this._getMouseOnCircle(e.pageX, e.pageY));
|
|
@@ -1086,7 +1086,7 @@ function cn(e) {
|
|
|
1086
1086
|
this._panEnd.copy(this._getMouseOnScreen(i, a));
|
|
1087
1087
|
}
|
|
1088
1088
|
}
|
|
1089
|
-
function
|
|
1089
|
+
function un(e) {
|
|
1090
1090
|
switch (this._pointers.length) {
|
|
1091
1091
|
case 0:
|
|
1092
1092
|
this.state = q.NONE;
|
|
@@ -1102,43 +1102,43 @@ function ln(e) {
|
|
|
1102
1102
|
break;
|
|
1103
1103
|
}
|
|
1104
1104
|
}
|
|
1105
|
-
this.dispatchEvent(
|
|
1105
|
+
this.dispatchEvent(Bt);
|
|
1106
1106
|
}
|
|
1107
1107
|
//#endregion
|
|
1108
1108
|
//#region src/render/camera.ts
|
|
1109
|
-
var
|
|
1110
|
-
function
|
|
1109
|
+
var dn = 1 / 3, fn = 1 / 6, pn = 2, mn = 1e-12, hn = new A(0, 0, -1), gn = new A(0, 1, 0);
|
|
1110
|
+
function _n(e, t) {
|
|
1111
1111
|
let n = e.clone().sub(t.clone().multiplyScalar(e.dot(t)));
|
|
1112
|
-
return n.lengthSq() <
|
|
1112
|
+
return n.lengthSq() < mn ? null : n.normalize();
|
|
1113
1113
|
}
|
|
1114
|
-
function
|
|
1114
|
+
function vn(e) {
|
|
1115
1115
|
for (let t of [
|
|
1116
|
-
new
|
|
1117
|
-
new
|
|
1118
|
-
new
|
|
1116
|
+
new A(0, 0, 1),
|
|
1117
|
+
new A(0, 1, 0),
|
|
1118
|
+
new A(1, 0, 0)
|
|
1119
1119
|
]) {
|
|
1120
|
-
let n =
|
|
1120
|
+
let n = _n(t, e);
|
|
1121
1121
|
if (n) return n;
|
|
1122
1122
|
}
|
|
1123
|
-
return new
|
|
1123
|
+
return new A(0, 1, 0);
|
|
1124
1124
|
}
|
|
1125
|
-
function
|
|
1126
|
-
let t = new
|
|
1125
|
+
function yn(e) {
|
|
1126
|
+
let t = new A(...e[0]), n = new A(...e[1]), r = new A(...e[2]).normalize(), i = _n(t, r) ?? _n(n, r) ?? vn(r), a = r.clone().cross(i).normalize(), o = i.clone().add(a.multiplyScalar(dn)).add(r.clone().multiplyScalar(fn)).normalize();
|
|
1127
1127
|
return {
|
|
1128
1128
|
outward: o,
|
|
1129
|
-
up:
|
|
1129
|
+
up: _n(r, o) ?? vn(o)
|
|
1130
1130
|
};
|
|
1131
1131
|
}
|
|
1132
|
-
function yn(e) {
|
|
1133
|
-
return Math.max(4, e * 4);
|
|
1134
|
-
}
|
|
1135
1132
|
function bn(e) {
|
|
1136
|
-
|
|
1137
|
-
return new E().setFromRotationMatrix(a).normalize();
|
|
1133
|
+
return Math.max(4, e * 4);
|
|
1138
1134
|
}
|
|
1139
1135
|
function xn(e) {
|
|
1136
|
+
let { outward: t, up: n } = yn(e), r = n.clone().cross(t).normalize(), i = t.clone().cross(r).normalize(), a = new re().makeBasis(r, i, t);
|
|
1137
|
+
return new O().setFromRotationMatrix(a).normalize();
|
|
1138
|
+
}
|
|
1139
|
+
function Sn(e) {
|
|
1140
1140
|
return {
|
|
1141
|
-
quaternion:
|
|
1141
|
+
quaternion: wn(xn(e)),
|
|
1142
1142
|
target: [
|
|
1143
1143
|
0,
|
|
1144
1144
|
0,
|
|
@@ -1147,11 +1147,11 @@ function xn(e) {
|
|
|
1147
1147
|
scale: 1
|
|
1148
1148
|
};
|
|
1149
1149
|
}
|
|
1150
|
-
function
|
|
1151
|
-
let i = new
|
|
1152
|
-
e.position.copy(a).sub(o.multiplyScalar(n)), e.up.copy(
|
|
1150
|
+
function Cn(e, t, n, r) {
|
|
1151
|
+
let i = new O(...t.quaternion).normalize(), a = new A(...t.target), o = hn.clone().applyQuaternion(i);
|
|
1152
|
+
e.position.copy(a).sub(o.multiplyScalar(n)), e.up.copy(gn.clone().applyQuaternion(i)), e.quaternion.copy(i), e.near = .01, e.far = Math.max(1e3, n + r * 8), e.updateProjectionMatrix();
|
|
1153
1153
|
}
|
|
1154
|
-
function
|
|
1154
|
+
function wn(e) {
|
|
1155
1155
|
return [
|
|
1156
1156
|
e.x,
|
|
1157
1157
|
e.y,
|
|
@@ -1159,10 +1159,10 @@ function Cn(e) {
|
|
|
1159
1159
|
e.w
|
|
1160
1160
|
];
|
|
1161
1161
|
}
|
|
1162
|
-
function
|
|
1163
|
-
let n = new
|
|
1162
|
+
function Tn(e, t) {
|
|
1163
|
+
let n = new A(1, 0, 0).applyQuaternion(t), r = new A(0, 1, 0).applyQuaternion(t), i = Infinity, a = -Infinity, o = Infinity, s = -Infinity;
|
|
1164
1164
|
for (let t of [e.min.x, e.max.x]) for (let c of [e.min.y, e.max.y]) for (let l of [e.min.z, e.max.z]) {
|
|
1165
|
-
let e = new
|
|
1165
|
+
let e = new A(t, c, l), u = e.dot(n), d = e.dot(r);
|
|
1166
1166
|
i = Math.min(i, u), a = Math.max(a, u), o = Math.min(o, d), s = Math.max(s, d);
|
|
1167
1167
|
}
|
|
1168
1168
|
return {
|
|
@@ -1170,31 +1170,31 @@ function wn(e, t) {
|
|
|
1170
1170
|
height: Math.max(1, s - o)
|
|
1171
1171
|
};
|
|
1172
1172
|
}
|
|
1173
|
-
function
|
|
1174
|
-
let i =
|
|
1175
|
-
return Math.max(.01, a / (o *
|
|
1173
|
+
function En(e, t, n, r) {
|
|
1174
|
+
let i = Tn(e, t), a = Math.sqrt(Math.max(1, n) * Math.max(1, r)), o = Math.sqrt(i.width * i.height);
|
|
1175
|
+
return Math.max(.01, a / (o * pn));
|
|
1176
1176
|
}
|
|
1177
|
-
function
|
|
1177
|
+
function Dn(e, t, n) {
|
|
1178
1178
|
e.left = -t / 2, e.right = t / 2, e.top = n / 2, e.bottom = -n / 2, e.updateProjectionMatrix();
|
|
1179
1179
|
}
|
|
1180
1180
|
//#endregion
|
|
1181
1181
|
//#region src/render/materials.ts
|
|
1182
|
-
var
|
|
1182
|
+
var On = .1, kn = .6, An = .8, jn = 2.2, Mn = [
|
|
1183
1183
|
.3,
|
|
1184
1184
|
.2,
|
|
1185
1185
|
0
|
|
1186
|
-
],
|
|
1187
|
-
function
|
|
1186
|
+
], Nn = "#fafafa", Pn = "#444444", Fn = "#f2f2f2", In = .3, Ln = "6.28318530718";
|
|
1187
|
+
function Rn(e, t) {
|
|
1188
1188
|
return t.reduce((e, [t, n]) => {
|
|
1189
1189
|
if (!e.includes(t)) throw Error(`bravais cannot draw with this three.js: its shader has no ${t}.`);
|
|
1190
1190
|
return e.replace(t, n);
|
|
1191
1191
|
}, e);
|
|
1192
1192
|
}
|
|
1193
|
-
function
|
|
1194
|
-
return
|
|
1193
|
+
function zn(e) {
|
|
1194
|
+
return Rn(e, [["#include <common>", "#include <common>\nflat varying int vSectorSite;\nflat varying vec3 vSphereCenter;\nflat varying float vSphereRadius;\nflat varying vec2 vDepthCoefficients;\nvarying vec3 vSpherePoint;"], ["#include <project_vertex>", "mat4 sphereMatrix = modelViewMatrix * instanceMatrix;\nvSphereCenter = sphereMatrix[3].xyz;\nvSphereRadius = length(sphereMatrix[0].xyz);\nvSpherePoint = vSphereCenter + vec3(position.xy * vSphereRadius, 0.0);\nvDepthCoefficients = vec2(projectionMatrix[2][2], projectionMatrix[3][2]);\nvSectorSite = gl_InstanceID;\nvec4 mvPosition = vec4(vSpherePoint, 1.0);\ngl_Position = projectionMatrix * mvPosition;"]]);
|
|
1195
1195
|
}
|
|
1196
|
-
function
|
|
1197
|
-
return
|
|
1196
|
+
function Bn(e) {
|
|
1197
|
+
return Rn(e, [
|
|
1198
1198
|
["#include <common>", "#include <common>\nuniform sampler2D sectorTexture;\nuniform float vacancyOpacity;\nflat varying int vSectorSite;\nflat varying vec3 vSphereCenter;\nflat varying float vSphereRadius;\nflat varying vec2 vDepthCoefficients;\nvarying vec3 vSpherePoint;"],
|
|
1199
1199
|
["#include <clipping_planes_fragment>", "// Where the view ray meets the sphere. The outline is smoothed over one\n// pixel through the alpha: sample coverage, or blending in a see-through layer.\nvec2 sphereOffset = vSpherePoint.xy - vSphereCenter.xy;\nfloat sphereDistance = length(sphereOffset);\nfloat sphereCoverage = clamp(\n (vSphereRadius - sphereDistance) / max(fwidth(sphereDistance), 1e-6) + 0.5,\n 0.0,\n 1.0\n);\nif (sphereCoverage <= 0.0) {\n discard;\n}\nfloat sphereHeight = sqrt(\n max(0.0, vSphereRadius * vSphereRadius - dot(sphereOffset, sphereOffset))\n);\nvec3 sphereNormal = vec3(sphereOffset, sphereHeight) / vSphereRadius;\nfloat sphereZ = vSphereCenter.z + sphereHeight;\ngl_FragDepth = (vDepthCoefficients.x * sphereZ + vDepthCoefficients.y) * 0.5 + 0.5;\n#include <clipping_planes_fragment>"],
|
|
1200
1200
|
["#include <color_fragment>", `#include <color_fragment>
|
|
@@ -1202,7 +1202,7 @@ function Rn(e) {
|
|
|
1202
1202
|
// A pie chart facing the viewer, like VESTA's occupancy pies: the instance
|
|
1203
1203
|
// colour fills the first sector from 12 o'clock clockwise, then each
|
|
1204
1204
|
// texel's colour from its stop on.
|
|
1205
|
-
float sectorAngle = fract(atan(sphereOffset.x, sphereOffset.y) / ${
|
|
1205
|
+
float sectorAngle = fract(atan(sphereOffset.x, sphereOffset.y) / ${Ln});
|
|
1206
1206
|
vec3 sectorColor = vColor.rgb;
|
|
1207
1207
|
float sectorOpacity = 1.0;
|
|
1208
1208
|
int sectorRow = vSectorSite / 256;
|
|
@@ -1222,53 +1222,53 @@ function Rn(e) {
|
|
|
1222
1222
|
["#include <normal_fragment_begin>", "#include <normal_fragment_begin>\nnormal = sphereNormal;\nnonPerturbedNormal = normal;"]
|
|
1223
1223
|
]);
|
|
1224
1224
|
}
|
|
1225
|
-
function
|
|
1226
|
-
let r = e < 1 || n, i = new
|
|
1225
|
+
function Vn(e, t, n) {
|
|
1226
|
+
let r = e < 1 || n, i = new w({
|
|
1227
1227
|
color: "#ffffff",
|
|
1228
|
-
metalness:
|
|
1229
|
-
roughness:
|
|
1228
|
+
metalness: On,
|
|
1229
|
+
roughness: kn,
|
|
1230
1230
|
opacity: e,
|
|
1231
1231
|
transparent: r,
|
|
1232
1232
|
alphaToCoverage: !r
|
|
1233
1233
|
});
|
|
1234
1234
|
return i.onBeforeCompile = (e) => {
|
|
1235
|
-
e.uniforms.sectorTexture = { value: t }, e.uniforms.vacancyOpacity = { value:
|
|
1235
|
+
e.uniforms.sectorTexture = { value: t }, e.uniforms.vacancyOpacity = { value: In }, e.vertexShader = zn(e.vertexShader), e.fragmentShader = Bn(e.fragmentShader);
|
|
1236
1236
|
}, i.customProgramCacheKey = () => "bravais-atom-spheres", i;
|
|
1237
1237
|
}
|
|
1238
|
-
function
|
|
1239
|
-
return
|
|
1238
|
+
function Hn(e) {
|
|
1239
|
+
return Rn(e, [["#include <common>", "#include <common>\nuniform float capRadius;\nflat varying vec3 vTubeCenter;\nflat varying vec3 vTubeAxis;\nflat varying vec3 vAtomCenter;\nflat varying float vTubeRadius;\nflat varying float vTubeHalfLength;\nflat varying vec2 vDepthCoefficients;\nvarying vec3 vBoxPoint;"], ["#include <project_vertex>", "mat4 tubeMatrix = modelViewMatrix * instanceMatrix;\nfloat tubeLength = max(length(tubeMatrix[1].xyz), 1e-6);\nvTubeRadius = length(tubeMatrix[0].xyz);\nvTubeHalfLength = tubeLength * 0.5;\nvTubeCenter = tubeMatrix[3].xyz;\nvTubeAxis = tubeMatrix[1].xyz / tubeLength;\nfloat rim = sqrt(max(0.0, capRadius * capRadius - vTubeRadius * vTubeRadius));\nvAtomCenter = vTubeCenter - vTubeAxis * (rim + vTubeHalfLength);\nvDepthCoefficients = vec2(projectionMatrix[2][2], projectionMatrix[3][2]);\nvec4 mvPosition = tubeMatrix * vec4(position, 1.0);\nvBoxPoint = mvPosition.xyz;\ngl_Position = projectionMatrix * mvPosition;"]]);
|
|
1240
1240
|
}
|
|
1241
|
-
function
|
|
1242
|
-
return
|
|
1241
|
+
function Un(e) {
|
|
1242
|
+
return Rn(e, [
|
|
1243
1243
|
["#include <common>", "#include <common>\nuniform float capRadius;\nflat varying vec3 vTubeCenter;\nflat varying vec3 vTubeAxis;\nflat varying vec3 vAtomCenter;\nflat varying float vTubeRadius;\nflat varying float vTubeHalfLength;\nflat varying vec2 vDepthCoefficients;\nvarying vec3 vBoxPoint;"],
|
|
1244
1244
|
["#include <clipping_planes_fragment>", "// The view ray through this pixel runs down view z. The tube's surface is\n// the nearest of: the wall outside the atom's sphere, the sphere's far side\n// inside the tube (the cut face) and the midpoint disc. Along the ray,\n// q(z) = p(z) - centre has q.a = k + (z - cz) a.z and |q|^2 = u + (z - cz)^2.\nvec2 tubePixel = vBoxPoint.xy;\nvec2 tubeOffset = tubePixel - vTubeCenter.xy;\nfloat tubeK = dot(tubeOffset, vTubeAxis.xy);\nfloat tubeU = dot(tubeOffset, tubeOffset);\nfloat axisZ = vTubeAxis.z;\nfloat quadA = 1.0 - axisZ * axisZ;\nfloat quadB = -2.0 * tubeK * axisZ;\nfloat quadC = tubeU - tubeK * tubeK - vTubeRadius * vTubeRadius;\nfloat tubeRadius2 = vTubeRadius * vTubeRadius;\n// The ray's closest approach to the axis, for the outline's coverage.\nfloat axisDistance2 = tubeU - tubeK * tubeK;\nif (quadA > 1e-6) {\n axisDistance2 -= quadB * quadB / (4.0 * quadA);\n}\nfloat axisDistance = sqrt(max(0.0, axisDistance2));\nfloat tubeCoverage = clamp(\n (vTubeRadius - axisDistance) / max(fwidth(axisDistance), 1e-6) + 0.5,\n 0.0,\n 1.0\n);\nif (tubeCoverage <= 0.0) {\n discard;\n}\nfloat tubeHitZ = -1e30;\nvec3 tubeNormal = vec3(0.0, 0.0, 1.0);\nif (quadA > 1e-6) {\n float discriminant = quadB * quadB - 4.0 * quadA * quadC;\n if (discriminant >= 0.0) {\n float z = vTubeCenter.z + (-quadB + sqrt(discriminant)) / (2.0 * quadA);\n vec3 d = vec3(tubePixel, z) - vTubeCenter;\n float s = dot(d, vTubeAxis);\n if (abs(s) <= vTubeHalfLength && distance(vec3(tubePixel, z), vAtomCenter) >= capRadius) {\n tubeHitZ = z;\n tubeNormal = (d - s * vTubeAxis) / vTubeRadius;\n }\n }\n}\nif (axisZ > 1e-6) {\n float z = vTubeCenter.z + (vTubeHalfLength - tubeK) / axisZ;\n vec3 d = vec3(tubePixel, z) - vTubeCenter;\n if (dot(d, d) - vTubeHalfLength * vTubeHalfLength <= tubeRadius2 && z > tubeHitZ &&\n distance(vec3(tubePixel, z), vAtomCenter) >= capRadius) {\n tubeHitZ = z;\n tubeNormal = vTubeAxis;\n }\n}\n{\n vec2 m = tubePixel - vAtomCenter.xy;\n float inside = capRadius * capRadius - dot(m, m);\n if (inside >= 0.0) {\n float z = vAtomCenter.z - sqrt(inside);\n vec3 d = vec3(tubePixel, z) - vTubeCenter;\n float s = dot(d, vTubeAxis);\n if (abs(s) <= vTubeHalfLength && dot(d, d) - s * s <= tubeRadius2 && z > tubeHitZ) {\n tubeHitZ = z;\n tubeNormal = (vAtomCenter - vec3(tubePixel, z)) / capRadius;\n }\n }\n}\nif (tubeHitZ < -1e29) {\n discard;\n}\ngl_FragDepth = (vDepthCoefficients.x * tubeHitZ + vDepthCoefficients.y) * 0.5 + 0.5;\n#include <clipping_planes_fragment>"],
|
|
1245
1245
|
["#include <color_fragment>", "#include <color_fragment>\ndiffuseColor.a *= tubeCoverage;"],
|
|
1246
1246
|
["#include <normal_fragment_begin>", "#include <normal_fragment_begin>\nnormal = tubeNormal;\nnonPerturbedNormal = normal;"]
|
|
1247
1247
|
]);
|
|
1248
1248
|
}
|
|
1249
|
-
function
|
|
1250
|
-
let n = e < 1, r = new
|
|
1249
|
+
function Wn(e, t) {
|
|
1250
|
+
let n = e < 1, r = new w({
|
|
1251
1251
|
color: "#ffffff",
|
|
1252
|
-
metalness:
|
|
1253
|
-
roughness:
|
|
1252
|
+
metalness: On,
|
|
1253
|
+
roughness: kn,
|
|
1254
1254
|
opacity: e,
|
|
1255
1255
|
transparent: n,
|
|
1256
1256
|
alphaToCoverage: !n
|
|
1257
1257
|
});
|
|
1258
1258
|
return r.onBeforeCompile = (e) => {
|
|
1259
|
-
e.uniforms.capRadius = { value: t }, e.vertexShader =
|
|
1259
|
+
e.uniforms.capRadius = { value: t }, e.vertexShader = Hn(e.vertexShader), e.fragmentShader = Un(e.fragmentShader);
|
|
1260
1260
|
}, r.customProgramCacheKey = () => "bravais-bond-tubes", r;
|
|
1261
1261
|
}
|
|
1262
|
-
function
|
|
1263
|
-
return new
|
|
1264
|
-
color:
|
|
1262
|
+
function Gn(e) {
|
|
1263
|
+
return new y({
|
|
1264
|
+
color: Pn,
|
|
1265
1265
|
opacity: e,
|
|
1266
1266
|
transparent: !0,
|
|
1267
1267
|
fog: !1
|
|
1268
1268
|
});
|
|
1269
1269
|
}
|
|
1270
|
-
function
|
|
1271
|
-
return new
|
|
1270
|
+
function Kn(e, n) {
|
|
1271
|
+
return new w({
|
|
1272
1272
|
color: e,
|
|
1273
1273
|
metalness: 0,
|
|
1274
1274
|
roughness: .8,
|
|
@@ -1276,35 +1276,32 @@ function Wn(e, n) {
|
|
|
1276
1276
|
stencilWrite: !0,
|
|
1277
1277
|
stencilRef: n,
|
|
1278
1278
|
stencilFunc: t,
|
|
1279
|
-
stencilZPass:
|
|
1279
|
+
stencilZPass: se
|
|
1280
1280
|
});
|
|
1281
1281
|
}
|
|
1282
1282
|
//#endregion
|
|
1283
1283
|
//#region src/render/gizmo.ts
|
|
1284
|
-
var
|
|
1284
|
+
var qn = {
|
|
1285
1285
|
a: "#d27686",
|
|
1286
1286
|
b: "#80c393",
|
|
1287
1287
|
c: "#75a4dd"
|
|
1288
|
-
},
|
|
1289
|
-
function
|
|
1288
|
+
}, Jn = .82, Yn = .055, Xn = .24, Zn = .13, Qn = .13, $n = 1.3, er = .5, tr = 128, nr = "#2a2a2a", rr = "#ffffff", ir = 3.2, ar = new A(0, 1, 0);
|
|
1289
|
+
function or(e, t) {
|
|
1290
1290
|
let n = document.createElement("canvas");
|
|
1291
|
-
n.width =
|
|
1291
|
+
n.width = tr, n.height = tr;
|
|
1292
1292
|
let r = n.getContext("2d");
|
|
1293
|
-
|
|
1294
|
-
let i = $n * .68;
|
|
1295
|
-
r.clearRect(0, 0, n.width, n.height), r.font = `italic 600 ${i}px ${t}`, r.textAlign = "center", r.textBaseline = "middle", r.fillStyle = "#ffffff", r.fillText(e, n.width / 2, n.height / 2);
|
|
1296
|
-
}
|
|
1293
|
+
r && (r.font = `italic 600 ${tr * .68}px ${t}`, r.textAlign = "center", r.textBaseline = "middle", r.fillStyle = "#ffffff", r.fillText(e, n.width / 2, n.height / 2));
|
|
1297
1294
|
let i = new o(n);
|
|
1298
|
-
return i.colorSpace =
|
|
1295
|
+
return i.colorSpace = ce, i.premultiplyAlpha = !0, i.magFilter = x, i.minFilter = te, i;
|
|
1299
1296
|
}
|
|
1300
|
-
function
|
|
1301
|
-
let r = new
|
|
1302
|
-
a.position.y =
|
|
1303
|
-
let o = new
|
|
1297
|
+
function sr(e, t, n) {
|
|
1298
|
+
let r = new _(), i = Kn(e, 1), a = new C(new u(Yn, Yn, Jn, 24), i);
|
|
1299
|
+
a.position.y = Jn / 2;
|
|
1300
|
+
let o = new C(new c(Zn, Xn, 32), i);
|
|
1304
1301
|
o.position.y = .94, r.add(a, o);
|
|
1305
|
-
let s =
|
|
1302
|
+
let s = or(t, n), l = [[nr, ie], [rr, m]];
|
|
1306
1303
|
for (let [e, t] of l) {
|
|
1307
|
-
let n = new
|
|
1304
|
+
let n = new de(new fe({
|
|
1308
1305
|
map: s,
|
|
1309
1306
|
color: e,
|
|
1310
1307
|
depthTest: !1,
|
|
@@ -1314,49 +1311,46 @@ function ar(e, t, n) {
|
|
|
1314
1311
|
stencilRef: 1,
|
|
1315
1312
|
stencilFunc: t
|
|
1316
1313
|
}));
|
|
1317
|
-
n.scale.set(
|
|
1314
|
+
n.scale.set(er, er, 1), n.position.y = $n, n.renderOrder = 10, r.add(n);
|
|
1318
1315
|
}
|
|
1319
1316
|
return r;
|
|
1320
1317
|
}
|
|
1321
|
-
var
|
|
1322
|
-
scene = new
|
|
1323
|
-
camera = new
|
|
1324
|
-
axes = new
|
|
1318
|
+
var cr = class {
|
|
1319
|
+
scene = new le();
|
|
1320
|
+
camera = new D(-3.2 / 2, ir / 2, ir / 2, -3.2 / 2, .1, 20);
|
|
1321
|
+
axes = new _();
|
|
1325
1322
|
arrows;
|
|
1326
1323
|
headlight = new f("#ffffff", 1.78);
|
|
1327
|
-
|
|
1328
|
-
direction = new j();
|
|
1324
|
+
direction = new A();
|
|
1329
1325
|
constructor(e) {
|
|
1330
1326
|
this.camera.position.set(0, 0, 5), this.camera.lookAt(0, 0, 0), this.scene.add(new n("#ffffff", .68)), this.headlight.position.set(1.6, 1.1, 5), this.scene.add(this.headlight), this.arrows = [
|
|
1331
1327
|
"a",
|
|
1332
1328
|
"b",
|
|
1333
1329
|
"c"
|
|
1334
|
-
].map((t) =>
|
|
1335
|
-
let t = new
|
|
1330
|
+
].map((t) => sr(qn[t], t, e));
|
|
1331
|
+
let t = new C(new ue(Qn, 32, 16), Kn("#f3f2ee", 0));
|
|
1336
1332
|
this.axes.add(...this.arrows, t), this.scene.add(this.axes);
|
|
1337
1333
|
}
|
|
1338
1334
|
setCell(e) {
|
|
1339
1335
|
this.arrows.forEach((t, n) => {
|
|
1340
|
-
t.quaternion.setFromUnitVectors(
|
|
1336
|
+
t.quaternion.setFromUnitVectors(ar, this.direction.set(...e[n]).normalize());
|
|
1341
1337
|
});
|
|
1342
1338
|
}
|
|
1343
1339
|
render(e, t, n) {
|
|
1344
|
-
this.axes.quaternion.copy(
|
|
1345
|
-
let r =
|
|
1346
|
-
|
|
1347
|
-
let i = e.autoClear;
|
|
1348
|
-
e.autoClear = !1, e.setViewport(0, 0, n, n), e.setScissor(0, 0, n, n), e.setScissorTest(!0), e.clear(!1, !0, !0), e.render(this.scene, this.camera), e.setScissorTest(!1), e.autoClear = i;
|
|
1340
|
+
this.axes.quaternion.copy(t).invert();
|
|
1341
|
+
let r = e.autoClear;
|
|
1342
|
+
e.autoClear = !1, e.setViewport(0, 0, n, n), e.setScissor(0, 0, n, n), e.setScissorTest(!0), e.clear(!1, !0, !0), e.render(this.scene, this.camera), e.setScissorTest(!1), e.autoClear = r;
|
|
1349
1343
|
}
|
|
1350
1344
|
dispose() {
|
|
1351
1345
|
this.axes.traverse((e) => {
|
|
1352
|
-
if (e instanceof
|
|
1346
|
+
if (e instanceof C || e instanceof de) {
|
|
1353
1347
|
e.geometry.dispose();
|
|
1354
1348
|
let t = e.material;
|
|
1355
1349
|
"map" in t && t.map && t.map.dispose(), t.dispose();
|
|
1356
1350
|
}
|
|
1357
1351
|
}), this.axes.clear();
|
|
1358
1352
|
}
|
|
1359
|
-
},
|
|
1353
|
+
}, lr = {
|
|
1360
1354
|
source: "VESTA's element colours, softened.",
|
|
1361
1355
|
elements: {
|
|
1362
1356
|
H: "#f2c0c0",
|
|
@@ -1460,21 +1454,21 @@ var or = class {
|
|
|
1460
1454
|
};
|
|
1461
1455
|
//#endregion
|
|
1462
1456
|
//#region src/render/oklab.ts
|
|
1463
|
-
function
|
|
1457
|
+
function ur(e) {
|
|
1464
1458
|
return e <= .04045 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4;
|
|
1465
1459
|
}
|
|
1466
|
-
function
|
|
1460
|
+
function dr(e) {
|
|
1467
1461
|
return e <= .0031308 ? e * 12.92 : 1.055 * e ** (1 / 2.4) - .055;
|
|
1468
1462
|
}
|
|
1469
|
-
function
|
|
1470
|
-
let t = Number.parseInt(e.slice(1), 16), n =
|
|
1463
|
+
function fr(e) {
|
|
1464
|
+
let t = Number.parseInt(e.slice(1), 16), n = ur((t >> 16 & 255) / 255), r = ur((t >> 8 & 255) / 255), i = ur((t & 255) / 255), a = Math.cbrt(.4122214708 * n + .5363325363 * r + .0514459929 * i), o = Math.cbrt(.2119034982 * n + .6806995451 * r + .1073969566 * i), s = Math.cbrt(.0883024619 * n + .2817188376 * r + .6299787005 * i);
|
|
1471
1465
|
return {
|
|
1472
1466
|
L: .2104542553 * a + .793617785 * o - .0040720468 * s,
|
|
1473
1467
|
a: 1.9779984951 * a - 2.428592205 * o + .4505937099 * s,
|
|
1474
1468
|
b: .0259040371 * a + .7827717662 * o - .808675766 * s
|
|
1475
1469
|
};
|
|
1476
1470
|
}
|
|
1477
|
-
function
|
|
1471
|
+
function pr(e) {
|
|
1478
1472
|
let t = (e.L + .3963377774 * e.a + .2158037573 * e.b) ** 3, n = (e.L - .1055613458 * e.a - .0638541728 * e.b) ** 3, r = (e.L - .0894841775 * e.a - 1.291485548 * e.b) ** 3;
|
|
1479
1473
|
return [
|
|
1480
1474
|
4.0767416621 * t - 3.3077115913 * n + .2309699292 * r,
|
|
@@ -1482,16 +1476,16 @@ function dr(e) {
|
|
|
1482
1476
|
-.0041960863 * t - .7034186147 * n + 1.707614701 * r
|
|
1483
1477
|
];
|
|
1484
1478
|
}
|
|
1485
|
-
function
|
|
1486
|
-
return
|
|
1479
|
+
function mr(e) {
|
|
1480
|
+
return pr(e).every((e) => e >= -1e-4 && e <= 1.0001);
|
|
1487
1481
|
}
|
|
1488
|
-
function
|
|
1489
|
-
return `#${
|
|
1490
|
-
let t =
|
|
1482
|
+
function hr(e) {
|
|
1483
|
+
return `#${pr(e).map((e) => {
|
|
1484
|
+
let t = dr(Math.min(1, Math.max(0, e)));
|
|
1491
1485
|
return Math.round(t * 255).toString(16).padStart(2, "0");
|
|
1492
1486
|
}).join("")}`;
|
|
1493
1487
|
}
|
|
1494
|
-
function
|
|
1488
|
+
function gr(e) {
|
|
1495
1489
|
let t = Math.hypot(e.a, e.b), n = (Math.atan2(e.b, e.a) * 180 / Math.PI + 360) % 360;
|
|
1496
1490
|
return {
|
|
1497
1491
|
L: e.L,
|
|
@@ -1499,7 +1493,7 @@ function mr(e) {
|
|
|
1499
1493
|
h: n
|
|
1500
1494
|
};
|
|
1501
1495
|
}
|
|
1502
|
-
function
|
|
1496
|
+
function X(e) {
|
|
1503
1497
|
let t = e.h * Math.PI / 180;
|
|
1504
1498
|
return {
|
|
1505
1499
|
L: e.L,
|
|
@@ -1507,12 +1501,12 @@ function hr(e) {
|
|
|
1507
1501
|
b: e.C * Math.sin(t)
|
|
1508
1502
|
};
|
|
1509
1503
|
}
|
|
1510
|
-
function
|
|
1511
|
-
if (
|
|
1504
|
+
function _r(e) {
|
|
1505
|
+
if (mr(X(e))) return e;
|
|
1512
1506
|
let t = 0, n = e.C;
|
|
1513
1507
|
for (let r = 0; r < 24; r += 1) {
|
|
1514
1508
|
let r = (t + n) / 2;
|
|
1515
|
-
|
|
1509
|
+
mr(X({
|
|
1516
1510
|
...e,
|
|
1517
1511
|
C: r
|
|
1518
1512
|
})) ? t = r : n = r;
|
|
@@ -1524,15 +1518,15 @@ function gr(e) {
|
|
|
1524
1518
|
}
|
|
1525
1519
|
//#endregion
|
|
1526
1520
|
//#region src/render/palette.ts
|
|
1527
|
-
var
|
|
1521
|
+
var vr = lr.elements, yr = {
|
|
1528
1522
|
Cr: "#6d87c9",
|
|
1529
1523
|
V: "#bf4b62",
|
|
1530
1524
|
F: "#9bd7d0"
|
|
1531
|
-
},
|
|
1525
|
+
}, br = /* @__PURE__ */ "O.Li.Na.K.Mg.Ca.Sr.Ba.Al.Si.Ti.Mn.Fe.Co.Ni.Cu.Zn.V.Cr.Ga.Ge.Y.Zr.Nb.Mo.Ru.Ag.Cd.In.Sn.Sb.La.Ce.Nd.Sm.Gd.Ta.W.Pt.Au.Pb.Bi.H.C.N.F.P.S.Cl.Se.Te.I.Br.B.Sc.Rb.Cs.Hf.Re.Ir.Pd.Rh.Os.Pr.Eu.Tb.Dy.Ho.Er.Tm.Yb.Lu.Th.U".split("."), xr = new Map(br.map((e, t) => [e, t])), Sr = .1, Cr = .7, Z = {
|
|
1532
1526
|
minL: .45,
|
|
1533
1527
|
maxL: .88,
|
|
1534
1528
|
maxC: .2
|
|
1535
|
-
},
|
|
1529
|
+
}, wr = .025, Tr = .09, Er = .1, Dr = [
|
|
1536
1530
|
0,
|
|
1537
1531
|
10,
|
|
1538
1532
|
-10,
|
|
@@ -1553,7 +1547,7 @@ var _r = sr.elements, vr = {
|
|
|
1553
1547
|
150,
|
|
1554
1548
|
-150,
|
|
1555
1549
|
180
|
|
1556
|
-
],
|
|
1550
|
+
], Or = [
|
|
1557
1551
|
0,
|
|
1558
1552
|
-.05,
|
|
1559
1553
|
.05,
|
|
@@ -1563,12 +1557,12 @@ var _r = sr.elements, vr = {
|
|
|
1563
1557
|
.15,
|
|
1564
1558
|
-.2,
|
|
1565
1559
|
.2
|
|
1566
|
-
],
|
|
1560
|
+
], kr = [
|
|
1567
1561
|
0,
|
|
1568
1562
|
.15,
|
|
1569
1563
|
-.15,
|
|
1570
1564
|
.3
|
|
1571
|
-
],
|
|
1565
|
+
], Ar = [
|
|
1572
1566
|
0,
|
|
1573
1567
|
30,
|
|
1574
1568
|
60,
|
|
@@ -1581,78 +1575,76 @@ var _r = sr.elements, vr = {
|
|
|
1581
1575
|
270,
|
|
1582
1576
|
300,
|
|
1583
1577
|
330
|
|
1584
|
-
],
|
|
1585
|
-
function
|
|
1586
|
-
let n = (e.L - t.L) *
|
|
1578
|
+
], jr = 30, Mr = .08, Nr = .15, Pr = 1.5, Fr = 2;
|
|
1579
|
+
function Ir(e, t) {
|
|
1580
|
+
let n = (e.L - t.L) * Cr;
|
|
1587
1581
|
return Math.hypot(n, e.a - t.a, e.b - t.b);
|
|
1588
1582
|
}
|
|
1589
|
-
function
|
|
1583
|
+
function Lr(e) {
|
|
1590
1584
|
let t = 2166136261;
|
|
1591
1585
|
for (let n = 0; n < e.length; n += 1) t = Math.imul(t ^ e.charCodeAt(n), 16777619) >>> 0;
|
|
1592
1586
|
return t;
|
|
1593
1587
|
}
|
|
1594
|
-
function Lr(e) {
|
|
1595
|
-
return vr[e] ?? _r[e] ?? null;
|
|
1596
|
-
}
|
|
1597
1588
|
function Rr(e) {
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1589
|
+
return yr[e] ?? vr[e] ?? null;
|
|
1590
|
+
}
|
|
1591
|
+
function zr(e) {
|
|
1592
|
+
let t = Rr(e);
|
|
1593
|
+
if (t) return gr(fr(t));
|
|
1594
|
+
let n = ye.indexOf(e) + 1;
|
|
1601
1595
|
return {
|
|
1602
1596
|
L: .68,
|
|
1603
1597
|
C: .12,
|
|
1604
|
-
h: (n > 0 ? n :
|
|
1598
|
+
h: (n > 0 ? n : Lr(e)) * 137.508 % 360
|
|
1605
1599
|
};
|
|
1606
1600
|
}
|
|
1607
|
-
function
|
|
1608
|
-
let t =
|
|
1601
|
+
function Br(e) {
|
|
1602
|
+
let t = xr.get(e);
|
|
1609
1603
|
if (t !== void 0) return t;
|
|
1610
|
-
let n =
|
|
1611
|
-
return
|
|
1604
|
+
let n = ye.indexOf(e);
|
|
1605
|
+
return br.length + (n >= 0 ? n : ye.length);
|
|
1612
1606
|
}
|
|
1613
|
-
function
|
|
1614
|
-
return
|
|
1607
|
+
function Vr(e) {
|
|
1608
|
+
return _r({
|
|
1615
1609
|
L: Math.min(Z.maxL, Math.max(Z.minL, e.L)),
|
|
1616
1610
|
C: Math.min(Z.maxC, Math.max(0, e.C)),
|
|
1617
1611
|
h: (e.h % 360 + 360) % 360
|
|
1618
1612
|
});
|
|
1619
1613
|
}
|
|
1620
|
-
function
|
|
1621
|
-
return
|
|
1614
|
+
function Hr(e, t) {
|
|
1615
|
+
return _r({
|
|
1622
1616
|
L: e,
|
|
1623
1617
|
C: .5,
|
|
1624
1618
|
h: t
|
|
1625
1619
|
}).C;
|
|
1626
1620
|
}
|
|
1627
|
-
function
|
|
1628
|
-
let n = Br(e);
|
|
1621
|
+
function Ur(e, t) {
|
|
1629
1622
|
return {
|
|
1630
|
-
|
|
1631
|
-
lab: hr(n),
|
|
1623
|
+
lab: X(Vr(e)),
|
|
1632
1624
|
cost: t
|
|
1633
1625
|
};
|
|
1634
1626
|
}
|
|
1635
|
-
function
|
|
1627
|
+
function Wr(e) {
|
|
1636
1628
|
let t = [];
|
|
1637
|
-
if (e.C <
|
|
1638
|
-
for (let n of
|
|
1639
|
-
let r = Math.abs(n) /
|
|
1640
|
-
t.push(
|
|
1629
|
+
if (e.C < wr) {
|
|
1630
|
+
for (let n of Or) {
|
|
1631
|
+
let r = Math.abs(n) / Mr * (n > 0 ? Pr : 1);
|
|
1632
|
+
t.push(Ur({
|
|
1641
1633
|
...e,
|
|
1642
1634
|
L: e.L + n
|
|
1643
1635
|
}, r));
|
|
1644
|
-
for (let i of
|
|
1645
|
-
L: e.L -
|
|
1646
|
-
C:
|
|
1636
|
+
for (let i of Ar) t.push(Ur({
|
|
1637
|
+
L: e.L - Er + n,
|
|
1638
|
+
C: Tr,
|
|
1647
1639
|
h: i
|
|
1648
|
-
},
|
|
1640
|
+
}, Fr + r + i / 3600));
|
|
1649
1641
|
}
|
|
1650
1642
|
return t.sort((e, t) => e.cost - t.cost);
|
|
1651
1643
|
}
|
|
1652
|
-
let n = e.C / Math.max(1e-6,
|
|
1653
|
-
for (let r of
|
|
1654
|
-
let o = Math.min(Z.maxL, Math.max(Z.minL, e.L + i)), s = e.h + r, c = Math.min(1, Math.max(.1, n + a)) *
|
|
1655
|
-
t.push(
|
|
1644
|
+
let n = e.C / Math.max(1e-6, Hr(e.L, e.h));
|
|
1645
|
+
for (let r of Dr) for (let i of Or) for (let a of kr) {
|
|
1646
|
+
let o = Math.min(Z.maxL, Math.max(Z.minL, e.L + i)), s = e.h + r, c = Math.min(1, Math.max(.1, n + a)) * Hr(o, s), l = Math.abs(r) / jr + Math.abs(i) / Mr + Math.abs(a) / Nr;
|
|
1647
|
+
t.push(Ur({
|
|
1656
1648
|
L: o,
|
|
1657
1649
|
C: c,
|
|
1658
1650
|
h: s
|
|
@@ -1661,55 +1653,54 @@ function Ur(e) {
|
|
|
1661
1653
|
return t.sort((e, t) => e.cost - t.cost);
|
|
1662
1654
|
}
|
|
1663
1655
|
var Q = /* @__PURE__ */ new Map();
|
|
1664
|
-
function
|
|
1665
|
-
let n = [...Q.values()].map((e) => e.lab), r = (e) => n.reduce((t, n) => Math.min(t,
|
|
1666
|
-
if (r(i) >=
|
|
1667
|
-
hex: e ??
|
|
1656
|
+
function Gr(e, t) {
|
|
1657
|
+
let n = [...Q.values()].map((e) => e.lab), r = (e) => n.reduce((t, n) => Math.min(t, Ir(e, n)), Infinity), i = X(t);
|
|
1658
|
+
if (r(i) >= Sr) return {
|
|
1659
|
+
hex: e ?? hr(i),
|
|
1668
1660
|
lab: i
|
|
1669
1661
|
};
|
|
1670
1662
|
let a = null, o = -Infinity, s = Infinity, c = null, l = -Infinity;
|
|
1671
|
-
for (let e of
|
|
1663
|
+
for (let e of Wr(t)) {
|
|
1672
1664
|
let t = r(e.lab);
|
|
1673
|
-
if (t >=
|
|
1665
|
+
if (t >= Sr) {
|
|
1674
1666
|
if ((e.cost < s - 1e-9 || Math.abs(e.cost - s) <= 1e-9 && t > o) && (a = e, s = e.cost, o = t), e.cost > s + 1e-9) break;
|
|
1675
1667
|
} else t > l && (c = e, l = t);
|
|
1676
1668
|
}
|
|
1677
1669
|
let u = a ?? c ?? {
|
|
1678
1670
|
lab: i,
|
|
1679
|
-
lch: t,
|
|
1680
1671
|
cost: 0
|
|
1681
1672
|
};
|
|
1682
1673
|
return {
|
|
1683
|
-
hex:
|
|
1674
|
+
hex: hr(u.lab),
|
|
1684
1675
|
lab: u.lab
|
|
1685
1676
|
};
|
|
1686
1677
|
}
|
|
1687
|
-
function Gr(e) {
|
|
1688
|
-
let t = [...new Set(e)].filter((e) => !Q.has(e)).sort((e, t) => zr(e) - zr(t));
|
|
1689
|
-
for (let e of t) Q.set(e, Wr(Lr(e), Rr(e)));
|
|
1690
|
-
}
|
|
1691
1678
|
function Kr(e) {
|
|
1679
|
+
let t = [...new Set(e)].filter((e) => !Q.has(e)).sort((e, t) => Br(e) - Br(t));
|
|
1680
|
+
for (let e of t) Q.set(e, Gr(Rr(e), zr(e)));
|
|
1681
|
+
}
|
|
1682
|
+
function qr(e) {
|
|
1692
1683
|
let t = Q.get(e);
|
|
1693
|
-
return t ? t.hex : (
|
|
1684
|
+
return t ? t.hex : (Kr([e]), Q.get(e).hex);
|
|
1694
1685
|
}
|
|
1695
|
-
function
|
|
1686
|
+
function Jr() {
|
|
1696
1687
|
return [...Q].map(([e, t]) => [e, t.hex]);
|
|
1697
1688
|
}
|
|
1698
|
-
function
|
|
1689
|
+
function Yr() {
|
|
1699
1690
|
Q.clear();
|
|
1700
1691
|
}
|
|
1701
1692
|
//#endregion
|
|
1702
1693
|
//#region src/render/legend.ts
|
|
1703
|
-
var
|
|
1704
|
-
function
|
|
1705
|
-
if (e.getElementById(
|
|
1694
|
+
var Xr = "bravais-styles", Zr = "\n.bravais-viewer {\n position: relative;\n overflow: hidden;\n}\n.bravais-canvas {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n display: block;\n touch-action: none;\n}\n.bravais-legend {\n position: absolute;\n left: 50%;\n bottom: 20px;\n transform: translateX(-50%);\n display: flex;\n flex-wrap: wrap;\n justify-content: center;\n gap: 8px 16px;\n max-width: calc(100% - 32px);\n padding: 8px 16px;\n border: 1px solid rgba(40, 40, 40, 0.1);\n border-radius: 999px;\n background: rgba(255, 255, 255, 0.72);\n backdrop-filter: blur(24px) saturate(150%);\n box-shadow: 0 10px 15px -3px rgba(40, 40, 40, 0.1);\n font-family: inherit;\n font-size: 0.95rem;\n line-height: 1;\n color: #282828;\n pointer-events: none;\n}\n.bravais-legend[hidden] {\n display: none;\n}\n.bravais-legend-item {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n.bravais-legend-swatch {\n width: 18px;\n height: 18px;\n border-radius: 50%;\n border: 1px solid rgba(40, 40, 40, 0.1);\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);\n}\n";
|
|
1695
|
+
function Qr(e) {
|
|
1696
|
+
if (e.getElementById(Xr)) return;
|
|
1706
1697
|
let t = e.createElement("style");
|
|
1707
|
-
t.id =
|
|
1698
|
+
t.id = Xr, t.textContent = Zr, e.head.appendChild(t);
|
|
1708
1699
|
}
|
|
1709
|
-
function
|
|
1700
|
+
function $r(e) {
|
|
1710
1701
|
return `linear-gradient(135deg, rgba(255, 255, 255, 0.38) 0 14%, rgba(255, 255, 255, 0) 42%), ${e}`;
|
|
1711
1702
|
}
|
|
1712
|
-
var
|
|
1703
|
+
var ei = class {
|
|
1713
1704
|
element;
|
|
1714
1705
|
constructor(e) {
|
|
1715
1706
|
this.element = e.createElement("div"), this.element.className = "bravais-legend", this.element.hidden = !0;
|
|
@@ -1720,17 +1711,17 @@ var $r = class {
|
|
|
1720
1711
|
let e = this.element.ownerDocument.createElement("span");
|
|
1721
1712
|
e.className = "bravais-legend-item";
|
|
1722
1713
|
let n = this.element.ownerDocument.createElement("span");
|
|
1723
|
-
n.className = "bravais-legend-swatch", n.style.background =
|
|
1714
|
+
n.className = "bravais-legend-swatch", n.style.background = $r(qr(t));
|
|
1724
1715
|
let r = this.element.ownerDocument.createElement("span");
|
|
1725
1716
|
r.textContent = t, e.append(n, r), this.element.appendChild(e);
|
|
1726
1717
|
}
|
|
1727
1718
|
this.element.hidden = e.length === 0;
|
|
1728
1719
|
}
|
|
1729
|
-
}, $ = .4,
|
|
1730
|
-
function
|
|
1731
|
-
let [t, n, r] = e.map((e) => new
|
|
1720
|
+
}, $ = .4, ti = .1, ni = .398, ri = Math.sqrt(ni * ni - ti * ti), ii = new A(0, 1, 0);
|
|
1721
|
+
function ai(e) {
|
|
1722
|
+
let [t, n, r] = e.map((e) => new A(...e));
|
|
1732
1723
|
return [
|
|
1733
|
-
new
|
|
1724
|
+
new A(),
|
|
1734
1725
|
t.clone(),
|
|
1735
1726
|
n.clone(),
|
|
1736
1727
|
r.clone(),
|
|
@@ -1740,7 +1731,7 @@ function ii(e) {
|
|
|
1740
1731
|
t.clone().add(n).add(r)
|
|
1741
1732
|
];
|
|
1742
1733
|
}
|
|
1743
|
-
function
|
|
1734
|
+
function oi(e) {
|
|
1744
1735
|
let [t, n, r] = e;
|
|
1745
1736
|
return [
|
|
1746
1737
|
(t[0] + n[0] + r[0]) / 2,
|
|
@@ -1748,7 +1739,7 @@ function ai(e) {
|
|
|
1748
1739
|
(t[2] + n[2] + r[2]) / 2
|
|
1749
1740
|
];
|
|
1750
1741
|
}
|
|
1751
|
-
var
|
|
1742
|
+
var si = [
|
|
1752
1743
|
[0, 1],
|
|
1753
1744
|
[0, 2],
|
|
1754
1745
|
[0, 3],
|
|
@@ -1762,251 +1753,315 @@ var oi = [
|
|
|
1762
1753
|
[5, 7],
|
|
1763
1754
|
[6, 7]
|
|
1764
1755
|
];
|
|
1765
|
-
function
|
|
1766
|
-
let n =
|
|
1767
|
-
for (let [e, t] of
|
|
1756
|
+
function ci(e, t) {
|
|
1757
|
+
let n = ai(e), r = [];
|
|
1758
|
+
for (let [e, t] of si) {
|
|
1768
1759
|
let i = n[e], a = n[t];
|
|
1769
1760
|
r.push(i.x, i.y, i.z, a.x, a.y, a.z);
|
|
1770
1761
|
}
|
|
1771
1762
|
let i = new a();
|
|
1772
|
-
return i.setAttribute("position", new h(r, 3)), new
|
|
1763
|
+
return i.setAttribute("position", new h(r, 3)), new b(i, Gn(t));
|
|
1773
1764
|
}
|
|
1774
|
-
function
|
|
1775
|
-
let t = 2048, n = Math.max(1, Math.ceil(e.length / 256)), r = new Float32Array(t * n * 4).fill(1), i = new s(
|
|
1765
|
+
function li(e) {
|
|
1766
|
+
let t = 2048, n = Math.max(1, Math.ceil(e.length / 256)), r = new Float32Array(t * n * 4).fill(1), i = new s(Fn), a = new s(), o = !1;
|
|
1776
1767
|
e.forEach((e, n) => {
|
|
1777
1768
|
let s = Math.floor(n / 256), c = n % 256 * 8, l = (s * t + c) * 4, u = 0, d = Math.min(1, e.species[0]?.occupancy ?? 1);
|
|
1778
|
-
for (let t of e.species.slice(1)) u < 7 && (a.set(
|
|
1769
|
+
for (let t of e.species.slice(1)) u < 7 && (a.set(qr(t.element)).toArray(r, l), r[l + 3] = d, l += 4, u += 1), d = Math.min(1, d + t.occupancy);
|
|
1779
1770
|
d < 1 - 1e-6 && (i.toArray(r, l), r[l + 3] = d + 2, o = !0);
|
|
1780
1771
|
});
|
|
1781
|
-
let c = new d(r, t, n,
|
|
1782
|
-
return c.magFilter =
|
|
1772
|
+
let c = new d(r, t, n, oe, g);
|
|
1773
|
+
return c.magFilter = T, c.minFilter = T, c.generateMipmaps = !1, c.needsUpdate = !0, {
|
|
1783
1774
|
texture: c,
|
|
1784
1775
|
hasVacancies: o
|
|
1785
1776
|
};
|
|
1786
1777
|
}
|
|
1787
|
-
function
|
|
1778
|
+
function ui() {
|
|
1788
1779
|
let e = /* @__PURE__ */ new Map();
|
|
1789
1780
|
return (t) => {
|
|
1790
1781
|
let n = e.get(t);
|
|
1791
|
-
return n || (n = new s(
|
|
1782
|
+
return n || (n = new s(qr(t)), e.set(t, n)), n;
|
|
1792
1783
|
};
|
|
1793
1784
|
}
|
|
1794
|
-
function
|
|
1795
|
-
let
|
|
1785
|
+
function di(e, t, n = ui()) {
|
|
1786
|
+
let r = new ae(2, 2), i = li(e), a = new v(r, Vn(t, i.texture, i.hasVacancies), e.length), o = new re();
|
|
1796
1787
|
return e.forEach((e, t) => {
|
|
1797
|
-
|
|
1798
|
-
}),
|
|
1788
|
+
o.makeScale($, $, $), o.setPosition(e.position[0], e.position[1], e.position[2]), a.setMatrixAt(t, o), a.setColorAt(t, n(e.element));
|
|
1789
|
+
}), a.instanceMatrix.needsUpdate = !0, a.instanceColor && (a.instanceColor.needsUpdate = !0), a.userData.sectorTexture = i.texture, a;
|
|
1799
1790
|
}
|
|
1800
|
-
function
|
|
1791
|
+
function fi(e, t, n = ui()) {
|
|
1801
1792
|
if (e.bonds.length === 0) return null;
|
|
1802
|
-
let
|
|
1803
|
-
return e.bonds.forEach((t,
|
|
1793
|
+
let r = new i(2, 1, 2), a = new v(r, Wn(t, ni), e.bonds.length * 2), o = new E(), s = new A(), c = new A(), l = new A(), u = new O();
|
|
1794
|
+
return e.bonds.forEach((t, r) => {
|
|
1804
1795
|
let i = e.atoms[t.start], d = e.atoms[t.end];
|
|
1805
|
-
|
|
1806
|
-
let f =
|
|
1807
|
-
|
|
1796
|
+
s.set(...i.position), c.set(...d.position), l.subVectors(c, s);
|
|
1797
|
+
let f = l.length() / 2;
|
|
1798
|
+
l.normalize(), u.setFromUnitVectors(ii, l);
|
|
1808
1799
|
let p = [[
|
|
1809
1800
|
0,
|
|
1810
1801
|
i,
|
|
1811
|
-
|
|
1802
|
+
ri,
|
|
1812
1803
|
f
|
|
1813
1804
|
], [
|
|
1814
1805
|
1,
|
|
1815
1806
|
d,
|
|
1816
1807
|
f,
|
|
1817
|
-
2 * f -
|
|
1808
|
+
2 * f - ri
|
|
1818
1809
|
]];
|
|
1819
|
-
for (let [e, t, i,
|
|
1820
|
-
let d = Math.max(0,
|
|
1821
|
-
|
|
1810
|
+
for (let [e, t, i, c] of p) {
|
|
1811
|
+
let d = Math.max(0, c - i);
|
|
1812
|
+
o.position.copy(s).addScaledVector(l, i + d / 2), o.quaternion.copy(u), o.scale.set(ti, d, ti), o.updateMatrix(), a.setMatrixAt(r * 2 + e, o.matrix), a.setColorAt(r * 2 + e, n(t.element));
|
|
1822
1813
|
}
|
|
1823
|
-
}),
|
|
1814
|
+
}), a.instanceMatrix.needsUpdate = !0, a.instanceColor && (a.instanceColor.needsUpdate = !0), a;
|
|
1824
1815
|
}
|
|
1825
|
-
function
|
|
1816
|
+
function pi(e) {
|
|
1826
1817
|
let t = e[0];
|
|
1827
1818
|
if (!t) throw Error("A scene model needs at least one layer.");
|
|
1828
|
-
|
|
1829
|
-
let n =
|
|
1819
|
+
Kr(e.flatMap((e) => [...e.scene.elements, ...e.scene.atoms.map((e) => e.element)]));
|
|
1820
|
+
let n = oi(t.scene.cell), i = new _();
|
|
1830
1821
|
i.position.set(-n[0], -n[1], -n[2]);
|
|
1831
|
-
let a = new r(), o = [], s = 1, c = [], l = new
|
|
1822
|
+
let a = new r(), o = [], s = 1, c = [], l = new A(...n), u = new A(), d = new A();
|
|
1832
1823
|
for (let t of e) {
|
|
1833
|
-
for (let e of
|
|
1834
|
-
for (let e of t.scene.atoms) u.set(...e.position).sub(l), a.expandByPoint(
|
|
1824
|
+
for (let e of ai(t.scene.cell)) a.expandByPoint(e.sub(l));
|
|
1825
|
+
for (let e of t.scene.atoms) u.set(...e.position).sub(l), a.expandByPoint(d.copy(u).addScalar($)), a.expandByPoint(d.copy(u).subScalar($));
|
|
1835
1826
|
for (let e of t.scene.cell) s = Math.max(s, Math.hypot(...e));
|
|
1836
1827
|
let e = t.opacity ?? 1;
|
|
1837
1828
|
if (e <= 0) continue;
|
|
1838
|
-
let n =
|
|
1829
|
+
let n = di(t.scene.atoms, e);
|
|
1839
1830
|
i.add(n), c.push(n);
|
|
1840
|
-
let r =
|
|
1831
|
+
let r = fi(t.scene, e);
|
|
1841
1832
|
r && (i.add(r), c.push(r));
|
|
1842
|
-
let
|
|
1843
|
-
i.add(
|
|
1833
|
+
let f = ci(t.scene.cell, e);
|
|
1834
|
+
i.add(f), c.push(f);
|
|
1844
1835
|
for (let e of t.scene.elements) o.includes(e) || o.push(e);
|
|
1845
1836
|
}
|
|
1846
1837
|
return {
|
|
1847
1838
|
group: i,
|
|
1848
1839
|
cell: t.scene.cell,
|
|
1849
|
-
center: n,
|
|
1850
1840
|
bounds: a,
|
|
1851
1841
|
span: s,
|
|
1852
1842
|
elements: o,
|
|
1853
1843
|
dispose() {
|
|
1854
|
-
|
|
1855
|
-
e.geometry.dispose();
|
|
1856
|
-
let t = e.userData.sectorTexture;
|
|
1857
|
-
t instanceof d && t.dispose();
|
|
1858
|
-
}
|
|
1859
|
-
i.clear();
|
|
1844
|
+
mi(c), i.clear();
|
|
1860
1845
|
}
|
|
1861
1846
|
};
|
|
1862
1847
|
}
|
|
1848
|
+
function mi(e) {
|
|
1849
|
+
for (let t of e) {
|
|
1850
|
+
t.geometry.dispose();
|
|
1851
|
+
let e = t.userData.sectorTexture;
|
|
1852
|
+
e instanceof d && e.dispose();
|
|
1853
|
+
}
|
|
1854
|
+
}
|
|
1855
|
+
var hi = {
|
|
1856
|
+
cell: [
|
|
1857
|
+
[
|
|
1858
|
+
1,
|
|
1859
|
+
0,
|
|
1860
|
+
0
|
|
1861
|
+
],
|
|
1862
|
+
[
|
|
1863
|
+
0,
|
|
1864
|
+
1,
|
|
1865
|
+
0
|
|
1866
|
+
],
|
|
1867
|
+
[
|
|
1868
|
+
0,
|
|
1869
|
+
0,
|
|
1870
|
+
1
|
|
1871
|
+
]
|
|
1872
|
+
],
|
|
1873
|
+
atoms: [0, 2].map((e, t) => ({
|
|
1874
|
+
siteIndex: t,
|
|
1875
|
+
element: "X",
|
|
1876
|
+
species: [{
|
|
1877
|
+
element: "X",
|
|
1878
|
+
occupancy: 1
|
|
1879
|
+
}],
|
|
1880
|
+
position: [
|
|
1881
|
+
0,
|
|
1882
|
+
0,
|
|
1883
|
+
e
|
|
1884
|
+
],
|
|
1885
|
+
fractional: [
|
|
1886
|
+
0,
|
|
1887
|
+
0,
|
|
1888
|
+
e
|
|
1889
|
+
],
|
|
1890
|
+
isImage: !1
|
|
1891
|
+
})),
|
|
1892
|
+
bonds: [{
|
|
1893
|
+
start: 0,
|
|
1894
|
+
end: 1,
|
|
1895
|
+
length: 2
|
|
1896
|
+
}],
|
|
1897
|
+
elements: []
|
|
1898
|
+
};
|
|
1899
|
+
function gi() {
|
|
1900
|
+
let e = new s("#ffffff"), t = [];
|
|
1901
|
+
for (let n of [1, .5]) t.push(di(hi.atoms, n, () => e), fi(hi, n, () => e));
|
|
1902
|
+
t.push(ci(hi.cell, 1));
|
|
1903
|
+
let n = new _();
|
|
1904
|
+
return n.add(...t), {
|
|
1905
|
+
group: n,
|
|
1906
|
+
dispose: () => mi(t)
|
|
1907
|
+
};
|
|
1908
|
+
}
|
|
1863
1909
|
//#endregion
|
|
1864
1910
|
//#region src/render/stage.ts
|
|
1865
|
-
function
|
|
1866
|
-
let r = new
|
|
1911
|
+
function _i(t = {}) {
|
|
1912
|
+
let r = new j({
|
|
1867
1913
|
antialias: !0,
|
|
1868
1914
|
alpha: !0,
|
|
1869
1915
|
stencil: t.stencil ?? !1
|
|
1870
1916
|
});
|
|
1871
|
-
r.setClearColor(
|
|
1872
|
-
let i = new
|
|
1873
|
-
i.add(new n("#ffffff",
|
|
1874
|
-
let s = new
|
|
1917
|
+
r.setClearColor(Nn, 1), r.toneMapping = e;
|
|
1918
|
+
let i = new le(), a = new D(-1, 1, 1, -1, .01, 1e3), o = new f("#ffffff", jn);
|
|
1919
|
+
i.add(new n("#ffffff", An), o, o.target);
|
|
1920
|
+
let s = new A();
|
|
1875
1921
|
return {
|
|
1876
1922
|
renderer: r,
|
|
1877
1923
|
scene: i,
|
|
1878
1924
|
camera: a,
|
|
1879
1925
|
updateHeadlight() {
|
|
1880
1926
|
let e = Math.max(a.position.length(), 4);
|
|
1881
|
-
s.set(...
|
|
1927
|
+
s.set(...Mn).multiplyScalar(e).applyQuaternion(a.quaternion), o.position.copy(a.position).add(s);
|
|
1882
1928
|
}
|
|
1883
1929
|
};
|
|
1884
1930
|
}
|
|
1885
1931
|
//#endregion
|
|
1886
1932
|
//#region src/render/viewer.ts
|
|
1887
|
-
var
|
|
1888
|
-
function
|
|
1889
|
-
let r = new
|
|
1933
|
+
var vi = .4, yi = .4, bi = .4, xi = 2, Si = 1.2, Ci = .2, wi = 1500, Ti = .2, Ei = 5, Di = 3, Oi = 1e-5, ki = 4, Ai = .35, ji = 110, Mi = 180;
|
|
1934
|
+
function Ni(e, t, n) {
|
|
1935
|
+
let r = new A(0, 0, 1).applyQuaternion(n), i = 0, a = 0, o = new A();
|
|
1890
1936
|
for (let t of [e.bounds.min.x, e.bounds.max.x]) for (let n of [e.bounds.min.y, e.bounds.max.y]) for (let s of [e.bounds.min.z, e.bounds.max.z]) {
|
|
1891
1937
|
let e = o.set(t, n, s).dot(r);
|
|
1892
1938
|
i = Math.max(i, e), a = Math.min(a, e);
|
|
1893
1939
|
}
|
|
1894
|
-
let s = Math.max(1, e.span), c = Math.max(.01 * s, -a), l = Math.min(c, -i), u = s *
|
|
1895
|
-
return new
|
|
1940
|
+
let s = Math.max(1, e.span), c = Math.max(.01 * s, -a), l = Math.min(c, -i), u = s * bi, d = l - u, f = t + (d + (Math.max(d, c - u) - d) * yi), p = f + (t + c - f) / vi;
|
|
1941
|
+
return new ee(Nn, f, p);
|
|
1896
1942
|
}
|
|
1897
|
-
function
|
|
1943
|
+
function Pi(e, t = {}) {
|
|
1898
1944
|
let n = e.ownerDocument;
|
|
1899
|
-
|
|
1900
|
-
let { renderer: r, scene: i, camera: a, updateHeadlight: o } =
|
|
1945
|
+
Qr(n), e.classList.add("bravais-viewer");
|
|
1946
|
+
let { renderer: r, scene: i, camera: a, updateHeadlight: o } = _i({ stencil: !0 });
|
|
1901
1947
|
r.setPixelRatio(n.defaultView?.devicePixelRatio ?? 1), r.domElement.className = "bravais-canvas", e.appendChild(r.domElement);
|
|
1902
|
-
let s = t.legend === !1 ? null : new
|
|
1948
|
+
let s = t.legend === !1 ? null : new ei(n);
|
|
1903
1949
|
s && e.appendChild(s.element);
|
|
1904
|
-
let c = n.defaultView?.getComputedStyle(e).fontFamily ?? "sans-serif", l = t.gizmo === !1 ? null : new
|
|
1905
|
-
u.rotateSpeed =
|
|
1906
|
-
let d = null, f =
|
|
1907
|
-
function
|
|
1908
|
-
|
|
1909
|
-
for (let e of
|
|
1910
|
-
}
|
|
1911
|
-
function
|
|
1912
|
-
if (o(), r.setViewport(0, 0,
|
|
1913
|
-
let e = Math.round(Math.min(
|
|
1950
|
+
let c = n.defaultView?.getComputedStyle(e).fontFamily ?? "sans-serif", l = t.gizmo === !1 ? null : new cr(c), u = new Yt(a, r.domElement);
|
|
1951
|
+
u.rotateSpeed = xi, u.zoomSpeed = Si, u.dynamicDampingFactor = Ci, u.staticMoving = !1, u.noPan = !0, u.mouseButtons.LEFT = S.ROTATE, u.mouseButtons.MIDDLE = S.DOLLY, u.mouseButtons.RIGHT = null;
|
|
1952
|
+
let d = null, f = null, p = 4, m = 1, h = 1, g = 1, _ = null, v = !1, y = 0, b = !1, x = 0, te = !1, ne = new k(), re = new O(), C = 0, w = new A(), T = /* @__PURE__ */ new Set();
|
|
1953
|
+
function ie() {
|
|
1954
|
+
x = 0, te = !1;
|
|
1955
|
+
for (let e of T) e();
|
|
1956
|
+
}
|
|
1957
|
+
function E() {
|
|
1958
|
+
if (!f && (o(), r.setViewport(0, 0, h, g), r.render(i, a), l && d)) {
|
|
1959
|
+
let e = Math.round(Math.min(Mi, Math.max(ji, Math.min(h, g) * Ai)));
|
|
1914
1960
|
l.render(r, a.quaternion, e);
|
|
1915
1961
|
}
|
|
1916
1962
|
}
|
|
1917
|
-
function
|
|
1963
|
+
function D() {
|
|
1918
1964
|
let t = e.getBoundingClientRect();
|
|
1919
|
-
|
|
1965
|
+
h = Math.max(1, Math.round(t.width)), g = Math.max(1, Math.round(t.height));
|
|
1920
1966
|
let n = r.getSize(ne);
|
|
1921
|
-
(n.x !==
|
|
1967
|
+
(n.x !== h || n.y !== g) && r.setSize(h, g, !1), Dn(a, h, g), u.handleResize(), u.rotateSpeed = h / wi * xi;
|
|
1922
1968
|
}
|
|
1923
|
-
function
|
|
1924
|
-
d && (
|
|
1969
|
+
function ae(e) {
|
|
1970
|
+
d && (m = En(d.bounds, e, h, g), u.minZoom = m * Ti, u.maxZoom = m * Ei);
|
|
1925
1971
|
}
|
|
1926
|
-
function
|
|
1927
|
-
let e = re.angleTo(a.quaternion) >
|
|
1928
|
-
return re.copy(a.quaternion),
|
|
1972
|
+
function oe() {
|
|
1973
|
+
let e = re.angleTo(a.quaternion) > Oi || Math.abs(C - a.zoom) > Oi * m || w.distanceToSquared(u.target) > Oi;
|
|
1974
|
+
return re.copy(a.quaternion), C = a.zoom, w.copy(u.target), e;
|
|
1929
1975
|
}
|
|
1930
1976
|
function se() {
|
|
1931
|
-
|
|
1932
|
-
}
|
|
1933
|
-
function D() {
|
|
1934
|
-
v = 0, _ || (_ = !0, g = requestAnimationFrame(se));
|
|
1977
|
+
_ = null, u.update(), oe() ? (y = 0, E(), x += 1, te = !0, x >= ki && ie()) : y += 1, b || y < Di ? _ = requestAnimationFrame(se) : (v = !1, te && ie());
|
|
1935
1978
|
}
|
|
1936
1979
|
function ce() {
|
|
1937
|
-
|
|
1980
|
+
y = 0, v || (v = !0, _ = requestAnimationFrame(se));
|
|
1938
1981
|
}
|
|
1939
|
-
u.addEventListener("start", () => {
|
|
1940
|
-
y = !0, D();
|
|
1941
|
-
}), u.addEventListener("end", () => {
|
|
1942
|
-
y = !1, D();
|
|
1943
|
-
}), u.addEventListener("change", D);
|
|
1944
1982
|
function le() {
|
|
1945
|
-
|
|
1946
|
-
ae(), oe(a.quaternion), a.zoom = p * e, a.updateProjectionMatrix(), w();
|
|
1983
|
+
_ !== null && (cancelAnimationFrame(_), _ = null), v = !1;
|
|
1947
1984
|
}
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1985
|
+
u.addEventListener("start", () => {
|
|
1986
|
+
b = !0, ce();
|
|
1987
|
+
}), u.addEventListener("end", () => {
|
|
1988
|
+
b = !1, ce();
|
|
1989
|
+
}), u.addEventListener("change", ce);
|
|
1990
|
+
function ue() {
|
|
1991
|
+
let e = m > 0 ? a.zoom / m : 1;
|
|
1992
|
+
D(), ae(a.quaternion), a.zoom = m * e, a.updateProjectionMatrix(), E();
|
|
1993
|
+
}
|
|
1994
|
+
let de = typeof ResizeObserver > "u" ? null : new ResizeObserver(ue);
|
|
1995
|
+
de?.observe(e), D();
|
|
1996
|
+
let fe = gi();
|
|
1997
|
+
i.add(fe.group), i.fog = new ee(Nn, 1, 2);
|
|
1998
|
+
let j = Promise.all([r.compileAsync(i, a), l && r.compileAsync(l.scene, l.camera)]);
|
|
1999
|
+
i.remove(fe.group), i.fog = null, fe.dispose(), f = j;
|
|
2000
|
+
let M = () => {
|
|
2001
|
+
f === j && (f = null, E());
|
|
2002
|
+
};
|
|
2003
|
+
j.then(M, M);
|
|
2004
|
+
function N(e) {
|
|
2005
|
+
d && (Cn(a, e, p, d.span), u.target.set(...e.target), ae(a.quaternion), a.zoom = m * e.scale, a.updateProjectionMatrix(), u.update(), oe());
|
|
1952
2006
|
}
|
|
1953
|
-
let
|
|
2007
|
+
let P = {
|
|
1954
2008
|
setLayers(e, t = null) {
|
|
1955
|
-
|
|
2009
|
+
P.clear(), e.length !== 0 && (d = pi(e), i.add(d.group), p = bn(d.span), i.fog = Ni(d, p, xn(d.cell)), s?.setElements(d.elements), l?.setCell(d.cell), D(), N(t ?? Sn(d.cell)), E());
|
|
1956
2010
|
},
|
|
1957
2011
|
clear() {
|
|
1958
|
-
|
|
2012
|
+
le(), d &&= (i.remove(d.group), d.dispose(), null), i.fog = null, s?.setElements([]), r.setViewport(0, 0, h, g), r.clear();
|
|
1959
2013
|
},
|
|
1960
2014
|
getView() {
|
|
1961
2015
|
return d ? {
|
|
1962
|
-
quaternion:
|
|
2016
|
+
quaternion: wn(a.quaternion),
|
|
1963
2017
|
target: [
|
|
1964
2018
|
u.target.x,
|
|
1965
2019
|
u.target.y,
|
|
1966
2020
|
u.target.z
|
|
1967
2021
|
],
|
|
1968
|
-
scale:
|
|
2022
|
+
scale: m > 0 ? a.zoom / m : 1
|
|
1969
2023
|
} : null;
|
|
1970
2024
|
},
|
|
1971
2025
|
setView(e) {
|
|
1972
|
-
|
|
2026
|
+
N(e), E();
|
|
1973
2027
|
},
|
|
1974
2028
|
resetView() {
|
|
1975
|
-
d &&
|
|
2029
|
+
d && N(Sn(d.cell)), E(), ie();
|
|
1976
2030
|
},
|
|
1977
|
-
resize:
|
|
1978
|
-
render:
|
|
2031
|
+
resize: ue,
|
|
2032
|
+
render: E,
|
|
1979
2033
|
onInteraction(e) {
|
|
1980
|
-
return
|
|
2034
|
+
return T.add(e), () => T.delete(e);
|
|
1981
2035
|
},
|
|
1982
2036
|
dispose() {
|
|
1983
|
-
|
|
2037
|
+
P.clear(), f = null, de?.disconnect(), u.dispose(), l?.dispose(), r.dispose(), r.domElement.remove(), s?.element.remove(), e.classList.remove("bravais-viewer");
|
|
1984
2038
|
}
|
|
1985
2039
|
};
|
|
1986
|
-
return
|
|
2040
|
+
return P;
|
|
1987
2041
|
}
|
|
1988
2042
|
//#endregion
|
|
1989
2043
|
//#region src/render/thumbnails.ts
|
|
1990
|
-
function
|
|
1991
|
-
let { renderer: e, scene: t, camera: n, updateHeadlight: r } =
|
|
1992
|
-
|
|
2044
|
+
function Fi() {
|
|
2045
|
+
let { renderer: e, scene: t, camera: n, updateHeadlight: r } = _i(), i = /* @__PURE__ */ new Map(), a = gi();
|
|
2046
|
+
t.add(a.group), e.compile(t, n), t.remove(a.group), a.dispose();
|
|
2047
|
+
function o(e, t) {
|
|
1993
2048
|
let n = i.get(e);
|
|
1994
2049
|
if (n && n.layers === t) return n.model;
|
|
1995
2050
|
n?.model.dispose();
|
|
1996
|
-
let r =
|
|
2051
|
+
let r = pi(t);
|
|
1997
2052
|
return i.set(e, {
|
|
1998
2053
|
layers: t,
|
|
1999
2054
|
model: r
|
|
2000
2055
|
}), r;
|
|
2001
2056
|
}
|
|
2002
2057
|
return {
|
|
2003
|
-
render(i,
|
|
2058
|
+
render(i, a, s, c) {
|
|
2004
2059
|
let l = c.getContext("2d");
|
|
2005
|
-
if (!l ||
|
|
2006
|
-
let u =
|
|
2007
|
-
(e.domElement.width !== d || e.domElement.height !== f) && e.setSize(d, f, !1),
|
|
2008
|
-
let p =
|
|
2009
|
-
|
|
2060
|
+
if (!l || a.length === 0) return;
|
|
2061
|
+
let u = o(i, a), d = Math.max(1, c.width), f = Math.max(1, c.height);
|
|
2062
|
+
(e.domElement.width !== d || e.domElement.height !== f) && e.setSize(d, f, !1), Dn(n, d, f);
|
|
2063
|
+
let p = bn(u.span), m = s ?? Sn(u.cell);
|
|
2064
|
+
Cn(n, m, p, u.span), n.zoom = En(u.bounds, new O(...m.quaternion), d, f) * m.scale, n.updateProjectionMatrix(), r(), t.add(u.group), e.render(t, n), t.remove(u.group), l.clearRect(0, 0, d, f), l.drawImage(e.domElement, 0, 0, d, f);
|
|
2010
2065
|
},
|
|
2011
2066
|
release(e) {
|
|
2012
2067
|
i.get(e)?.model.dispose(), i.delete(e);
|
|
@@ -2019,18 +2074,18 @@ function ji() {
|
|
|
2019
2074
|
}
|
|
2020
2075
|
//#endregion
|
|
2021
2076
|
//#region src/index.ts
|
|
2022
|
-
async function
|
|
2023
|
-
let t =
|
|
2024
|
-
if (!n) throw new
|
|
2025
|
-
let r =
|
|
2077
|
+
async function Ii(e) {
|
|
2078
|
+
let t = ve(e), n = t.blocks.find(Ze) ?? t.blocks[0];
|
|
2079
|
+
if (!n) throw new N("The CIF has no data block.");
|
|
2080
|
+
let r = Qe(n);
|
|
2026
2081
|
return {
|
|
2027
2082
|
lattice: r.lattice,
|
|
2028
2083
|
sites: r.sites,
|
|
2029
|
-
operations: await
|
|
2084
|
+
operations: await yt(r),
|
|
2030
2085
|
spaceGroup: r.spaceGroup
|
|
2031
2086
|
};
|
|
2032
2087
|
}
|
|
2033
2088
|
//#endregion
|
|
2034
|
-
export {
|
|
2089
|
+
export { N as CifStructureError, M as CifSyntaxError, it as SpaceGroupLookupError, St as SymmetryAnalysisError, Lt as buildScene, Fi as createThumbnailRenderer, Pi as createViewer, qr as elementColor, Jr as elementColorAssignments, Kr as ensureElementColors, at as ensureMoyo, bt as expandStructure, Pe as latticeFromParameters, Fe as latticeFromVectors, pt as operationsForSpaceGroup, ve as parseCif, Qe as parseCifStructure, Be as parseSymmetryOperation, Ii as readCif, Yr as resetElementColors, It as structureElements, Tt as symmetryDataset, kt as typesetSymbol };
|
|
2035
2090
|
|
|
2036
2091
|
//# sourceMappingURL=bravais.js.map
|