Skip to main content

Visual Pipeline Editor

megane's pipeline editor lets you build visualization workflows by wiring nodes — no code required. Open the pipeline panel from the sidebar to start building.

Pipelines can also be built programmatically in Python, TypeScript, or written directly as JSON.

For real-world examples, see the Gallery.

Concept

A pipeline is a directed graph of nodes connected by edges. Data flows from source nodes (like Load Structure) through processing nodes (like Filter or Modify) and into a Viewport node for rendering.

Each edge carries a specific data type — particle, bond, cell, label, mesh, trajectory, or vector — and only matching types can connect.

When a node encounters an error — for example, a parse failure in LoadStructure — an error icon appears on the node with a tooltip showing the details.

AI Pipeline Generator

Describe the visualization you want in natural language, and megane builds the node graph for you. Open the AI chat panel from the pipeline editor toolbar and type a prompt like:

Load protein.pdb with bonds and make water translucent

The generator creates the appropriate LoadStructure, AddBond, Filter, Modify, and Viewport nodes, wires them together, and places them in the editor. You can then adjust parameters or add more nodes manually.

VSCode Extension Auto-Setup

When you open a supported molecular file (.pdb, .gro, .xyz, .mol, .sdf, .cif) in the megane VSCode extension, it automatically creates a default pipeline consisting of LoadStructure → AddBond → Viewport. This gives you an immediate 3D view of the structure with bonds, without needing to build a pipeline manually. You can then modify the auto-generated pipeline in the editor as needed.

Getting Started

The simplest pipeline loads a structure and displays it:

LoadStructure → Viewport

To add bonds inferred from atomic distances:

LoadStructure → AddBond → Viewport

LoadStructure → Viewport (particle + cell)

Use the Templates dropdown to load pre-built pipelines:

  • Molecule — Caffeine (caffeine_water.pdb) with structure-based bonds and a vibration trajectory (caffeine_water_vibration.xtc). Nodes: LoadStructure → AddBond → Viewport, LoadTrajectory → Viewport.
  • Solid — Perovskite SrTiO₃ 3×3×3 supercell with distance-based bonds and TiO₆ coordination polyhedra. Nodes: LoadStructure → AddBond → Viewport, PolyhedronGenerator → Viewport. Center = Ti (22), Ligand = O (8), max distance = 2.5 Å.

Node Reference

Data Loading

NodeDescriptionInputsOutputs
Load StructureLoad a molecular structure file (PDB, GRO, XYZ, MOL/SDF, CIF, LAMMPS data)particle, trajectory, cell
Load TrajectoryLoad an XTC or ASE .traj trajectory fileparticletrajectory
StreamingWebSocket-based real-time data deliveryparticle, bond, trajectory, cell
Load VectorLoad per-atom vector data from a filevector

Processing

NodeDescriptionInputsOutputs
FilterSelect atoms using a query expressionparticle (in)particle (out)
ModifyOverride scale and opacity for a group of atomsparticle (in)particle (out)

Overlay

NodeDescriptionInputsOutputs
Add BondDetect bonds from structure or by distanceparticlebond
Label GeneratorGenerate text labels at atom positionsparticlelabel
Polyhedron GeneratorRender coordination polyhedra (convex hulls)particlemesh
Vector OverlayConfigure per-atom vector visualization (e.g. forces)vectorvector

Output

NodeDescriptionInputsOutputs
Viewport3D rendering outputparticle, bond, cell, trajectory, label, mesh, vector

Node Parameters

Load Structure

ParameterTypeDescription
File pathstringPath to molecular structure file. Supported: .pdb, .gro, .xyz, .mol, .sdf, .cif, .data, .lammps

Load Trajectory

ParameterTypeDescription
xtcstringPath to XTC trajectory file
trajstringPath to ASE .traj trajectory file

Requires a connection from a LoadStructure node. Frames are loaded lazily when frame_index changes.

Load Vector

ParameterTypeDescription
File pathstringPath to vector data file (JSON with per-atom 3D vectors)

Add Bond

ParameterValuesDefaultDescription
Bond sourcestructureRead bonds from the structure file (CONECT records in PDB, etc.)
distanceInfer bonds from van der Waals radii

Filter

ParameterTypeDefaultDescription
Querystring"" (all)Atom selection query expression (see Filter DSL)
Bond querystring"" (all)Bond selection query expression (see Bond Selection DSL)

Both input fields validate your query in real time — invalid syntax is highlighted in red.

The Query field filters which atoms pass through when the Filter node is connected to a particle stream (particle input/output). The Bond query field filters which bonds are selected when the Filter node is connected to a bond stream; this selection is used by downstream nodes (for example, Modify) to apply per-bond opacity overrides — it does not remove bonds from the scene. Because a Filter node has a single generic in → out port and only one data type flows through it at a time, using both atom and bond queries in the same workflow typically means adding two Filter nodes: one on the particle edge and one on the bond edge.

Modify

ParameterRangeDefaultDescription
Scale0.1 – 2.01.0Atom sphere radius multiplier
Opacity0 – 1.01.0Transparency (0 = invisible, 1 = opaque)

Label Generator

ParameterValuesDefaultDescription
SourceelementChemical element symbol (C, O, Fe, ...)
resnameResidue name (ALA, HOH, ...)
indexAtom index (0, 1, 2, ...)

Polyhedron Generator

ParameterTypeDefaultDescription
Center elementsnumber[]Atomic numbers of center atoms (e.g., Ti=22, Si=14)
Ligand elementsnumber[]O (8)Atomic numbers of ligand atoms
Max distancenumber2.5 ÅMaximum center–ligand distance
Opacitynumber0.5Face transparency (0–1)
Show edgesbooleanoffDisplay wireframe edges
Edge colorstring#ddddddWireframe edge color (hex)
Edge widthnumber3.0Wireframe edge width (px)

Vector Overlay

ParameterTypeDefaultDescription
Scalenumber1.0Vector arrow length multiplier

Viewport

ParameterDefaultDescription
PerspectiveoffToggle perspective / orthographic projection
Cell axes visibleonShow simulation cell axes with labels
Pivot marker visibleonShow the rotation pivot marker at the camera target

A Render Export button is available in the pipeline editor toolbar. Click it to export the current viewport as a PNG image (or other formats such as EPS, GIF, and MP4 via the render modal).

Data Types

Seven typed data channels flow through color-coded edges:

TypeColorDescription
particleBlueAtom positions, elements, and optional indices/overrides
bondAmberBond pairs and orders
cellEmeraldSimulation cell (3×3 matrix)
labelVioletText labels positioned at atoms
meshGrayTriangle mesh for polyhedra rendering
trajectoryPinkMulti-frame coordinate data
vectorTealPer-atom 3D vector data (forces, velocities, etc.)

Filter DSL

The Filter node accepts Python-like query expressions to select atoms.

Available Fields

FieldTypeDescription
elementstringElement symbol (e.g., "C", "O", "Fe")
indexnumberAtom index (0-based)
x, y, znumberCartesian coordinates
resnamestringResidue name (e.g., "ALA", "HOH")
massnumberAtomic mass

Operators

==, !=, >, <, >=, <=

Logical Operators

and, or, not, parentheses ()

Special Keywords

all — select all atoms, none — select no atoms

Examples

element == "C"                         # All carbon atoms
index > 10 and index < 20 # Atoms 10–19
resname == "HOH" # Water molecules
not element == "H" # Non-hydrogen atoms
element == "O" or element == "N" # Oxygen or nitrogen
(x > 0 and x < 10) and element == "C" # Carbons in x range
mass > 32 # Atoms heavier than sulfur

Bond Selection DSL

The Bond query field in the Filter node accepts expressions to select bonds.

Available Fields

FieldTypeDescription
bond_indexnumber0-based sequential bond index
atom_indexnumberAtom endpoint index
elementstringElement symbol of an atom endpoint (e.g., "C", "O")

Operators

==, !=, >, <, >=, <=

Logical Operators

and, or, not, parentheses ()

Special Keywords

  • all — select all bonds (default when query is empty)
  • none — select no bonds
  • both — prefix on a comparison involving atom_index or element to require both atoms of the bond to satisfy the condition (default: either atom, OR semantics). Has no effect on bond_index comparisons.

Examples

element == "C"                         # Bonds where either atom is carbon
both element != "H" # Bonds where neither atom is hydrogen
atom_index >= 24 # Bonds involving atom 24 or higher
bond_index < 10 # First 10 bonds only
both atom_index >= 0 and bond_index < 50 # First 50 bonds (all-atom filter)

The bond query selects which bonds a downstream Modify node applies opacity overrides to. This lets you selectively fade specific bonds without removing them from the scene.

Editor Examples

TiO₆ Octahedra in SrTiO₃

  1. Load a perovskite structure (LoadStructure)
  2. Add a PolyhedronGenerator node
  3. Set center = Ti (22), ligand = O (8), max distance = 2.5 Å
  4. Connect LoadStructure.particle → PolyhedronGenerator.particle
  5. Connect PolyhedronGenerator.mesh → Viewport.mesh

Or use the Solid template which sets this up automatically.

Make Solvent Translucent

Use Filter + Modify nodes to fade out water molecules while keeping the protein fully visible.

  1. Add a LoadStructure node and load your PDB file
  2. Add a Filter node with query: resname == "HOH"
  3. Add a Modify node and set opacity to 0.2, scale to 0.5
  4. Connect: LoadStructure.particle → Filter.in → Modify.in → Viewport.particle
  5. Connect the original LoadStructure.particle → Viewport.particle as well (for the protein)

The viewport renders both streams — the protein at full opacity, and the water as translucent small spheres.

Multiple Structure Layers

You can load multiple structure files simultaneously, with each file rendered as a separate layer in the viewport. Each LoadStructure node connected to a Viewport creates an independent rendering layer, allowing you to combine different molecules in a single view.

For example, to display a protein and a ligand loaded from separate files:

LoadStructure (protein.pdb) → AddBond → Viewport
LoadStructure (ligand.mol) → AddBond ↗

Each layer is processed independently through its own chain of Filter, Modify, and overlay nodes before reaching the Viewport.


For more examples with code, see the Gallery.