react-cheminfo 0.139.0 → 0.140.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/lib/credits/core/credits.d.ts +12 -0
- package/lib/credits/core/credits.d.ts.map +1 -1
- package/lib/credits/core/credits.js +16 -0
- package/lib/credits/core/credits.js.map +1 -1
- package/lib/crystal3d/ui/CrystalCanvas3D.d.ts +1 -1
- package/lib/crystal3d/ui/CrystalCanvas3D.d.ts.map +1 -1
- package/lib/crystal3d/ui/CrystalViewer3D.d.ts +1 -1
- package/lib/crystal3d/ui/CrystalViewer3D.d.ts.map +1 -1
- package/lib/crystal3d/ui/crystalStructureViewerProps.d.ts +1 -1
- package/lib/crystal3d/ui/crystalStructureViewerProps.d.ts.map +1 -1
- package/lib/download/ui/FigureDownloadPanel.d.ts +17 -3
- package/lib/download/ui/FigureDownloadPanel.d.ts.map +1 -1
- package/lib/download/ui/FigureDownloadPanel.js +1 -1
- package/lib/download/ui/FigureDownloadPanel.js.map +1 -1
- package/lib/download/ui/FigureQuickActions.d.ts +10 -4
- package/lib/download/ui/FigureQuickActions.d.ts.map +1 -1
- package/lib/download/ui/FigureQuickActions.js +12 -6
- package/lib/download/ui/FigureQuickActions.js.map +1 -1
- package/lib/ecosystem/core/home.d.ts +19 -0
- package/lib/ecosystem/core/home.d.ts.map +1 -0
- package/lib/ecosystem/core/home.js +23 -0
- package/lib/ecosystem/core/home.js.map +1 -0
- package/lib/ecosystem/core/index.d.ts +3 -0
- package/lib/ecosystem/core/index.d.ts.map +1 -1
- package/lib/ecosystem/core/index.js +2 -0
- package/lib/ecosystem/core/index.js.map +1 -1
- package/lib/ecosystem/core/searchSites.d.ts +39 -0
- package/lib/ecosystem/core/searchSites.d.ts.map +1 -0
- package/lib/ecosystem/core/searchSites.js +77 -0
- package/lib/ecosystem/core/searchSites.js.map +1 -0
- package/lib/ecosystem/core/types.d.ts +1 -1
- package/lib/ecosystem/core/types.d.ts.map +1 -1
- package/lib/ecosystem/core/unlistedSites.d.ts.map +1 -1
- package/lib/ecosystem/core/unlistedSites.js +14 -0
- package/lib/ecosystem/core/unlistedSites.js.map +1 -1
- package/lib/ecosystem/ui/EcosystemButton.d.ts +6 -0
- package/lib/ecosystem/ui/EcosystemButton.d.ts.map +1 -1
- package/lib/ecosystem/ui/EcosystemButton.js +2 -2
- package/lib/ecosystem/ui/EcosystemButton.js.map +1 -1
- package/lib/ecosystem/ui/EcosystemMenu.d.ts +13 -4
- package/lib/ecosystem/ui/EcosystemMenu.d.ts.map +1 -1
- package/lib/ecosystem/ui/EcosystemMenu.js +56 -6
- package/lib/ecosystem/ui/EcosystemMenu.js.map +1 -1
- package/lib/ecosystem/ui/SiteGroupGrid.d.ts +12 -0
- package/lib/ecosystem/ui/SiteGroupGrid.d.ts.map +1 -1
- package/lib/ecosystem/ui/SiteGroupGrid.js +15 -2
- package/lib/ecosystem/ui/SiteGroupGrid.js.map +1 -1
- package/lib/ecosystem/ui/glyphs.d.ts.map +1 -1
- package/lib/ecosystem/ui/glyphs.js +4 -0
- package/lib/ecosystem/ui/glyphs.js.map +1 -1
- package/lib/i18n/core/chromeCatalog.d.ts +1 -1
- package/lib/i18n/core/chromeCatalog.d.ts.map +1 -1
- package/lib/locales/de.json +10 -0
- package/lib/locales/en.json +10 -0
- package/lib/locales/es.json +10 -0
- package/lib/locales/fr.json +10 -0
- package/lib/locales/it.json +10 -0
- package/lib/molecule3d/core/bondNeighbours.d.ts +30 -0
- package/lib/molecule3d/core/bondNeighbours.d.ts.map +1 -0
- package/lib/molecule3d/core/bondNeighbours.js +108 -0
- package/lib/molecule3d/core/bondNeighbours.js.map +1 -0
- package/lib/molecule3d/core/file.d.ts +15 -4
- package/lib/molecule3d/core/file.d.ts.map +1 -1
- package/lib/molecule3d/core/file.js +10 -1
- package/lib/molecule3d/core/file.js.map +1 -1
- package/lib/molecule3d/core/index.d.ts +11 -2
- package/lib/molecule3d/core/index.d.ts.map +1 -1
- package/lib/molecule3d/core/index.js +6 -1
- package/lib/molecule3d/core/index.js.map +1 -1
- package/lib/molecule3d/core/partialBondMode.d.ts +34 -0
- package/lib/molecule3d/core/partialBondMode.d.ts.map +1 -0
- package/lib/molecule3d/core/partialBondMode.js +39 -0
- package/lib/molecule3d/core/partialBondMode.js.map +1 -0
- package/lib/molecule3d/core/partialBondRanges.d.ts +61 -0
- package/lib/molecule3d/core/partialBondRanges.d.ts.map +1 -0
- package/lib/molecule3d/core/partialBondRanges.js +89 -0
- package/lib/molecule3d/core/partialBondRanges.js.map +1 -0
- package/lib/molecule3d/core/partialBonds.d.ts +61 -0
- package/lib/molecule3d/core/partialBonds.d.ts.map +1 -0
- package/lib/molecule3d/core/partialBonds.js +115 -0
- package/lib/molecule3d/core/partialBonds.js.map +1 -0
- package/lib/molecule3d/core/settings.d.ts +13 -35
- package/lib/molecule3d/core/settings.d.ts.map +1 -1
- package/lib/molecule3d/core/settings.js +17 -25
- package/lib/molecule3d/core/settings.js.map +1 -1
- package/lib/molecule3d/core/tools.d.ts +36 -0
- package/lib/molecule3d/core/tools.d.ts.map +1 -0
- package/lib/molecule3d/core/tools.js +24 -0
- package/lib/molecule3d/core/tools.js.map +1 -0
- package/lib/molecule3d/ui/Molecule3DExport.d.ts.map +1 -1
- package/lib/molecule3d/ui/Molecule3DExport.js +19 -2
- package/lib/molecule3d/ui/Molecule3DExport.js.map +1 -1
- package/lib/molecule3d/ui/Molecule3DOptions.d.ts +5 -2
- package/lib/molecule3d/ui/Molecule3DOptions.d.ts.map +1 -1
- package/lib/molecule3d/ui/Molecule3DOptions.js +6 -4
- package/lib/molecule3d/ui/Molecule3DOptions.js.map +1 -1
- package/lib/molecule3d/ui/Molecule3DPartialBonds.d.ts +22 -0
- package/lib/molecule3d/ui/Molecule3DPartialBonds.d.ts.map +1 -0
- package/lib/molecule3d/ui/Molecule3DPartialBonds.js +53 -0
- package/lib/molecule3d/ui/Molecule3DPartialBonds.js.map +1 -0
- package/lib/molecule3d/ui/Molecule3DToolbar.d.ts +1 -1
- package/lib/molecule3d/ui/Molecule3DToolbar.d.ts.map +1 -1
- package/lib/molecule3d/ui/Molecule3DToolbar.js +1 -1
- package/lib/molecule3d/ui/Molecule3DToolbar.js.map +1 -1
- package/lib/molecule3d/ui/MoleculeCanvas3D.d.ts.map +1 -1
- package/lib/molecule3d/ui/MoleculeCanvas3D.js +3 -2
- package/lib/molecule3d/ui/MoleculeCanvas3D.js.map +1 -1
- package/lib/molecule3d/ui/drawScene.d.ts +4 -3
- package/lib/molecule3d/ui/drawScene.d.ts.map +1 -1
- package/lib/molecule3d/ui/drawScene.js +12 -2
- package/lib/molecule3d/ui/drawScene.js.map +1 -1
- package/lib/molecule3d/ui/moleculeFileFormats.d.ts +3 -2
- package/lib/molecule3d/ui/moleculeFileFormats.d.ts.map +1 -1
- package/lib/molecule3d/ui/moleculeFileFormats.js +5 -3
- package/lib/molecule3d/ui/moleculeFileFormats.js.map +1 -1
- package/lib/molecule3d/ui/moleculeViewer3DProps.d.ts +2 -1
- package/lib/molecule3d/ui/moleculeViewer3DProps.d.ts.map +1 -1
- package/lib/molecule3d/ui/partialBondShapes.d.ts +117 -0
- package/lib/molecule3d/ui/partialBondShapes.d.ts.map +1 -0
- package/lib/molecule3d/ui/partialBondShapes.js +164 -0
- package/lib/molecule3d/ui/partialBondShapes.js.map +1 -0
- package/lib/molecule3d/ui/renderMolecule.d.ts +9 -0
- package/lib/molecule3d/ui/renderMolecule.d.ts.map +1 -1
- package/lib/molecule3d/ui/renderMolecule.js +17 -0
- package/lib/molecule3d/ui/renderMolecule.js.map +1 -1
- package/lib/molecule3d/ui/renderPartialBonds.d.ts +19 -0
- package/lib/molecule3d/ui/renderPartialBonds.d.ts.map +1 -0
- package/lib/molecule3d/ui/renderPartialBonds.js +90 -0
- package/lib/molecule3d/ui/renderPartialBonds.js.map +1 -0
- package/lib/molecule3d/ui/structureGeometry.d.ts +22 -0
- package/lib/molecule3d/ui/structureGeometry.d.ts.map +1 -0
- package/lib/molecule3d/ui/structureGeometry.js +63 -0
- package/lib/molecule3d/ui/structureGeometry.js.map +1 -0
- package/lib/molecule3d/ui/usePolarSurfaceArea.d.ts +2 -2
- package/lib/molecule3d/ui/usePolarSurfaceArea.d.ts.map +1 -1
- package/lib/molecule3d/ui/usePolarSurfaceArea.js +5 -4
- package/lib/molecule3d/ui/usePolarSurfaceArea.js.map +1 -1
- package/lib/molecule3d/ui/viewer.d.ts +8 -1
- package/lib/molecule3d/ui/viewer.d.ts.map +1 -1
- package/lib/molecule3d/ui/viewer.js +10 -0
- package/lib/molecule3d/ui/viewer.js.map +1 -1
- package/lib/molecule3d/ui/viewerTypes.d.ts +18 -0
- package/lib/molecule3d/ui/viewerTypes.d.ts.map +1 -1
- package/lib/panel/ui/FilterInput.d.ts +11 -0
- package/lib/panel/ui/FilterInput.d.ts.map +1 -1
- package/lib/panel/ui/FilterInput.js +10 -1
- package/lib/panel/ui/FilterInput.js.map +1 -1
- package/lib/shell/ui/ShellFrame.d.ts.map +1 -1
- package/lib/shell/ui/ShellFrame.js +3 -2
- package/lib/shell/ui/ShellFrame.js.map +1 -1
- package/package.json +1 -1
- package/src/credits/core/credits.ts +16 -0
- package/src/crystal3d/ui/CrystalCanvas3D.tsx +1 -1
- package/src/crystal3d/ui/CrystalViewer3D.tsx +1 -1
- package/src/crystal3d/ui/crystalStructureViewerProps.ts +1 -1
- package/src/download/ui/FigureDownloadPanel.tsx +20 -4
- package/src/download/ui/FigureQuickActions.tsx +18 -6
- package/src/ecosystem/core/home.ts +27 -0
- package/src/ecosystem/core/index.ts +7 -0
- package/src/ecosystem/core/searchSites.ts +102 -0
- package/src/ecosystem/core/types.ts +1 -0
- package/src/ecosystem/core/unlistedSites.ts +15 -0
- package/src/ecosystem/ui/EcosystemButton.tsx +8 -2
- package/src/ecosystem/ui/EcosystemMenu.tsx +103 -7
- package/src/ecosystem/ui/SiteGroupGrid.tsx +28 -3
- package/src/ecosystem/ui/glyphs.tsx +14 -0
- package/src/locales/de.json +10 -0
- package/src/locales/en.json +10 -0
- package/src/locales/es.json +10 -0
- package/src/locales/fr.json +10 -0
- package/src/locales/it.json +10 -0
- package/src/molecule3d/core/bondNeighbours.ts +108 -0
- package/src/molecule3d/core/file.ts +18 -4
- package/src/molecule3d/core/index.ts +17 -3
- package/src/molecule3d/core/partialBondMode.ts +48 -0
- package/src/molecule3d/core/partialBondRanges.ts +120 -0
- package/src/molecule3d/core/partialBonds.ts +180 -0
- package/src/molecule3d/core/settings.ts +29 -52
- package/src/molecule3d/core/tools.ts +51 -0
- package/src/molecule3d/ui/Molecule3DExport.tsx +17 -2
- package/src/molecule3d/ui/Molecule3DOptions.tsx +16 -3
- package/src/molecule3d/ui/Molecule3DPartialBonds.tsx +100 -0
- package/src/molecule3d/ui/Molecule3DToolbar.tsx +2 -2
- package/src/molecule3d/ui/MoleculeCanvas3D.tsx +3 -4
- package/src/molecule3d/ui/drawScene.ts +15 -2
- package/src/molecule3d/ui/moleculeFileFormats.ts +5 -3
- package/src/molecule3d/ui/moleculeViewer3DProps.ts +2 -1
- package/src/molecule3d/ui/partialBondShapes.ts +246 -0
- package/src/molecule3d/ui/renderMolecule.ts +20 -0
- package/src/molecule3d/ui/renderPartialBonds.ts +122 -0
- package/src/molecule3d/ui/structureGeometry.ts +73 -0
- package/src/molecule3d/ui/usePolarSurfaceArea.ts +5 -4
- package/src/molecule3d/ui/viewer.ts +12 -0
- package/src/molecule3d/ui/viewerTypes.ts +19 -0
- package/src/panel/ui/FilterInput.tsx +24 -0
- package/src/shell/ui/ShellFrame.tsx +7 -1
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The partial bonds of the structure on screen, as molstar draws them: each
|
|
3
|
+
* one a dashed cylinder, each half in the colour of the atom it starts from as
|
|
4
|
+
* a bond of the model is, with its length written over its middle.
|
|
5
|
+
*
|
|
6
|
+
* The pairs are found by `findPartialBonds`, from the atoms and the bonds
|
|
7
|
+
* molstar itself drew, so a partial bond is never a bond molstar already has.
|
|
8
|
+
*/
|
|
9
|
+
import { addFixedCountDashedCylinder } from 'molstar/lib/mol-geo/geometry/mesh/builder/cylinder.js';
|
|
10
|
+
import { MeshBuilder } from 'molstar/lib/mol-geo/geometry/mesh/mesh-builder.js';
|
|
11
|
+
import { Mesh } from 'molstar/lib/mol-geo/geometry/mesh/mesh.js';
|
|
12
|
+
import { TextBuilder } from 'molstar/lib/mol-geo/geometry/text/text-builder.js';
|
|
13
|
+
import { Text } from 'molstar/lib/mol-geo/geometry/text/text.js';
|
|
14
|
+
import { Vec3 } from 'molstar/lib/mol-math/linear-algebra.js';
|
|
15
|
+
import { Shape } from 'molstar/lib/mol-model/shape.js';
|
|
16
|
+
import { Representation } from 'molstar/lib/mol-repr/representation.js';
|
|
17
|
+
// Lowercased on import: it is a factory, not a constructor.
|
|
18
|
+
import { ShapeRepresentation as createShapeRepresentation } from 'molstar/lib/mol-repr/shape/representation.js';
|
|
19
|
+
import { ElementSymbolColors, elementSymbolColor, } from 'molstar/lib/mol-theme/color/element-symbol.js';
|
|
20
|
+
import { Color } from 'molstar/lib/mol-util/color/color.js';
|
|
21
|
+
import { MarkerAction } from 'molstar/lib/mol-util/marker-action.js';
|
|
22
|
+
import { ParamDefinition as PD } from 'molstar/lib/mol-util/param-definition.js';
|
|
23
|
+
import { bondLimit } from "../../molstar/bonds/bondRule.js";
|
|
24
|
+
import { findPartialBonds } from "../core/partialBonds.js";
|
|
25
|
+
import { structureGeometry } from "./structureGeometry.js";
|
|
26
|
+
/**
|
|
27
|
+
* The partial bonds of a structure, between the atoms molstar draws in it.
|
|
28
|
+
* @param structure - The structure on screen.
|
|
29
|
+
* @returns The bonds, with the atoms they need to be drawn.
|
|
30
|
+
*/
|
|
31
|
+
export function partialBondScene(structure) {
|
|
32
|
+
const geometry = structureGeometry(structure);
|
|
33
|
+
const elements = [];
|
|
34
|
+
for (let atom = 0; atom < geometry.elements.length; atom++) {
|
|
35
|
+
elements.push((geometry.elements[atom] ?? '').toUpperCase());
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
elements,
|
|
39
|
+
coordinates: geometry.coordinates,
|
|
40
|
+
bonds: findPartialBonds(geometry, { bondLimit }),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
// Lowercased: molstar's parameter definitions are factories, not constructors.
|
|
44
|
+
const { Boolean: booleanParam, Color: colorParam, MultiSelect: multiSelectParam, Numeric: numericParam, } = PD;
|
|
45
|
+
/** How the partial bonds are drawn. */
|
|
46
|
+
export const PartialBondParams = {
|
|
47
|
+
...Mesh.Params,
|
|
48
|
+
...Text.Params,
|
|
49
|
+
/** Radius of the dashes, Å. */
|
|
50
|
+
radius: numericParam(0.14, { min: 0.01, max: 1, step: 0.01 }),
|
|
51
|
+
textColor: colorParam(Color.fromHexStyle('#1f2937')), // tokens-ok: a scene colour
|
|
52
|
+
textSize: numericParam(0.36, { min: 0.1, max: 10, step: 0.1 }),
|
|
53
|
+
// On a pale card, as the crystal viewer writes its labels: written straight
|
|
54
|
+
// over the dashes, the digits are read as part of them.
|
|
55
|
+
background: booleanParam(true),
|
|
56
|
+
backgroundMargin: numericParam(0.2, { min: 0, max: 1, step: 0.01 }),
|
|
57
|
+
backgroundColor: colorParam(Color.fromHexStyle('#ffffff')), // tokens-ok: a scene colour
|
|
58
|
+
backgroundOpacity: numericParam(0.85, { min: 0, max: 1, step: 0.01 }),
|
|
59
|
+
// In front of the dashes, as the measurement labels are.
|
|
60
|
+
offsetZ: numericParam(0.75, { min: 0, max: 10, step: 0.1 }),
|
|
61
|
+
visuals: multiSelectParam(['dashes', 'lengths'], [
|
|
62
|
+
['dashes', 'Dashes'],
|
|
63
|
+
['lengths', 'Lengths'],
|
|
64
|
+
]),
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* The representation drawing the dashes and, when asked, their lengths.
|
|
68
|
+
* @param context - molstar's representation context.
|
|
69
|
+
* @returns The representation; `createOrUpdate` it with a {@link PartialBondScene}.
|
|
70
|
+
*/
|
|
71
|
+
export function createPartialBondRepresentation(context) {
|
|
72
|
+
return Representation.createMulti('Partial bonds', context, () => PartialBondParams, Representation.StateBuilder, {
|
|
73
|
+
dashes: () => createShapeRepresentation(dashesShape, Mesh.Utils),
|
|
74
|
+
lengths: () => createShapeRepresentation(lengthsShape, Text.Utils, {
|
|
75
|
+
modifyState: (state) => ({
|
|
76
|
+
...state,
|
|
77
|
+
markerActions: MarkerAction.None,
|
|
78
|
+
}),
|
|
79
|
+
}),
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
const dashesShape = (_context, scene, props, shape) => {
|
|
83
|
+
const state = MeshBuilder.createState(1024, 512, shape?.geometry);
|
|
84
|
+
const start = Vec3.zero();
|
|
85
|
+
const end = Vec3.zero();
|
|
86
|
+
const cylinder = {
|
|
87
|
+
radiusTop: props.radius,
|
|
88
|
+
radiusBottom: props.radius,
|
|
89
|
+
radialSegments: 16,
|
|
90
|
+
topCap: true,
|
|
91
|
+
bottomCap: true,
|
|
92
|
+
};
|
|
93
|
+
const { bonds, coordinates } = scene;
|
|
94
|
+
for (let index = 0; index < bonds.length; index++) {
|
|
95
|
+
const bond = bonds[index];
|
|
96
|
+
if (bond === undefined)
|
|
97
|
+
continue;
|
|
98
|
+
position(start, coordinates, bond.first);
|
|
99
|
+
position(end, coordinates, bond.second);
|
|
100
|
+
const dashes = dashCount(bond.distance);
|
|
101
|
+
// Each half from its own atom, as molstar draws the halves of a bond.
|
|
102
|
+
state.currentGroup = index * 2;
|
|
103
|
+
addFixedCountDashedCylinder(state, start, end, 0.5, dashes, true, cylinder);
|
|
104
|
+
state.currentGroup = index * 2 + 1;
|
|
105
|
+
addFixedCountDashedCylinder(state, end, start, 0.5, dashes, true, cylinder);
|
|
106
|
+
}
|
|
107
|
+
return Shape.create('Partial bonds', scene, MeshBuilder.getMesh(state), (group) => halfColor(scene, group), () => 1, (group) => bondLabel(scene, Math.floor(group / 2)), undefined, bonds.length * 2);
|
|
108
|
+
};
|
|
109
|
+
const lengthsShape = (_context, scene, props, shape) => {
|
|
110
|
+
const builder = TextBuilder.create(props, 64, 32, shape?.geometry);
|
|
111
|
+
const start = Vec3.zero();
|
|
112
|
+
const end = Vec3.zero();
|
|
113
|
+
const { bonds, coordinates } = scene;
|
|
114
|
+
for (let index = 0; index < bonds.length; index++) {
|
|
115
|
+
const bond = bonds[index];
|
|
116
|
+
if (bond === undefined)
|
|
117
|
+
continue;
|
|
118
|
+
position(start, coordinates, bond.first);
|
|
119
|
+
position(end, coordinates, bond.second);
|
|
120
|
+
Vec3.add(start, start, end);
|
|
121
|
+
Vec3.scale(start, start, 0.5);
|
|
122
|
+
const x = start[0] ?? 0;
|
|
123
|
+
const y = start[1] ?? 0;
|
|
124
|
+
const z = start[2] ?? 0;
|
|
125
|
+
builder.add(lengthText(bond.distance), x, y, z, 1, 1, index);
|
|
126
|
+
}
|
|
127
|
+
return Shape.create('Partial bond lengths', scene, builder.getText(), () => props.textColor, () => props.textSize, (group) => bondLabel(scene, group), undefined, bonds.length);
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* What a length reads, as molstar writes the distances it measures.
|
|
131
|
+
* @param distance - In ångström.
|
|
132
|
+
* @returns E.g. `2.27 Å`.
|
|
133
|
+
*/
|
|
134
|
+
function lengthText(distance) {
|
|
135
|
+
return `${distance.toFixed(2)} Å`;
|
|
136
|
+
}
|
|
137
|
+
// Dashes along one half, under 0.2 Å each and never fewer than four: an even
|
|
138
|
+
// count, so every dash has its full length.
|
|
139
|
+
function dashCount(distance) {
|
|
140
|
+
return Math.max(4, 2 * Math.round(distance / 0.8));
|
|
141
|
+
}
|
|
142
|
+
function position(out, coordinates, atom) {
|
|
143
|
+
Vec3.set(out, coordinates[atom * 3] ?? 0, coordinates[atom * 3 + 1] ?? 0, coordinates[atom * 3 + 2] ?? 0);
|
|
144
|
+
}
|
|
145
|
+
function halfColor(scene, group) {
|
|
146
|
+
const bond = scene.bonds[Math.floor(group / 2)];
|
|
147
|
+
const atom = group % 2 === 0 ? bond?.first : bond?.second;
|
|
148
|
+
const element = atom === undefined ? '' : (scene.elements[atom] ?? '');
|
|
149
|
+
return elementSymbolColor(ElementSymbolColors, element);
|
|
150
|
+
}
|
|
151
|
+
// `C1–C6 2.27 Å`: the atoms numbered as in the file.
|
|
152
|
+
function bondLabel(scene, index) {
|
|
153
|
+
const bond = scene.bonds[index];
|
|
154
|
+
if (bond === undefined)
|
|
155
|
+
return 'Partial bond';
|
|
156
|
+
const { first, second, distance } = bond;
|
|
157
|
+
const atom = (at) => `${symbolOf(scene.elements[at] ?? '')}${at + 1}`;
|
|
158
|
+
return `${atom(first)}–${atom(second)} ${lengthText(distance)}`;
|
|
159
|
+
}
|
|
160
|
+
// `CL` as it is written, `Cl`.
|
|
161
|
+
function symbolOf(element) {
|
|
162
|
+
return element.charAt(0) + element.slice(1).toLowerCase();
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=partialBondShapes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"partialBondShapes.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/partialBondShapes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,2BAA2B,EAAE,MAAM,uDAAuD,CAAC;AACpG,OAAO,EAAE,WAAW,EAAE,MAAM,mDAAmD,CAAC;AAChF,OAAO,EAAE,IAAI,EAAE,MAAM,2CAA2C,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,mDAAmD,CAAC;AAChF,OAAO,EAAE,IAAI,EAAE,MAAM,2CAA2C,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,wCAAwC,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAGvD,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAExE,4DAA4D;AAC5D,OAAO,EAAE,mBAAmB,IAAI,yBAAyB,EAAE,MAAM,8CAA8C,CAAC;AAChH,O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AQ,EAAE,GAAG,IAAI,CAAC;IACzC,MAAM,IAAI,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;IAC9E,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;AAClE,CAAC;AAED,+BAA+B;AAC/B,SAAS,QAAQ,CAAC,OAAe;IAC/B,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;AAC5D,CAAC"}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import type { Structure } from 'molstar/lib/mol-model/structure.js';
|
|
10
10
|
import type { PluginContext } from 'molstar/lib/mol-plugin/context.js';
|
|
11
11
|
import type { Molecule3DFile } from '../core/file.ts';
|
|
12
|
+
import type { RepresentationId } from '../core/settings.ts';
|
|
12
13
|
import type { MoleculeStyle } from './viewerTypes.ts';
|
|
13
14
|
/** State-tree ref of the structure every representation hangs off. */
|
|
14
15
|
export declare const MOLECULE_STRUCTURE_REF = "molecule3d-structure";
|
|
@@ -37,4 +38,12 @@ export declare function clearMolecule(plugin: PluginContext): Promise<void>;
|
|
|
37
38
|
* @returns The loaded structure, or `undefined` when no molecule is displayed.
|
|
38
39
|
*/
|
|
39
40
|
export declare function moleculeStructure(plugin: PluginContext): Structure | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* The radius molstar gives a C–C bond of the model, so what is drawn beside
|
|
43
|
+
* the bonds can be sized after them.
|
|
44
|
+
* @param representation - Which representation.
|
|
45
|
+
* @param sizeFactor - The settings' radius multiplier.
|
|
46
|
+
* @returns The radius in ångström; 0 for spacefill, which draws no bonds.
|
|
47
|
+
*/
|
|
48
|
+
export declare function bondRadius(representation: RepresentationId, sizeFactor: number): number;
|
|
40
49
|
//# sourceMappingURL=renderMolecule.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderMolecule.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/renderMolecule.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAOvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"renderMolecule.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/renderMolecule.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAOvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,sEAAsE;AACtE,eAAO,MAAM,sBAAsB,yBAAyB,CAAC;AAK7D,qEAAqE;AACrE,eAAO,MAAM,wBAAwB,qBAAqB,CAAC;AAoB3D;;;;;;;;;GASG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,cAAc,EACvB,KAAK,GAAE,aAAkB,GACxB,OAAO,CAAC,MAAM,CAAC,CA2CjB;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAGxE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,aAAa,GACpB,SAAS,GAAG,SAAS,CAIvB;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,cAAc,EAAE,gBAAgB,EAChC,UAAU,EAAE,MAAM,GACjB,MAAM,CAKR"}
|
|
@@ -27,6 +27,8 @@ const BALL_AND_STICK_ASPECT_RATIO = 2 / 3;
|
|
|
27
27
|
const SPACEFILL_SCALE = 4;
|
|
28
28
|
/** Sticks take the factor as a radius in ångström; 0.3 Å is licorice. */
|
|
29
29
|
const STICK_SCALE = 1.2;
|
|
30
|
+
/** molstar's van der Waals radius of carbon, which sizes a C–C bond, Å. */
|
|
31
|
+
const CARBON_VDW_RADIUS = 1.7;
|
|
30
32
|
/**
|
|
31
33
|
* Replace the displayed molecule. Everything already on screen goes first.
|
|
32
34
|
* @param plugin - The molstar context.
|
|
@@ -85,6 +87,21 @@ export function moleculeStructure(plugin) {
|
|
|
85
87
|
return undefined;
|
|
86
88
|
return object.data;
|
|
87
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* The radius molstar gives a C–C bond of the model, so what is drawn beside
|
|
92
|
+
* the bonds can be sized after them.
|
|
93
|
+
* @param representation - Which representation.
|
|
94
|
+
* @param sizeFactor - The settings' radius multiplier.
|
|
95
|
+
* @returns The radius in ångström; 0 for spacefill, which draws no bonds.
|
|
96
|
+
*/
|
|
97
|
+
export function bondRadius(representation, sizeFactor) {
|
|
98
|
+
const factor = sizeFactor * NATURAL_SIZE_FACTOR;
|
|
99
|
+
if (representation === 'spacefill')
|
|
100
|
+
return 0;
|
|
101
|
+
if (representation === 'stick')
|
|
102
|
+
return factor * STICK_SCALE;
|
|
103
|
+
return factor * BALL_AND_STICK_ASPECT_RATIO * CARBON_VDW_RADIUS;
|
|
104
|
+
}
|
|
88
105
|
/**
|
|
89
106
|
* Translate one of the three representations into molstar's own. `stick` is a
|
|
90
107
|
* genuine licorice model: a uniform size theme and an aspect ratio of 1 give
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderMolecule.js","sourceRoot":"","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IACX,IAAI,cAAc,KAAK,WAAW,EAAE,CAAC;QACnC,OAAO,mCAAmC,CAAC,MAAM,EAAE,SAAS,EAAE;YAC5D,IAAI,EAAE,WAAW;YACjB,UAAU,EAAE,EAAE,UAAU,EAAE,UAAU,GAAG,eAAe,EAAE;YACxD,KAAK;YACL,WAAW;SACZ,CAAC,CAAC;IACL,CAAC;IACD,IAAI,cAAc,KAAK,OAAO,EAAE,CAAC;QAC/B,OAAO,mCAAmC,CAAC,MAAM,EAAE,SAAS,EAAE;YAC5D,IAAI,EAAE,gBAAgB;YACtB,UAAU,EAAE;gBACV,UAAU,EAAE,UAAU,GAAG,WAAW;gBACpC,eAAe,EAAE,CAAC;gBAClB,aAAa,EAAE,KAAK;aACrB;YACD,KAAK;YACL,WAAW;YACX,IAAI,EAAE,SAAS;YACf,UAAU,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE;SACzB,CAAC,CAAC;IACL,CAAC;IACD,OAAO,mCAAmC,CAAC,MAAM,EAAE,SAAS,EAAE;QAC5D,IAAI,EAAE,gBAAgB;QACtB,UAAU,EAAE;YACV,UAAU;YACV,eAAe,EAAE,2BAA2B;YAC5C,aAAa,EAAE,KAAK;SACrB;QACD,KAAK;QACL,WAAW;KACZ,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The partial bonds drawn over the model: a node of the state tree hanging off
|
|
3
|
+
* the structure, as the surface does.
|
|
4
|
+
*
|
|
5
|
+
* Hanging there, it is rebuilt from the structure each time the structure
|
|
6
|
+
* changes — another frame of a trajectory included, so the bonds forming along
|
|
7
|
+
* a reaction path are found again at every step — and it goes with the
|
|
8
|
+
* molecule when that is replaced.
|
|
9
|
+
*/
|
|
10
|
+
import type { PluginContext } from 'molstar/lib/mol-plugin/context.js';
|
|
11
|
+
import type { PartialBondStyle } from './viewerTypes.ts';
|
|
12
|
+
/**
|
|
13
|
+
* Draw the partial bonds of the molecule on screen, or restyle them.
|
|
14
|
+
* @param plugin - The molstar context.
|
|
15
|
+
* @param style - See {@link PartialBondStyle}.
|
|
16
|
+
* @returns Nothing; resolves once they are on screen.
|
|
17
|
+
*/
|
|
18
|
+
export declare function renderPartialBonds(plugin: PluginContext, style?: PartialBondStyle): Promise<void>;
|
|
19
|
+
//# sourceMappingURL=renderPartialBonds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderPartialBonds.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/renderPartialBonds.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAcvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAWzD;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,aAAa,EACrB,KAAK,GAAE,gBAAqB,GAC3B,OAAO,CAAC,IAAI,CAAC,CAef"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The partial bonds drawn over the model: a node of the state tree hanging off
|
|
3
|
+
* the structure, as the surface does.
|
|
4
|
+
*
|
|
5
|
+
* Hanging there, it is rebuilt from the structure each time the structure
|
|
6
|
+
* changes — another frame of a trajectory included, so the bonds forming along
|
|
7
|
+
* a reaction path are found again at every step — and it goes with the
|
|
8
|
+
* molecule when that is replaced.
|
|
9
|
+
*/
|
|
10
|
+
import { PluginStateObject } from 'molstar/lib/mol-plugin-state/objects.js';
|
|
11
|
+
import { StateTransformer } from 'molstar/lib/mol-state/index.js';
|
|
12
|
+
import { Task } from 'molstar/lib/mol-task/index.js';
|
|
13
|
+
import { ParamDefinition as PD } from 'molstar/lib/mol-util/param-definition.js';
|
|
14
|
+
import { createPartialBondRepresentation, partialBondScene, } from "./partialBondShapes.js";
|
|
15
|
+
import { MOLECULE_STRUCTURE_REF, bondRadius } from "./renderMolecule.js";
|
|
16
|
+
/** The partial bond node, replaced in place whenever the style changes. */
|
|
17
|
+
const PARTIAL_BONDS_REF = 'molecule3d-partial-bonds';
|
|
18
|
+
/**
|
|
19
|
+
* A dash is thinner than a bond, so a partial bond never reads as a full one
|
|
20
|
+
* seen end on.
|
|
21
|
+
*/
|
|
22
|
+
const DASH_RADIUS_SCALE = 0.5;
|
|
23
|
+
/**
|
|
24
|
+
* Draw the partial bonds of the molecule on screen, or restyle them.
|
|
25
|
+
* @param plugin - The molstar context.
|
|
26
|
+
* @param style - See {@link PartialBondStyle}.
|
|
27
|
+
* @returns Nothing; resolves once they are on screen.
|
|
28
|
+
*/
|
|
29
|
+
export async function renderPartialBonds(plugin, style = {}) {
|
|
30
|
+
const { representation = 'ball-and-stick', sizeFactor = 1, lengths = true, } = style;
|
|
31
|
+
if (!plugin.state.data.cells.has(MOLECULE_STRUCTURE_REF))
|
|
32
|
+
return;
|
|
33
|
+
await plugin
|
|
34
|
+
.build()
|
|
35
|
+
.to(MOLECULE_STRUCTURE_REF)
|
|
36
|
+
.applyOrUpdate(PARTIAL_BONDS_REF, PartialBonds3D, {
|
|
37
|
+
radius: dashRadius(representation, sizeFactor),
|
|
38
|
+
lengths,
|
|
39
|
+
})
|
|
40
|
+
.commit();
|
|
41
|
+
}
|
|
42
|
+
function dashRadius(representation, sizeFactor) {
|
|
43
|
+
return Math.max(0.02, bondRadius(representation, sizeFactor) * DASH_RADIUS_SCALE);
|
|
44
|
+
}
|
|
45
|
+
const createTransformer = StateTransformer.builderFactory('react-cheminfo');
|
|
46
|
+
// Lowercased: molstar's parameter definitions are factories, not constructors.
|
|
47
|
+
const { Boolean: booleanParam, Numeric: numericParam } = PD;
|
|
48
|
+
/** The structure's partial bonds, as a representation of their own. */
|
|
49
|
+
const PartialBonds3D = createTransformer({
|
|
50
|
+
name: 'molecule3d-partial-bonds-3d',
|
|
51
|
+
display: 'Partial bonds',
|
|
52
|
+
from: PluginStateObject.Molecule.Structure,
|
|
53
|
+
to: PluginStateObject.Shape.Representation3D,
|
|
54
|
+
params: {
|
|
55
|
+
radius: numericParam(0.14, { min: 0.01, max: 1, step: 0.01 }),
|
|
56
|
+
lengths: booleanParam(true),
|
|
57
|
+
},
|
|
58
|
+
})({
|
|
59
|
+
canAutoUpdate() {
|
|
60
|
+
return true;
|
|
61
|
+
},
|
|
62
|
+
apply({ a, params }, plugin) {
|
|
63
|
+
return Task.create('Partial bonds', async (runtime) => {
|
|
64
|
+
const scene = partialBondScene(a.data);
|
|
65
|
+
const repr = createPartialBondRepresentation({
|
|
66
|
+
webgl: plugin.canvas3d?.webgl,
|
|
67
|
+
...plugin.representation.structure.themes,
|
|
68
|
+
});
|
|
69
|
+
await repr.createOrUpdate(reprProps(params), scene).runInContext(runtime);
|
|
70
|
+
return new PluginStateObject.Shape.Representation3D({ repr, sourceData: scene }, { label: 'Partial bonds' });
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
update({ a, b, newParams }) {
|
|
74
|
+
return Task.create('Partial bonds', async (runtime) => {
|
|
75
|
+
const scene = partialBondScene(a.data);
|
|
76
|
+
await b.data.repr
|
|
77
|
+
.createOrUpdate(reprProps(newParams), scene)
|
|
78
|
+
.runInContext(runtime);
|
|
79
|
+
b.data.sourceData = scene;
|
|
80
|
+
return StateTransformer.UpdateResult.Updated;
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
function reprProps(params) {
|
|
85
|
+
return {
|
|
86
|
+
radius: params.radius,
|
|
87
|
+
visuals: params.lengths ? ['dashes', 'lengths'] : ['dashes'],
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=renderPartialBonds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderPartialBonds.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/renderPartialBonds.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,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E;QACxB,OAAO,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;YACpD,MAAM,KAAK,GAAG,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YACvC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI;iBACd,cAAc,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,KAAK,CAAC;iBAC3C,YAAY,CAAC,OAAO,CAAC,CAAC;YACzB,CAAC,CAAC,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;YAC1B,OAAO,gBAAgB,CAAC,YAAY,CAAC,OAAO,CAAC;QAC/C,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC;AAEH,SAAS,SAAS,CAAC,MAGlB;IACC,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;KAC7D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The atoms of a molstar structure and the bonds molstar drew between them,
|
|
3
|
+
* as the plain arrays `findPartialBonds` reads.
|
|
4
|
+
*/
|
|
5
|
+
import type { Structure } from 'molstar/lib/mol-model/structure.js';
|
|
6
|
+
import type { PartialBondGeometry } from '../core/partialBonds.ts';
|
|
7
|
+
/** {@link PartialBondGeometry}, its arrays typed as they are built. */
|
|
8
|
+
export interface StructureGeometry extends PartialBondGeometry {
|
|
9
|
+
readonly elements: readonly string[];
|
|
10
|
+
readonly coordinates: Float64Array;
|
|
11
|
+
readonly bonds: Int32Array;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The atomic units of a structure, one after the other: their atoms in the
|
|
15
|
+
* order of each unit — the order of the file, for a molecule read from one —
|
|
16
|
+
* at the coordinates of the frame on screen, and every bond molstar drew,
|
|
17
|
+
* within a unit or between two.
|
|
18
|
+
* @param structure - The structure on screen.
|
|
19
|
+
* @returns Its atoms and bonds.
|
|
20
|
+
*/
|
|
21
|
+
export declare function structureGeometry(structure: Structure): StructureGeometry;
|
|
22
|
+
//# sourceMappingURL=structureGeometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structureGeometry.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/structureGeometry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAEV,SAAS,EACV,MAAM,oCAAoC,CAAC;AAG5C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAEnE,uEAAuE;AACvE,MAAM,WAAW,iBAAkB,SAAQ,mBAAmB;IAC5D,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,WAAW,EAAE,YAAY,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;CAC5B;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,SAAS,GAAG,iBAAiB,CA2CzE"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The atoms of a molstar structure and the bonds molstar drew between them,
|
|
3
|
+
* as the plain arrays `findPartialBonds` reads.
|
|
4
|
+
*/
|
|
5
|
+
import { Vec3 } from 'molstar/lib/mol-math/linear-algebra.js';
|
|
6
|
+
import { Unit } from 'molstar/lib/mol-model/structure.js';
|
|
7
|
+
/**
|
|
8
|
+
* The atomic units of a structure, one after the other: their atoms in the
|
|
9
|
+
* order of each unit — the order of the file, for a molecule read from one —
|
|
10
|
+
* at the coordinates of the frame on screen, and every bond molstar drew,
|
|
11
|
+
* within a unit or between two.
|
|
12
|
+
* @param structure - The structure on screen.
|
|
13
|
+
* @returns Its atoms and bonds.
|
|
14
|
+
*/
|
|
15
|
+
export function structureGeometry(structure) {
|
|
16
|
+
const units = structure.units;
|
|
17
|
+
const offsets = new Map();
|
|
18
|
+
let count = 0;
|
|
19
|
+
for (let index = 0; index < units.length; index++) {
|
|
20
|
+
const unit = units[index];
|
|
21
|
+
if (unit === undefined || !Unit.isAtomic(unit))
|
|
22
|
+
continue;
|
|
23
|
+
offsets.set(unit.id, count);
|
|
24
|
+
count += unit.elements.length;
|
|
25
|
+
}
|
|
26
|
+
const elements = [];
|
|
27
|
+
const coordinates = new Float64Array(count * 3);
|
|
28
|
+
const bonds = [];
|
|
29
|
+
const point = Vec3.zero();
|
|
30
|
+
for (let index = 0; index < units.length; index++) {
|
|
31
|
+
const unit = units[index];
|
|
32
|
+
if (unit === undefined || !Unit.isAtomic(unit))
|
|
33
|
+
continue;
|
|
34
|
+
const offset = offsets.get(unit.id) ?? 0;
|
|
35
|
+
const symbols = unit.model.atomicHierarchy.atoms.type_symbol;
|
|
36
|
+
const atoms = unit.elements;
|
|
37
|
+
for (let local = 0; local < atoms.length; local++) {
|
|
38
|
+
const atom = atoms[local];
|
|
39
|
+
elements.push(symbols.value(atom));
|
|
40
|
+
unit.conformation.position(atom, point);
|
|
41
|
+
coordinates[(offset + local) * 3] = point[0] ?? 0;
|
|
42
|
+
coordinates[(offset + local) * 3 + 1] = point[1] ?? 0;
|
|
43
|
+
coordinates[(offset + local) * 3 + 2] = point[2] ?? 0;
|
|
44
|
+
}
|
|
45
|
+
// Every bond is listed from both ends; each is taken once.
|
|
46
|
+
const { a, b } = unit.bonds;
|
|
47
|
+
for (let edge = 0; edge < a.length; edge++) {
|
|
48
|
+
const from = a[edge] ?? 0;
|
|
49
|
+
const to = b[edge] ?? 0;
|
|
50
|
+
if (from < to)
|
|
51
|
+
bonds.push(offset + from, offset + to);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
for (const edge of structure.interUnitBonds.edges) {
|
|
55
|
+
const first = offsets.get(edge.unitA);
|
|
56
|
+
const second = offsets.get(edge.unitB);
|
|
57
|
+
if (first === undefined || second === undefined)
|
|
58
|
+
continue;
|
|
59
|
+
bonds.push(first + edge.indexA, second + edge.indexB);
|
|
60
|
+
}
|
|
61
|
+
return { elements, coordinates, bonds: Int32Array.from(bonds) };
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=structureGeometry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structureGeometry.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/structureGeometry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,wCAAwC,CAAC;AAK9D,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAW1D;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAAC,SAAoB;IACpD,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC;IAC9B,MAAM,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC1C,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QAClD,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;QAC1B,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;YAAE,SAAS;QACzD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QAC5B,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;IAChC,CAAC;IACD,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,WAAW,GAAG,IAAI,YAAY,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;IAChD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAC1B,KAAK,IAAI,KAAK,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5B,KAAK,IAAI,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC;YAC3C,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC1B,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACxB,IAAI,IAAI,GAAG,EAAE;gBAAE,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,EAAE,MAAM,GAAG,EAAE,CAAC,CAAC;QACxD,CAAC;IACH,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,SAAS,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC;QAClD,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACtC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACvC,IAAI,KAAK,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS;YAAE,SAAS;QAC1D,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;IACxD,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;AAClE,CAAC"}
|
|
@@ -4,8 +4,8 @@ import type { Molecule3DFile } from '../core/file.ts';
|
|
|
4
4
|
* loaded only once a caller asks for it.
|
|
5
5
|
* @param molfile - The molecule, or `null`.
|
|
6
6
|
* @param enabled - Whether to compute it at all.
|
|
7
|
-
* @returns The area in Ų, or `null` while unknown, disabled, for
|
|
8
|
-
*
|
|
7
|
+
* @returns The area in Ų, or `null` while unknown, disabled, for a file that
|
|
8
|
+
* is not a molfile, or when openchemlib is not installed or cannot read it.
|
|
9
9
|
*/
|
|
10
10
|
export declare function usePolarSurfaceArea(molfile: Molecule3DFile | null, enabled: boolean): number | null;
|
|
11
11
|
//# sourceMappingURL=usePolarSurfaceArea.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePolarSurfaceArea.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/usePolarSurfaceArea.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"usePolarSurfaceArea.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/usePolarSurfaceArea.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGtD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,cAAc,GAAG,IAAI,EAC9B,OAAO,EAAE,OAAO,GACf,MAAM,GAAG,IAAI,CAqBf"}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
|
+
import { isMolfileFormat } from "../core/file.js";
|
|
2
3
|
/**
|
|
3
4
|
* Ertl's topological polar surface area of the molecule, from openchemlib,
|
|
4
5
|
* loaded only once a caller asks for it.
|
|
5
6
|
* @param molfile - The molecule, or `null`.
|
|
6
7
|
* @param enabled - Whether to compute it at all.
|
|
7
|
-
* @returns The area in Ų, or `null` while unknown, disabled, for
|
|
8
|
-
*
|
|
8
|
+
* @returns The area in Ų, or `null` while unknown, disabled, for a file that
|
|
9
|
+
* is not a molfile, or when openchemlib is not installed or cannot read it.
|
|
9
10
|
*/
|
|
10
11
|
export function usePolarSurfaceArea(molfile, enabled) {
|
|
11
12
|
const [result, setResult] = useState(null);
|
|
12
|
-
//
|
|
13
|
-
const data = enabled && molfile
|
|
13
|
+
// openchemlib finds the polar atoms by the bonds of a molfile.
|
|
14
|
+
const data = enabled && molfile && isMolfileFormat(molfile.format) ? molfile.data : null;
|
|
14
15
|
useEffect(() => {
|
|
15
16
|
if (data === null)
|
|
16
17
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePolarSurfaceArea.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/usePolarSurfaceArea.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"usePolarSurfaceArea.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/usePolarSurfaceArea.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG5C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAA8B,EAC9B,OAAgB;IAEhB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAG1B,IAAI,CAAC,CAAC;IAChB,+DAA+D;IAC/D,MAAM,IAAI,GACR,OAAO,IAAI,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IAE9E,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,IAAI,KAAK,IAAI;YAAE,OAAO;QAC1B,IAAI,SAAS,GAAG,KAAK,CAAC;QACtB,KAAK,uBAAuB,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;YAC/C,IAAI,CAAC,SAAS;gBAAE,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;QACH,OAAO,GAAG,EAAE;YACV,SAAS,GAAG,IAAI,CAAC;QACnB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,OAAO,IAAI,KAAK,IAAI,IAAI,MAAM,EAAE,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AACrE,CAAC;AAED,KAAK,UAAU,uBAAuB,CACpC,OAAe;IAEf,IAAI,CAAC;QACH,MAAM,EAAE,QAAQ,EAAE,kBAAkB,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;QACrE,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAC/C,OAAO,IAAI,kBAAkB,CAAC,QAAQ,CAAC,CAAC,gBAAgB,CAAC;IAC3D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -13,7 +13,7 @@ import type { Molecule3DHighlight } from '../core/highlight.ts';
|
|
|
13
13
|
import type { Measurement, MeasurementKind } from '../core/measurement.ts';
|
|
14
14
|
import { MoleculeFrames } from './moleculeFrames.ts';
|
|
15
15
|
import { SceneWatches } from './sceneWatches.ts';
|
|
16
|
-
import type { Molecule3DViewerOptions, MoleculeStyle, SurfaceStyle } from './viewerTypes.ts';
|
|
16
|
+
import type { Molecule3DViewerOptions, MoleculeStyle, PartialBondStyle, SurfaceStyle } from './viewerTypes.ts';
|
|
17
17
|
/**
|
|
18
18
|
* One molstar canvas, and every operation the component performs on it — its
|
|
19
19
|
* pictures and what it reports of the camera and the pointer included, from
|
|
@@ -45,6 +45,13 @@ export declare class Molecule3DViewer extends SceneWatches {
|
|
|
45
45
|
* @returns Nothing; resolves once the scene is empty.
|
|
46
46
|
*/
|
|
47
47
|
hideMolecule(): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Draw the partial bonds of the current molecule, dashed: pairs a little too
|
|
50
|
+
* far apart to be bonded. Another molecule takes them away with it.
|
|
51
|
+
* @param style - See {@link PartialBondStyle}.
|
|
52
|
+
* @returns Nothing; resolves once they are on screen.
|
|
53
|
+
*/
|
|
54
|
+
showPartialBonds(style?: PartialBondStyle): Promise<void>;
|
|
48
55
|
/**
|
|
49
56
|
* Add or restyle the molecular surface over the current molecule.
|
|
50
57
|
* @param style - See {@link SurfaceStyle}.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewer.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/viewer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAcH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAG3E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"viewer.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/viewer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAcH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAG3E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AASrD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EACV,uBAAuB,EACvB,aAAa,EACb,gBAAgB,EAChB,YAAY,EACb,MAAM,kBAAkB,CAAC;AAE1B;;;;;GAKG;AACH,qBAAa,gBAAiB,SAAQ,YAAY;;IAKhD,0EAA0E;IAC1E,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC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I,IAAI;CAKhB"}
|
|
@@ -12,6 +12,7 @@ import { DEFAULT_CAMERA_DURATION, DEFAULT_SPIN_SPEED, HighlightPainter, Measurem
|
|
|
12
12
|
import { applyCamera, resetCamera } from "./camera.js";
|
|
13
13
|
import { MoleculeFrames } from "./moleculeFrames.js";
|
|
14
14
|
import { MODEL_REPRESENTATION_REF, clearMolecule, moleculeStructure, renderMolecule, } from "./renderMolecule.js";
|
|
15
|
+
import { renderPartialBonds } from "./renderPartialBonds.js";
|
|
15
16
|
import { clearSurface, renderSurface } from "./renderSurface.js";
|
|
16
17
|
import { SceneWatches } from "./sceneWatches.js";
|
|
17
18
|
/**
|
|
@@ -72,6 +73,15 @@ export class Molecule3DViewer extends SceneWatches {
|
|
|
72
73
|
return 0;
|
|
73
74
|
}));
|
|
74
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Draw the partial bonds of the current molecule, dashed: pairs a little too
|
|
78
|
+
* far apart to be bonded. Another molecule takes them away with it.
|
|
79
|
+
* @param style - See {@link PartialBondStyle}.
|
|
80
|
+
* @returns Nothing; resolves once they are on screen.
|
|
81
|
+
*/
|
|
82
|
+
showPartialBonds(style) {
|
|
83
|
+
return this.#plugin.run((plugin) => renderPartialBonds(plugin, style));
|
|
84
|
+
}
|
|
75
85
|
/**
|
|
76
86
|
* Add or restyle the molecular surface over the current molecule.
|
|
77
87
|
* @param style - See {@link SurfaceStyle}.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewer.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/viewer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AAE5D,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,OAAO,GACR,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAAE,WAAW,EAAE,W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