### Development install with uv sync Source: https://github.com/haozeke/chemparseplot/blob/main/doc/source/installation.md Clone the repository and set up a reproducible development environment with all dev dependencies using uv sync --all-extras. ```bash git clone https://github.com/HaoZeke/chemparseplot cd chemparseplot # Install with all dev dependencies uv sync --all-extras ``` -------------------------------- ### Install chemparseplot on Linux with uv Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/install.org Recommended Linux installation: install uv via the official script, then add chemparseplot with uv. ```bash # Recommended: use uv for fastest installation curl -LsSf https://astral.sh/uv/install.sh | sh uv add chemparseplot ``` -------------------------------- ### Install chemparseplot with feature extras Source: https://github.com/haozeke/chemparseplot/blob/main/readme.md Transitional convenience installs for plotting support or all extras. Prefer the bare install and suite pins for new work. ```bash # transitional: # With plotting support pip install "chemparseplot[plot]" # Everything pip install "chemparseplot[all]" ``` -------------------------------- ### Install all chemparseplot dependencies Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/install.org Install chemparseplot with all optional dependencies using the [all] extra. ```bash pip install "chemparseplot[all]" ``` -------------------------------- ### Install chemparseplot with pip (basic, plot, all) Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/install.org Install chemparseplot using pip. The basic install is minimal; the [plot] extra adds matplotlib and cmcrameri; [all] installs all optional dependencies. ```bash # Basic installation pip install chemparseplot # With plotting support pip install "chemparseplot[plot]" # With all optional dependencies pip install "chemparseplot[all]" ``` -------------------------------- ### Install JAX for GP surface fitting Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/troubleshooting.org Install JAX with CPU or CUDA support to resolve 'Module 'jax' is not installed' error. Choose CPU-only or CUDA12 variant. ```bash pip install "jax[cpu]" # CPU-only # or pip install "jax[cuda12]" # With CUDA support ``` -------------------------------- ### Install chemparseplot with uv Source: https://github.com/haozeke/chemparseplot/blob/main/llms-full.txt Install chemparseplot using the uv package manager. ```bash uv add chemparseplot ``` -------------------------------- ### Development install with git and uv Source: https://github.com/haozeke/chemparseplot/blob/main/doc/source/quickstart.md Clone the repository and set up a development environment with uv, syncing all extras. ```bash git clone https://github.com/HaoZeke/chemparseplot cd chemparseplot uv sync --all-extras ``` -------------------------------- ### Include examples in docstrings Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/dev/best_practices.org Document functions with a docstring that includes a usage example showing how to call the function. ```python def plot_profile(data, output): """Plot energy profile. Parameters ---------- data : dict Parsed NEB data output : Path Output file path Example ------- >>> data = parse_orca_neb("job") >>> plot_profile(data, "profile.pdf") """ ... ``` -------------------------------- ### Install chemparseplot in a virtual environment Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/install.org Create and activate a virtual environment, then install chemparseplot inside it to avoid permission issues. ```bash python -m venv .venv source .venv/bin/activate pip install chemparseplot ``` -------------------------------- ### Docstring example for plot_energy_profile Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/dev/contributing.org Example of a public function with a docstring, as required for all public functions. Shows the docstring format including parameters and an example. ```python def plot_energy_profile( data: dict[str, Any], output: Path, width: float = 5.37, ) -> None: """Plot NEB energy profile. Parameters ---------- data Parsed NEB data from parse_orca_neb() output Output file path width Figure width in inches Example ------- >>> data = parse_orca_neb("job") >>> plot_energy_profile(data, "profile.pdf") """ ... ``` -------------------------------- ### Install chemparseplot with pixi Source: https://github.com/haozeke/chemparseplot/blob/main/llms-full.txt Install chemparseplot using the pixi package manager. ```bash pixi add chemparseplot ``` -------------------------------- ### Dependencies List Source: https://github.com/haozeke/chemparseplot/blob/main/llms-full.txt Lists required and optional dependencies. Optional ones are lazy-loaded to keep the installation small. ```text Required: - numpy - pint (units) Optional (lazy-loaded): - matplotlib (plotting) - cmcrameri (colormaps) - ase (structure handling) - polars (dataframes) - h5py (HDF5) - orca-pi (ORCA 6.1+ parsing) - jax (GP surface fitting, via rgpycrumbs) ``` -------------------------------- ### Sync all extras for development (uv) Source: https://github.com/haozeke/chemparseplot/blob/main/AGENTS.md Installs all extras as CI does, requiring Python 3.11 or 3.12. Note that uv.lock is out of date on main, so uv sync and uv run rewrite it. ```bash uv sync --all-extras ``` -------------------------------- ### Install chemparseplot with --user flag Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/install.org Install chemparseplot for the current user only, avoiding permission errors. ```bash pip install --user chemparseplot ``` -------------------------------- ### Install optional extras (plot, neb, all) Source: https://github.com/haozeke/chemparseplot/blob/main/doc/source/installation.md Transitional extras for plotting support (matplotlib, cmcrameri colormaps), NEB analysis (ase, h5py, polars, readcon), and everything transitional. Note: there is no [xyzrender] extra; use bare install with AUTO_DEPS or suite pins for new work. ```bash # Plotting support (matplotlib, cmcrameri colormaps) pip install "chemparseplot[plot]" ``` ```bash # NEB analysis (ase, h5py, polars, readcon) pip install "chemparseplot[neb]" ``` ```bash # Everything transitional pip install "chemparseplot[all]" ``` -------------------------------- ### Development installation of chemparseplot Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/install.org Clone the repository, install in editable mode with all extras via uv, and run the test suite with pytest. ```bash # Clone repository git clone https://github.com/HaoZeke/chemparseplot cd chemparseplot # Install in editable mode with all dependencies uv sync --all-extras # Run tests uv run pytest ``` -------------------------------- ### Install chemparseplot with plot and neb extras Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/tutorials/journal_figure.org Install the required dependencies for the tutorial. The 'neb' and 'plot' extras install both ASE and matplotlib. Requires Python 3.11 or newer. ```bash pip install "chemparseplot[plot,neb]" ``` -------------------------------- ### Install solvis extra for Lennard-Jones clusters Source: https://github.com/haozeke/chemparseplot/blob/main/doc/source/installation.md Install the solvis extra to support Lennard-Jones cluster rendering. The test extra also installs this stack including pyvista and vtk; VTK draws through GLX and may require Xvfb when no display is available. ```bash pip install "chemparseplot[solvis]" ``` -------------------------------- ### Install plotting dependencies for chemparseplot Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/troubleshooting.org Install the optional plotting dependencies required for chemparseplot's plotting features. ```bash pip install "chemparseplot[plot]" ``` -------------------------------- ### Install chemparseplot via pip Source: https://github.com/haozeke/chemparseplot/blob/main/doc/source/quickstart.md Install the base package with pip. For plotting support, add the 'plot' extra. To install all extras, use the 'all' extra. ```bash pip install chemparseplot ``` ```bash pip install "chemparseplot[plot]" ``` ```bash pip install "chemparseplot[all]" ``` -------------------------------- ### Install chemparseplot via pip Source: https://github.com/haozeke/chemparseplot/blob/main/doc/source/installation.md Basic installation command that automatically installs the rgpycrumbs dependency for computational modules. ```bash pip install chemparseplot ``` -------------------------------- ### Install chemparseplot with uv Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/install.org Add chemparseplot as a dependency using the uv package manager. ```bash uv add chemparseplot ``` -------------------------------- ### Install chemparseplot with conda Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/install.org Install chemparseplot from the conda-forge channel using conda. ```bash conda install -c conda-forge chemparseplot ``` -------------------------------- ### Check Python path and install in correct environment Source: https://github.com/haozeke/chemparseplot/blob/main/llms-full.txt Diagnose ModuleNotFoundError by checking the Python executable and installing in the correct environment. ```bash # Check Python path python -c "import sys; print(sys.executable)" # Install in correct environment /path/to/python -m pip install chemparseplot ``` -------------------------------- ### Install chemparseplot with pixi Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/install.org Add chemparseplot as a dependency using the pixi package manager. ```bash pixi add chemparseplot ``` -------------------------------- ### Install OPI for ORCA NEB Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/tutorials/orca_neb.org Installs the orca-pi package to resolve the ImportError for the 'opi' module. ```bash pip install orca-pi ``` -------------------------------- ### Install chemparseplot in correct environment Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/faq.org Use the full path to the Python interpreter of the target environment to install chemparseplot, ensuring it is installed in the correct environment. ```bash /path/to/python -m pip install chemparseplot ``` -------------------------------- ### Install chemparseplot on macOS with Homebrew Python Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/install.org Install chemparseplot on macOS using Homebrew Python and pip. ```bash # Using Homebrew Python brew install python pip install chemparseplot ``` -------------------------------- ### Example commit subject for ORCA scan step parser Source: https://github.com/haozeke/chemparseplot/blob/main/skills/chemparseplot-add-parser/SKILL.md Follow the commit log style for parser additions. This example is for reading ORCA scan step banners. ```git feat(parse): read ORCA scan step banners ``` -------------------------------- ### ORCA NEB input file (job.inp) Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/tutorials/orca_neb.org Example ORCA NEB input file using B3LYP/def2-SVP with NEB-CI, 7 images, and product/reactant XYZ files. Run with 'orca job.inp > job.out'. ```text ! B3LYP def2-SVP NEB-CI %neb nimages = 7 Product "prod.xyz" end *xyzfile 0 1 react.xyz ``` -------------------------------- ### Install chemparseplot NEB extra Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/install.org Install the [neb] extra for NEB processing, which includes ase, h5py, and polars. ```bash pip install "chemparseplot[neb]" ``` -------------------------------- ### Install chemparseplot with pixi or conda Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/faq.org Install chemparseplot using pixi or conda (via conda-forge). Use pixi add chemparseplot for pixi environments, or conda install -c conda-forge chemparseplot for conda environments. ```bash # Using pixi pixi add chemparseplot # Using conda (via conda-forge) conda install -c conda-forge chemparseplot ``` -------------------------------- ### Install OPI for ORCA 6.1+ parsing Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/faq.org OPI (ORCA Python Interface) is required for ORCA 6.1+ parsing. Install it with pip. ```bash pip install orca-pi ``` -------------------------------- ### Install chemparseplot with uv or pip Source: https://github.com/haozeke/chemparseplot/blob/main/doc/source/llms.txt Install the chemparseplot package using either the uv package manager or pip. The uv command is preferred, with pip as an alternative. ```sh uv add chemparseplot # or pip install chemparseplot ``` -------------------------------- ### Verify chemparseplot installation Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/install.org Check that chemparseplot is installed correctly by importing it and printing its version. Expected output is a version number like "0.2.0". ```bash python -c "import chemparseplot; print(chemparseplot.__version__)" ``` -------------------------------- ### Thin dense minimization movies with SurfaceFitConfig Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/faq.org Configure auto_thin and max_surface_points to cap fit size. Default auto_thin is False so existing scripts keep full-cloud fits. ```python from chemparseplot.plot.neb import SurfaceFitConfig cfg = SurfaceFitConfig.from_mapping({"auto_thin": True, "max_surface_points": 64}) ``` -------------------------------- ### Install chemparseplot NEB processing dependencies Source: https://github.com/haozeke/chemparseplot/blob/main/llms-full.txt Install optional NEB processing dependencies (ase, h5py, polars) via pip. ```bash pip install "chemparseplot[neb]" ``` -------------------------------- ### Install chemparseplot plotting extra Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/install.org Install the [plot] extra to enable plotting support, which includes matplotlib and cmcrameri scientific colormaps. ```bash pip install "chemparseplot[plot]" ``` -------------------------------- ### Release workflow steps (bash) Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/release.org Run the full release process: checks, preview version, build changelog, commit, tag, and push. Requires uv, cog, towncrier, and Emacs 30. The version 1.7.1 is used as an example; adjust as needed. ```bash # 1. Run the same checks the tag workflow expects uv sync --extra test --extra plot --extra lint --extra doc --extra release uv run pytest --cov=chemparseplot tests uv run ruff check . uv run ruff format --check . # Emacs 30 writes doc/source/index.rst. Sphinx reads that file. (cd docs && emacs --batch --load export.el) uv run sphinx-build doc/source/ doc/build # 2. Preview the next semantic version cog bump --dry-run --auto # 3. Aggregate towncrier fragments into CHANGELOG.md uvx towncrier build --version "1.7.1" # 4. Commit the release notes and consumed fragments git add CHANGELOG.md doc/release/upcoming_changes git commit -m "release: v1.7.1" # 5. Tag the release and push cog bump --auto git push origin main --tags # 6. GitHub Actions publishes from the pushed tag ``` -------------------------------- ### Install chemparseplot on Windows with pip or conda Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/install.org Install chemparseplot on Windows using either pip or conda. Note that OPI requires ORCA 6.1+ and some parallel features work best with WSL2. ```bash # Using pip pip install chemparseplot # Or using conda conda install -c conda-forge chemparseplot ``` -------------------------------- ### Run Jupyter Lab for tutorial development Source: https://github.com/haozeke/chemparseplot/blob/main/doc/source/tutorials/contribdoc.md Starts Jupyter Lab with remote access allowed, browser opening disabled, and on port 8889. Use this command to develop tutorials locally; it requires the nbdoc optional dependency group. ```bash uv run jupyter lab --ServerApp.allow_remote_access=1 \ --ServerApp.open_browser=False --port=8889 ``` -------------------------------- ### Run batch processing sequentially Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/dev/best_practices.org Example of running a batch processing command sequentially, which is slow for many files. ```bash # Sequential (slow for many files) rgpycrumbs chemgp batch -c config.toml ``` -------------------------------- ### Unified data format example Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/explanation/architecture.org Python dictionary showing the unified data structure returned by all parsers, with keys for energies, RMSD, gradients, convergence, and number of images. ```python { "energies": np.array([...]), # eV "rmsd_r": np.array([...]), # Angstrom "rmsd_p": np.array([...]), # Angstrom "grad_r": np.array([...]), # eV/Angstrom "grad_p": np.array([...]), # eV/Angstrom "converged": bool, "n_images": int, } ``` -------------------------------- ### Use legacy parser for ORCA < 6.1 Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/faq.org Use the fallback parser for ORCA versions before 6.1, which parses .interp files. ```python from chemparseplot.parse.orca.neb import parse_orca_neb_fallback data = parse_orca_neb_fallback("job", Path("calc")) ``` -------------------------------- ### Lazy imports example Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/explanation/architecture.org Python code showing how optional dependencies are loaded on first use using ensure_import from rgpycrumbs._aux. ```python from rgpycrumbs._aux import ensure_import def _get_opi(): global _opi if _opi is None: _opi = ensure_import("opi.output.core") return _opi ``` -------------------------------- ### Set up development environment with uv or pip Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/dev/contributing.org Set up the development environment using either uv (recommended) or pip with a virtual environment. ```bash # Using uv (recommended) uv sync --all-extras # Or using pip python -m venv .venv source .venv/bin/activate pip install -e ".[all,test]" ``` -------------------------------- ### xyzrender backend for structure strip Source: https://github.com/haozeke/chemparseplot/blob/main/llms-full.txt For ray-traced structure images, use the xyzrender renderer. Stages via rgpycrumbs ensure_import when AUTO_DEPS is on (or pip install 'xyzrender>=0.1.3'). Uses the Python API, not a PATH binary. ```python # xyzrender stages via rgpycrumbs ensure_import when AUTO_DEPS is on # (or: pip install 'xyzrender>=0.1.3'). Uses the Python API, not a PATH binary. plot_structure_strip( ax, atoms_list, labels, renderer="xyzrender", ) ``` -------------------------------- ### Create an energy profile plot Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/faq.org Creates an energy profile plot from parsed NEB data and saves it to a PDF. See the ORCA NEB Tutorial for details. ```python from chemparseplot.plot.neb import plot_orca_neb_energy_profile plot_orca_neb_energy_profile(data, "profile.pdf") ``` -------------------------------- ### Run base tests with uv Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/dev_testing.org Sets up the base test environment and runs the core test suite, excluding tutorials. Requires uv and the test extra. ```shell cd chemparseplot uv sync --extra test uv run pytest tests/ --ignore=tests/tutorials ``` -------------------------------- ### Speed up batch plotting with parallel processing Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/faq.org Use the -j 4 flag to run 4 parallel workers for batch plotting. ```bash rgpycrumbs chemgp batch -c config.toml -j 4 ``` -------------------------------- ### Expected output from plot_neb.py Source: https://github.com/haozeke/chemparseplot/blob/main/llms-full.txt Example output showing parsed NEB data: 8 images, converged, energies, and barrier heights. ```text Number of images: 8 Converged: True Energies (eV): [0.0, 0.52, 0.89, 1.15, 0.98, 0.67, 0.34, 0.0] Barrier (forward): 1.15 eV Barrier (reverse): 1.15 eV ``` -------------------------------- ### Install chemparseplot in correct Python environment Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/troubleshooting.org Check the active Python and install chemparseplot in the correct environment. Use the full path to the Python interpreter if needed. ```bash # Check which Python is active which python python --version # Install in correct environment python -m pip install chemparseplot # Or use full path /path/to/python -m pip install chemparseplot ``` -------------------------------- ### Lazy Import Pattern with ensure_import Source: https://github.com/haozeke/chemparseplot/blob/main/llms-full.txt Loads optional dependencies on first use to reduce installation size and allow graceful degradation. The `_get_opi` function caches the imported module in a global variable. ```python from rgpycrumbs._aux import ensure_import def _get_opi(): global _opi if _opi is None: _opi = ensure_import("opi.output.core") return _opi ``` -------------------------------- ### Sync doc extra at v1.13.2 tag Source: https://github.com/haozeke/chemparseplot/blob/main/AGENTS.md Installs the doc extra at the v1.13.2 tag. The rewritten lock leaves the tree dirty, so hatch-vcs gives a dev version like 1.13.3.dev0+gd5e1b77cd.d20261031. ```bash uv sync --extra doc ``` -------------------------------- ### Build llms.txt site map Source: https://github.com/haozeke/chemparseplot/blob/main/skills/chemparseplot-add-parser/SKILL.md Run this script after adding a how-to page and updating the site map. CI fails while llms-full.txt is stale. ```bash python scripts/llms/build_llms.py ``` -------------------------------- ### Run ORCA and compress output Source: https://github.com/haozeke/chemparseplot/blob/main/doc/source/tutorials/orca/geomscan.md Commands to set up the ORCA environment, run ORCA, and compress the output file for later analysis. ```bash export PATH=$PATH:/blah/orca_5_0_4_linux_x86-64_openmpi411/ mkdir uhf cp orca.inp h2_base.xyz uhf cd uhf ($(which orca) orca.inp 2>&1) | tee scan_uhf ``` ```bash gzip -9 -c scan_uhf > scanuhf.gz mv scanuhf.gz ../data/ ``` -------------------------------- ### Unit-Aware Energy Conversion with pint Source: https://github.com/haozeke/chemparseplot/blob/main/ARCHITECTURE.md Shows how chemparseplot uses pint for automatic unit conversion. The example creates a quantity with a value and unit, then converts it to another unit, printing the result. This demonstrates the library's unit-aware design. ```python from chemparseplot.units import Q_ energy = Q_(-123.456, "hartree") print(energy.to("kcal/mol")) # Automatic conversion ``` -------------------------------- ### Use theme system with get_theme Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/dev/contributing.org Use the theme system by importing get_theme and retrieving a theme (e.g., "ruhi"). ```python from chemparseplot.plot.theme import get_theme theme = get_theme("ruhi") ``` -------------------------------- ### Clone and enter chemparseplot repository Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/dev/contributing.org Clone the repository and navigate into the project directory. ```bash git clone https://github.com/your-username/chemparseplot cd chemparseplot ``` -------------------------------- ### Run ORCA and compress output Source: https://github.com/haozeke/chemparseplot/blob/main/llms-full.txt Shell commands to set ORCA path, create uhf directory, copy input files, run ORCA with tee to scan_uhf, then gzip the output to scanuhf.gz and move to data/. ```bash export PATH=$PATH:/blah/orca_5_0_4_linux_x86-64_openmpi411/ mkdir uhf cp orca.inp h2_base.xyz uhf cd uhf ($(which orca) orca.inp 2>&1) | tee scan_uhf ``` ```bash gzip -9 -c scan_uhf > scanuhf.gz mv scanuhf.gz ../data/ ``` -------------------------------- ### Build documentation with uv and Sphinx Source: https://github.com/haozeke/chemparseplot/blob/main/AGENTS.md Syncs the doc extra, exports Org files to RST with Emacs, then builds HTML with Sphinx. Requires Emacs 30 (Org 9.7); Emacs 29.3 stops at the first page. Sphinx prints 'build succeeded, 17 warnings'. ```bash uv sync --extra doc (cd docs && emacs --batch --load export.el) uv run sphinx-build doc/source doc/build/html ``` -------------------------------- ### setup_publication_theme Source: https://github.com/haozeke/chemparseplot/blob/main/llms-full.txt Adds line width, spine removal, and DPI defaults on top of the base theme. Optionally uses a journal preset for sizes. ```APIDOC ## setup_publication_theme ### Description Adds line width, spine removal, and DPI defaults on top of the base theme. Optionally uses a journal preset for sizes. ### Method Function call ### Signature `setup_publication_theme(theme, journal=None)` ### Parameters - **theme** (Theme) - Required - Theme object from `get_theme`. - **journal** (str) - Optional - Journal abbreviation or preset key (e.g., "jctc", "acs"). ### Example ```python from chemparseplot.plot.theme import get_theme, setup_publication_theme theme = get_theme("ruhi") setup_publication_theme(theme) setup_publication_theme(theme, journal="jctc") ``` ``` -------------------------------- ### Format and lint with ruff Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/dev/contributing.org Format the codebase and run lint checks using ruff. ```bash uv run ruff format . uv run ruff check . ``` -------------------------------- ### setup_global_theme Source: https://github.com/haozeke/chemparseplot/blob/main/llms-full.txt Applies a theme globally to matplotlib settings. ```APIDOC ## setup_global_theme ### Description Applies a theme globally to matplotlib settings. ### Method Function call ### Signature `setup_global_theme(theme)` ### Parameters - **theme** (Theme) - Required - Theme object from `get_theme`. ### Example ```python from chemparseplot.plot.theme import get_theme, setup_global_theme theme = get_theme("ruhi") setup_global_theme(theme) ``` ``` -------------------------------- ### Import geomscan module and gzip utilities Source: https://github.com/haozeke/chemparseplot/blob/main/llms-full.txt Imports gzip, Path, ase.build.molecule, matplotlib.pyplot, and chemparseplot.parse.orca.geomscan for parsing ORCA geometry scan output. ```python import gzip from pathlib import Path from ase.build import molecule import matplotlib.pyplot as plt from chemparseplot.parse.orca import geomscan ``` -------------------------------- ### Check Python executable path for ModuleNotFoundError Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/faq.org When encountering 'ModuleNotFoundError: No module named chemparseplot', verify the Python environment by printing the executable path. This helps confirm you installed chemparseplot in the correct environment. ```bash # Check Python path python -c "import sys; print(sys.executable)" ``` -------------------------------- ### Install plot extra with rgpycrumbs and scipy Source: https://github.com/haozeke/chemparseplot/blob/main/skills/chemparseplot-orca-scan/SKILL.md Installs the chemparseplot plot extra along with `rgpycrumbs` and `scipy>=1.11`. Without `rgpycrumbs` the call stops with `ModuleNotFoundError`; without scipy, `rgpycrumbs` raises `ImportError: Module 'scipy.interpolate' is required`. ```bash pip install "chemparseplot[plot]" rgpycrumbs "scipy>=1.11" ``` -------------------------------- ### Run where_is.py to check site map sources Source: https://github.com/haozeke/chemparseplot/blob/main/skills/chemparseplot-docs/SKILL.md Prints the source of every page linked by the site map. Exits 1 when a page has no source; on main all 39 pages have one. ```bash python scripts/where_is.py ``` -------------------------------- ### Batch Process eOn Saddle Searches Source: https://github.com/haozeke/chemparseplot/blob/main/doc/source/tutorials/eon/saddle.md Shows how to batch process multiple saddle search directories using glob and parse_eon_saddle, then compute the success rate. ```python # Process multiple saddle searches # from glob import glob # # results_dirs = glob("saddle_searches/*/") # all_results = [] # # for i, res_dir in enumerate(results_dirs): # rloc = SpinID(mol_id=f"mol_{i}", spin=0) # result = parse_eon_saddle(Path(res_dir), rloc) # all_results.append(result) # # print(f"Processed {len(all_results)} saddle searches") # print(f"Success rate: {sum(r.success for r in all_results) / len(all_results):.1%}") ``` -------------------------------- ### Convert readme_src.org to readme.md Source: https://github.com/haozeke/chemparseplot/blob/main/AGENTS.md Exports readme_src.org to readme.md. On main the two have drifted apart, so change both by hand. Links in the README must be absolute since PyPI shows it too. ```bash bash scripts/org_to_md.sh readme_src.org readme.md ``` -------------------------------- ### Don't Execute Untrusted Code Source: https://github.com/haozeke/chemparseplot/blob/main/llms-full.txt Avoid using exec() on user input. Use safe parsing like tomllib for configuration files. ```python # BAD: Never do this exec(user_input) # GOOD: Use safe parsing import tomllib with open(config_file, "rb") as f: config = tomllib.load(f) ``` -------------------------------- ### Create TwoDimPlot with sample data Source: https://github.com/haozeke/chemparseplot/blob/main/doc/source/tutorials/orca/geomscan.md Creates a TwoDimPlot instance, sets units, adds two EnergyPath objects with random data, and displays the plot. ```python # Create an instance of TwoDimPlot twodim_plot = TwoDimPlot() # Set the units for the plot twodim_plot.set_units('angstrom', 'hartree') # Add data (EnergyPath instances) to the plot energy_path1 = EnergyPath('Path 1', np.linspace(0, 10, 30) * ureg.angstrom, np.random.uniform(-1, 0, 30) * ureg.hartree) energy_path2 = EnergyPath('Path 2', np.linspace(1, 9, 25) * ureg.angstrom, np.random.uniform(-0.5, 0.5, 25) * ureg.hartree) twodim_plot.add_data(energy_path1) twodim_plot.add_data(energy_path2) # Display the plot twodim_plot.show_plot("Energy Paths") ``` -------------------------------- ### Run tests in individual pixi environments Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/dev_testing.org Runs tests for individual pixi environments, each with its own optional dependencies. Comments indicate the purpose of each command. ```shell pixi run -e test test-base # base tests only pixi run -e plot test-plot # with jax + cmcrameri pixi run -e chemgp test-chemgp # with pandas + plotnine pixi run -e plumed test-plumed # plumed tests only ``` -------------------------------- ### Plot energy paths from ORCA scan Source: https://github.com/haozeke/chemparseplot/blob/main/skills/chemparseplot-orca-scan/SKILL.md Plots energy vs. distance for an ORCA scan using `plot_energy_paths`. Sort the data first because ORCA scans run in input order (here long to short) and the spline fails with `ValueError: Error on input data` otherwise. Requires `rgpycrumbs` and `scipy`, which are not installed with the plot extra or `[all]`; only the `test` extra installs them. ```python import numpy as np from chemparseplot.plot.geomscan import plot_energy_paths from chemparseplot.plot.structs import EnergyPath order = np.argsort(distance.magnitude) plotter = plot_energy_paths( [EnergyPath("H2 scan", distance[order], energy[order])], {"distance": "angstrom", "energy": "eV"}, ) plotter.fig.savefig("scan.png") ``` -------------------------------- ### Apply journal style with custom font Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/journal_figures.org Applies the 'jctc' journal style with a specified font (e.g., 'Helvetica'). If the named face is not installed, it is replaced by one with the same advance widths, so text takes the same room. The journal's faces stand in the same way when the theme's face is missing; if none are installed, text falls back to DejaVu Sans. ```python from chemparseplot.plot.journal import apply_style style = apply_style("jctc", font="Helvetica") style.font # Helvetica, or Nimbus Sans, Liberation Sans or Arimo ``` -------------------------------- ### Troubleshoot ModuleNotFoundError for chemparseplot Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/install.org Diagnose and fix a missing chemparseplot module by checking the active Python environment and installing into the correct one. ```bash # Check which Python is being used which python python --version # Install in correct environment /path/to/python -m pip install chemparseplot ``` -------------------------------- ### Use Context Managers for Files Source: https://github.com/haozeke/chemparseplot/blob/main/llms-full.txt Use a Path object for the working directory to avoid hardcoded paths and ensure proper file handling. ```python from pathlib import Path work_dir = Path("calculation") data = parse_orca_neb("job", working_dir=work_dir) ``` -------------------------------- ### Run a small NEB with ASE Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/tutorials/journal_figure.org Sets up a gold atom hopping between hollow sites on an Al(100) surface using the EMT calculator. The band uses the improved tangent method. The two lower layers are fixed. 'converged' is True when the largest force is below 0.05 eV/Angstrom. ```python import numpy as np from ase.build import add_adsorbate, fcc100 from ase.calculators.emt import EMT from ase.constraints import FixAtoms from ase.mep import NEB from ase.optimize import BFGS, QuasiNewton slab = fcc100("Al", size=(2, 2, 3)) add_adsorbate(slab, "Au", 1.7, "hollow") slab.center(axis=2, vacuum=4.0) fixed = FixAtoms(mask=[atom.tag > 1 for atom in slab]) def relaxed(atoms): atoms = atoms.copy() atoms.set_constraint(fixed) atoms.calc = EMT() QuasiNewton(atoms, logfile=None).run(fmax=0.05) return atoms initial = relaxed(slab) hop = initial.copy() hop[-1].x += hop.get_cell()[0, 0] / 2 final = relaxed(hop) images = [initial] + [initial.copy() for _ in range(3)] + [final] for image in images: image.set_constraint(fixed) image.calc = EMT() band = NEB(images, method="improvedtangent") band.interpolate() converged = BFGS(band, logfile=None).run(fmax=0.05) ``` -------------------------------- ### Set appropriate DPI Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/dev/best_practices.org Recommended DPI settings for different output contexts: 150 for presentations, 300 for publications, and 72 for web. ```python # For presentations dpi = 150 # For publications dpi = 300 # For web dpi = 72 ``` -------------------------------- ### Type-hinted public function parse_orca_neb Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/dev/contributing.org Example of a public function with type hints, as required for all public functions. Target is 90%+ type hint coverage. ```python def parse_orca_neb( basename: str, working_dir: Path | None = None, ) -> dict[str, Any]: """Parse ORCA NEB calculation.""" ... ``` -------------------------------- ### Run ruff check and format on new files Source: https://github.com/haozeke/chemparseplot/blob/main/skills/chemparseplot-add-parser/SKILL.md Run these commands to lint and format new files. Alternatively, use `uvx prek run --files FILE...` for all hooks in prek.toml (ruff, ruff-format, taplo, codespell, whitespace). ```bash uv run ruff check ``` ```bash uv run ruff format ``` -------------------------------- ### Speed up landscape plotting with RBF and fewer inducing points Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/troubleshooting.org Reduce computational cost of surface fitting by using method='rbf' and n_inducing=100. ```python plot_orca_neb_landscape( data, "landscape.pdf", method="rbf", # Faster than GP methods n_inducing=100 # Fewer inducing points ) ``` -------------------------------- ### Import ChemGP plotting functions Source: https://github.com/haozeke/chemparseplot/blob/main/llms-full.txt Imports the four ChemGP plotting functions used in the convergence tutorial: `plot_convergence_curve`, `plot_rff_quality`, `plot_energy_profile`, and `plot_fps_projection`. Also imports required libraries. ```python import h5py import numpy as np import pandas as pd from pathlib import Path from chemparseplot.plot.chemgp import ( plot_convergence_curve, plot_rff_quality, plot_energy_profile, plot_fps_projection, ) ``` -------------------------------- ### Use RBF interpolation instead of grad_matern Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/troubleshooting.org Simpler interpolation method to avoid JAX dependency. Use method='rbf' instead of 'grad_matern'. ```python plot_orca_neb_landscape( data, "landscape.pdf", method="rbf" # Instead of "grad_matern" ) ``` -------------------------------- ### Enable JSON output in ORCA input Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/troubleshooting.org Add this block to the ORCA input file to enable JSON output, required for ORCA 6.1+ parsing. ```text %output Print[JSON] true end ``` -------------------------------- ### Augment with External NEB Paths Source: https://github.com/haozeke/chemparseplot/blob/main/llms-full.txt Adds data from other NEB runs to improve landscape surface fits. Augmented paths get 'step'=-1 in the DataFrame, distinguishing them from the primary path. ```python from ase.io import read as ase_read ref_atoms = ase_read("reactant.con") prod_atoms = ase_read("product.con") df = aggregate_neb_landscape_data( all_dat_paths=dat_paths, all_con_paths=con_paths, y_data_column=1, ira_instance=ira_mod.IRA(), cache_file=Path("landscape_cache.parquet"), augment_dat="extra_run/*.dat", augment_con="extra_run/*.con", ref_atoms=ref_atoms, prod_atoms=prod_atoms, ) ``` -------------------------------- ### Use cross-references in org-mode Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/dev/best_practices.org Link to another org file using the file: syntax for cross-referencing documentation. ```org See [[file:../howto/parse_orca_neb.org][Parse ORCA NEB Calculations]] for details. ``` -------------------------------- ### Enable geometry output for landscape plots Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/faq.org Landscape plots require geometry output. Add this block to your ORCA input to enable Molden and MO printing. ```text %output Print[P_Molden] true Print[MOs] true end ``` -------------------------------- ### Test with Mock Data Source: https://github.com/haozeke/chemparseplot/blob/main/llms-full.txt Create a mock data dictionary with sample energies and n_images to test plotting functions. ```python import numpy as np mock_data = { "energies": np.array([0.0, 0.5, 1.0, 0.5, 0.0]), "n_images": 5, "converged": True, } plot_profile(mock_data, "test_profile.pdf") ``` -------------------------------- ### Run batch plotting in parallel with -j 8 Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/troubleshooting.org Speed up batch plotting by using parallel processing. Use the -j flag to specify number of jobs. ```bash rgpycrumbs chemgp batch -c config.toml -j 8 ``` -------------------------------- ### load_structures_and_calculate_additional_rmsd(con_file, additional_con, ira_kmax, sp_file=None) Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/reference/eon_neb_api.org Loads the main NEB trajectory and calculates RMSD for additional comparison structures. Returns a NebOverlayBundle containing atoms, additional structures, and an optional saddle point. ```APIDOC ## load_structures_and_calculate_additional_rmsd(con_file, additional_con, ira_kmax, sp_file=None) ### Description Loads the main NEB trajectory and calculates RMSD for additional comparison structures. Returns a NebOverlayBundle containing atoms, additional structures, and an optional saddle point. ### Parameters - **con_file** (Path) - Required - Path to main trajectory CON file - **additional_con** (list[tuple[Path, str]]) - Required - List of (path, label) pairs for extra structures - **ira_kmax** (float) - Required - kmax factor for IRA alignment - **sp_file** (Path or None) - Optional - Path to explicit saddle point CON file ### Returns NebOverlayBundle with fields: - **atoms_list** (list[Atoms]) - ASE Atoms from main trajectory - **additional_structures** (list[NebOverlayStructure]) - Typed overlay records with atoms, r, p, and label - **saddle_point** (NebOverlayStructure or None) - Explicit saddle-point overlay record ### Notes - Uses IRA (Iterative Rotations and Assignments) for RMSD - Raises ImportError if ira_mod is not available, because landscape coordinates without IRA are chemically misleading for permutationally symmetric systems - RMSD computed relative to first frame (reactant) and last frame (product) - Empty labels default to the file stem ### Overlay Record NebOverlayStructure is a frozen typed record with four fields: - **atoms**: ASE structure to render - **r**: RMSD to the reactant - **p**: RMSD to the product - **label**: legend / annotation label ``` -------------------------------- ### Create energy profile plot with plot_orca_neb_energy_profile Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/tutorials/orca_neb.org Creates an energy profile PDF using Hermite or spline interpolation. Requires ORCA output files; skipped in doctests. Outputs neb_profile.pdf with labeled reactant, product, saddle, and barrier annotation. ```python # SKIP-DOCTEST -- requires ORCA output files from chemparseplot.plot.neb import plot_orca_neb_energy_profile # Create energy profile plot plot_orca_neb_energy_profile( data, output=Path("neb_profile.pdf"), width=5.37, # inches height=5.37, # inches dpi=200, # resolution method="hermite" # interpolation: 'hermite' or 'spline' ) print("Created neb_profile.pdf") ``` -------------------------------- ### load_min_trajectory(job_dir, prefix="minimization") -> MinTrajectoryData Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/reference/eon_neb_api.org Loads the complete trajectory from an eOn minimization job directory. The movie file is required; prefers per-frame CON metadata and falls back to the sidecar .dat table when metadata is incomplete. ```APIDOC ## load_min_trajectory(job_dir, prefix="minimization") -> MinTrajectoryData ### Description Loads the complete trajectory from an eOn minimization job directory. The movie file is required; prefers per-frame CON metadata and falls back to the sidecar `.dat` table when metadata is incomplete. ### Parameters - **job_dir** (Path) - Required - Directory containing the eOn minimization job output - **prefix** (str) - Optional - Prefix for the data file (default: "minimization") ### Returns - **MinTrajectoryData** - Dataclass containing: - **atoms_list** (list[Atoms]) - Per-iteration structures from movie file - **dat_df** (pl.DataFrame) - Metrics reconstructed from per-frame CON metadata when available, otherwise from `minimization.dat` (or `.dat`) with columns iteration, step_size, convergence, energy - **initial_atoms** (Atoms) - Starting structure (first frame) - **final_atoms** (Atoms) - Final minimized structure (prefers `.con`, then legacy `min.con`, otherwise last movie frame) ``` -------------------------------- ### Run parallel batch processing with rgpycrumbs Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/dev/best_practices.org Use rgpycrumbs to run chemgp batch in parallel. The -j flag controls the number of workers; -j 4 and -j 8 are shown as examples. ```bash # Parallel (4 workers) rgpycrumbs chemgp batch -c config.toml -j 4 # Parallel (8 workers, fast) rgpycrumbs chemgp batch -c config.toml -j 8 ``` -------------------------------- ### Import eOn Saddle Search Parser Source: https://github.com/haozeke/chemparseplot/blob/main/doc/source/tutorials/eon/saddle.md Import the required modules for parsing eOn saddle search results. ```python from pathlib import Path from chemparseplot.parse.eon.saddle_search import parse_eon_saddle from rgpycrumbs.basetypes import SpinID ``` -------------------------------- ### Parsing eOn Saddle Searches with chemparseplot.parse.eon.saddle_search Source: https://github.com/haozeke/chemparseplot/blob/main/doc/source/tutorials/index.md Parses eOn saddle search results using `parse_eon_saddle`, which takes a results directory and a `SpinID` object. The example prints the resulting barrier energy. ```python from chemparseplot.parse.eon.saddle_search import parse_eon_saddle from rgpycrumbs.basetypes import SpinID result = parse_eon_saddle(results_dir, SpinID(mol_id="test", spin=0)) print(f"Barrier: {result.barrier}") ``` -------------------------------- ### setup_publication_theme(theme, journal=None) Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/reference/plotting_api.org Extends setup_global_theme() with publication defaults: spine removal, line widths, DPI 300, tight bbox. With journal (a preset key or alias such as "jctc"), applies the style of chemparseplot.plot.journal instead. ```APIDOC ## setup_publication_theme(theme, journal=None) ### Description Extends setup_global_theme() with publication defaults: spine removal, line widths, DPI 300, tight bbox. With journal (a preset key or alias such as "jctc"), applies the style of chemparseplot.plot.journal instead. ``` -------------------------------- ### Use legacy parser for ORCA < 6.1 Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/troubleshooting.org Fallback parser for ORCA versions older than 6.1. Call parse_orca_neb_fallback with the job name and a Path object for the calculation directory. ```python from chemparseplot.parse.orca.neb import parse_orca_neb_fallback data = parse_orca_neb_fallback("job", Path("calc")) ``` -------------------------------- ### Get and set built-in theme Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/create_neb_figures.org Retrieves a built-in theme by name (e.g., "ruhi", "cmc.batlow") and applies it globally. ```python from chemparseplot.plot.theme import get_theme, setup_global_theme # Available themes: "ruhi", "cmc.batlow" theme = get_theme("ruhi") setup_global_theme(theme) ``` -------------------------------- ### Parse ORCA NEB output Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/faq.org Parses ORCA NEB output from a working directory. Returns a dictionary with 'energies' and 'barrier_forward' (in eV). See the ORCA NEB Tutorial for details. ```python from pathlib import Path from chemparseplot.parse.orca.neb import parse_orca_neb data = parse_orca_neb("job", working_dir=Path("calculation")) print(f"Energies: {data['energies']}") print(f"Barrier: {data['barrier_forward']:.2f} eV") ``` -------------------------------- ### Run scaffold check script Source: https://github.com/haozeke/chemparseplot/blob/main/skills/chemparseplot-add-parser/SKILL.md Executes the scaffold check script that copies the package, tests, pyproject.toml, CHANGELOG.md, and the ORCA tutorial run into a temporary directory. It verifies imports, runs four tests, checks ruff compliance, and confirms the towncrier draft lists the fragment under 'Added'. The checkout is not changed. ```bash python scripts/scaffold_check.py ``` -------------------------------- ### Check and smooth energy arrays Source: https://github.com/haozeke/chemparseplot/blob/main/docs/orgmode/howto/troubleshooting.org Useful for diagnosing issues with energy data before plotting. Prints min, max, and unique value count, then applies Gaussian smoothing with sigma=1. ```python # Check for issues print(f"Min energy: {energies.min()}") print(f"Max energy: {energies.max()}") print(f"Unique values: {len(np.unique(energies))}") # Filter or smooth if needed from scipy.ndimage import gaussian_filter1d energies_smooth = gaussian_filter1d(energies, sigma=1) ```