Molecular Structure Viewer (mol-viewer)¶
Advanced molecular structure visualization and analysis tool for examining molecular geometries and properties.
Overview¶
The [mol-viewer](../commands/mol_viewer.rst:1) command provides a powerful 3D visualization interface for molecular structures, surfaces, and properties. This tool is essential for visual analysis, result interpretation, and presentation of molecular data.
Command Syntax¶
surfacia mol-viewer [OPTIONS] --file STRUCTURE_FILE
Basic Usage Examples¶
View Molecular Structure¶
# View a basic molecular structure
surfacia mol-viewer --file molecule.xyz
# View with different representation
surfacia mol-viewer --file molecule.xyz --style ball-stick
# View multiple conformations
surfacia mol-viewer --file conformers.xyz --multi-frame
Surface Visualization¶
# View molecular surface
surfacia mol-viewer --file molecule.wfn --surface
# View surface with properties
surfacia mol-viewer --file molecule.wfn --surface --property esp
# Custom surface transparency
surfacia mol-viewer --file molecule.wfn --surface --transparency 0.7
Property Mapping¶
# Map electrostatic potential
surfacia mol-viewer --file molecule.wfn --property esp --color-scale rwb
# Map electron density
surfacia mol-viewer --file molecule.wfn --property density --iso-value 0.001
# Multiple property comparison
surfacia mol-viewer --file molecule.wfn --properties esp,density --split-view
Command-Line Options¶
Input Options¶
--file, -f FILERequired. Molecular structure or wavefunction file to visualize
Supported formats: XYZ, SDF, MOL, PDB, WFN, CUBE
Multiple files: Use multiple
--fileflagsExample:
--file caffeine.xyz
--format FORMATExplicitly specify input file format
Auto-detection: Usually not needed
Override: For ambiguous extensions
Example:
--format xyz
--multi-frameEnable multi-frame mode for trajectory files
Animation controls: Play, pause, step through frames
Frame selection: Jump to specific frames
Example:
--multi-frame
Display Options¶
--style STYLESet molecular representation style
Available styles: wireframe, ball-stick, space-fill, ribbon
Default: ball-stick
Example:
--style space-fill
--color-scheme SCHEMESet atom coloring scheme
Available schemes: element, residue, chain, custom
Default: element (CPK colors)
Example:
--color-scheme residue
--background COLORSet background color
Formats: name, hex, rgb
Default: white
Example:
--background black
--size WIDTHxHEIGHTSet viewer window size
Format: Width x Height in pixels
Default: 1024x768
Example:
--size 1200x900
Surface Options¶
--surfaceEnable molecular surface display
Surface types: Van der Waals, solvent-accessible, molecular
Default: Molecular surface
Example:
--surface
--surface-type TYPESpecify surface type
Types: vdw, sas, molecular, custom
Default: molecular
Example:
--surface-type vdw
--transparency ALPHASet surface transparency
Range: 0.0 (opaque) to 1.0 (transparent)
Default: 0.3
Example:
--transparency 0.5
--probe-radius RADIUSSet probe radius for surface calculation
Units: Angstroms
Default: 1.4 (water)
Example:
--probe-radius 1.2
Property Visualization¶
--property PROPMap property onto surface or structure
Available properties: esp, density, fukui, lie, hardness
Data source: From wavefunction file
Example:
--property esp
--properties LISTDisplay multiple properties
Format: Comma-separated list
Split view: Side-by-side comparison
Example:
--properties esp,density,fukui
--color-scale SCALESet color scale for property mapping
Available scales: rwb, bwr, rainbow, viridis, plasma
Default: rwb (red-white-blue)
Example:
--color-scale viridis
--iso-value VALUESet isosurface value for property display
Units: Property-dependent
Multiple values: Comma-separated
Example:
--iso-value 0.001,0.01
Comparison Options¶
--compare FILECompare with another structure
Overlay mode: Superimpose structures
Difference analysis: Highlight changes
Example:
--compare optimized.xyz
--alignEnable structure alignment for comparison
Algorithm: Kabsch algorithm
RMSD calculation: Root-mean-square deviation
Example:
--align
--split-viewUse split-screen view for comparisons
Side-by-side: Left and right panels
Synchronized: Linked rotation and zoom
Example:
--split-view
Output Options¶
--output, -o FILESave rendered image to file
Formats: PNG, JPG, SVG, PDF
High resolution: Vector formats for publications
Example:
--output molecule_view.png
--resolution WIDTHxHEIGHTSet output image resolution
High-DPI: For publication quality
Default: Window size
Example:
--resolution 2400x1800
--dpi DPISet dots per inch for output
Publication quality: 300+ DPI
Default: 150
Example:
--dpi 300
Interactive Features¶
Selection and Measurement¶
- Atom Selection
Click: Select individual atoms
Ctrl+Click: Multiple selection
Shift+Click: Range selection
Double-click: Select residue/molecule
- Measurement Tools
Distance: Click two atoms
Angle: Click three atoms
Dihedral: Click four atoms
Clear: Right-click to clear measurements
Property Analysis¶
- Interactive Probing
Hover: Show property values
Click: Pin property display
Color mapping: Real-time updates
Statistics: Min, max, average values
- Contour Lines
Toggle: Show/hide contours
Levels: Adjustable contour levels
Labels: Property value labels
Export: Save contour data
Visualization Styles¶
Molecular Representations¶
- Wireframe
Bonds as lines
Minimal visual clutter
Fast rendering
Good for large systems
- Ball-and-Stick
Atoms as spheres
Bonds as cylinders
Standard representation
Good balance of detail and clarity
- Space-Filling
Van der Waals spheres
Shows molecular volume
Surface accessibility
Good for packing analysis
- Ribbon
Protein secondary structure
Alpha helices and beta sheets
Cartoon representation
Good for macromolecules
Surface Representations¶
- Solid Surface
Opaque surface rendering
Clear boundary definition
Property mapping support
Good for shape analysis
- Transparent Surface
See-through surface
Internal structure visible
Adjustable transparency
Good for cavity analysis
- Mesh Surface
Wireframe surface
Topology visualization
Low memory usage
Good for large surfaces
- Contour Surface
Isosurface rendering
Property-based surfaces
Multiple contour levels
Good for property analysis
File Format Support¶
Structure Formats¶
- XYZ Files
Cartesian coordinates
Multiple frames supported
Comment line information
Simple format
- SDF Files
Structure-data format
Property information
Multiple molecules
Chemical database format
- PDB Files
Protein Data Bank format
Biological macromolecules
Secondary structure
Experimental metadata
- MOL Files
MDL Molfile format
Connection tables
Stereochemistry
Chemical structure
Wavefunction Formats¶
- WFN Files
Gaussian wavefunction
Electron density
Molecular orbitals
Property calculation
- CUBE Files
Volumetric data
Property grids
Isosurface generation
Visualization ready
- FCHK Files
Formatted checkpoint
Gaussian output
Complete wavefunction
Property extraction
Advanced Features¶
Animation and Dynamics¶
# View molecular dynamics trajectory
surfacia mol-viewer --file trajectory.xyz --multi-frame --animate
# Control animation speed
surfacia mol-viewer --file trajectory.xyz --fps 10
# Export animation
surfacia mol-viewer --file trajectory.xyz --export-animation movie.mp4
Property Analysis¶
# Analyze property statistics
surfacia mol-viewer --file molecule.wfn --property esp --statistics
# Export property data
surfacia mol-viewer --file molecule.wfn --property esp --export-data esp_data.csv
# Custom property mapping
surfacia mol-viewer --file molecule.wfn --custom-property custom_data.txt
Scripting Interface¶
# Python API for automated visualization
from surfacia.tools import MolViewer
viewer = MolViewer()
viewer.load_structure('molecule.xyz')
viewer.add_surface(transparency=0.5)
viewer.map_property('esp', color_scale='rwb')
viewer.save_image('molecule_esp.png', dpi=300)
Integration with Workflow¶
Result Visualization¶
# View workflow results
surfacia mol-viewer --file results/molecule_surface.wfn --surface --property esp
# Compare before and after optimization
surfacia mol-viewer --file original.xyz --compare results/optimized.xyz --align
Quality Control¶
# Check structure quality
surfacia mol-viewer --file molecule.xyz --validate --measurements
# Verify surface generation
surfacia mol-viewer --file molecule.wfn --surface --quality-check
Presentation¶
# Generate publication-quality images
surfacia mol-viewer --file molecule.wfn --surface --property esp \
--output figure.png --resolution 2400x1800 --dpi 300
# Create multi-panel figure
surfacia mol-viewer --file molecule.wfn --properties esp,density,fukui \
--split-view --output multi_panel.png
Troubleshooting¶
Common Issues¶
- File Loading Problems
Check file format and extension
Verify file integrity
Try different format specification
Check file permissions
- Performance Issues
Reduce surface resolution
Use simpler representations
Close other applications
Check system memory
- Display Problems
Update graphics drivers
Try different rendering options
Adjust window size
Check OpenGL support
- Property Mapping Issues
Verify wavefunction file completeness
Check property availability
Try different color scales
Validate property ranges
Best Practices¶
Use appropriate representations for different analysis types
Save high-resolution images for publications
Validate structures before detailed analysis
Use consistent color schemes for comparisons
Document visualization settings for reproducibility
See Also¶
Molecular Structure Drawing (mol-drawer) - Molecular structure drawing
workflow - Complete analysis pipeline
shap-viz - SHAP visualization
Quick Start - Getting started guide
Examples - Usage examples