MatterViz in VS Code and Cursor
The MatterViz extension opens structures, trajectories, Fermi surfaces, volumetric data and materials JSON files in an editor tab, with the same viewers and plots as this site.
| Editor | Install from |
|---|---|
| VS Code | Visual Studio Marketplace |
| Cursor, VSCodium | Open VSX |
Open a file
- Right-click a file in the explorer and pick Open with MatterViz, or press Cmd+Shift+V (Ctrl+Shift+V on Windows and Linux) with the file open.
- Binary files MatterViz can decode (ASE
.traj,.h5/.hdf5) open in MatterViz directly. To open them in another editor instead, overrideworkbench.editorAssociations, e.g."*.h5": "default". - The tab reloads when the file changes on disk, and follows VS Code’s light or dark theme.
What it opens
- Structures: CIF and mmCIF, POSCAR/CONTCAR, XYZ/extXYZ, PDB, SDF/MOL, Quantum ESPRESSO input, LAMMPS data, pymatgen and OPTIMADE JSON, YAML.
- Trajectories: ASE
.traj, extXYZ, XDATCAR, OUTCAR,vasprun.xml, LAMMPS dumps, HDF5 and pymatgen JSON, with playback and energy, force and stress plots. XTC, TRR and DCD files open to a hint to convert them first (e.g. with MDAnalysis), since MatterViz has no reader for them. - Fermi surfaces: BXSF and FermiSurfer
.frmsf. - Volumetric data: Gaussian cube and VASP CHGCAR, ELFCAR, LOCPOT, AECCAR and PARCHG, as isosurfaces or 2D slices.
- JSON with several datasets (structures, band structures, DOS, convex hulls, phase diagrams, XRD patterns, tables): a tree browser whose nodes render on click. Drag a node to a canvas edge to show several side by side.
Every format also opens gzipped (.gz). The exact file name patterns are the customEditors selectors in the extension’s package.json.
Remote SSH and large files
Over Remote SSH, MatterViz reads files straight off the remote machine, so cluster outputs open without copying them.
- Uncompressed ASE
.trajand XYZ/extXYZ trajectories stream frame by frame, at any size. - Other files load whole and must be under 1 GiB. Text formats other than trajectories must be under about 400 MiB.
- Parsing runs in a worker inside the tab, so the editor stays responsive while a large file loads.
Settings
Search MatterViz in the Settings UI, or set keys in settings.json. Workspace settings (.vscode/settings.json) apply per project.
{
"matterviz.color_scheme": "Jmol",
"matterviz.structure.show_image_atoms": true,
"matterviz.trajectory.fps": 10,
"matterviz.trajectory.display_mode": "structure+plot",
"matterviz.trajectory.atom_type_mapping": { "1": "Si", "2": "O" }
}
atom_type_mapping names the integer atom types of LAMMPS dumps, which rarely carry element names. matterviz.trajectory.index_above_bytes (default 25 MB) sets the file size above which trajectories are indexed and decoded per frame instead of loaded up front.
The settings mirror the viewer controls on this site. The extension readme groups them by category.
Report a bug
Run MatterViz: Report Bug from the command palette. It opens a GitHub bug report in your browser, already filled in with your editor, extension and OS versions, remote session, memory use, open files (home folder shown as ~) and recent log lines. Unexpected errors come with a Report Bug button that adds the error, its stack trace and the failing file’s type and size (never the file, though a parse error may quote a line of it). Add what went wrong, check the report, then submit.