Molecular Structure Viewer

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.

Usage:

The structure viewer is part of SpectraViewer1D's assignment table. It needs:

// 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,
  },
});

Options:

These options are read from the assignmentTable object itself (not from assignmentTable.structure):

show_hydrogen

Show hydrogen atoms.

boolean | default: false

show_atom_numbers

Overlay atom index labels.

boolean | default: false

use_jsmol

Also 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