|
| 1 | +# MatterViz VS Code Extension |
| 2 | + |
| 3 | +**MatterViz** offers a VSCode extension for rendering crystal structures and molecular dynamics (MD) or geometry optimization trajectories directly in the editor to speed up typical materials science/computational chemistry workflows. |
| 4 | + |
| 5 | +## ✨ Features |
| 6 | + |
| 7 | +### 🔬 **Structure Visualization** |
| 8 | + |
| 9 | +- **Crystal Structures**: Visualize CIF, POSCAR, VASP, and other crystallographic formats |
| 10 | +- **Molecular Systems**: Display XYZ, JSON, and YAML molecular structures |
| 11 | +- **Interactive 3D Viewer**: Rotate, zoom, and explore structures with intuitive controls |
| 12 | +- **Atomic Properties**: View element information, bonding, and structural details |
| 13 | + |
| 14 | +### 🎬 **Trajectory Analysis** |
| 15 | + |
| 16 | +- **MD Trajectories**: Animate and analyze molecular dynamics simulations |
| 17 | +- **Multi-format Support**: Handle TRAJ, ExtXYZ, HDF5, and compressed formats |
| 18 | +- **Playback Controls**: Navigate through trajectory frames with timeline controls |
| 19 | +- **Frame Analysis**: Extract and analyze individual frames from trajectories |
| 20 | + |
| 21 | +### 🎨 **Customization** |
| 22 | + |
| 23 | +- **Color Schemes**: Multiple built-in color schemes (Jmol, VESTA, Alloy, Pastel, etc.) |
| 24 | +- **Visualization Modes**: Ball-and-stick, space-filling, wireframe representations |
| 25 | +- **Export Options**: Save visualizations to PNG or export structure data to ASE XYZ and pymatgen JSON |
| 26 | + |
| 27 | +## 🚀 Installation |
| 28 | + |
| 29 | +Search for "MatterViz" in the VS Code Extensions marketplace. |
| 30 | + |
| 31 | +## 📋 Usage |
| 32 | + |
| 33 | +### Quick Start |
| 34 | + |
| 35 | +1. **Open a structure file** in VS Code (`.cif`, `.poscar`, `.xyz`, `.json`, etc.) |
| 36 | +2. **Right-click** in the explorer or editor |
| 37 | +3. **Select "Render with MatterViz"** from the context menu |
| 38 | +4. **Or use the keyboard shortcut**: `Ctrl+Shift+V` (Windows/Linux) / `Cmd+Shift+V` (Mac) |
| 39 | + |
| 40 | +### Supported File Formats |
| 41 | + |
| 42 | +#### Structure Files |
| 43 | + |
| 44 | +- **CIF** - Crystallographic Information Files |
| 45 | +- **POSCAR/CONTCAR** - VASP structure files |
| 46 | +- **XYZ/ExtXYZ** - Standard molecular coordinate formats |
| 47 | +- **JSON** - JSON-formatted structure data |
| 48 | +- **YAML/YML** - YAML structure definitions |
| 49 | + |
| 50 | +#### Trajectory Files |
| 51 | + |
| 52 | +- **TRAJ** - ASE trajectory files |
| 53 | +- **ExtXYZ** - Extended XYZ trajectories |
| 54 | +- **HDF5/H5** - `torch-sim` HDF5 trajectory formats |
| 55 | +- **JSON** - `pymatgen` JSON trajectory formats |
| 56 | +- **Compressed files** - `.gz` compressed versions of above |
| 57 | + |
| 58 | +### Custom Editor Integration |
| 59 | + |
| 60 | +MatterViz automatically registers as a custom editor for trajectory files (`.traj`, `.h5`, `.hdf5`, `.gz`), providing seamless integration with VS Code's editor system. |
| 61 | + |
| 62 | +## ⌨️ Keyboard Shortcuts |
| 63 | + |
| 64 | +| Shortcut | Action | |
| 65 | +| ------------------------------ | ------------------------------- | |
| 66 | +| `Ctrl+Shift+V` / `Cmd+Shift+V` | Render structure with MatterViz | |
| 67 | + |
| 68 | +## 🛠️ Development |
| 69 | + |
| 70 | +This extension is built with: |
| 71 | + |
| 72 | +- **TypeScript** - Main extension logic |
| 73 | +- **Svelte 5** - Modern reactive webview components |
| 74 | +- **Vite** - Fast build tooling |
| 75 | +- **Three.js** - 3D visualization engine |
| 76 | + |
| 77 | +### Building from Source |
| 78 | + |
| 79 | +```bash |
| 80 | +cd extensions/vscode |
| 81 | +pnpm install |
| 82 | +pnpm build |
| 83 | +vsce package |
| 84 | +``` |
| 85 | + |
| 86 | +## 🤝 Contributing |
| 87 | + |
| 88 | +We welcome contributions! Please see our [Contributing Guide](../../contributing.md) for details. |
| 89 | + |
| 90 | +## 📄 License |
| 91 | + |
| 92 | +This extension is [MIT-Licensed](./license). |
| 93 | + |
| 94 | +## 🐛 Issues & Support |
| 95 | + |
| 96 | +- **Bug Reports**: [GitHub Issues](https://github.com/janosh/matterviz/issues) |
| 97 | +- **Feature Requests**: [GitHub Discussions](https://github.com/janosh/matterviz/discussions) |
| 98 | +- **Documentation**: [MatterViz Docs](https://matterviz.janosh.dev) |
| 99 | + |
| 100 | +## 🔗 Related Projects |
| 101 | + |
| 102 | +- **MatterViz Web**: Full-featured web application at [matterviz.janosh.dev](https://matterviz.janosh.dev) |
| 103 | +- (TODO) **MatterViz CLI**: Command-line interface for batch processing |
| 104 | +- (TODO) **MatterViz iPython**: [Jupyter](https://jupyter.org)/[Marimo](https://marimo.io) extension for interactive Python-based visualization |
0 commit comments