Skip to content

Mol* and files in the molecule's own frame

/molviewer draws the same molecule and the same surfaces with two engines: 3Dmol.js and Mol*. The same surfaces can also be downloaded as standard files. Either way they stay on the atoms, because there is only one coordinate frame.

One frame

/api/model returns one RDKit conformer twice: as atoms[].position and as a MolBlock with exactly the same coordinates (16.1). Every field the browser computes is evaluated in that frame:

  • the π layer (pi_field), on a grid in Å;
  • the hybrid and lone-pair orbitals, centred on atoms[].position.

A viewer that keeps the MolBlock's coordinates therefore needs nothing else: the files below land on the atoms. Both engines are checked rather than trusted:

  • After loading, the viewer reads the atoms back out of its own scene and compares them with /api/model. The R pill shows the largest deviation; 4·10⁻⁵ Å is the MolBlock's 4-decimal rounding.
  • If an engine had moved the molecule (some re-centre their scene), the measured offset would be added to every surface. The pill then says how far the surfaces were moved.

Mol*

The Mol* tab is the Mol* viewer by Sehnal and colleagues (Nucleic Acids Research 49, W431, 2021; MIT licence). It is built for large biomolecules: sequence view, selections, measurements, assemblies, and any PDB entry ("Load PDB" or Mol*'s own panels). This molecule arrives in it as:

whathowwhy
the conformerthe MolBlockMol* keeps file coordinates
π density, interference, π MOsGaussian cube volumes, at the 3Dmol tab's isovalue (amber/teal for ±ψ)Mol* draws its own isosurfaces; the level can be changed in its volume controls
hybrid and lone-pair orbitals, potential-coloured π surfaceone PLY mesh with per-vertex coloursthe same triangles as the 3Dmol tab

Changes in the side panel are sent again automatically while the tab is open.

PDB entries keep their deposited coordinates, so a protein and this molecule do not overlap. For orbitals on a protein, use /sites (16.4). It cuts a motif or metal site out of the structure, computes that fragment, and draws its surfaces on the whole protein in Mol*, in the protein's own frame.

The Mol* bundle (about 5 MB, 1.3 MB gzipped) loads only when a visitor opens the tab. Install it on the server with ./install_molstar.sh; until then the tab loads the same pinned build (4.5.0) from cdn.jsdelivr.net. Loading a PDB entry fetches it from the RCSB PDB in the visitor's browser.

Files

The three buttons under "Files" write what the page shows, in the MolBlock's frame. Opened together, they line up in any viewer.

  • π field .cube: the selected π field (π density when none is selected). Gaussian cube format, read by Mol*, VMD, PyMOL, Jmol and Avogadro.
    • Lengths in bohr.
    • Values in atomic units: ψ in bohr^−3/2, densities in e/bohr³, the potential in hartree/e (1 hartree/e = 27.211 V).
    • The atoms are written into the file as well.
  • surfaces .ply: every surface drawn in the 3Dmol tab, as an ASCII PLY mesh (Turk, 1994) with RGBA per vertex, in Å to 1 mÅ. Read by Mol*, MeshLab, Blender and ParaView. The surfaces are closed, every triangle faces out of its lobe and the vertices carry smooth normals (qo-mesh.js), so viewers that do not draw back faces show them whole.
  • molecule .mol: the conformer.

Tested, and not yet

  • tests/test_export.js writes cube files of real π fields and reads them back:
    • every value lands in the right place (the format runs x outer, z inner; the engine x fastest);
    • grid, origin and atoms survive the bohr conversion to 10⁻⁵ Å;
    • a shifted frame moves the field and the atoms together.
  • tests/test_molstar_bridge.js checks against a recording Mol* stand-in what the tab sends:
    • the MolBlock as mol, the cube with ± isovalues and colours, the PLY;
    • the R check, and a Mol* that moves the molecule by (3, −1, 2) Å, with every surface following;
    • only the tab's own nodes are replaced (nothing else the visitor loaded is cleared);
    • malformed PDB IDs are refused.
  • A headless-browser run of the page with the same stand-in: tabs, keyboard, downloads, no horizontal scroll at 390 px.
  • Not yet tested against the real Mol* bundle: the sandbox this was built in could not download it. The tab uses Mol*'s public Viewer API (Viewer.create, loadStructureFromData, loadVolumeFromUrl, loadPdb). For the PLY mesh it uses the plugin's data-format registry, as Mol*'s "Open Files" does. Every call is guarded: if a Mol* version differs, the tab says which part it could not show.

Source: MOLSTAR_AND_FILES.md in the server package · updated