The 3D Molecular Structure Viewer is implemented using 3Dmol.js (included in the package). It allows you to visualize molecular structures in 3D, including atom positions, bonds, and other structural features. It is linked to the NMR assignment table: clicking an atom selects its assigned peaks and zooms to them. This viewer is particularly useful for NMR data where 3D structures are available.
The structure viewer is part of SpectraViewer1D's assignment table. It needs:
event.detail.assignmentData.structure_data).id="mol-3d" on the page; 3Dmol.js renders the structure into it.structure key in the assignmentTable options, which enables the viewer.// HTML: <div id="assignments"></div> <div id="mol-3d" style="width: 400px; height: 400px; position: relative;"></div>
let viewer = new SpectraViewer1D("#graph", {
// ... other SpectraViewer1D options ...
assignmentTable: {
containerID: "#assignments",
data: [event.detail.assignmentData],
structure: {}, // enables the 3D structure viewer
show_hydrogen: true,
show_atom_numbers: true,
},
});These options are read from the assignmentTable object itself (not from assignmentTable.structure):
Show hydrogen atoms.
boolean | default: falseOverlay atom index labels.
boolean | default: falseAlso render the structure with a JSmol applet (in a #view-3d element added to the assignmentTable container) in place of the default 2D structure drawing. The 3Dmol.js view in #mol-3d is still created. JSmol must be loaded separately in the browser (see Getting Started).
boolean | default: false