bravais 0.1.4 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +10 -1
- package/THIRD_PARTY_NOTICES.md +11 -3
- package/dist/bravais.js +558 -493
- package/dist/bravais.js.map +1 -1
- package/dist/types/render/model.d.ts +9 -0
- package/dist/types/render/viewer.d.ts +4 -2
- package/examples/CoO.cif +254 -0
- package/package.json +2 -1
package/dist/bravais.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
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
|
|
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 C, Mesh as w, MeshStandardMaterial as T, NearestFilter as E, NotEqualStencilFunc as D, Object3D as O, OrthographicCamera as k, PlaneGeometry as re, Quaternion as A, RGBAFormat as ie, ReplaceStencilOp as ae, SRGBColorSpace as oe, Scene as se, SphereGeometry as ce, Sprite as le, SpriteMaterial as ue, Vector2 as j, Vector3 as M, WebGLRenderer as N } from "three";
|
|
2
2
|
//#region src/cif/tokenizer.ts
|
|
3
|
-
var
|
|
3
|
+
var P = 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
8
|
};
|
|
9
|
-
function
|
|
9
|
+
function F(e) {
|
|
10
10
|
return e === " " || e === " " || e === "\r" || e === "\n";
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function de(e, t) {
|
|
13
13
|
let n = e.toLowerCase();
|
|
14
14
|
return e.startsWith("_") ? {
|
|
15
15
|
kind: "tag",
|
|
@@ -37,7 +37,7 @@ function me(e, t) {
|
|
|
37
37
|
line: t
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function fe(e) {
|
|
41
41
|
let t = [], n = e.split(/\r\n|\r|\n/), r = 0;
|
|
42
42
|
for (; r < n.length;) {
|
|
43
43
|
let e = n[r] ?? "", i = r + 1;
|
|
@@ -54,7 +54,7 @@ function he(e) {
|
|
|
54
54
|
}
|
|
55
55
|
a.push(e), r += 1;
|
|
56
56
|
}
|
|
57
|
-
if (!o) throw new
|
|
57
|
+
if (!o) throw new P("unterminated text field", i);
|
|
58
58
|
t.push({
|
|
59
59
|
kind: "value",
|
|
60
60
|
text: a.join("\n"),
|
|
@@ -65,7 +65,7 @@ function he(e) {
|
|
|
65
65
|
let a = 0;
|
|
66
66
|
for (; a < e.length;) {
|
|
67
67
|
let n = e.charAt(a);
|
|
68
|
-
if (
|
|
68
|
+
if (F(n)) {
|
|
69
69
|
a += 1;
|
|
70
70
|
continue;
|
|
71
71
|
}
|
|
@@ -74,15 +74,15 @@ function he(e) {
|
|
|
74
74
|
let r = a + 1;
|
|
75
75
|
for (; r < e.length;) {
|
|
76
76
|
let t = e.indexOf(n, r);
|
|
77
|
-
if (t === -1) throw new
|
|
77
|
+
if (t === -1) throw new P("unterminated quoted string", i);
|
|
78
78
|
let a = e.charAt(t + 1);
|
|
79
|
-
if (t + 1 >= e.length ||
|
|
79
|
+
if (t + 1 >= e.length || F(a)) {
|
|
80
80
|
r = t;
|
|
81
81
|
break;
|
|
82
82
|
}
|
|
83
83
|
r = t + 1;
|
|
84
84
|
}
|
|
85
|
-
if (r >= e.length) throw new
|
|
85
|
+
if (r >= e.length) throw new P("unterminated quoted string", i);
|
|
86
86
|
t.push({
|
|
87
87
|
kind: "value",
|
|
88
88
|
text: e.slice(a + 1, r),
|
|
@@ -91,8 +91,8 @@ function he(e) {
|
|
|
91
91
|
continue;
|
|
92
92
|
}
|
|
93
93
|
let r = a;
|
|
94
|
-
for (; r < e.length && !
|
|
95
|
-
t.push(
|
|
94
|
+
for (; r < e.length && !F(e.charAt(r));) r += 1;
|
|
95
|
+
t.push(de(e.slice(a, r), i)), a = r;
|
|
96
96
|
}
|
|
97
97
|
r += 1;
|
|
98
98
|
}
|
|
@@ -100,10 +100,10 @@ function he(e) {
|
|
|
100
100
|
}
|
|
101
101
|
//#endregion
|
|
102
102
|
//#region src/cif/parser.ts
|
|
103
|
-
function
|
|
103
|
+
function pe(e) {
|
|
104
104
|
return typeof e == "string" ? [e] : e;
|
|
105
105
|
}
|
|
106
|
-
var
|
|
106
|
+
var me = class {
|
|
107
107
|
name;
|
|
108
108
|
items = /* @__PURE__ */ new Map();
|
|
109
109
|
loops = [];
|
|
@@ -111,41 +111,41 @@ var _e = class {
|
|
|
111
111
|
this.name = e;
|
|
112
112
|
}
|
|
113
113
|
get(e) {
|
|
114
|
-
for (let t of
|
|
114
|
+
for (let t of pe(e)) {
|
|
115
115
|
let e = this.items.get(t.toLowerCase());
|
|
116
116
|
if (e !== void 0) return e;
|
|
117
117
|
}
|
|
118
118
|
return null;
|
|
119
119
|
}
|
|
120
120
|
findLoop(e) {
|
|
121
|
-
for (let t of
|
|
121
|
+
for (let t of pe(e)) {
|
|
122
122
|
let e = t.toLowerCase(), n = this.loops.find((t) => t.tags.includes(e));
|
|
123
123
|
if (n) return n;
|
|
124
124
|
}
|
|
125
125
|
return null;
|
|
126
126
|
}
|
|
127
127
|
};
|
|
128
|
-
function
|
|
129
|
-
for (let n of
|
|
128
|
+
function I(e, t) {
|
|
129
|
+
for (let n of pe(t)) {
|
|
130
130
|
let t = e.tags.indexOf(n.toLowerCase());
|
|
131
131
|
if (t !== -1) return e.rows.map((e) => e[t] ?? "?");
|
|
132
132
|
}
|
|
133
133
|
return null;
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function L(e) {
|
|
136
136
|
return e === "?" || e === ".";
|
|
137
137
|
}
|
|
138
|
-
function
|
|
139
|
-
if (e == null ||
|
|
138
|
+
function R(e) {
|
|
139
|
+
if (e == null || L(e)) return null;
|
|
140
140
|
let t = e.replace(/\(\d+\)$/, "").trim();
|
|
141
141
|
return /^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(t) ? Number(t) : null;
|
|
142
142
|
}
|
|
143
|
-
function
|
|
143
|
+
function he(e) {
|
|
144
144
|
return e === void 0 || e.kind !== "value";
|
|
145
145
|
}
|
|
146
|
-
function
|
|
147
|
-
let t =
|
|
148
|
-
if (r || (r = new
|
|
146
|
+
function ge(e) {
|
|
147
|
+
let t = fe(e), n = [], r = null, i = 0, a = 0, o = (e) => {
|
|
148
|
+
if (r || (r = new me(""), n.push(r)), a > 0) throw new P(`unexpected ${e.kind} inside a save frame`, e.line);
|
|
149
149
|
return r;
|
|
150
150
|
};
|
|
151
151
|
for (; i < t.length;) {
|
|
@@ -153,7 +153,7 @@ function ye(e) {
|
|
|
153
153
|
if (!e) break;
|
|
154
154
|
switch (e.kind) {
|
|
155
155
|
case "data":
|
|
156
|
-
r = new
|
|
156
|
+
r = new me(e.text), n.push(r), a = 0, i += 1;
|
|
157
157
|
break;
|
|
158
158
|
case "save":
|
|
159
159
|
a = e.text === "" ? Math.max(0, a - 1) : a + 1, i += 1;
|
|
@@ -167,18 +167,18 @@ function ye(e) {
|
|
|
167
167
|
break;
|
|
168
168
|
}
|
|
169
169
|
let n = o(e), r = t[i + 1];
|
|
170
|
-
if (!r || r.kind !== "value") throw new
|
|
170
|
+
if (!r || r.kind !== "value") throw new P(`tag ${e.text} has no value`, e.line);
|
|
171
171
|
n.items.set(e.text.toLowerCase(), r.text), i += 2;
|
|
172
172
|
break;
|
|
173
173
|
}
|
|
174
174
|
case "loop": {
|
|
175
175
|
let n = [];
|
|
176
176
|
for (i += 1; t[i]?.kind === "tag";) n.push(t[i].text.toLowerCase()), i += 1;
|
|
177
|
-
if (n.length === 0) throw new
|
|
177
|
+
if (n.length === 0) throw new P("loop_ without tags", e.line);
|
|
178
178
|
let r = [];
|
|
179
|
-
for (; !
|
|
179
|
+
for (; !he(t[i]);) r.push(t[i].text), i += 1;
|
|
180
180
|
if (a > 0) break;
|
|
181
|
-
if (r.length % n.length !== 0) throw new
|
|
181
|
+
if (r.length % n.length !== 0) throw new P(`loop with ${n.length} tags has ${r.length} values`, e.line);
|
|
182
182
|
let s = [];
|
|
183
183
|
for (let e = 0; e < r.length; e += n.length) s.push(r.slice(e, e + n.length));
|
|
184
184
|
o(e).loops.push({
|
|
@@ -187,60 +187,60 @@ function ye(e) {
|
|
|
187
187
|
});
|
|
188
188
|
break;
|
|
189
189
|
}
|
|
190
|
-
case "value": throw new
|
|
190
|
+
case "value": throw new P(`unexpected value ${JSON.stringify(e.text)}`, e.line);
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
return { blocks: n };
|
|
194
194
|
}
|
|
195
195
|
//#endregion
|
|
196
196
|
//#region src/structure/elements.ts
|
|
197
|
-
var
|
|
198
|
-
function
|
|
199
|
-
return
|
|
197
|
+
var _e = /* @__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("."), ve = new Set(_e);
|
|
198
|
+
function ye(e) {
|
|
199
|
+
return ve.has(e) || e === "D";
|
|
200
200
|
}
|
|
201
|
-
function
|
|
201
|
+
function be(e) {
|
|
202
202
|
return e.charAt(0).toUpperCase() + e.slice(1).toLowerCase();
|
|
203
203
|
}
|
|
204
|
-
function
|
|
204
|
+
function xe(e) {
|
|
205
205
|
let t = e.match(/^[A-Za-z]{1,2}/)?.[0];
|
|
206
206
|
if (!t) return null;
|
|
207
|
-
let n =
|
|
208
|
-
if (t.length === 2 &&
|
|
207
|
+
let n = be(t);
|
|
208
|
+
if (t.length === 2 && ye(n)) return n;
|
|
209
209
|
let r = t.charAt(0).toUpperCase();
|
|
210
|
-
return
|
|
210
|
+
return ye(r) ? r : null;
|
|
211
211
|
}
|
|
212
|
-
function
|
|
212
|
+
function Se(e) {
|
|
213
213
|
return e === "D" ? "H" : e;
|
|
214
214
|
}
|
|
215
215
|
//#endregion
|
|
216
216
|
//#region src/structure/fractional.ts
|
|
217
|
-
var
|
|
218
|
-
function
|
|
217
|
+
var Ce = .001, we = 1e-9;
|
|
218
|
+
function z(e, t = we) {
|
|
219
219
|
let n = e - Math.floor(e);
|
|
220
220
|
return n >= 1 - t ? 0 : n;
|
|
221
221
|
}
|
|
222
|
-
function
|
|
222
|
+
function Te(e) {
|
|
223
223
|
return [
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
224
|
+
z(e[0]),
|
|
225
|
+
z(e[1]),
|
|
226
|
+
z(e[2])
|
|
227
227
|
];
|
|
228
228
|
}
|
|
229
|
-
function
|
|
229
|
+
function Ee(e, t, n) {
|
|
230
230
|
for (let r = 0; r < 3; r += 1) {
|
|
231
231
|
let i = Math.abs(e[r] - t[r]);
|
|
232
232
|
if (i -= Math.round(i), Math.abs(i) > n) return !1;
|
|
233
233
|
}
|
|
234
234
|
return !0;
|
|
235
235
|
}
|
|
236
|
-
var
|
|
237
|
-
function
|
|
238
|
-
return Math.floor(
|
|
236
|
+
var B = 100;
|
|
237
|
+
function De(e) {
|
|
238
|
+
return Math.floor(z(e) * B) % B;
|
|
239
239
|
}
|
|
240
|
-
function
|
|
241
|
-
return (e *
|
|
240
|
+
function Oe(e, t, n) {
|
|
241
|
+
return (e * B + t) * B + n;
|
|
242
242
|
}
|
|
243
|
-
var
|
|
243
|
+
var ke = class {
|
|
244
244
|
tolerance;
|
|
245
245
|
buckets = /* @__PURE__ */ new Map();
|
|
246
246
|
positions = [];
|
|
@@ -250,25 +250,25 @@ var Ae = class {
|
|
|
250
250
|
add(e) {
|
|
251
251
|
let t = this.positions.length;
|
|
252
252
|
this.positions.push(e);
|
|
253
|
-
let n =
|
|
253
|
+
let n = Oe(De(e[0]), De(e[1]), De(e[2])), r = this.buckets.get(n);
|
|
254
254
|
return r ? r.push(t) : this.buckets.set(n, [t]), t;
|
|
255
255
|
}
|
|
256
256
|
near(e) {
|
|
257
|
-
let t =
|
|
257
|
+
let t = Te(e), [n, r, i] = t.map(De), a = [];
|
|
258
258
|
for (let e = -1; e <= 1; e += 1) {
|
|
259
|
-
let o = (n + e +
|
|
259
|
+
let o = (n + e + B) % B;
|
|
260
260
|
for (let e = -1; e <= 1; e += 1) {
|
|
261
|
-
let n = (r + e +
|
|
261
|
+
let n = (r + e + B) % B;
|
|
262
262
|
for (let e = -1; e <= 1; e += 1) {
|
|
263
|
-
let r = (i + e +
|
|
264
|
-
for (let e of this.buckets.get(
|
|
263
|
+
let r = (i + e + B) % B;
|
|
264
|
+
for (let e of this.buckets.get(Oe(o, n, r)) ?? []) Ee(this.positions[e], t, this.tolerance) && a.push(e);
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
268
|
return a.sort((e, t) => e - t);
|
|
269
269
|
}
|
|
270
270
|
};
|
|
271
|
-
function
|
|
271
|
+
function Ae(e, t) {
|
|
272
272
|
let n = e.rotation, [r, i, a] = t, o = e.translation;
|
|
273
273
|
return [
|
|
274
274
|
(n[0] ?? 0) * r + (n[1] ?? 0) * i + (n[2] ?? 0) * a + o[0],
|
|
@@ -278,12 +278,12 @@ function je(e, t) {
|
|
|
278
278
|
}
|
|
279
279
|
//#endregion
|
|
280
280
|
//#region src/structure/lattice.ts
|
|
281
|
-
var
|
|
282
|
-
function
|
|
281
|
+
var V = Math.PI / 180;
|
|
282
|
+
function je(e, t, n) {
|
|
283
283
|
return Math.min(n, Math.max(t, e));
|
|
284
284
|
}
|
|
285
|
-
function
|
|
286
|
-
let { a: t, b: n, c: r } = e, i = e.alpha *
|
|
285
|
+
function Me(e) {
|
|
286
|
+
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(je((s * c - l) / (u * d), -1, 1)), p = [
|
|
287
287
|
t * d,
|
|
288
288
|
0,
|
|
289
289
|
t * c
|
|
@@ -305,8 +305,8 @@ function Ne(e) {
|
|
|
305
305
|
]
|
|
306
306
|
};
|
|
307
307
|
}
|
|
308
|
-
function
|
|
309
|
-
let [t, n, r] = e, i = (e) => Math.hypot(e[0], e[1], e[2]), a = (e, t) => Math.acos(
|
|
308
|
+
function Ne(e) {
|
|
309
|
+
let [t, n, r] = e, i = (e) => Math.hypot(e[0], e[1], e[2]), a = (e, t) => Math.acos(je((e[0] * t[0] + e[1] * t[1] + e[2] * t[2]) / (i(e) * i(t)), -1, 1)) / V;
|
|
310
310
|
return {
|
|
311
311
|
a: i(t),
|
|
312
312
|
b: i(n),
|
|
@@ -317,7 +317,7 @@ function Pe(e) {
|
|
|
317
317
|
vectors: e
|
|
318
318
|
};
|
|
319
319
|
}
|
|
320
|
-
function
|
|
320
|
+
function Pe(e, t) {
|
|
321
321
|
let [n, r, i] = e.vectors, [a, o, s] = t;
|
|
322
322
|
return [
|
|
323
323
|
a * n[0] + o * r[0] + s * i[0],
|
|
@@ -325,49 +325,49 @@ function Fe(e, t) {
|
|
|
325
325
|
a * n[2] + o * r[2] + s * i[2]
|
|
326
326
|
];
|
|
327
327
|
}
|
|
328
|
-
function
|
|
328
|
+
function Fe(e, t) {
|
|
329
329
|
let n = e[0] - t[0], r = e[1] - t[1], i = e[2] - t[2];
|
|
330
330
|
return Math.sqrt(n * n + r * r + i * i);
|
|
331
331
|
}
|
|
332
332
|
//#endregion
|
|
333
333
|
//#region src/cif/errors.ts
|
|
334
|
-
var
|
|
334
|
+
var H = class extends Error {
|
|
335
335
|
constructor(e) {
|
|
336
336
|
super(e), this.name = "CifStructureError";
|
|
337
337
|
}
|
|
338
|
-
},
|
|
338
|
+
}, Ie = [
|
|
339
339
|
"x",
|
|
340
340
|
"y",
|
|
341
341
|
"z"
|
|
342
342
|
];
|
|
343
|
-
function
|
|
343
|
+
function Le(e) {
|
|
344
344
|
if (e === "" || e === "+") return 1;
|
|
345
345
|
if (e === "-") return -1;
|
|
346
346
|
let t = e.match(/^([+-]?\d+)\/(\d+)$/), n = t ? Number(t[1]) / Number(t[2]) : Number(e);
|
|
347
|
-
if (!Number.isFinite(n)) throw new
|
|
347
|
+
if (!Number.isFinite(n)) throw new H(`Cannot read the number ${JSON.stringify(e)} in a symmetry operator.`);
|
|
348
348
|
return n;
|
|
349
349
|
}
|
|
350
|
-
function
|
|
350
|
+
function Re(e) {
|
|
351
351
|
let t = e.split(",").map((e) => e.toLowerCase().replace(/[^xyz0-9./+-]/g, ""));
|
|
352
|
-
if (t.length !== 3) throw new
|
|
352
|
+
if (t.length !== 3) throw new H(`A symmetry operator needs three components: ${JSON.stringify(e)}.`);
|
|
353
353
|
let n = [], r = [];
|
|
354
354
|
for (let i of t) {
|
|
355
355
|
let t = i.match(/[+-]?[^+-]+/g);
|
|
356
|
-
if (!t || t.join("") !== i) throw new
|
|
356
|
+
if (!t || t.join("") !== i) throw new H(`Cannot read the symmetry operator ${JSON.stringify(e)}.`);
|
|
357
357
|
let a = [
|
|
358
358
|
0,
|
|
359
359
|
0,
|
|
360
360
|
0
|
|
361
361
|
], o = 0;
|
|
362
362
|
for (let e of t) {
|
|
363
|
-
let t =
|
|
364
|
-
if (t === -1) o +=
|
|
363
|
+
let t = Ie.findIndex((t) => e.includes(t));
|
|
364
|
+
if (t === -1) o += Le(e);
|
|
365
365
|
else {
|
|
366
|
-
let n =
|
|
366
|
+
let n = Le(e.replace(Ie[t], "").replace(/\*$/, ""));
|
|
367
367
|
a[t] = (a[t] ?? 0) + n;
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
|
-
n.push(...a), r.push(
|
|
370
|
+
n.push(...a), r.push(z(o));
|
|
371
371
|
}
|
|
372
372
|
return {
|
|
373
373
|
rotation: n,
|
|
@@ -376,99 +376,99 @@ function ze(e) {
|
|
|
376
376
|
}
|
|
377
377
|
//#endregion
|
|
378
378
|
//#region src/cif/structure.ts
|
|
379
|
-
var
|
|
379
|
+
var ze = 1e-4, Be = ["_space_group_symop_operation_xyz", "_symmetry_equiv_pos_as_xyz"], Ve = ["_space_group_it_number", "_symmetry_int_tables_number"], He = [
|
|
380
380
|
"_space_group_name_h-m_alt",
|
|
381
381
|
"_symmetry_space_group_name_h-m",
|
|
382
382
|
"_space_group_name_h-m_full"
|
|
383
|
-
],
|
|
384
|
-
function
|
|
385
|
-
let n =
|
|
386
|
-
if (n === null) throw new
|
|
383
|
+
], Ue = ["_space_group_name_hall", "_symmetry_space_group_name_hall"];
|
|
384
|
+
function U(e, t) {
|
|
385
|
+
let n = R(e.get(t));
|
|
386
|
+
if (n === null) throw new H(`${e.name || "The CIF"} has no usable ${t}.`);
|
|
387
387
|
return n;
|
|
388
388
|
}
|
|
389
|
-
function
|
|
389
|
+
function We(e, t, n) {
|
|
390
390
|
let r = e.find((e) => e.element === t);
|
|
391
391
|
r ? r.occupancy += n : e.push({
|
|
392
392
|
element: t,
|
|
393
393
|
occupancy: n
|
|
394
394
|
}), e.sort((e, t) => t.occupancy - e.occupancy);
|
|
395
395
|
}
|
|
396
|
-
function
|
|
396
|
+
function Ge(e) {
|
|
397
397
|
for (let t of e) {
|
|
398
398
|
let e = t.species.reduce((e, t) => e + t.occupancy, 0);
|
|
399
399
|
if (e > 1.000001) for (let n of t.species) n.occupancy /= e;
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
|
-
function
|
|
402
|
+
function Ke(e) {
|
|
403
403
|
let t = e.findLoop("_atom_site_fract_x");
|
|
404
|
-
if (!t) throw new
|
|
405
|
-
let n =
|
|
404
|
+
if (!t) throw new H(`${e.name || "The CIF"} has no atom sites.`);
|
|
405
|
+
let n = I(t, "_atom_site_fract_x") ?? [], r = I(t, "_atom_site_fract_y") ?? [], i = I(t, "_atom_site_fract_z") ?? [], a = I(t, "_atom_site_label"), o = I(t, "_atom_site_type_symbol"), s = I(t, "_atom_site_occupancy"), c = [], l = new ke(ze);
|
|
406
406
|
for (let e = 0; e < t.rows.length; e += 1) {
|
|
407
|
-
let t =
|
|
407
|
+
let t = R(n[e]), u = R(r[e]), d = R(i[e]);
|
|
408
408
|
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
|
-
|
|
409
|
+
let f = a?.[e] ?? o?.[e] ?? `site${e + 1}`, p = o?.[e], m = (p && !L(p) ? xe(p) : null) ?? xe(f);
|
|
410
|
+
if (!m) throw new H(`Atom site ${JSON.stringify(f)} names no element (type symbol ${JSON.stringify(p ?? "")}).`);
|
|
411
|
+
let h = R(s?.[e]) ?? 1, g = [
|
|
412
|
+
z(t),
|
|
413
|
+
z(u),
|
|
414
|
+
z(d)
|
|
415
|
+
], [ee] = l.near(g);
|
|
416
|
+
ee === void 0 ? (l.add(g), c.push({
|
|
417
417
|
label: f,
|
|
418
418
|
species: [{
|
|
419
419
|
element: m,
|
|
420
420
|
occupancy: h
|
|
421
421
|
}],
|
|
422
422
|
fractional: g
|
|
423
|
-
})) :
|
|
423
|
+
})) : We(c[ee].species, m, h);
|
|
424
424
|
}
|
|
425
|
-
if (c.length === 0) throw new
|
|
426
|
-
return
|
|
425
|
+
if (c.length === 0) throw new H(`${e.name || "The CIF"} has no atom sites with coordinates.`);
|
|
426
|
+
return Ge(c), c;
|
|
427
427
|
}
|
|
428
|
-
function
|
|
429
|
-
let t = e.findLoop(
|
|
428
|
+
function qe(e) {
|
|
429
|
+
let t = e.findLoop(Be);
|
|
430
430
|
if (!t) {
|
|
431
|
-
let t = e.get(
|
|
432
|
-
return t === null ? null : [
|
|
431
|
+
let t = e.get(Be);
|
|
432
|
+
return t === null ? null : [Re(t)];
|
|
433
433
|
}
|
|
434
|
-
let n = (
|
|
434
|
+
let n = (I(t, Be) ?? []).filter((e) => !L(e)).map(Re);
|
|
435
435
|
return n.length > 0 ? n : null;
|
|
436
436
|
}
|
|
437
|
-
function
|
|
438
|
-
let t = e.get(
|
|
437
|
+
function Je(e) {
|
|
438
|
+
let t = e.get(Ve), n = t === null ? null : R(t), r = e.get(He), i = e.get(Ue);
|
|
439
439
|
return {
|
|
440
440
|
number: n !== null && Number.isInteger(n) && n >= 1 && n <= 230 ? n : null,
|
|
441
|
-
symbol: r !== null && !
|
|
442
|
-
hallSymbol: i !== null && !
|
|
441
|
+
symbol: r !== null && !L(r) ? r.trim() : null,
|
|
442
|
+
hallSymbol: i !== null && !L(i) ? i.trim() : null
|
|
443
443
|
};
|
|
444
444
|
}
|
|
445
|
-
function
|
|
445
|
+
function Ye(e) {
|
|
446
446
|
return e.findLoop("_atom_site_fract_x") !== null;
|
|
447
447
|
}
|
|
448
|
-
function
|
|
448
|
+
function Xe(e) {
|
|
449
449
|
return {
|
|
450
|
-
lattice:
|
|
451
|
-
a:
|
|
452
|
-
b:
|
|
453
|
-
c:
|
|
454
|
-
alpha:
|
|
455
|
-
beta:
|
|
456
|
-
gamma:
|
|
450
|
+
lattice: Me({
|
|
451
|
+
a: U(e, "_cell_length_a"),
|
|
452
|
+
b: U(e, "_cell_length_b"),
|
|
453
|
+
c: U(e, "_cell_length_c"),
|
|
454
|
+
alpha: U(e, "_cell_angle_alpha"),
|
|
455
|
+
beta: U(e, "_cell_angle_beta"),
|
|
456
|
+
gamma: U(e, "_cell_angle_gamma")
|
|
457
457
|
}),
|
|
458
|
-
sites:
|
|
459
|
-
operations:
|
|
460
|
-
spaceGroup:
|
|
458
|
+
sites: Ke(e),
|
|
459
|
+
operations: qe(e),
|
|
460
|
+
spaceGroup: Je(e)
|
|
461
461
|
};
|
|
462
462
|
}
|
|
463
463
|
//#endregion
|
|
464
464
|
//#region src/structure/closure.ts
|
|
465
|
-
function
|
|
466
|
-
let n = new
|
|
465
|
+
function Ze(e, t) {
|
|
466
|
+
let n = new ke(Ce);
|
|
467
467
|
for (let t of e) n.add(t.fractional);
|
|
468
468
|
let r = !1, i = !0;
|
|
469
469
|
return e.forEach((e, a) => {
|
|
470
470
|
for (let o of t) {
|
|
471
|
-
let t = n.near(
|
|
471
|
+
let t = n.near(Ae(o, e.fractional));
|
|
472
472
|
t.some((e) => e !== a) && (r = !0), t.length === 0 && (i = !1);
|
|
473
473
|
}
|
|
474
474
|
}), {
|
|
@@ -478,7 +478,7 @@ function Qe(e, t) {
|
|
|
478
478
|
}
|
|
479
479
|
//#endregion
|
|
480
480
|
//#region src/structure/types.ts
|
|
481
|
-
var
|
|
481
|
+
var Qe = {
|
|
482
482
|
rotation: [
|
|
483
483
|
1,
|
|
484
484
|
0,
|
|
@@ -495,29 +495,29 @@ var $e = {
|
|
|
495
495
|
0,
|
|
496
496
|
0
|
|
497
497
|
]
|
|
498
|
-
},
|
|
499
|
-
function
|
|
500
|
-
return
|
|
501
|
-
await e.instantiate(),
|
|
498
|
+
}, $e = null, et = null;
|
|
499
|
+
function tt() {
|
|
500
|
+
return et ||= import("./moyo-wasm.js").then(async (e) => {
|
|
501
|
+
await e.instantiate(), $e = e;
|
|
502
502
|
}).catch((e) => {
|
|
503
|
-
throw
|
|
504
|
-
}),
|
|
503
|
+
throw et = null, e;
|
|
504
|
+
}), et;
|
|
505
505
|
}
|
|
506
|
-
function
|
|
507
|
-
if (
|
|
508
|
-
return
|
|
506
|
+
function W() {
|
|
507
|
+
if (!$e) throw Error("moyo is not loaded yet; await ensureMoyo() first.");
|
|
508
|
+
return $e;
|
|
509
509
|
}
|
|
510
510
|
//#endregion
|
|
511
511
|
//#region src/symmetry/moyo.ts
|
|
512
|
-
var
|
|
512
|
+
var nt = class extends Error {
|
|
513
513
|
constructor(e) {
|
|
514
514
|
super(e), this.name = "SpaceGroupLookupError";
|
|
515
515
|
}
|
|
516
|
-
},
|
|
517
|
-
function
|
|
518
|
-
return
|
|
516
|
+
}, G = null;
|
|
517
|
+
function rt() {
|
|
518
|
+
return tt();
|
|
519
519
|
}
|
|
520
|
-
function
|
|
520
|
+
function it(e) {
|
|
521
521
|
let t = e.rotation;
|
|
522
522
|
return {
|
|
523
523
|
rotation: [
|
|
@@ -538,119 +538,119 @@ function at(e) {
|
|
|
538
538
|
]
|
|
539
539
|
};
|
|
540
540
|
}
|
|
541
|
-
function
|
|
542
|
-
if (!
|
|
543
|
-
|
|
544
|
-
for (let e = 1; e <= 230; e += 1)
|
|
541
|
+
function at() {
|
|
542
|
+
if (!G) {
|
|
543
|
+
G = [];
|
|
544
|
+
for (let e = 1; e <= 230; e += 1) G.push(...W().hall_symbol_entries_from_number(e));
|
|
545
545
|
}
|
|
546
|
-
return
|
|
546
|
+
return G;
|
|
547
547
|
}
|
|
548
|
-
function
|
|
548
|
+
function K(e) {
|
|
549
549
|
return e.replace(/[\s_]/g, "").toLowerCase();
|
|
550
550
|
}
|
|
551
|
-
function
|
|
551
|
+
function ot(e) {
|
|
552
552
|
let t = e.trim(), n = t.match(/^(.*?)\s*:\s*(\S+)$/);
|
|
553
553
|
if (n && n[1] && n[2]) return {
|
|
554
|
-
base:
|
|
554
|
+
base: K(n[1]),
|
|
555
555
|
setting: n[2].toLowerCase()
|
|
556
556
|
};
|
|
557
557
|
let r = t.match(/^(.*\S)\s+([HRhr])$/);
|
|
558
558
|
return r && r[1] && r[2] ? {
|
|
559
|
-
base:
|
|
559
|
+
base: K(r[1]),
|
|
560
560
|
setting: r[2].toLowerCase()
|
|
561
561
|
} : {
|
|
562
|
-
base:
|
|
562
|
+
base: K(t),
|
|
563
563
|
setting: null
|
|
564
564
|
};
|
|
565
565
|
}
|
|
566
|
-
function
|
|
566
|
+
function st(e) {
|
|
567
567
|
let t = e[0];
|
|
568
568
|
if (!t) return e;
|
|
569
|
-
let n =
|
|
569
|
+
let n = W().space_group_type(t.number).hall_number;
|
|
570
570
|
return [...e].sort((e, t) => Number(t.hall_number === n) - Number(e.hall_number === n));
|
|
571
571
|
}
|
|
572
|
-
function
|
|
573
|
-
let t =
|
|
572
|
+
function ct(e) {
|
|
573
|
+
let t = at().filter((t) => e.number === null || t.number === e.number);
|
|
574
574
|
if (e.hallSymbol) {
|
|
575
|
-
let n =
|
|
575
|
+
let n = K(e.hallSymbol), r = t.filter((e) => K(e.hall_symbol) === n);
|
|
576
576
|
if (r.length > 0) return r;
|
|
577
577
|
}
|
|
578
578
|
if (e.symbol) {
|
|
579
|
-
let { base: n, setting: r } =
|
|
579
|
+
let { base: n, setting: r } = ot(e.symbol), i = t.filter((e) => K(e.hm_short) === n || K(e.hm_full) === n);
|
|
580
580
|
if (r) {
|
|
581
581
|
let e = i.filter((e) => e.setting.toLowerCase() === r);
|
|
582
582
|
if (e.length > 0) return e;
|
|
583
583
|
}
|
|
584
|
-
return
|
|
584
|
+
return st(i);
|
|
585
585
|
}
|
|
586
586
|
return [];
|
|
587
587
|
}
|
|
588
|
-
function
|
|
588
|
+
function lt(e) {
|
|
589
589
|
return [
|
|
590
590
|
e.hallSymbol,
|
|
591
591
|
e.symbol,
|
|
592
592
|
e.number
|
|
593
593
|
].filter((e) => e !== null).join(" / ");
|
|
594
594
|
}
|
|
595
|
-
async function
|
|
596
|
-
await
|
|
597
|
-
let { operations_from_number: t } =
|
|
595
|
+
async function ut(e) {
|
|
596
|
+
await rt();
|
|
597
|
+
let { operations_from_number: t } = W();
|
|
598
598
|
if (e.hallSymbol || e.symbol) {
|
|
599
|
-
let n =
|
|
600
|
-
if (n.length === 0) throw new
|
|
599
|
+
let n = ct(e);
|
|
600
|
+
if (n.length === 0) throw new nt(`Space group ${lt(e)} is not in the symmetry table.`);
|
|
601
601
|
return n.map((e) => ({
|
|
602
602
|
setting: e.setting,
|
|
603
603
|
operations: t(e.number, {
|
|
604
604
|
type: "HallNumber",
|
|
605
605
|
value: e.hall_number
|
|
606
|
-
}, !1).map(
|
|
606
|
+
}, !1).map(it)
|
|
607
607
|
}));
|
|
608
608
|
}
|
|
609
|
-
if (e.number === null) throw new
|
|
609
|
+
if (e.number === null) throw new nt("The CIF names no space group.");
|
|
610
610
|
return [{
|
|
611
611
|
setting: "",
|
|
612
|
-
operations: t(e.number, { type: "Spglib" }, !1).map(
|
|
612
|
+
operations: t(e.number, { type: "Spglib" }, !1).map(it)
|
|
613
613
|
}];
|
|
614
614
|
}
|
|
615
|
-
async function
|
|
616
|
-
let [t] = await
|
|
615
|
+
async function dt(e) {
|
|
616
|
+
let [t] = await ut(e);
|
|
617
617
|
return t.operations;
|
|
618
618
|
}
|
|
619
619
|
//#endregion
|
|
620
620
|
//#region src/symmetry/resolve.ts
|
|
621
|
-
var
|
|
622
|
-
function
|
|
623
|
-
return new
|
|
621
|
+
var ft = .001, pt = .01;
|
|
622
|
+
function mt() {
|
|
623
|
+
return new H("The symmetry does not fit the listed atoms: they are already expanded, yet the operations generate positions the file does not list.");
|
|
624
624
|
}
|
|
625
|
-
function
|
|
626
|
-
let n =
|
|
627
|
-
if (n.preExpanded && !n.closed) throw
|
|
625
|
+
function ht(e, t) {
|
|
626
|
+
let n = Ze(e, t);
|
|
627
|
+
if (n.preExpanded && !n.closed) throw mt();
|
|
628
628
|
}
|
|
629
|
-
function
|
|
630
|
-
let o = (e, t) => Math.abs(e - t) <=
|
|
629
|
+
function gt({ a: e, b: t, c: n, alpha: r, beta: i, gamma: a }) {
|
|
630
|
+
let o = (e, t) => Math.abs(e - t) <= ft * Math.max(e, t), s = (e, t) => Math.abs(e - t) <= pt;
|
|
631
631
|
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
632
|
}
|
|
633
|
-
async function
|
|
634
|
-
if (e.operations) return
|
|
633
|
+
async function _t(e) {
|
|
634
|
+
if (e.operations) return ht(e.sites, e.operations), e.operations;
|
|
635
635
|
let { spaceGroup: t } = e;
|
|
636
|
-
if (t.hallSymbol === null && t.symbol === null && t.number === null) return [
|
|
637
|
-
let n = await
|
|
636
|
+
if (t.hallSymbol === null && t.symbol === null && t.number === null) return [Qe];
|
|
637
|
+
let n = await ut(t);
|
|
638
638
|
if (n.length === 1) {
|
|
639
639
|
let [t] = n;
|
|
640
|
-
return
|
|
640
|
+
return ht(e.sites, t.operations), t.operations;
|
|
641
641
|
}
|
|
642
|
-
let r = n.map((t) =>
|
|
642
|
+
let r = n.map((t) => Ze(e.sites, t.operations)), i = n.find((e, t) => r[t].preExpanded && r[t].closed);
|
|
643
643
|
if (i) return i.operations;
|
|
644
|
-
if (r.some((e) => e.preExpanded)) throw
|
|
645
|
-
let a =
|
|
644
|
+
if (r.some((e) => e.preExpanded)) throw mt();
|
|
645
|
+
let a = gt(e.lattice);
|
|
646
646
|
return ((a === null ? void 0 : n.find((e) => e.setting.toUpperCase() === a)) ?? n[0]).operations;
|
|
647
647
|
}
|
|
648
648
|
//#endregion
|
|
649
649
|
//#region src/structure/expand.ts
|
|
650
|
-
function
|
|
651
|
-
let t = [], n = new
|
|
650
|
+
function vt(e) {
|
|
651
|
+
let t = [], n = new ke(Ce);
|
|
652
652
|
for (let r of e.sites) for (let i of e.operations) {
|
|
653
|
-
let e =
|
|
653
|
+
let e = Te(Ae(i, r.fractional));
|
|
654
654
|
n.near(e).length === 0 && (n.add(e), t.push({
|
|
655
655
|
label: r.label,
|
|
656
656
|
species: r.species,
|
|
@@ -660,17 +660,17 @@ function yt(e) {
|
|
|
660
660
|
return {
|
|
661
661
|
...e,
|
|
662
662
|
sites: t,
|
|
663
|
-
operations: [
|
|
663
|
+
operations: [Qe]
|
|
664
664
|
};
|
|
665
665
|
}
|
|
666
666
|
//#endregion
|
|
667
667
|
//#region src/symmetry/dataset.ts
|
|
668
|
-
var
|
|
668
|
+
var yt = .01, bt = class extends Error {
|
|
669
669
|
constructor(e) {
|
|
670
670
|
super(e), this.name = "SymmetryAnalysisError";
|
|
671
671
|
}
|
|
672
672
|
};
|
|
673
|
-
function
|
|
673
|
+
function xt(e) {
|
|
674
674
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
675
675
|
return {
|
|
676
676
|
numbers: e.map((e) => {
|
|
@@ -680,7 +680,7 @@ function St(e) {
|
|
|
680
680
|
speciesByLabel: n
|
|
681
681
|
};
|
|
682
682
|
}
|
|
683
|
-
function
|
|
683
|
+
function St(e, t, n) {
|
|
684
684
|
let r = e.std_cell.lattice.basis, i = [
|
|
685
685
|
[
|
|
686
686
|
r[0],
|
|
@@ -702,13 +702,13 @@ function Ct(e, t, n) {
|
|
|
702
702
|
return a.set(s, c), {
|
|
703
703
|
label: `${s}${c}`,
|
|
704
704
|
species: o,
|
|
705
|
-
fractional:
|
|
705
|
+
fractional: Te(n)
|
|
706
706
|
};
|
|
707
707
|
});
|
|
708
708
|
return {
|
|
709
|
-
lattice:
|
|
709
|
+
lattice: Ne(i),
|
|
710
710
|
sites: o,
|
|
711
|
-
operations: [
|
|
711
|
+
operations: [Qe],
|
|
712
712
|
spaceGroup: {
|
|
713
713
|
number: e.number,
|
|
714
714
|
symbol: e.hm_symbol,
|
|
@@ -716,9 +716,9 @@ function Ct(e, t, n) {
|
|
|
716
716
|
}
|
|
717
717
|
};
|
|
718
718
|
}
|
|
719
|
-
async function
|
|
720
|
-
await
|
|
721
|
-
let { analyze_cell: n, hall_symbol_entry: r, space_group_type: i } =
|
|
719
|
+
async function Ct(e, t = {}) {
|
|
720
|
+
await rt();
|
|
721
|
+
let { analyze_cell: n, hall_symbol_entry: r, space_group_type: i } = W(), a = vt(e), { numbers: o, speciesByLabel: s } = xt(a.sites), [c, l, u] = a.lattice.vectors, d = {
|
|
722
722
|
lattice: { basis: [
|
|
723
723
|
...c,
|
|
724
724
|
...l,
|
|
@@ -728,11 +728,11 @@ async function wt(e, t = {}) {
|
|
|
728
728
|
numbers: o
|
|
729
729
|
}, f;
|
|
730
730
|
try {
|
|
731
|
-
f = n(JSON.stringify(d), t.symprec ??
|
|
731
|
+
f = n(JSON.stringify(d), t.symprec ?? yt, "Standard");
|
|
732
732
|
} catch (e) {
|
|
733
|
-
throw new
|
|
733
|
+
throw new bt(`moyo could not analyse the structure: ${e instanceof Error ? e.message : String(e)}`);
|
|
734
734
|
}
|
|
735
|
-
let p = r(f.hall_number), m = i(f.number), h =
|
|
735
|
+
let p = r(f.hall_number), m = i(f.number), h = St(f, s, p);
|
|
736
736
|
return {
|
|
737
737
|
number: f.number,
|
|
738
738
|
symbol: f.hm_symbol,
|
|
@@ -741,7 +741,7 @@ async function wt(e, t = {}) {
|
|
|
741
741
|
hallNumber: f.hall_number,
|
|
742
742
|
setting: p.setting,
|
|
743
743
|
crystalSystem: m.crystal_system,
|
|
744
|
-
operations: f.operations.map(
|
|
744
|
+
operations: f.operations.map(it),
|
|
745
745
|
wyckoffs: f.wyckoffs,
|
|
746
746
|
siteSymmetries: f.site_symmetry_symbols,
|
|
747
747
|
structure: a,
|
|
@@ -750,34 +750,34 @@ async function wt(e, t = {}) {
|
|
|
750
750
|
}
|
|
751
751
|
//#endregion
|
|
752
752
|
//#region src/symmetry/symbol.ts
|
|
753
|
-
var
|
|
754
|
-
function
|
|
755
|
-
return
|
|
753
|
+
var wt = "₀₁₂₃₄₅₆₇₈₉", Tt = "̅";
|
|
754
|
+
function Et(e) {
|
|
755
|
+
return wt[Number(e)] ?? e;
|
|
756
756
|
}
|
|
757
|
-
function
|
|
757
|
+
function Dt(e) {
|
|
758
758
|
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 +
|
|
759
|
+
return a.map((e) => a.length > 1 ? e.replace(/^([2346])([1-5])(?=$|\/)/, (e, t, n) => Number(n) < Number(t) ? t + Et(n) : e) : e).join("").replace(/(\d)_(\d)/g, (e, t, n) => t + Et(n)).replace(/-(\d)/g, (e, t) => t + Tt) + i;
|
|
760
760
|
}
|
|
761
761
|
//#endregion
|
|
762
762
|
//#region src/structure/bonds.ts
|
|
763
|
-
var
|
|
763
|
+
var Ot = {
|
|
764
764
|
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
765
|
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
|
|
766
|
+
}.pairs, kt = .4;
|
|
767
|
+
function At(e, t) {
|
|
768
|
+
return Ot[e < t ? `${e}-${t}` : `${t}-${e}`] ?? null;
|
|
769
769
|
}
|
|
770
|
-
function
|
|
770
|
+
function jt(e) {
|
|
771
771
|
let t = /* @__PURE__ */ new Map(), n = e.map((e) => {
|
|
772
772
|
let n = t.get(e.element);
|
|
773
773
|
return n === void 0 && (n = t.size, t.set(e.element, n)), n;
|
|
774
774
|
}), r = [...t.keys()], i = new Float64Array(r.length * r.length), a = 0;
|
|
775
775
|
if (r.forEach((e, t) => {
|
|
776
776
|
r.forEach((n, o) => {
|
|
777
|
-
let s =
|
|
777
|
+
let s = At(e, n) ?? 0;
|
|
778
778
|
i[t * r.length + o] = s, a = Math.max(a, s);
|
|
779
779
|
});
|
|
780
|
-
}), a <
|
|
780
|
+
}), a < kt) return [];
|
|
781
781
|
let o = e.map((e) => e.position.map((e) => Math.floor(e / a) | 0)), s = [
|
|
782
782
|
Infinity,
|
|
783
783
|
Infinity,
|
|
@@ -799,9 +799,9 @@ function Mt(e) {
|
|
|
799
799
|
m.length = 0;
|
|
800
800
|
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
801
|
let r = i[u + n[h]];
|
|
802
|
-
if (h <= a || r <
|
|
803
|
-
let o =
|
|
804
|
-
o >=
|
|
802
|
+
if (h <= a || r < kt) continue;
|
|
803
|
+
let o = Fe(t.position, e[h].position);
|
|
804
|
+
o >= kt && o <= r && m.push({
|
|
805
805
|
start: a,
|
|
806
806
|
end: h,
|
|
807
807
|
length: o
|
|
@@ -812,11 +812,11 @@ function Mt(e) {
|
|
|
812
812
|
}
|
|
813
813
|
//#endregion
|
|
814
814
|
//#region src/structure/images.ts
|
|
815
|
-
var
|
|
816
|
-
function
|
|
815
|
+
var Mt = 1e-4;
|
|
816
|
+
function Nt(e, t) {
|
|
817
817
|
let n = [];
|
|
818
818
|
return e.forEach((e, r) => {
|
|
819
|
-
let i = e.fractional.map((e) =>
|
|
819
|
+
let i = e.fractional.map((e) => z(e, Mt));
|
|
820
820
|
if (n.push({
|
|
821
821
|
siteIndex: r,
|
|
822
822
|
fractional: i,
|
|
@@ -826,7 +826,7 @@ function Pt(e, t) {
|
|
|
826
826
|
0,
|
|
827
827
|
1,
|
|
828
828
|
2
|
|
829
|
-
].filter((e) => i[e] <
|
|
829
|
+
].filter((e) => i[e] < Mt), o = 1 << a.length;
|
|
830
830
|
for (let e = 1; e < o; e += 1) {
|
|
831
831
|
let t = [
|
|
832
832
|
i[0],
|
|
@@ -845,16 +845,16 @@ function Pt(e, t) {
|
|
|
845
845
|
}
|
|
846
846
|
//#endregion
|
|
847
847
|
//#region src/scene/build.ts
|
|
848
|
-
function
|
|
848
|
+
function Pt(e) {
|
|
849
849
|
let t = [];
|
|
850
850
|
for (let n of e.sites) for (let e of n.species) {
|
|
851
|
-
let n =
|
|
851
|
+
let n = Se(e.element);
|
|
852
852
|
t.includes(n) || t.push(n);
|
|
853
853
|
}
|
|
854
854
|
return t;
|
|
855
855
|
}
|
|
856
|
-
function
|
|
857
|
-
let n =
|
|
856
|
+
function Ft(e, t = {}) {
|
|
857
|
+
let n = Nt(e.sites, t.imageAtoms ?? !0).map((t) => {
|
|
858
858
|
let n = e.sites[t.siteIndex];
|
|
859
859
|
if (!n) throw Error(`Site ${t.siteIndex} is missing.`);
|
|
860
860
|
let r = n.species[0];
|
|
@@ -863,7 +863,7 @@ function It(e, t = {}) {
|
|
|
863
863
|
siteIndex: t.siteIndex,
|
|
864
864
|
element: r.element,
|
|
865
865
|
species: n.species,
|
|
866
|
-
position:
|
|
866
|
+
position: Pe(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: jt(n),
|
|
875
|
+
elements: Pt(e)
|
|
876
876
|
};
|
|
877
877
|
}
|
|
878
878
|
//#endregion
|
|
879
879
|
//#region node_modules/three/examples/jsm/controls/TrackballControls.js
|
|
880
|
-
var
|
|
880
|
+
var It = { type: "change" }, Lt = { type: "start" }, Rt = { type: "end" }, zt = 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
|
-
}, Bt = new
|
|
887
|
+
}, Bt = new j(), J = new j(), Vt = new M(), Ht = new M(), Ut = new M(), Y = new A(), Wt = new M(), Gt = new M(), Kt = new M(), qt = new M(), Jt = 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 M(), this.state = q.NONE, this.keyState = q.NONE, this._lastPosition = new M(), this._lastUp = new M(), this._lastZoom = 1, this._touchZoomDistanceStart = 0, this._touchZoomDistanceEnd = 0, this._touchRollAngle = 0, this._touchRollPointerIds = "", this._lastAngle = 0, this._lastRollAngle = 0, this._eye = new M(), this._movePrev = new j(), this._moveCurr = new j(), this._lastAxis = new M(), this._zoomStart = new j(), this._zoomEnd = new j(), this._panStart = new j(), this._panEnd = new j(), this._pointers = [], this._pointerPositions = {}, this._onPointerMove = Xt.bind(this), this._onPointerDown = Yt.bind(this), this._onPointerUp = Zt.bind(this), this._onPointerCancel = Qt.bind(this), this._onContextMenu = on.bind(this), this._onMouseWheel = an.bind(this), this._onKeyDown = en.bind(this), this._onKeyUp = $t.bind(this), this._onTouchStart = sn.bind(this), this._onTouchMove = cn.bind(this), this._onTouchEnd = ln.bind(this), this._onMouseDown = tn.bind(this), this._onMouseMove = nn.bind(this), this._onMouseUp = rn.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";
|
|
@@ -917,16 +917,16 @@ var Lt = { type: "change" }, Rt = { type: "start" }, zt = { type: "end" }, K = 1
|
|
|
917
917
|
update() {
|
|
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
|
-
let e = this._lastPosition.distanceToSquared(this.object.position) >
|
|
921
|
-
(e || t) && (this.dispatchEvent(
|
|
920
|
+
let e = this._lastPosition.distanceToSquared(this.object.position) > zt, t = this._lastUp.distanceToSquared(this.object.up) > zt;
|
|
921
|
+
(e || t) && (this.dispatchEvent(It), 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
|
-
let e = this._lastPosition.distanceToSquared(this.object.position) >
|
|
925
|
-
(e || t || n) && (this.dispatchEvent(
|
|
924
|
+
let e = this._lastPosition.distanceToSquared(this.object.position) > zt, t = this._lastUp.distanceToSquared(this.object.up) > zt, n = this._lastZoom !== this.object.zoom;
|
|
925
|
+
(e || t || n) && (this.dispatchEvent(It), 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(It), 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()) {
|
|
@@ -959,7 +959,7 @@ 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
965
|
return Bt.set((e - this.screen.left) / this.screen.width, (t - this.screen.top) / this.screen.height), Bt;
|
|
@@ -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 j(), 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];
|
|
@@ -1022,26 +1022,26 @@ 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(Lt);
|
|
1038
1038
|
}
|
|
1039
1039
|
function nn(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
1043
|
function rn() {
|
|
1044
|
-
this.state = q.NONE, this.dispatchEvent(
|
|
1044
|
+
this.state = q.NONE, this.dispatchEvent(Rt);
|
|
1045
1045
|
}
|
|
1046
1046
|
function an(e) {
|
|
1047
1047
|
if (this.enabled !== !1 && this.noZoom !== !0) {
|
|
@@ -1054,7 +1054,7 @@ function an(e) {
|
|
|
1054
1054
|
break;
|
|
1055
1055
|
default: this._zoomStart.y -= e.deltaY * 25e-5;
|
|
1056
1056
|
}
|
|
1057
|
-
this.dispatchEvent(
|
|
1057
|
+
this.dispatchEvent(Lt), this.dispatchEvent(Rt);
|
|
1058
1058
|
}
|
|
1059
1059
|
}
|
|
1060
1060
|
function on(e) {
|
|
@@ -1072,7 +1072,7 @@ 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(Lt);
|
|
1076
1076
|
}
|
|
1077
1077
|
function cn(e) {
|
|
1078
1078
|
switch (this._trackPointer(e), this._pointers.length) {
|
|
@@ -1102,28 +1102,28 @@ function ln(e) {
|
|
|
1102
1102
|
break;
|
|
1103
1103
|
}
|
|
1104
1104
|
}
|
|
1105
|
-
this.dispatchEvent(
|
|
1105
|
+
this.dispatchEvent(Rt);
|
|
1106
1106
|
}
|
|
1107
1107
|
//#endregion
|
|
1108
1108
|
//#region src/render/camera.ts
|
|
1109
|
-
var un = 1 / 3, dn = 1 / 6, fn = 2, pn = 1e-12, mn = new
|
|
1109
|
+
var un = 1 / 3, dn = 1 / 6, fn = 2, pn = 1e-12, mn = new M(0, 0, -1), hn = new M(0, 1, 0);
|
|
1110
1110
|
function gn(e, t) {
|
|
1111
1111
|
let n = e.clone().sub(t.clone().multiplyScalar(e.dot(t)));
|
|
1112
1112
|
return n.lengthSq() < pn ? null : n.normalize();
|
|
1113
1113
|
}
|
|
1114
1114
|
function _n(e) {
|
|
1115
1115
|
for (let t of [
|
|
1116
|
-
new
|
|
1117
|
-
new
|
|
1118
|
-
new
|
|
1116
|
+
new M(0, 0, 1),
|
|
1117
|
+
new M(0, 1, 0),
|
|
1118
|
+
new M(1, 0, 0)
|
|
1119
1119
|
]) {
|
|
1120
1120
|
let n = gn(t, e);
|
|
1121
1121
|
if (n) return n;
|
|
1122
1122
|
}
|
|
1123
|
-
return new
|
|
1123
|
+
return new M(0, 1, 0);
|
|
1124
1124
|
}
|
|
1125
1125
|
function vn(e) {
|
|
1126
|
-
let t = new
|
|
1126
|
+
let t = new M(...e[0]), n = new M(...e[1]), r = new M(...e[2]).normalize(), i = gn(t, r) ?? gn(n, r) ?? _n(r), a = r.clone().cross(i).normalize(), o = i.clone().add(a.multiplyScalar(un)).add(r.clone().multiplyScalar(dn)).normalize();
|
|
1127
1127
|
return {
|
|
1128
1128
|
outward: o,
|
|
1129
1129
|
up: gn(r, o) ?? _n(o)
|
|
@@ -1133,8 +1133,8 @@ function yn(e) {
|
|
|
1133
1133
|
return Math.max(4, e * 4);
|
|
1134
1134
|
}
|
|
1135
1135
|
function bn(e) {
|
|
1136
|
-
let { outward: t, up: n } = vn(e), r = n.clone().cross(t).normalize(), i = t.clone().cross(r).normalize(), a = new
|
|
1137
|
-
return new
|
|
1136
|
+
let { outward: t, up: n } = vn(e), r = n.clone().cross(t).normalize(), i = t.clone().cross(r).normalize(), a = new C().makeBasis(r, i, t);
|
|
1137
|
+
return new A().setFromRotationMatrix(a).normalize();
|
|
1138
1138
|
}
|
|
1139
1139
|
function xn(e) {
|
|
1140
1140
|
return {
|
|
@@ -1148,7 +1148,7 @@ function xn(e) {
|
|
|
1148
1148
|
};
|
|
1149
1149
|
}
|
|
1150
1150
|
function Sn(e, t, n, r) {
|
|
1151
|
-
let i = new
|
|
1151
|
+
let i = new A(...t.quaternion).normalize(), a = new M(...t.target), o = mn.clone().applyQuaternion(i);
|
|
1152
1152
|
e.position.copy(a).sub(o.multiplyScalar(n)), e.up.copy(hn.clone().applyQuaternion(i)), e.quaternion.copy(i), e.near = .01, e.far = Math.max(1e3, n + r * 8), e.updateProjectionMatrix();
|
|
1153
1153
|
}
|
|
1154
1154
|
function Cn(e) {
|
|
@@ -1160,9 +1160,9 @@ function Cn(e) {
|
|
|
1160
1160
|
];
|
|
1161
1161
|
}
|
|
1162
1162
|
function wn(e, t) {
|
|
1163
|
-
let n = new
|
|
1163
|
+
let n = new M(1, 0, 0).applyQuaternion(t), r = new M(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 M(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 {
|
|
@@ -1184,17 +1184,17 @@ var Dn = .1, On = .6, kn = .8, An = 2.2, jn = [
|
|
|
1184
1184
|
.2,
|
|
1185
1185
|
0
|
|
1186
1186
|
], Mn = "#fafafa", Nn = "#444444", Pn = "#f2f2f2", Fn = .3, In = "6.28318530718";
|
|
1187
|
-
function
|
|
1187
|
+
function Ln(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 Ln(e) {
|
|
1194
|
-
return X(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
|
-
}
|
|
1196
1193
|
function Rn(e) {
|
|
1197
|
-
return
|
|
1194
|
+
return Ln(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
|
+
}
|
|
1196
|
+
function zn(e) {
|
|
1197
|
+
return Ln(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>
|
|
@@ -1222,8 +1222,8 @@ 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 Bn(e, t, n) {
|
|
1226
|
+
let r = e < 1 || n, i = new T({
|
|
1227
1227
|
color: "#ffffff",
|
|
1228
1228
|
metalness: Dn,
|
|
1229
1229
|
roughness: On,
|
|
@@ -1232,22 +1232,22 @@ function zn(e, t, n) {
|
|
|
1232
1232
|
alphaToCoverage: !r
|
|
1233
1233
|
});
|
|
1234
1234
|
return i.onBeforeCompile = (e) => {
|
|
1235
|
-
e.uniforms.sectorTexture = { value: t }, e.uniforms.vacancyOpacity = { value: Fn }, e.vertexShader =
|
|
1235
|
+
e.uniforms.sectorTexture = { value: t }, e.uniforms.vacancyOpacity = { value: Fn }, e.vertexShader = Rn(e.vertexShader), e.fragmentShader = zn(e.fragmentShader);
|
|
1236
1236
|
}, i.customProgramCacheKey = () => "bravais-atom-spheres", i;
|
|
1237
1237
|
}
|
|
1238
|
-
function Bn(e) {
|
|
1239
|
-
return X(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
|
-
}
|
|
1241
1238
|
function Vn(e) {
|
|
1242
|
-
return
|
|
1239
|
+
return Ln(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
|
+
}
|
|
1241
|
+
function Hn(e) {
|
|
1242
|
+
return Ln(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 Un(e, t) {
|
|
1250
|
+
let n = e < 1, r = new T({
|
|
1251
1251
|
color: "#ffffff",
|
|
1252
1252
|
metalness: Dn,
|
|
1253
1253
|
roughness: On,
|
|
@@ -1256,19 +1256,19 @@ function Hn(e, t) {
|
|
|
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 = Vn(e.vertexShader), e.fragmentShader = Hn(e.fragmentShader);
|
|
1260
1260
|
}, r.customProgramCacheKey = () => "bravais-bond-tubes", r;
|
|
1261
1261
|
}
|
|
1262
|
-
function
|
|
1263
|
-
return new
|
|
1262
|
+
function Wn(e) {
|
|
1263
|
+
return new y({
|
|
1264
1264
|
color: Nn,
|
|
1265
1265
|
opacity: e,
|
|
1266
1266
|
transparent: !0,
|
|
1267
1267
|
fog: !1
|
|
1268
1268
|
});
|
|
1269
1269
|
}
|
|
1270
|
-
function
|
|
1271
|
-
return new
|
|
1270
|
+
function Gn(e, n) {
|
|
1271
|
+
return new T({
|
|
1272
1272
|
color: e,
|
|
1273
1273
|
metalness: 0,
|
|
1274
1274
|
roughness: .8,
|
|
@@ -1276,35 +1276,35 @@ function Wn(e, n) {
|
|
|
1276
1276
|
stencilWrite: !0,
|
|
1277
1277
|
stencilRef: n,
|
|
1278
1278
|
stencilFunc: t,
|
|
1279
|
-
stencilZPass:
|
|
1279
|
+
stencilZPass: ae
|
|
1280
1280
|
});
|
|
1281
1281
|
}
|
|
1282
1282
|
//#endregion
|
|
1283
1283
|
//#region src/render/gizmo.ts
|
|
1284
|
-
var
|
|
1284
|
+
var Kn = {
|
|
1285
1285
|
a: "#d27686",
|
|
1286
1286
|
b: "#80c393",
|
|
1287
1287
|
c: "#75a4dd"
|
|
1288
|
-
},
|
|
1289
|
-
function
|
|
1288
|
+
}, qn = .82, Jn = .055, Yn = .24, Xn = .13, Zn = .13, Qn = 1.3, $n = .5, er = 128, tr = "#2a2a2a", nr = "#ffffff", rr = 3.2, ir = new M(0, 1, 0);
|
|
1289
|
+
function ar(e, t) {
|
|
1290
1290
|
let n = document.createElement("canvas");
|
|
1291
|
-
n.width =
|
|
1291
|
+
n.width = er, n.height = er;
|
|
1292
1292
|
let r = n.getContext("2d");
|
|
1293
1293
|
if (r) {
|
|
1294
|
-
let i =
|
|
1294
|
+
let i = er * .68;
|
|
1295
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
1296
|
}
|
|
1297
1297
|
let i = new o(n);
|
|
1298
|
-
return i.colorSpace =
|
|
1298
|
+
return i.colorSpace = oe, i.premultiplyAlpha = !0, i.magFilter = x, i.minFilter = te, i;
|
|
1299
1299
|
}
|
|
1300
|
-
function
|
|
1301
|
-
let r = new
|
|
1302
|
-
a.position.y =
|
|
1303
|
-
let o = new
|
|
1300
|
+
function or(e, t, n) {
|
|
1301
|
+
let r = new _(), i = Gn(e, 1), a = new w(new u(Jn, Jn, qn, 24), i);
|
|
1302
|
+
a.position.y = qn / 2;
|
|
1303
|
+
let o = new w(new c(Xn, Yn, 32), i);
|
|
1304
1304
|
o.position.y = .94, r.add(a, o);
|
|
1305
|
-
let s =
|
|
1305
|
+
let s = ar(t, n), l = [[tr, D], [nr, m]];
|
|
1306
1306
|
for (let [e, t] of l) {
|
|
1307
|
-
let n = new
|
|
1307
|
+
let n = new le(new ue({
|
|
1308
1308
|
map: s,
|
|
1309
1309
|
color: e,
|
|
1310
1310
|
depthTest: !1,
|
|
@@ -1314,49 +1314,49 @@ function ar(e, t, n) {
|
|
|
1314
1314
|
stencilRef: 1,
|
|
1315
1315
|
stencilFunc: t
|
|
1316
1316
|
}));
|
|
1317
|
-
n.scale.set(
|
|
1317
|
+
n.scale.set($n, $n, 1), n.position.y = Qn, n.renderOrder = 10, r.add(n);
|
|
1318
1318
|
}
|
|
1319
1319
|
return r;
|
|
1320
1320
|
}
|
|
1321
|
-
var
|
|
1322
|
-
scene = new
|
|
1323
|
-
camera = new
|
|
1324
|
-
axes = new
|
|
1321
|
+
var sr = class {
|
|
1322
|
+
scene = new se();
|
|
1323
|
+
camera = new k(-1, 1, 1, -1, .1, 20);
|
|
1324
|
+
axes = new _();
|
|
1325
1325
|
arrows;
|
|
1326
1326
|
headlight = new f("#ffffff", 1.78);
|
|
1327
|
-
inverse = new
|
|
1328
|
-
direction = new
|
|
1327
|
+
inverse = new A();
|
|
1328
|
+
direction = new M();
|
|
1329
1329
|
constructor(e) {
|
|
1330
1330
|
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
1331
|
"a",
|
|
1332
1332
|
"b",
|
|
1333
1333
|
"c"
|
|
1334
|
-
].map((t) =>
|
|
1335
|
-
let t = new
|
|
1334
|
+
].map((t) => or(Kn[t], t, e));
|
|
1335
|
+
let t = new w(new ce(Zn, 32, 16), Gn("#f3f2ee", 0));
|
|
1336
1336
|
this.axes.add(...this.arrows, t), this.scene.add(this.axes);
|
|
1337
1337
|
}
|
|
1338
1338
|
setCell(e) {
|
|
1339
1339
|
this.arrows.forEach((t, n) => {
|
|
1340
|
-
t.quaternion.setFromUnitVectors(
|
|
1340
|
+
t.quaternion.setFromUnitVectors(ir, this.direction.set(...e[n]).normalize());
|
|
1341
1341
|
});
|
|
1342
1342
|
}
|
|
1343
1343
|
render(e, t, n) {
|
|
1344
1344
|
this.axes.quaternion.copy(this.inverse.copy(t).invert());
|
|
1345
|
-
let r =
|
|
1345
|
+
let r = rr / 2;
|
|
1346
1346
|
this.camera.left = -1.6, this.camera.right = r, this.camera.top = r, this.camera.bottom = -1.6, this.camera.updateProjectionMatrix();
|
|
1347
1347
|
let i = e.autoClear;
|
|
1348
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;
|
|
1349
1349
|
}
|
|
1350
1350
|
dispose() {
|
|
1351
1351
|
this.axes.traverse((e) => {
|
|
1352
|
-
if (e instanceof
|
|
1352
|
+
if (e instanceof w || e instanceof le) {
|
|
1353
1353
|
e.geometry.dispose();
|
|
1354
1354
|
let t = e.material;
|
|
1355
1355
|
"map" in t && t.map && t.map.dispose(), t.dispose();
|
|
1356
1356
|
}
|
|
1357
1357
|
}), this.axes.clear();
|
|
1358
1358
|
}
|
|
1359
|
-
},
|
|
1359
|
+
}, cr = {
|
|
1360
1360
|
source: "VESTA's element colours, softened.",
|
|
1361
1361
|
elements: {
|
|
1362
1362
|
H: "#f2c0c0",
|
|
@@ -1460,21 +1460,21 @@ var or = class {
|
|
|
1460
1460
|
};
|
|
1461
1461
|
//#endregion
|
|
1462
1462
|
//#region src/render/oklab.ts
|
|
1463
|
-
function
|
|
1463
|
+
function lr(e) {
|
|
1464
1464
|
return e <= .04045 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4;
|
|
1465
1465
|
}
|
|
1466
|
-
function
|
|
1466
|
+
function ur(e) {
|
|
1467
1467
|
return e <= .0031308 ? e * 12.92 : 1.055 * e ** (1 / 2.4) - .055;
|
|
1468
1468
|
}
|
|
1469
|
-
function
|
|
1470
|
-
let t = Number.parseInt(e.slice(1), 16), n =
|
|
1469
|
+
function dr(e) {
|
|
1470
|
+
let t = Number.parseInt(e.slice(1), 16), n = lr((t >> 16 & 255) / 255), r = lr((t >> 8 & 255) / 255), i = lr((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
1471
|
return {
|
|
1472
1472
|
L: .2104542553 * a + .793617785 * o - .0040720468 * s,
|
|
1473
1473
|
a: 1.9779984951 * a - 2.428592205 * o + .4505937099 * s,
|
|
1474
1474
|
b: .0259040371 * a + .7827717662 * o - .808675766 * s
|
|
1475
1475
|
};
|
|
1476
1476
|
}
|
|
1477
|
-
function
|
|
1477
|
+
function fr(e) {
|
|
1478
1478
|
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
1479
|
return [
|
|
1480
1480
|
4.0767416621 * t - 3.3077115913 * n + .2309699292 * r,
|
|
@@ -1482,16 +1482,16 @@ function dr(e) {
|
|
|
1482
1482
|
-.0041960863 * t - .7034186147 * n + 1.707614701 * r
|
|
1483
1483
|
];
|
|
1484
1484
|
}
|
|
1485
|
-
function fr(e) {
|
|
1486
|
-
return dr(e).every((e) => e >= -1e-4 && e <= 1.0001);
|
|
1487
|
-
}
|
|
1488
1485
|
function pr(e) {
|
|
1489
|
-
return
|
|
1490
|
-
|
|
1486
|
+
return fr(e).every((e) => e >= -1e-4 && e <= 1.0001);
|
|
1487
|
+
}
|
|
1488
|
+
function mr(e) {
|
|
1489
|
+
return `#${fr(e).map((e) => {
|
|
1490
|
+
let t = ur(Math.min(1, Math.max(0, e)));
|
|
1491
1491
|
return Math.round(t * 255).toString(16).padStart(2, "0");
|
|
1492
1492
|
}).join("")}`;
|
|
1493
1493
|
}
|
|
1494
|
-
function
|
|
1494
|
+
function hr(e) {
|
|
1495
1495
|
let t = Math.hypot(e.a, e.b), n = (Math.atan2(e.b, e.a) * 180 / Math.PI + 360) % 360;
|
|
1496
1496
|
return {
|
|
1497
1497
|
L: e.L,
|
|
@@ -1499,7 +1499,7 @@ function mr(e) {
|
|
|
1499
1499
|
h: n
|
|
1500
1500
|
};
|
|
1501
1501
|
}
|
|
1502
|
-
function
|
|
1502
|
+
function gr(e) {
|
|
1503
1503
|
let t = e.h * Math.PI / 180;
|
|
1504
1504
|
return {
|
|
1505
1505
|
L: e.L,
|
|
@@ -1507,12 +1507,12 @@ function hr(e) {
|
|
|
1507
1507
|
b: e.C * Math.sin(t)
|
|
1508
1508
|
};
|
|
1509
1509
|
}
|
|
1510
|
-
function
|
|
1511
|
-
if (
|
|
1510
|
+
function _r(e) {
|
|
1511
|
+
if (pr(gr(e))) return e;
|
|
1512
1512
|
let t = 0, n = e.C;
|
|
1513
1513
|
for (let r = 0; r < 24; r += 1) {
|
|
1514
1514
|
let r = (t + n) / 2;
|
|
1515
|
-
|
|
1515
|
+
pr(gr({
|
|
1516
1516
|
...e,
|
|
1517
1517
|
C: r
|
|
1518
1518
|
})) ? t = r : n = r;
|
|
@@ -1524,15 +1524,15 @@ function gr(e) {
|
|
|
1524
1524
|
}
|
|
1525
1525
|
//#endregion
|
|
1526
1526
|
//#region src/render/palette.ts
|
|
1527
|
-
var
|
|
1527
|
+
var vr = cr.elements, yr = {
|
|
1528
1528
|
Cr: "#6d87c9",
|
|
1529
1529
|
V: "#bf4b62",
|
|
1530
1530
|
F: "#9bd7d0"
|
|
1531
|
-
},
|
|
1531
|
+
}, 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, X = {
|
|
1532
1532
|
minL: .45,
|
|
1533
1533
|
maxL: .88,
|
|
1534
1534
|
maxC: .2
|
|
1535
|
-
},
|
|
1535
|
+
}, wr = .025, Tr = .09, Er = .1, Dr = [
|
|
1536
1536
|
0,
|
|
1537
1537
|
10,
|
|
1538
1538
|
-10,
|
|
@@ -1553,7 +1553,7 @@ var _r = sr.elements, vr = {
|
|
|
1553
1553
|
150,
|
|
1554
1554
|
-150,
|
|
1555
1555
|
180
|
|
1556
|
-
],
|
|
1556
|
+
], Or = [
|
|
1557
1557
|
0,
|
|
1558
1558
|
-.05,
|
|
1559
1559
|
.05,
|
|
@@ -1563,12 +1563,12 @@ var _r = sr.elements, vr = {
|
|
|
1563
1563
|
.15,
|
|
1564
1564
|
-.2,
|
|
1565
1565
|
.2
|
|
1566
|
-
],
|
|
1566
|
+
], kr = [
|
|
1567
1567
|
0,
|
|
1568
1568
|
.15,
|
|
1569
1569
|
-.15,
|
|
1570
1570
|
.3
|
|
1571
|
-
],
|
|
1571
|
+
], Ar = [
|
|
1572
1572
|
0,
|
|
1573
1573
|
30,
|
|
1574
1574
|
60,
|
|
@@ -1581,78 +1581,78 @@ var _r = sr.elements, vr = {
|
|
|
1581
1581
|
270,
|
|
1582
1582
|
300,
|
|
1583
1583
|
330
|
|
1584
|
-
],
|
|
1585
|
-
function
|
|
1586
|
-
let n = (e.L - t.L) *
|
|
1584
|
+
], jr = 30, Mr = .08, Nr = .15, Pr = 1.5, Fr = 2;
|
|
1585
|
+
function Ir(e, t) {
|
|
1586
|
+
let n = (e.L - t.L) * Cr;
|
|
1587
1587
|
return Math.hypot(n, e.a - t.a, e.b - t.b);
|
|
1588
1588
|
}
|
|
1589
|
-
function
|
|
1589
|
+
function Lr(e) {
|
|
1590
1590
|
let t = 2166136261;
|
|
1591
1591
|
for (let n = 0; n < e.length; n += 1) t = Math.imul(t ^ e.charCodeAt(n), 16777619) >>> 0;
|
|
1592
1592
|
return t;
|
|
1593
1593
|
}
|
|
1594
|
-
function Lr(e) {
|
|
1595
|
-
return vr[e] ?? _r[e] ?? null;
|
|
1596
|
-
}
|
|
1597
1594
|
function Rr(e) {
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1595
|
+
return yr[e] ?? vr[e] ?? null;
|
|
1596
|
+
}
|
|
1597
|
+
function zr(e) {
|
|
1598
|
+
let t = Rr(e);
|
|
1599
|
+
if (t) return hr(dr(t));
|
|
1600
|
+
let n = _e.indexOf(e) + 1;
|
|
1601
1601
|
return {
|
|
1602
1602
|
L: .68,
|
|
1603
1603
|
C: .12,
|
|
1604
|
-
h: (n > 0 ? n :
|
|
1604
|
+
h: (n > 0 ? n : Lr(e)) * 137.508 % 360
|
|
1605
1605
|
};
|
|
1606
1606
|
}
|
|
1607
|
-
function
|
|
1608
|
-
let t =
|
|
1607
|
+
function Br(e) {
|
|
1608
|
+
let t = xr.get(e);
|
|
1609
1609
|
if (t !== void 0) return t;
|
|
1610
|
-
let n =
|
|
1611
|
-
return
|
|
1610
|
+
let n = _e.indexOf(e);
|
|
1611
|
+
return br.length + (n >= 0 ? n : _e.length);
|
|
1612
1612
|
}
|
|
1613
|
-
function
|
|
1614
|
-
return
|
|
1615
|
-
L: Math.min(
|
|
1616
|
-
C: Math.min(
|
|
1613
|
+
function Vr(e) {
|
|
1614
|
+
return _r({
|
|
1615
|
+
L: Math.min(X.maxL, Math.max(X.minL, e.L)),
|
|
1616
|
+
C: Math.min(X.maxC, Math.max(0, e.C)),
|
|
1617
1617
|
h: (e.h % 360 + 360) % 360
|
|
1618
1618
|
});
|
|
1619
1619
|
}
|
|
1620
|
-
function
|
|
1621
|
-
return
|
|
1620
|
+
function Hr(e, t) {
|
|
1621
|
+
return _r({
|
|
1622
1622
|
L: e,
|
|
1623
1623
|
C: .5,
|
|
1624
1624
|
h: t
|
|
1625
1625
|
}).C;
|
|
1626
1626
|
}
|
|
1627
|
-
function
|
|
1628
|
-
let n =
|
|
1627
|
+
function Ur(e, t) {
|
|
1628
|
+
let n = Vr(e);
|
|
1629
1629
|
return {
|
|
1630
1630
|
lch: n,
|
|
1631
|
-
lab:
|
|
1631
|
+
lab: gr(n),
|
|
1632
1632
|
cost: t
|
|
1633
1633
|
};
|
|
1634
1634
|
}
|
|
1635
|
-
function
|
|
1635
|
+
function Wr(e) {
|
|
1636
1636
|
let t = [];
|
|
1637
|
-
if (e.C <
|
|
1638
|
-
for (let n of
|
|
1639
|
-
let r = Math.abs(n) /
|
|
1640
|
-
t.push(
|
|
1637
|
+
if (e.C < wr) {
|
|
1638
|
+
for (let n of Or) {
|
|
1639
|
+
let r = Math.abs(n) / Mr * (n > 0 ? Pr : 1);
|
|
1640
|
+
t.push(Ur({
|
|
1641
1641
|
...e,
|
|
1642
1642
|
L: e.L + n
|
|
1643
1643
|
}, r));
|
|
1644
|
-
for (let i of
|
|
1645
|
-
L: e.L -
|
|
1646
|
-
C:
|
|
1644
|
+
for (let i of Ar) t.push(Ur({
|
|
1645
|
+
L: e.L - Er + n,
|
|
1646
|
+
C: Tr,
|
|
1647
1647
|
h: i
|
|
1648
|
-
},
|
|
1648
|
+
}, Fr + r + i / 3600));
|
|
1649
1649
|
}
|
|
1650
1650
|
return t.sort((e, t) => e.cost - t.cost);
|
|
1651
1651
|
}
|
|
1652
|
-
let n = e.C / Math.max(1e-6,
|
|
1653
|
-
for (let r of
|
|
1654
|
-
let o = Math.min(
|
|
1655
|
-
t.push(
|
|
1652
|
+
let n = e.C / Math.max(1e-6, Hr(e.L, e.h));
|
|
1653
|
+
for (let r of Dr) for (let i of Or) for (let a of kr) {
|
|
1654
|
+
let o = Math.min(X.maxL, Math.max(X.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;
|
|
1655
|
+
t.push(Ur({
|
|
1656
1656
|
L: o,
|
|
1657
1657
|
C: c,
|
|
1658
1658
|
h: s
|
|
@@ -1660,17 +1660,17 @@ function Ur(e) {
|
|
|
1660
1660
|
}
|
|
1661
1661
|
return t.sort((e, t) => e.cost - t.cost);
|
|
1662
1662
|
}
|
|
1663
|
-
var
|
|
1664
|
-
function
|
|
1665
|
-
let n = [...
|
|
1666
|
-
if (r(i) >=
|
|
1667
|
-
hex: e ??
|
|
1663
|
+
var Z = /* @__PURE__ */ new Map();
|
|
1664
|
+
function Gr(e, t) {
|
|
1665
|
+
let n = [...Z.values()].map((e) => e.lab), r = (e) => n.reduce((t, n) => Math.min(t, Ir(e, n)), Infinity), i = gr(t);
|
|
1666
|
+
if (r(i) >= Sr) return {
|
|
1667
|
+
hex: e ?? mr(i),
|
|
1668
1668
|
lab: i
|
|
1669
1669
|
};
|
|
1670
1670
|
let a = null, o = -Infinity, s = Infinity, c = null, l = -Infinity;
|
|
1671
|
-
for (let e of
|
|
1671
|
+
for (let e of Wr(t)) {
|
|
1672
1672
|
let t = r(e.lab);
|
|
1673
|
-
if (t >=
|
|
1673
|
+
if (t >= Sr) {
|
|
1674
1674
|
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
1675
|
} else t > l && (c = e, l = t);
|
|
1676
1676
|
}
|
|
@@ -1680,36 +1680,36 @@ function Wr(e, t) {
|
|
|
1680
1680
|
cost: 0
|
|
1681
1681
|
};
|
|
1682
1682
|
return {
|
|
1683
|
-
hex:
|
|
1683
|
+
hex: mr(u.lab),
|
|
1684
1684
|
lab: u.lab
|
|
1685
1685
|
};
|
|
1686
1686
|
}
|
|
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
1687
|
function Kr(e) {
|
|
1692
|
-
let t =
|
|
1693
|
-
|
|
1688
|
+
let t = [...new Set(e)].filter((e) => !Z.has(e)).sort((e, t) => Br(e) - Br(t));
|
|
1689
|
+
for (let e of t) Z.set(e, Gr(Rr(e), zr(e)));
|
|
1694
1690
|
}
|
|
1695
|
-
function qr() {
|
|
1696
|
-
|
|
1691
|
+
function qr(e) {
|
|
1692
|
+
let t = Z.get(e);
|
|
1693
|
+
return t ? t.hex : (Kr([e]), Z.get(e).hex);
|
|
1697
1694
|
}
|
|
1698
1695
|
function Jr() {
|
|
1699
|
-
|
|
1696
|
+
return [...Z].map(([e, t]) => [e, t.hex]);
|
|
1697
|
+
}
|
|
1698
|
+
function Yr() {
|
|
1699
|
+
Z.clear();
|
|
1700
1700
|
}
|
|
1701
1701
|
//#endregion
|
|
1702
1702
|
//#region src/render/legend.ts
|
|
1703
|
-
var
|
|
1704
|
-
function
|
|
1705
|
-
if (e.getElementById(
|
|
1703
|
+
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";
|
|
1704
|
+
function Qr(e) {
|
|
1705
|
+
if (e.getElementById(Xr)) return;
|
|
1706
1706
|
let t = e.createElement("style");
|
|
1707
|
-
t.id =
|
|
1707
|
+
t.id = Xr, t.textContent = Zr, e.head.appendChild(t);
|
|
1708
1708
|
}
|
|
1709
|
-
function
|
|
1709
|
+
function $r(e) {
|
|
1710
1710
|
return `linear-gradient(135deg, rgba(255, 255, 255, 0.38) 0 14%, rgba(255, 255, 255, 0) 42%), ${e}`;
|
|
1711
1711
|
}
|
|
1712
|
-
var
|
|
1712
|
+
var ei = class {
|
|
1713
1713
|
element;
|
|
1714
1714
|
constructor(e) {
|
|
1715
1715
|
this.element = e.createElement("div"), this.element.className = "bravais-legend", this.element.hidden = !0;
|
|
@@ -1720,17 +1720,17 @@ var $r = class {
|
|
|
1720
1720
|
let e = this.element.ownerDocument.createElement("span");
|
|
1721
1721
|
e.className = "bravais-legend-item";
|
|
1722
1722
|
let n = this.element.ownerDocument.createElement("span");
|
|
1723
|
-
n.className = "bravais-legend-swatch", n.style.background =
|
|
1723
|
+
n.className = "bravais-legend-swatch", n.style.background = $r(qr(t));
|
|
1724
1724
|
let r = this.element.ownerDocument.createElement("span");
|
|
1725
1725
|
r.textContent = t, e.append(n, r), this.element.appendChild(e);
|
|
1726
1726
|
}
|
|
1727
1727
|
this.element.hidden = e.length === 0;
|
|
1728
1728
|
}
|
|
1729
|
-
},
|
|
1729
|
+
}, Q = .4, $ = .1, ti = .398, ni = Math.sqrt(ti * ti - $ * $), ri = new M(0, 1, 0);
|
|
1730
1730
|
function ii(e) {
|
|
1731
|
-
let [t, n, r] = e.map((e) => new
|
|
1731
|
+
let [t, n, r] = e.map((e) => new M(...e));
|
|
1732
1732
|
return [
|
|
1733
|
-
new
|
|
1733
|
+
new M(),
|
|
1734
1734
|
t.clone(),
|
|
1735
1735
|
n.clone(),
|
|
1736
1736
|
r.clone(),
|
|
@@ -1769,17 +1769,17 @@ function si(e, t) {
|
|
|
1769
1769
|
r.push(i.x, i.y, i.z, a.x, a.y, a.z);
|
|
1770
1770
|
}
|
|
1771
1771
|
let i = new a();
|
|
1772
|
-
return i.setAttribute("position", new h(r, 3)), new
|
|
1772
|
+
return i.setAttribute("position", new h(r, 3)), new b(i, Wn(t));
|
|
1773
1773
|
}
|
|
1774
1774
|
function ci(e) {
|
|
1775
1775
|
let t = 2048, n = Math.max(1, Math.ceil(e.length / 256)), r = new Float32Array(t * n * 4).fill(1), i = new s(Pn), a = new s(), o = !1;
|
|
1776
1776
|
e.forEach((e, n) => {
|
|
1777
1777
|
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(
|
|
1778
|
+
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
1779
|
d < 1 - 1e-6 && (i.toArray(r, l), r[l + 3] = d + 2, o = !0);
|
|
1780
1780
|
});
|
|
1781
|
-
let c = new d(r, t, n,
|
|
1782
|
-
return c.magFilter =
|
|
1781
|
+
let c = new d(r, t, n, ie, g);
|
|
1782
|
+
return c.magFilter = E, c.minFilter = E, c.generateMipmaps = !1, c.needsUpdate = !0, {
|
|
1783
1783
|
texture: c,
|
|
1784
1784
|
hasVacancies: o
|
|
1785
1785
|
};
|
|
@@ -1788,23 +1788,23 @@ function li() {
|
|
|
1788
1788
|
let e = /* @__PURE__ */ new Map();
|
|
1789
1789
|
return (t) => {
|
|
1790
1790
|
let n = e.get(t);
|
|
1791
|
-
return n || (n = new s(
|
|
1791
|
+
return n || (n = new s(qr(t)), e.set(t, n)), n;
|
|
1792
1792
|
};
|
|
1793
1793
|
}
|
|
1794
|
-
function ui(e, t) {
|
|
1795
|
-
let
|
|
1794
|
+
function ui(e, t, n = li()) {
|
|
1795
|
+
let r = new re(2, 2), i = ci(e), a = new v(r, Bn(t, i.texture, i.hasVacancies), e.length), o = new C();
|
|
1796
1796
|
return e.forEach((e, t) => {
|
|
1797
|
-
|
|
1798
|
-
}),
|
|
1797
|
+
o.makeScale(Q, Q, Q), o.setPosition(e.position[0], e.position[1], e.position[2]), a.setMatrixAt(t, o), a.setColorAt(t, n(e.element));
|
|
1798
|
+
}), a.instanceMatrix.needsUpdate = !0, a.instanceColor && (a.instanceColor.needsUpdate = !0), a.userData.sectorTexture = i.texture, a;
|
|
1799
1799
|
}
|
|
1800
|
-
function di(e, t) {
|
|
1800
|
+
function di(e, t, n = li()) {
|
|
1801
1801
|
if (e.bonds.length === 0) return null;
|
|
1802
|
-
let
|
|
1803
|
-
return e.bonds.forEach((t,
|
|
1802
|
+
let r = new i(2, 1, 2), a = new v(r, Un(t, ti), e.bonds.length * 2), o = new O(), s = new M(), c = new M(), l = new M(), u = new A();
|
|
1803
|
+
return e.bonds.forEach((t, r) => {
|
|
1804
1804
|
let i = e.atoms[t.start], d = e.atoms[t.end];
|
|
1805
|
-
|
|
1806
|
-
let f =
|
|
1807
|
-
|
|
1805
|
+
s.set(...i.position), c.set(...d.position), l.subVectors(c, s);
|
|
1806
|
+
let f = l.length() / 2;
|
|
1807
|
+
l.normalize(), u.setFromUnitVectors(ri, l);
|
|
1808
1808
|
let p = [[
|
|
1809
1809
|
0,
|
|
1810
1810
|
i,
|
|
@@ -1816,22 +1816,22 @@ function di(e, t) {
|
|
|
1816
1816
|
f,
|
|
1817
1817
|
2 * f - ni
|
|
1818
1818
|
]];
|
|
1819
|
-
for (let [e, t, i,
|
|
1820
|
-
let d = Math.max(0,
|
|
1821
|
-
|
|
1819
|
+
for (let [e, t, i, c] of p) {
|
|
1820
|
+
let d = Math.max(0, c - i);
|
|
1821
|
+
o.position.copy(s).addScaledVector(l, i + d / 2), o.quaternion.copy(u), o.scale.set($, d, $), o.updateMatrix(), a.setMatrixAt(r * 2 + e, o.matrix), a.setColorAt(r * 2 + e, n(t.element));
|
|
1822
1822
|
}
|
|
1823
|
-
}),
|
|
1823
|
+
}), a.instanceMatrix.needsUpdate = !0, a.instanceColor && (a.instanceColor.needsUpdate = !0), a;
|
|
1824
1824
|
}
|
|
1825
1825
|
function fi(e) {
|
|
1826
1826
|
let t = e[0];
|
|
1827
1827
|
if (!t) throw Error("A scene model needs at least one layer.");
|
|
1828
|
-
|
|
1829
|
-
let n = ai(t.scene.cell), i = new
|
|
1828
|
+
Kr(e.flatMap((e) => [...e.scene.elements, ...e.scene.atoms.map((e) => e.element)]));
|
|
1829
|
+
let n = ai(t.scene.cell), i = new _();
|
|
1830
1830
|
i.position.set(-n[0], -n[1], -n[2]);
|
|
1831
|
-
let a = new r(), o = [], s = 1, c = [], l = new
|
|
1831
|
+
let a = new r(), o = [], s = 1, c = [], l = new M(...n), u = new M(), d = new M();
|
|
1832
1832
|
for (let t of e) {
|
|
1833
1833
|
for (let e of ii(t.scene.cell)) a.expandByPoint(e.sub(l));
|
|
1834
|
-
for (let e of t.scene.atoms) u.set(...e.position).sub(l), a.expandByPoint(
|
|
1834
|
+
for (let e of t.scene.atoms) u.set(...e.position).sub(l), a.expandByPoint(d.copy(u).addScalar(Q)), a.expandByPoint(d.copy(u).subScalar(Q));
|
|
1835
1835
|
for (let e of t.scene.cell) s = Math.max(s, Math.hypot(...e));
|
|
1836
1836
|
let e = t.opacity ?? 1;
|
|
1837
1837
|
if (e <= 0) continue;
|
|
@@ -1839,8 +1839,8 @@ function fi(e) {
|
|
|
1839
1839
|
i.add(n), c.push(n);
|
|
1840
1840
|
let r = di(t.scene, e);
|
|
1841
1841
|
r && (i.add(r), c.push(r));
|
|
1842
|
-
let
|
|
1843
|
-
i.add(
|
|
1842
|
+
let f = si(t.scene.cell, e);
|
|
1843
|
+
i.add(f), c.push(f);
|
|
1844
1844
|
for (let e of t.scene.elements) o.includes(e) || o.push(e);
|
|
1845
1845
|
}
|
|
1846
1846
|
return {
|
|
@@ -1851,27 +1851,83 @@ function fi(e) {
|
|
|
1851
1851
|
span: s,
|
|
1852
1852
|
elements: o,
|
|
1853
1853
|
dispose() {
|
|
1854
|
-
|
|
1855
|
-
e.geometry.dispose();
|
|
1856
|
-
let t = e.userData.sectorTexture;
|
|
1857
|
-
t instanceof d && t.dispose();
|
|
1858
|
-
}
|
|
1859
|
-
i.clear();
|
|
1854
|
+
pi(c), i.clear();
|
|
1860
1855
|
}
|
|
1861
1856
|
};
|
|
1862
1857
|
}
|
|
1858
|
+
function pi(e) {
|
|
1859
|
+
for (let t of e) {
|
|
1860
|
+
t.geometry.dispose();
|
|
1861
|
+
let e = t.userData.sectorTexture;
|
|
1862
|
+
e instanceof d && e.dispose();
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
var mi = {
|
|
1866
|
+
cell: [
|
|
1867
|
+
[
|
|
1868
|
+
1,
|
|
1869
|
+
0,
|
|
1870
|
+
0
|
|
1871
|
+
],
|
|
1872
|
+
[
|
|
1873
|
+
0,
|
|
1874
|
+
1,
|
|
1875
|
+
0
|
|
1876
|
+
],
|
|
1877
|
+
[
|
|
1878
|
+
0,
|
|
1879
|
+
0,
|
|
1880
|
+
1
|
|
1881
|
+
]
|
|
1882
|
+
],
|
|
1883
|
+
atoms: [0, 2].map((e, t) => ({
|
|
1884
|
+
siteIndex: t,
|
|
1885
|
+
element: "X",
|
|
1886
|
+
species: [{
|
|
1887
|
+
element: "X",
|
|
1888
|
+
occupancy: 1
|
|
1889
|
+
}],
|
|
1890
|
+
position: [
|
|
1891
|
+
0,
|
|
1892
|
+
0,
|
|
1893
|
+
e
|
|
1894
|
+
],
|
|
1895
|
+
fractional: [
|
|
1896
|
+
0,
|
|
1897
|
+
0,
|
|
1898
|
+
e
|
|
1899
|
+
],
|
|
1900
|
+
isImage: !1
|
|
1901
|
+
})),
|
|
1902
|
+
bonds: [{
|
|
1903
|
+
start: 0,
|
|
1904
|
+
end: 1,
|
|
1905
|
+
length: 2
|
|
1906
|
+
}],
|
|
1907
|
+
elements: []
|
|
1908
|
+
};
|
|
1909
|
+
function hi() {
|
|
1910
|
+
let e = new s("#ffffff"), t = [];
|
|
1911
|
+
for (let n of [1, .5]) t.push(ui(mi.atoms, n, () => e), di(mi, n, () => e));
|
|
1912
|
+
t.push(si(mi.cell, 1));
|
|
1913
|
+
let n = new _();
|
|
1914
|
+
return n.add(...t), {
|
|
1915
|
+
group: n,
|
|
1916
|
+
dispose: () => pi(t)
|
|
1917
|
+
};
|
|
1918
|
+
}
|
|
1863
1919
|
//#endregion
|
|
1864
1920
|
//#region src/render/stage.ts
|
|
1865
|
-
function
|
|
1866
|
-
let r = new
|
|
1921
|
+
function gi(t = {}) {
|
|
1922
|
+
let r = new N({
|
|
1867
1923
|
antialias: !0,
|
|
1868
1924
|
alpha: !0,
|
|
1869
1925
|
stencil: t.stencil ?? !1
|
|
1870
1926
|
});
|
|
1871
1927
|
r.setClearColor(Mn, 1), r.toneMapping = e;
|
|
1872
|
-
let i = new
|
|
1928
|
+
let i = new se(), a = new k(-1, 1, 1, -1, .01, 1e3), o = new f("#ffffff", An);
|
|
1873
1929
|
i.add(new n("#ffffff", kn), o, o.target);
|
|
1874
|
-
let s = new
|
|
1930
|
+
let s = new M();
|
|
1875
1931
|
return {
|
|
1876
1932
|
renderer: r,
|
|
1877
1933
|
scene: i,
|
|
@@ -1884,78 +1940,86 @@ function pi(t = {}) {
|
|
|
1884
1940
|
}
|
|
1885
1941
|
//#endregion
|
|
1886
1942
|
//#region src/render/viewer.ts
|
|
1887
|
-
var
|
|
1888
|
-
function
|
|
1889
|
-
let r = new
|
|
1943
|
+
var _i = .4, vi = .4, yi = .4, bi = 2, xi = 1.2, Si = .2, Ci = 1500, wi = .2, Ti = 5, Ei = 3, Di = 1e-5, Oi = 4, ki = .35, Ai = 110, ji = 180;
|
|
1944
|
+
function Mi(e, t, n) {
|
|
1945
|
+
let r = new M(0, 0, 1).applyQuaternion(n), i = 0, a = 0, o = new M();
|
|
1890
1946
|
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
1947
|
let e = o.set(t, n, s).dot(r);
|
|
1892
1948
|
i = Math.max(i, e), a = Math.min(a, e);
|
|
1893
1949
|
}
|
|
1894
|
-
let s = Math.max(1, e.span), c = Math.max(.01 * s, -a), l = Math.min(c, -i), u = s *
|
|
1895
|
-
return new
|
|
1950
|
+
let s = Math.max(1, e.span), c = Math.max(.01 * s, -a), l = Math.min(c, -i), u = s * yi, d = l - u, f = t + (d + (Math.max(d, c - u) - d) * vi), p = f + (t + c - f) / _i;
|
|
1951
|
+
return new ee(Mn, f, p);
|
|
1896
1952
|
}
|
|
1897
|
-
function
|
|
1953
|
+
function Ni(e, t = {}) {
|
|
1898
1954
|
let n = e.ownerDocument;
|
|
1899
|
-
|
|
1900
|
-
let { renderer: r, scene: i, camera: a, updateHeadlight: o } =
|
|
1955
|
+
Qr(n), e.classList.add("bravais-viewer");
|
|
1956
|
+
let { renderer: r, scene: i, camera: a, updateHeadlight: o } = gi({ stencil: !0 });
|
|
1901
1957
|
r.setPixelRatio(n.defaultView?.devicePixelRatio ?? 1), r.domElement.className = "bravais-canvas", e.appendChild(r.domElement);
|
|
1902
|
-
let s = t.legend === !1 ? null : new
|
|
1958
|
+
let s = t.legend === !1 ? null : new ei(n);
|
|
1903
1959
|
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(
|
|
1960
|
+
let c = n.defaultView?.getComputedStyle(e).fontFamily ?? "sans-serif", l = t.gizmo === !1 ? null : new sr(c), u = new Jt(a, r.domElement);
|
|
1961
|
+
u.rotateSpeed = bi, u.zoomSpeed = xi, u.dynamicDampingFactor = Si, u.staticMoving = !1, u.noPan = !0, u.mouseButtons.LEFT = S.ROTATE, u.mouseButtons.MIDDLE = S.DOLLY, u.mouseButtons.RIGHT = null;
|
|
1962
|
+
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 j(), C = new A(), w = 0, T = new M(), E = /* @__PURE__ */ new Set();
|
|
1963
|
+
function D() {
|
|
1964
|
+
x = 0, te = !1;
|
|
1965
|
+
for (let e of E) e();
|
|
1966
|
+
}
|
|
1967
|
+
function O() {
|
|
1968
|
+
if (!f && (o(), r.setViewport(0, 0, h, g), r.render(i, a), l && d)) {
|
|
1969
|
+
let e = Math.round(Math.min(ji, Math.max(Ai, Math.min(h, g) * ki)));
|
|
1914
1970
|
l.render(r, a.quaternion, e);
|
|
1915
1971
|
}
|
|
1916
1972
|
}
|
|
1917
|
-
function
|
|
1973
|
+
function k() {
|
|
1918
1974
|
let t = e.getBoundingClientRect();
|
|
1919
|
-
|
|
1975
|
+
h = Math.max(1, Math.round(t.width)), g = Math.max(1, Math.round(t.height));
|
|
1920
1976
|
let n = r.getSize(ne);
|
|
1921
|
-
(n.x !==
|
|
1977
|
+
(n.x !== h || n.y !== g) && r.setSize(h, g, !1), En(a, h, g), u.handleResize(), u.rotateSpeed = h / Ci * bi;
|
|
1922
1978
|
}
|
|
1923
|
-
function
|
|
1924
|
-
d && (
|
|
1979
|
+
function re(e) {
|
|
1980
|
+
d && (m = Tn(d.bounds, e, h, g), u.minZoom = m * wi, u.maxZoom = m * Ti);
|
|
1925
1981
|
}
|
|
1926
|
-
function
|
|
1927
|
-
let e =
|
|
1928
|
-
return
|
|
1982
|
+
function ie() {
|
|
1983
|
+
let e = C.angleTo(a.quaternion) > Di || Math.abs(w - a.zoom) > Di * m || T.distanceToSquared(u.target) > Di;
|
|
1984
|
+
return C.copy(a.quaternion), w = a.zoom, T.copy(u.target), e;
|
|
1929
1985
|
}
|
|
1930
|
-
function
|
|
1931
|
-
|
|
1986
|
+
function ae() {
|
|
1987
|
+
_ = null, u.update(), ie() ? (y = 0, O(), x += 1, te = !0, x >= Oi && D()) : y += 1, b || y < Ei ? _ = requestAnimationFrame(ae) : (v = !1, te && D());
|
|
1932
1988
|
}
|
|
1933
|
-
function
|
|
1934
|
-
|
|
1989
|
+
function oe() {
|
|
1990
|
+
y = 0, v || (v = !0, _ = requestAnimationFrame(ae));
|
|
1935
1991
|
}
|
|
1936
|
-
function
|
|
1937
|
-
|
|
1992
|
+
function se() {
|
|
1993
|
+
_ !== null && (cancelAnimationFrame(_), _ = null), v = !1;
|
|
1938
1994
|
}
|
|
1939
1995
|
u.addEventListener("start", () => {
|
|
1940
|
-
|
|
1996
|
+
b = !0, oe();
|
|
1941
1997
|
}), u.addEventListener("end", () => {
|
|
1942
|
-
|
|
1943
|
-
}), u.addEventListener("change",
|
|
1944
|
-
function
|
|
1945
|
-
let e =
|
|
1946
|
-
|
|
1947
|
-
}
|
|
1948
|
-
let
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1998
|
+
b = !1, oe();
|
|
1999
|
+
}), u.addEventListener("change", oe);
|
|
2000
|
+
function ce() {
|
|
2001
|
+
let e = m > 0 ? a.zoom / m : 1;
|
|
2002
|
+
k(), re(a.quaternion), a.zoom = m * e, a.updateProjectionMatrix(), O();
|
|
2003
|
+
}
|
|
2004
|
+
let le = typeof ResizeObserver > "u" ? null : new ResizeObserver(ce);
|
|
2005
|
+
le?.observe(e), k();
|
|
2006
|
+
let ue = hi();
|
|
2007
|
+
i.add(ue.group), i.fog = new ee(Mn, 1, 2);
|
|
2008
|
+
let N = Promise.all([r.compileAsync(i, a), l && r.compileAsync(l.scene, l.camera)]);
|
|
2009
|
+
i.remove(ue.group), i.fog = null, ue.dispose(), f = N;
|
|
2010
|
+
let P = () => {
|
|
2011
|
+
f === N && (f = null, O());
|
|
2012
|
+
};
|
|
2013
|
+
N.then(P, P);
|
|
2014
|
+
function F(e) {
|
|
2015
|
+
d && (Sn(a, e, p, d.span), u.target.set(...e.target), re(a.quaternion), a.zoom = m * e.scale, a.updateProjectionMatrix(), u.update(), ie());
|
|
2016
|
+
}
|
|
2017
|
+
let de = {
|
|
1954
2018
|
setLayers(e, t = null) {
|
|
1955
|
-
|
|
2019
|
+
de.clear(), e.length !== 0 && (d = fi(e), i.add(d.group), p = yn(d.span), i.fog = Mi(d, p, bn(d.cell)), s?.setElements(d.elements), l?.setCell(d.cell), k(), F(t ?? xn(d.cell)), O());
|
|
1956
2020
|
},
|
|
1957
2021
|
clear() {
|
|
1958
|
-
|
|
2022
|
+
se(), d &&= (i.remove(d.group), d.dispose(), null), i.fog = null, s?.setElements([]), r.setViewport(0, 0, h, g), r.clear();
|
|
1959
2023
|
},
|
|
1960
2024
|
getView() {
|
|
1961
2025
|
return d ? {
|
|
@@ -1965,31 +2029,32 @@ function Ai(e, t = {}) {
|
|
|
1965
2029
|
u.target.y,
|
|
1966
2030
|
u.target.z
|
|
1967
2031
|
],
|
|
1968
|
-
scale:
|
|
2032
|
+
scale: m > 0 ? a.zoom / m : 1
|
|
1969
2033
|
} : null;
|
|
1970
2034
|
},
|
|
1971
2035
|
setView(e) {
|
|
1972
|
-
|
|
2036
|
+
F(e), O();
|
|
1973
2037
|
},
|
|
1974
2038
|
resetView() {
|
|
1975
|
-
d &&
|
|
2039
|
+
d && F(xn(d.cell)), O(), D();
|
|
1976
2040
|
},
|
|
1977
|
-
resize:
|
|
1978
|
-
render:
|
|
2041
|
+
resize: ce,
|
|
2042
|
+
render: O,
|
|
1979
2043
|
onInteraction(e) {
|
|
1980
|
-
return
|
|
2044
|
+
return E.add(e), () => E.delete(e);
|
|
1981
2045
|
},
|
|
1982
2046
|
dispose() {
|
|
1983
|
-
|
|
2047
|
+
de.clear(), f = null, b = !1, le?.disconnect(), u.dispose(), l?.dispose(), r.dispose(), r.domElement.remove(), s?.element.remove(), e.classList.remove("bravais-viewer");
|
|
1984
2048
|
}
|
|
1985
2049
|
};
|
|
1986
|
-
return
|
|
2050
|
+
return de;
|
|
1987
2051
|
}
|
|
1988
2052
|
//#endregion
|
|
1989
2053
|
//#region src/render/thumbnails.ts
|
|
1990
|
-
function
|
|
1991
|
-
let { renderer: e, scene: t, camera: n, updateHeadlight: r } =
|
|
1992
|
-
|
|
2054
|
+
function Pi() {
|
|
2055
|
+
let { renderer: e, scene: t, camera: n, updateHeadlight: r } = gi(), i = /* @__PURE__ */ new Map(), a = hi();
|
|
2056
|
+
t.add(a.group), e.compile(t, n), t.remove(a.group), a.dispose();
|
|
2057
|
+
function o(e, t) {
|
|
1993
2058
|
let n = i.get(e);
|
|
1994
2059
|
if (n && n.layers === t) return n.model;
|
|
1995
2060
|
n?.model.dispose();
|
|
@@ -2000,13 +2065,13 @@ function ji() {
|
|
|
2000
2065
|
}), r;
|
|
2001
2066
|
}
|
|
2002
2067
|
return {
|
|
2003
|
-
render(i,
|
|
2068
|
+
render(i, a, s, c) {
|
|
2004
2069
|
let l = c.getContext("2d");
|
|
2005
|
-
if (!l ||
|
|
2006
|
-
let u =
|
|
2070
|
+
if (!l || a.length === 0) return;
|
|
2071
|
+
let u = o(i, a), d = Math.max(1, c.width), f = Math.max(1, c.height);
|
|
2007
2072
|
(e.domElement.width !== d || e.domElement.height !== f) && e.setSize(d, f, !1), En(n, d, f);
|
|
2008
2073
|
let p = yn(u.span), m = s ?? xn(u.cell);
|
|
2009
|
-
Sn(n, m, p, u.span), n.zoom = Tn(u.bounds, new
|
|
2074
|
+
Sn(n, m, p, u.span), n.zoom = Tn(u.bounds, new A(...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
2075
|
},
|
|
2011
2076
|
release(e) {
|
|
2012
2077
|
i.get(e)?.model.dispose(), i.delete(e);
|
|
@@ -2019,18 +2084,18 @@ function ji() {
|
|
|
2019
2084
|
}
|
|
2020
2085
|
//#endregion
|
|
2021
2086
|
//#region src/index.ts
|
|
2022
|
-
async function
|
|
2023
|
-
let t =
|
|
2024
|
-
if (!n) throw new
|
|
2025
|
-
let r =
|
|
2087
|
+
async function Fi(e) {
|
|
2088
|
+
let t = ge(e), n = t.blocks.find(Ye) ?? t.blocks[0];
|
|
2089
|
+
if (!n) throw new H("The CIF has no data block.");
|
|
2090
|
+
let r = Xe(n);
|
|
2026
2091
|
return {
|
|
2027
2092
|
lattice: r.lattice,
|
|
2028
2093
|
sites: r.sites,
|
|
2029
|
-
operations: await
|
|
2094
|
+
operations: await _t(r),
|
|
2030
2095
|
spaceGroup: r.spaceGroup
|
|
2031
2096
|
};
|
|
2032
2097
|
}
|
|
2033
2098
|
//#endregion
|
|
2034
|
-
export {
|
|
2099
|
+
export { H as CifStructureError, P as CifSyntaxError, nt as SpaceGroupLookupError, bt as SymmetryAnalysisError, Ft as buildScene, Pi as createThumbnailRenderer, Ni as createViewer, qr as elementColor, Jr as elementColorAssignments, Kr as ensureElementColors, rt as ensureMoyo, vt as expandStructure, Me as latticeFromParameters, Ne as latticeFromVectors, dt as operationsForSpaceGroup, ge as parseCif, Xe as parseCifStructure, Re as parseSymmetryOperator, Fi as readCif, Yr as resetElementColors, Pt as structureElements, Ct as symmetryDataset, Dt as typesetSymbol };
|
|
2035
2100
|
|
|
2036
2101
|
//# sourceMappingURL=bravais.js.map
|