@chemistry/crystalview 1.0.9 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +61 -31
- package/dist/{src/camera → camera}/Camera.d.ts +69 -63
- package/dist/camera/Camera.d.ts.map +1 -0
- package/dist/camera/Camera.js +257 -0
- package/dist/camera/Camera.js.map +1 -0
- package/dist/camera/ICamera.d.ts +9 -0
- package/dist/camera/ICamera.d.ts.map +1 -0
- package/dist/camera/ICamera.js +2 -0
- package/dist/camera/ICamera.js.map +1 -0
- package/dist/{src/crystal-view.d.ts → crystal-view.d.ts} +25 -24
- package/dist/crystal-view.d.ts.map +1 -0
- package/dist/crystal-view.js +181 -0
- package/dist/crystal-view.js.map +1 -0
- package/dist/crystalview.css +47 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/{src/molecule3d → molecule3d}/Atom.d.ts +14 -13
- package/dist/molecule3d/Atom.d.ts.map +1 -0
- package/dist/molecule3d/Atom.js +19 -0
- package/dist/molecule3d/Atom.js.map +1 -0
- package/dist/{src/molecule3d → molecule3d}/Bond.d.ts +8 -7
- package/dist/molecule3d/Bond.d.ts.map +1 -0
- package/dist/molecule3d/Bond.js +11 -0
- package/dist/molecule3d/Bond.js.map +1 -0
- package/dist/{src/molecule3d → molecule3d}/CellAtom.d.ts +96 -96
- package/dist/molecule3d/CellAtom.d.ts.map +1 -0
- package/dist/molecule3d/CellAtom.js +132 -0
- package/dist/molecule3d/CellAtom.js.map +1 -0
- package/dist/{src/molecule3d → molecule3d}/Link.d.ts +15 -14
- package/dist/molecule3d/Link.d.ts.map +1 -0
- package/dist/molecule3d/Link.js +17 -0
- package/dist/molecule3d/Link.js.map +1 -0
- package/dist/{src/molecule3d → molecule3d}/Marker.d.ts +9 -8
- package/dist/molecule3d/Marker.d.ts.map +1 -0
- package/dist/molecule3d/Marker.js +11 -0
- package/dist/molecule3d/Marker.js.map +1 -0
- package/dist/{src/molecule3d → molecule3d}/MarkerContact.d.ts +7 -6
- package/dist/molecule3d/MarkerContact.d.ts.map +1 -0
- package/dist/molecule3d/MarkerContact.js +9 -0
- package/dist/molecule3d/MarkerContact.js.map +1 -0
- package/dist/{src/molecule3d → molecule3d}/Molecule3D.d.ts +45 -44
- package/dist/molecule3d/Molecule3D.d.ts.map +1 -0
- package/dist/molecule3d/Molecule3D.js +139 -0
- package/dist/molecule3d/Molecule3D.js.map +1 -0
- package/dist/{src/molecule3d → molecule3d}/MoleculeBuilder.d.ts +20 -19
- package/dist/molecule3d/MoleculeBuilder.d.ts.map +1 -0
- package/dist/molecule3d/MoleculeBuilder.js +131 -0
- package/dist/molecule3d/MoleculeBuilder.js.map +1 -0
- package/dist/molecule3d/MoleculeConnector.d.ts +10 -0
- package/dist/molecule3d/MoleculeConnector.d.ts.map +1 -0
- package/dist/molecule3d/MoleculeConnector.js +107 -0
- package/dist/molecule3d/MoleculeConnector.js.map +1 -0
- package/dist/{src/molecule3d → molecule3d}/UnitCell.d.ts +36 -35
- package/dist/molecule3d/UnitCell.d.ts.map +1 -0
- package/dist/molecule3d/UnitCell.js +238 -0
- package/dist/molecule3d/UnitCell.js.map +1 -0
- package/dist/molecule3d/io/IMoleculeReader.d.ts +8 -0
- package/dist/molecule3d/io/IMoleculeReader.d.ts.map +1 -0
- package/dist/molecule3d/io/IMoleculeReader.js +2 -0
- package/dist/molecule3d/io/IMoleculeReader.js.map +1 -0
- package/dist/{src/molecule3d → molecule3d}/io/MoleculeReaderJCIF.d.ts +12 -11
- package/dist/molecule3d/io/MoleculeReaderJCIF.d.ts.map +1 -0
- package/dist/molecule3d/io/MoleculeReaderJCIF.js +115 -0
- package/dist/molecule3d/io/MoleculeReaderJCIF.js.map +1 -0
- package/dist/{src/painter → painter}/CanvasContext.d.ts +15 -14
- package/dist/painter/CanvasContext.d.ts.map +1 -0
- package/dist/painter/CanvasContext.js +68 -0
- package/dist/painter/CanvasContext.js.map +1 -0
- package/dist/painter/Painter.d.ts +36 -0
- package/dist/painter/Painter.d.ts.map +1 -0
- package/dist/painter/Painter.js +237 -0
- package/dist/painter/Painter.js.map +1 -0
- package/dist/ui/ContextMenu.d.ts +24 -0
- package/dist/ui/ContextMenu.d.ts.map +1 -0
- package/dist/ui/ContextMenu.js +147 -0
- package/dist/ui/ContextMenu.js.map +1 -0
- package/dist/{src/ui → ui}/ContextMenuItem.d.ts +18 -17
- package/dist/ui/ContextMenuItem.d.ts.map +1 -0
- package/dist/ui/ContextMenuItem.js +72 -0
- package/dist/ui/ContextMenuItem.js.map +1 -0
- package/package.json +68 -87
- package/dist/crystal-view.min.js +0 -24
- package/dist/src/molecule3d/MoleculeConnector.d.ts +0 -9
- package/dist/src/painter/Painter.d.ts +0 -35
- package/dist/src/ui/ContextMenu.d.ts +0 -24
- package/package-lock.json +0 -9410
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { Camera } from './camera/Camera.js';
|
|
2
|
+
import { Molecule3D } from './molecule3d/Molecule3D.js';
|
|
3
|
+
import { Painter } from './painter/Painter.js';
|
|
4
|
+
import { ContextMenu } from './ui/ContextMenu.js';
|
|
5
|
+
import { ContextMenuItem } from './ui/ContextMenuItem.js';
|
|
6
|
+
export class Mol3DView {
|
|
7
|
+
viewElement;
|
|
8
|
+
canvasElement;
|
|
9
|
+
context;
|
|
10
|
+
initDone;
|
|
11
|
+
width;
|
|
12
|
+
height;
|
|
13
|
+
subscriptions;
|
|
14
|
+
molecule;
|
|
15
|
+
painter;
|
|
16
|
+
camera;
|
|
17
|
+
contextMenu;
|
|
18
|
+
options;
|
|
19
|
+
constructor(options) {
|
|
20
|
+
this.options = {
|
|
21
|
+
bgcolor: options.bgcolor ?? '#2b303b',
|
|
22
|
+
showLabels: false,
|
|
23
|
+
showMarkers: true,
|
|
24
|
+
showUnitCell: false,
|
|
25
|
+
};
|
|
26
|
+
this.initDone = false;
|
|
27
|
+
this.subscriptions = [];
|
|
28
|
+
this.molecule = new Molecule3D();
|
|
29
|
+
}
|
|
30
|
+
append(element) {
|
|
31
|
+
if (this.viewElement || this.initDone) {
|
|
32
|
+
throw new Error('append or init were already done');
|
|
33
|
+
}
|
|
34
|
+
const viewEl = document.createElement('div');
|
|
35
|
+
viewEl.className = 'jcmolview';
|
|
36
|
+
const canvas = document.createElement('canvas');
|
|
37
|
+
viewEl.appendChild(canvas);
|
|
38
|
+
viewEl.style.backgroundColor = this.options.bgcolor;
|
|
39
|
+
viewEl.style.display = 'block';
|
|
40
|
+
viewEl.style.height = '100%';
|
|
41
|
+
viewEl.style.position = 'absolute';
|
|
42
|
+
viewEl.style.width = '100%';
|
|
43
|
+
canvas.style.display = 'block';
|
|
44
|
+
element.appendChild(viewEl);
|
|
45
|
+
this.viewElement = viewEl;
|
|
46
|
+
this.canvasElement = canvas;
|
|
47
|
+
this.context = this.canvasElement.getContext('2d');
|
|
48
|
+
this.painter = new Painter(this.context, this.options);
|
|
49
|
+
this.camera = new Camera({
|
|
50
|
+
element: this.canvasElement,
|
|
51
|
+
onClick: (x, y) => {
|
|
52
|
+
if (!this.options.showMarkers) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const marker = this.painter.uprojectToMarker({
|
|
56
|
+
camera: this.camera,
|
|
57
|
+
molecule: this.molecule,
|
|
58
|
+
x,
|
|
59
|
+
y,
|
|
60
|
+
});
|
|
61
|
+
if (marker) {
|
|
62
|
+
this.molecule.extendByMarker(marker);
|
|
63
|
+
this.redraw();
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
onRedraw: () => {
|
|
67
|
+
this.redraw();
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
this.contextMenu = new ContextMenu([
|
|
71
|
+
new ContextMenuItem({
|
|
72
|
+
command: () => {
|
|
73
|
+
this.center();
|
|
74
|
+
},
|
|
75
|
+
title: 'Center Molecule',
|
|
76
|
+
type: 'item',
|
|
77
|
+
}),
|
|
78
|
+
new ContextMenuItem({
|
|
79
|
+
title: '----',
|
|
80
|
+
type: 'delimer',
|
|
81
|
+
}),
|
|
82
|
+
new ContextMenuItem({
|
|
83
|
+
command: () => {
|
|
84
|
+
this.options.showMarkers = !this.options.showMarkers;
|
|
85
|
+
this.redraw();
|
|
86
|
+
},
|
|
87
|
+
isChecked: () => {
|
|
88
|
+
return this.options.showMarkers;
|
|
89
|
+
},
|
|
90
|
+
title: 'Show Markers',
|
|
91
|
+
type: 'checkbox',
|
|
92
|
+
}),
|
|
93
|
+
new ContextMenuItem({
|
|
94
|
+
command: () => {
|
|
95
|
+
this.options.showUnitCell = !this.options.showUnitCell;
|
|
96
|
+
this.redraw();
|
|
97
|
+
},
|
|
98
|
+
isChecked: () => {
|
|
99
|
+
return this.options.showUnitCell;
|
|
100
|
+
},
|
|
101
|
+
title: 'Show Unit Cell',
|
|
102
|
+
type: 'checkbox',
|
|
103
|
+
}),
|
|
104
|
+
new ContextMenuItem({
|
|
105
|
+
command: () => {
|
|
106
|
+
this.options.showLabels = !this.options.showLabels;
|
|
107
|
+
this.redraw();
|
|
108
|
+
},
|
|
109
|
+
isChecked: () => {
|
|
110
|
+
return this.options.showLabels;
|
|
111
|
+
},
|
|
112
|
+
title: 'Show Labels',
|
|
113
|
+
type: 'checkbox',
|
|
114
|
+
}),
|
|
115
|
+
]);
|
|
116
|
+
}
|
|
117
|
+
load(jcif) {
|
|
118
|
+
this.molecule.clear();
|
|
119
|
+
this.molecule.load(jcif);
|
|
120
|
+
this.center();
|
|
121
|
+
}
|
|
122
|
+
center() {
|
|
123
|
+
// Center the molecule
|
|
124
|
+
if (this.molecule?.atoms?.length > 2) {
|
|
125
|
+
const center = this.molecule.getCenter();
|
|
126
|
+
const scale = Math.min(this.viewElement.clientWidth - 10, this.viewElement.clientHeight - 10) /
|
|
127
|
+
this.molecule.getRadius();
|
|
128
|
+
this.camera.setCameraView(scale / 2, center);
|
|
129
|
+
this.redraw();
|
|
130
|
+
}
|
|
131
|
+
this.redraw();
|
|
132
|
+
}
|
|
133
|
+
onInit() {
|
|
134
|
+
if (!this.viewElement) {
|
|
135
|
+
throw new Error('append has to be called first');
|
|
136
|
+
}
|
|
137
|
+
if (this.initDone) {
|
|
138
|
+
throw new Error('Init has to be called once');
|
|
139
|
+
}
|
|
140
|
+
this.camera.onInit();
|
|
141
|
+
const event = () => {
|
|
142
|
+
this.resizeCanvas();
|
|
143
|
+
};
|
|
144
|
+
window.addEventListener('resize', event);
|
|
145
|
+
// save subscription
|
|
146
|
+
this.subscriptions.push(() => {
|
|
147
|
+
window.removeEventListener('resize', event);
|
|
148
|
+
});
|
|
149
|
+
setTimeout(() => {
|
|
150
|
+
this.resizeCanvas();
|
|
151
|
+
}, 0);
|
|
152
|
+
this.contextMenu.onInit(this.viewElement);
|
|
153
|
+
this.initDone = true;
|
|
154
|
+
}
|
|
155
|
+
onDestroy() {
|
|
156
|
+
this.camera.onDestroy();
|
|
157
|
+
this.subscriptions.forEach((fn) => {
|
|
158
|
+
fn();
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
redraw() {
|
|
162
|
+
if (!this.height || !this.width) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
this.painter.draw(this.molecule, this.camera);
|
|
166
|
+
}
|
|
167
|
+
resizeCanvas() {
|
|
168
|
+
const width = this.viewElement.clientWidth;
|
|
169
|
+
const height = this.viewElement.clientHeight;
|
|
170
|
+
// Same dimensions already set
|
|
171
|
+
if (width === this.width && height === this.height) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
this.width = width;
|
|
175
|
+
this.height = height;
|
|
176
|
+
this.canvasElement.width = this.width;
|
|
177
|
+
this.canvasElement.height = this.height;
|
|
178
|
+
this.redraw();
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=crystal-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crystal-view.js","sourceRoot":"","sources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CAAC;QACD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,aAAa,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACtC,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QACxC,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;CACF"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
.jcmolview-dropdown-menu {
|
|
2
|
+
top: 100%;
|
|
3
|
+
left: 0;
|
|
4
|
+
z-index: 1000;
|
|
5
|
+
display: none;
|
|
6
|
+
float: left;
|
|
7
|
+
min-width: 10rem;
|
|
8
|
+
padding: 0.5rem 0;
|
|
9
|
+
margin: 0.125rem 0 0;
|
|
10
|
+
font-size: 1rem;
|
|
11
|
+
color: #292b2c;
|
|
12
|
+
text-align: left;
|
|
13
|
+
list-style: none;
|
|
14
|
+
background-color: #fff;
|
|
15
|
+
background-clip: padding-box;
|
|
16
|
+
border: 1px solid rgba(0, 0, 0, 0.15);
|
|
17
|
+
border-radius: 0.25rem;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.jcmolview-dropdown-item {
|
|
21
|
+
box-sizing: border-box;
|
|
22
|
+
display: block;
|
|
23
|
+
text-decoration: none;
|
|
24
|
+
width: 100%;
|
|
25
|
+
padding: 3px 1.5rem 3px 1rem;
|
|
26
|
+
clear: both;
|
|
27
|
+
font-weight: 400;
|
|
28
|
+
color: #292b2c;
|
|
29
|
+
text-align: inherit;
|
|
30
|
+
white-space: nowrap;
|
|
31
|
+
background: 0 0;
|
|
32
|
+
border: 0;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.jcmolview-dropdown-item:hover,
|
|
36
|
+
.jcmolview-dropdown-item:focus {
|
|
37
|
+
color: #1d1e1f;
|
|
38
|
+
text-decoration: none;
|
|
39
|
+
background-color: #f7f7f9;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.jcmolview-dropdown-divider {
|
|
43
|
+
height: 1px;
|
|
44
|
+
margin: 0.5rem 0;
|
|
45
|
+
overflow: hidden;
|
|
46
|
+
background-color: #eceeef;
|
|
47
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { Matrix3x4, Vec3 } from
|
|
2
|
-
import { CellAtom } from
|
|
3
|
-
export declare class Atom {
|
|
4
|
-
fractional: Vec3;
|
|
5
|
-
position: Vec3;
|
|
6
|
-
parent: CellAtom;
|
|
7
|
-
symetry: Matrix3x4;
|
|
8
|
-
constructor(parent: CellAtom, symetry: Matrix3x4);
|
|
9
|
-
/**
|
|
10
|
-
* Return color of the element
|
|
11
|
-
*/
|
|
12
|
-
getColor(): string;
|
|
13
|
-
}
|
|
1
|
+
import { Matrix3x4, Vec3 } from '@chemistry/math';
|
|
2
|
+
import { CellAtom } from './CellAtom.js';
|
|
3
|
+
export declare class Atom {
|
|
4
|
+
fractional: Vec3;
|
|
5
|
+
position: Vec3;
|
|
6
|
+
parent: CellAtom;
|
|
7
|
+
symetry: Matrix3x4;
|
|
8
|
+
constructor(parent: CellAtom, symetry: Matrix3x4);
|
|
9
|
+
/**
|
|
10
|
+
* Return color of the element
|
|
11
|
+
*/
|
|
12
|
+
getColor(): string;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=Atom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Atom.d.ts","sourceRoot":"","sources":["../../src/molecule3d/Atom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,qBAAa,IAAI;IACR,UAAU,EAAE,IAAI,CAAC;IACjB,QAAQ,EAAE,IAAI,CAAC;IACf,MAAM,EAAE,QAAQ,CAAC;IACjB,OAAO,EAAE,SAAS,CAAC;gBAEd,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS;IAOhD;;OAEG;IACI,QAAQ;CAGhB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export class Atom {
|
|
2
|
+
fractional;
|
|
3
|
+
position;
|
|
4
|
+
parent;
|
|
5
|
+
symetry;
|
|
6
|
+
constructor(parent, symetry) {
|
|
7
|
+
this.parent = parent;
|
|
8
|
+
this.fractional = symetry.project(parent.fractional);
|
|
9
|
+
this.symetry = symetry;
|
|
10
|
+
this.position = parent.unitCell.fractToOrth(this.fractional);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Return color of the element
|
|
14
|
+
*/
|
|
15
|
+
getColor() {
|
|
16
|
+
return this.parent.element.color;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=Atom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Atom.js","sourceRoot":"","sources":["../../src/molecule3d/Atom.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,IAAI;IACR,UAAU,CAAO;IACjB,QAAQ,CAAO;IACf,MAAM,CAAW;IACjB,OAAO,CAAY;IAE1B,YAAY,MAAgB,EAAE,OAAkB;QAC9C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACrD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC/D,CAAC;IAED;;OAEG;IACI,QAAQ;QACb,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;IACnC,CAAC;CACF"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Atom } from
|
|
2
|
-
export declare class Bond {
|
|
3
|
-
atom1: Atom;
|
|
4
|
-
atom2: Atom;
|
|
5
|
-
order: number;
|
|
6
|
-
constructor(atom1: Atom, atom2: Atom, order?: number);
|
|
7
|
-
}
|
|
1
|
+
import { Atom } from './Atom.js';
|
|
2
|
+
export declare class Bond {
|
|
3
|
+
atom1: Atom;
|
|
4
|
+
atom2: Atom;
|
|
5
|
+
order: number;
|
|
6
|
+
constructor(atom1: Atom, atom2: Atom, order?: number);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=Bond.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Bond.d.ts","sourceRoot":"","sources":["../../src/molecule3d/Bond.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,qBAAa,IAAI;IACR,KAAK,EAAE,IAAI,CAAC;IACZ,KAAK,EAAE,IAAI,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;gBAET,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM;CAKrD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Bond.js","sourceRoot":"","sources":["../../src/molecule3d/Bond.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,IAAI;IACR,KAAK,CAAO;IACZ,KAAK,CAAO;IACZ,KAAK,CAAS;IAErB,YAAY,KAAW,EAAE,KAAW,EAAE,KAAc;QAClD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,IAAI,CAAC,CAAC;IAC1B,CAAC;CACF"}
|
|
@@ -1,96 +1,96 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Matrix3x4, Vec3 } from
|
|
3
|
-
import { Atom } from
|
|
4
|
-
import { Link } from
|
|
5
|
-
import { UnitCell } from
|
|
6
|
-
export declare class CellAtom {
|
|
7
|
-
/**
|
|
8
|
-
* Atom ID within molecule
|
|
9
|
-
*/
|
|
10
|
-
id: number;
|
|
11
|
-
/**
|
|
12
|
-
* label
|
|
13
|
-
* @type {string}
|
|
14
|
-
*/
|
|
15
|
-
label: string;
|
|
16
|
-
/**
|
|
17
|
-
* Element
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
*
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
1
|
+
import { ChemElementInfo } from '@chemistry/elements';
|
|
2
|
+
import { Matrix3x4, Vec3 } from '@chemistry/math';
|
|
3
|
+
import { Atom } from './Atom.js';
|
|
4
|
+
import { Link } from './Link.js';
|
|
5
|
+
import { UnitCell } from './UnitCell.js';
|
|
6
|
+
export declare class CellAtom {
|
|
7
|
+
/**
|
|
8
|
+
* Atom ID within molecule
|
|
9
|
+
*/
|
|
10
|
+
id: number;
|
|
11
|
+
/**
|
|
12
|
+
* label
|
|
13
|
+
* @type {string}
|
|
14
|
+
*/
|
|
15
|
+
label: string;
|
|
16
|
+
/**
|
|
17
|
+
* Element
|
|
18
|
+
*/
|
|
19
|
+
element: ChemElementInfo;
|
|
20
|
+
/**
|
|
21
|
+
* Cartezian position of Atom
|
|
22
|
+
*/
|
|
23
|
+
position: Vec3;
|
|
24
|
+
/**
|
|
25
|
+
* Unit Cell
|
|
26
|
+
*/
|
|
27
|
+
unitCell: UnitCell;
|
|
28
|
+
/**
|
|
29
|
+
* Fractional position of Atom
|
|
30
|
+
*/
|
|
31
|
+
fractional: Vec3;
|
|
32
|
+
/**
|
|
33
|
+
* Occupancy
|
|
34
|
+
*/
|
|
35
|
+
occupancy: number;
|
|
36
|
+
/**
|
|
37
|
+
* Isotropic U
|
|
38
|
+
*/
|
|
39
|
+
uiso: number;
|
|
40
|
+
/**
|
|
41
|
+
* Disorder Assembly
|
|
42
|
+
*/
|
|
43
|
+
assembly: string;
|
|
44
|
+
/**
|
|
45
|
+
* Disorder Group
|
|
46
|
+
*/
|
|
47
|
+
group: string;
|
|
48
|
+
/**
|
|
49
|
+
* List of Atoms Created From this Cell Atom
|
|
50
|
+
*/
|
|
51
|
+
children: Atom[];
|
|
52
|
+
/**
|
|
53
|
+
* List of connected atoms
|
|
54
|
+
*/
|
|
55
|
+
links: Link[];
|
|
56
|
+
constructor(data: {
|
|
57
|
+
id: number;
|
|
58
|
+
unitCell: UnitCell;
|
|
59
|
+
type: string;
|
|
60
|
+
label: string;
|
|
61
|
+
x: number;
|
|
62
|
+
y: number;
|
|
63
|
+
z: number;
|
|
64
|
+
occupancy: number;
|
|
65
|
+
uiso: number;
|
|
66
|
+
assembly: string;
|
|
67
|
+
group: string;
|
|
68
|
+
});
|
|
69
|
+
/**
|
|
70
|
+
* Add link to another element
|
|
71
|
+
*/
|
|
72
|
+
addLink(otherAtom: CellAtom, symetry: Matrix3x4): void;
|
|
73
|
+
getLinks(): Link[];
|
|
74
|
+
/**
|
|
75
|
+
* Returns true if Cell Atom has Chield with Specific position
|
|
76
|
+
*/
|
|
77
|
+
hasChild(position: Vec3): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Return Chield Atom with Specifified Position or null if not found
|
|
80
|
+
*/
|
|
81
|
+
getChild(position: Vec3): Atom | null;
|
|
82
|
+
/**
|
|
83
|
+
* Return true if has Atom with Specified symetry position
|
|
84
|
+
*/
|
|
85
|
+
hasChieldWithSymetry(symetry: Matrix3x4): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Return Chield Atom with Specifified symetry or similar atom liing on the same spot
|
|
88
|
+
*/
|
|
89
|
+
getChieldWithSymetry(symetry: Matrix3x4): Atom | null;
|
|
90
|
+
/**
|
|
91
|
+
* Create Atom & return it based on this Cell Atom
|
|
92
|
+
* and set correct settings
|
|
93
|
+
*/
|
|
94
|
+
createAtom(symetry: Matrix3x4, addToChields: boolean): Atom;
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=CellAtom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CellAtom.d.ts","sourceRoot":"","sources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