API Reference#
This section provides detailed documentation for all modules, classes, and functions in moldenViz.
Parser Module#
The parser module provides functionality to read and parse molden files.
- class Parser(source, only_molecule=False)#
Parser for molden files.
- Parameters:
Attributes:
atoms(list): A list of Atom objects containing the label, atomic number, and position for each atom.mos(list): A list of molecular orbital objects (only available whenonly_molecule=False).
Example Usage:
from moldenViz import Parser # Parse from file parser = Parser('molden.inp') # Access atoms and molecular orbitals atoms = parser.atoms mos = parser.mos # Parse only molecule structure (skip MOs) parser = Parser('molden.inp', only_molecule=True)
Plotter Module#
The plotter module provides 3D visualization capabilities for molecules and molecular orbitals.
- class Plotter(source, only_molecule=False, tabulator=None)#
Create interactive 3D plots of molecules and molecular orbitals.
- Parameters:
Example Usage:
from moldenViz import Plotter # Plot molecule with orbitals Plotter('molden.inp') # Plot only the molecule structure Plotter('molden.inp', only_molecule=True) # Use example molecules from moldenViz.examples import benzene Plotter(benzene)
Tabulator Module#
The tabulator module provides functionality to create grids and tabulate molecular orbitals on those grids.
- class Tabulator(source, only_molecule=False)#
Create grids and tabulate Gaussian-type orbitals (GTOs) and molecular orbitals.
- Parameters:
Attributes:
grid (numpy.ndarray): The generated grid points.
gtos (numpy.ndarray): Tabulated Gaussian-type orbital data on the grid.
Methods:
- spherical_grid(r, theta, phi)#
Create a spherical coordinate grid.
- Parameters:
r – Radial distances.
theta – Polar angles.
phi – Azimuthal angles.
- cartesian_grid(x, y, z)#
Create a Cartesian coordinate grid.
- Parameters:
x – X coordinates.
y – Y coordinates.
z – Z coordinates.
- tabulate_mos(indices=None)#
Tabulate molecular orbitals on the current grid.
Example Usage:
from moldenViz import Tabulator import numpy as np # Create tabulator tab = Tabulator('molden.inp') # Create spherical grid tab.spherical_grid( r=np.linspace(0, 5, 20), theta=np.linspace(0, np.pi, 20), phi=np.linspace(0, 2 * np.pi, 40) ) # Tabulate molecular orbitals mo_data = tab.tabulate_mos([0, 1, 2]) # First three orbitals
Examples Module#
The examples module provides pre-defined molecular structures for testing and demonstration.
Available Examples:
co
o2
co2
h2o
benzene
prismane
pyridine
furan
acrolein
Example Usage:
from moldenViz.examples import benzene, h2o
from moldenViz import Plotter
# Use example molecules
Plotter(benzene)
Plotter(h2o, only_molecule=True)