Maintainers
Pricing
Enterprise
More
More
Documentation
Try Live
Rankings
Install
Blog
Docs7
Ask
New
Add Docs
rgpycrumbs
https://github.com/haozeke/rgpycrumbs
Admin
A dispatcher-based analytical and visualization suite for chemical physics.
Tokens:
104,003
Snippets:
1,059
Trust Score:
9.2
License:
MIT
Update:
4 days ago
Context
Chat
Benchmark
Latest
Show doc for...
Code
Info
Show Results
Tokens:
Raw
Copy
Link
Tokens:
Raw
Copy
Link
### Layered TOML Configuration Setup Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/howto/install.org Set up global and project-level TOML configuration files. The project file overrides the global one and is discovered by walking up from the current directory. ```bash # global mkdir -p ~/.config/rgpkgs cp docs/examples/rgpkgs.config.toml ~/.config/rgpkgs/config.toml # project (overrides global; walk-up from CWD) cp docs/examples/rgpkgs.config.toml ./rgpkgs.toml ``` -------------------------------- ### Check uv and pip availability Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/howto/install.org Verifies that uv or pip is installed to resolve 'Failed to install' errors. ```bash which uv which pip ``` -------------------------------- ### Quick Install with pip Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/howto/install.org Install the rgpycrumbs package from PyPI using pip. ```bash pip install rgpycrumbs ``` -------------------------------- ### Test JAX installation Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/howto/install.org Verify that JAX is working by importing FastTPS from rgpycrumbs.surfaces. ```bash python3 -c "from rgpycrumbs.surfaces import FastTPS; print('JAX working!')" ``` -------------------------------- ### Verify installation with Python Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/howto/install.org Check that rgpycrumbs is installed and print its version. ```bash python -c "import rgpycrumbs; print(rgpycrumbs.__version__)" ``` -------------------------------- ### Install JAX with CUDA support Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/howto/install.org Install JAX with CUDA 12 or CUDA 11 for GPU-accelerated surface fitting. ```bash # CUDA 12 pip install "jax[cuda12]" # CUDA 11 pip install "jax[cuda11]" ``` -------------------------------- ### Install dependencies for surface fitting Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/howto/install.org Install JAX and SciPy for Gaussian Process surface fitting. Use RGPYCRUMBS_AUTO_DEPS=1 to auto-install on first use, or use uv. ```bash # JAX for surface fitting, SciPy for its hyperparameter fits pip install jax scipy # or: export RGPYCRUMBS_AUTO_DEPS=1 # Or with uv uv pip install jax scipy # or: export RGPYCRUMBS_AUTO_DEPS=1 # Or enable auto-install (installs on first use) export RGPYCRUMBS_AUTO_DEPS=1 ``` -------------------------------- ### Install specific packages with pip Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/howto/install.org Explicitly install optional dependencies like JAX, SciPy, and ASE when you prefer a controlled host environment. ```bash pip install jax scipy ase ``` -------------------------------- ### User installation for permission errors Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/howto/install.org Uses pip install --user to avoid permission errors when auto-installing packages. ```bash export RGPYCRUMBS_AUTO_DEPS=1 pip install --user jax # or AUTO_DEPS ``` -------------------------------- ### Development setup and test commands with uv Source: https://github.com/haozeke/rgpycrumbs/blob/main/README.md Clone and install in development mode with test dependencies, then run pure tests and interpolation tests (needs scipy). ```bash # Clone and install in development mode with test dependencies uv sync --extra test # Run the pure tests (no heavy optional deps) uv run pytest -m pure # Run interpolation tests (needs scipy) uv run --extra interpolation pytest -m interpolation ``` -------------------------------- ### Enable auto-dependency resolution and test import Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/quickstart.org Sets RGPYCRUMBS_AUTO_DEPS=1 to enable on-demand dependency installation via uv/pip. The example command imports FastTPS from rgpycrumbs.surfaces, which triggers automatic installation of jax. The resolver is CUDA-aware: on machines without an NVIDIA GPU it installs CPU-only variants (e.g. jax[cpu]) to avoid pulling unused CUDA libraries. ```bash export RGPYCRUMBS_AUTO_DEPS=1 python -c "from rgpycrumbs.surfaces import FastTPS" # jax installed automatically ``` -------------------------------- ### One-command auto-install prefix Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/howto/install.org Prefix any command with RGPYCRUMBS_AUTO_DEPS=1 to enable auto-install for that single invocation. ```bash RGPYCRUMBS_AUTO_DEPS=1 python3 my_script.py ``` -------------------------------- ### Install rgpycrumbs with pip or development setup Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/tutorials/first-project.org Install the core package with all pip-available extras, or clone the repository and sync dependencies with uv for development. The pip command includes an optional environment variable export for auto-dependencies. ```bash # Core package with all pip-available extras pip install rgpycrumbs # + export RGPYCRUMBS_AUTO_DEPS=1 # Or for development git clone https://github.com/HaoZeke/rgpycrumbs cd rgpycrumbs uv sync --all-extras ``` -------------------------------- ### Enable auto-install temporarily Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/howto/install.org Set RGPYCRUMBS_AUTO_DEPS=1 for the current session to auto-install optional dependencies on first use. ```bash export RGPYCRUMBS_AUTO_DEPS=1 python3 -c "from rgpycrumbs.surfaces import FastTPS" # Auto-installs JAX ``` -------------------------------- ### Hard Dependency Example (JAX) Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/dev/lazy_imports.org Shows the bad practice of importing JAX as a hard dependency, forcing all users to install it even if they only need basic plotting. ```python # BAD: Hard dependency import jax import jax.numpy as jnp def fit_surface(data): # Uses JAX ... ``` -------------------------------- ### Enable auto-install via shell export Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/howto/install.org Sets the RGPYCRUMBS_AUTO_DEPS environment variable to 1 in a shell session, then runs a Python script that uses JAX. JAX is automatically installed on first import. ```bash # Enable auto-install export RGPYCRUMBS_AUTO_DEPS=1 # Run script that uses JAX python3 my_gp_script.py # JAX is automatically installed on first import ``` -------------------------------- ### Enable auto-install in Jupyter Notebook Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/howto/install.org Sets the RGPYCRUMBS_AUTO_DEPS environment variable in Python before importing FastTPS, which auto-installs JAX. ```python import os os.environ["RGPYCRUMBS_AUTO_DEPS"] = "1" from rgpycrumbs.surfaces import FastTPS # Auto-installs JAX ``` -------------------------------- ### Install JAX to fix ModuleNotFoundError Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/howto/faq.org Install the JAX extra or enable auto-install to resolve the missing module error. ```bash pip install jax # or: export RGPYCRUMBS_AUTO_DEPS=1 ``` -------------------------------- ### Set Up Environment with uv sync Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/dev/contributing.org Install all dependencies and extras using uv sync with the --all-extras flag. ```bash uv sync --all-extras ``` -------------------------------- ### Example test file structure Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/dev/testing.org Shows the expected layout for test files under the tests/ directory, mirroring the package structure. ```text tests/ chemgp/test_chemgp_refactoring.py eon/test_eon_cli.py test_detect_fragments.py test_ensure_import.py test_lazy_import_coverage.py ``` -------------------------------- ### Preferred CLI Entry with Dispatcher Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/howto/install.org Use the dispatcher as the primary CLI entry point instead of raw uv run. The dispatcher sets PYTHONPATH and defaults RGPYCRUMBS_AUTO_DEPS=1. ```bash rgpycrumbs eon plt-neb --help python -m rgpycrumbs.cli eon plt-neb --help ``` -------------------------------- ### Install rgpycrumbs and optional backends Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/tutorials/neb-visualization.org Install the rgpycrumbs package. Library/CLI plot paths enable AUTO_DEPS by default (jax, chemparseplot, xyzrender, adjustText via ensure_import + uv on PATH). Optional explicit backends only if needed: solvis-tools for strip_renderer=solvis, and ovito via conda-forge or separate heavy install. ```bash pip install rgpycrumbs # Library/CLI plot paths enable AUTO_DEPS by default (jax, chemparseplot, # xyzrender, adjustText via ensure_import + uv on PATH). # Optional explicit backends only if you need them: # pip install solvis-tools # strip_renderer=solvis # # ovito: conda-forge / separate heavy install ``` -------------------------------- ### rgpycrumbs --help Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/quickstart.org Displays the list of available CLI commands for the rgpycrumbs dispatcher. ```APIDOC ## rgpycrumbs --help ### Description Displays the list of available CLI commands for the rgpycrumbs dispatcher. ### Method CLI ### Endpoint `rgpycrumbs --help` ### Request Example ```bash rgpycrumbs --help ``` ``` -------------------------------- ### Install JAX or enable auto-deps Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/howto/troubleshooting.org Install JAX for surface fitting, or enable auto-installation of dependencies via the RGPYCRUMBS_AUTO_DEPS environment variable. ```bash pip install jax # or: export RGPYCRUMBS_AUTO_DEPS=1 # Or enable auto-install export RGPYCRUMBS_AUTO_DEPS=1 ``` -------------------------------- ### Catch specific ImportError for optional dependencies Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/dev/best_practices.org Catch specific exceptions when importing optional dependencies. The example catches ImportError and prints an installation hint. ```python try: module = ensure_import("jax") except ImportError as e: print(f"Install with: pip install jax # or AUTO_DEPS") ``` -------------------------------- ### Example: Run pure tests Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/contributing/test_requirements.org Runs the 'pure' test suite in the 'test' environment. ```bash pixi run -e test pytest -m pure ``` -------------------------------- ### Disable auto-install Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/howto/install.org Disables auto-install by setting RGPYCRUMBS_AUTO_DEPS=0 or unsetting it. Accepts true/yes/on and false/no/off, case-insensitive; any other value counts as unset. ```bash export RGPYCRUMBS_AUTO_DEPS=0 # Or unset unset RGPYCRUMBS_AUTO_DEPS ``` -------------------------------- ### List available CLI commands with rgpycrumbs --help Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/quickstart.org Displays the available commands for the rgpycrumbs CLI, which uses a PEP 723 dispatcher that runs each script in an isolated uv environment. ```bash rgpycrumbs --help ``` -------------------------------- ### Example: Run fragments tests Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/contributing/test_requirements.org Runs the 'fragments' test suite in the 'fragments' environment. ```bash pixi run -e fragments pytest -m fragments ``` -------------------------------- ### Using nebpath and SaddleMeasure from rgpycrumbs.basetypes Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/quickstart.org Shows how to store a NEB path snapshot with nebpath and track saddle search results with SaddleMeasure. The SaddleMeasure example records pes_calls, success, barrier, and method. ```python from rgpycrumbs.basetypes import nebpath, SaddleMeasure # Store a NEB path snapshot path = nebpath( norm_dist=[0.0, 0.25, 0.5, 0.75, 1.0], arc_dist=[0.0, 1.2, 2.4, 3.6, 4.8], energy=[0.0, -0.5, 0.3, -0.2, 0.0], ) # Track saddle search results result = SaddleMeasure( pes_calls=142, success=True, barrier=0.35, method="gprdimer", ) ``` -------------------------------- ### Run pure tests with uv Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/dev/testing.org Runs the 'pure' test marker using uv with the 'test' extra. Requires the 'test' extra to be installed. ```bash uv run --extra test pytest -m pure ``` -------------------------------- ### Install uv via curl Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/howto/troubleshooting.org Install the uv tool using the official installer script, required for PEP 723 scripts. ```bash curl -LsSf https://astral.sh/uv/install.sh | sh ``` -------------------------------- ### Example: Run align tests Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/contributing/test_requirements.org Runs the 'align' test suite in the 'test' environment. ```bash pixi run -e test pytest -m align ``` -------------------------------- ### Setup Development Environment with uv Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/dev/index.org Clones the rgpycrumbs repository, changes into the directory, and syncs all extras using uv. Run this before developing or testing. ```bash git clone https://github.com/HaoZeke/rgpycrumbs cd rgpycrumbs uv sync --all-extras ``` -------------------------------- ### Install pixi environment Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/contributing/test_requirements.org Run this command to install the project's isolated pixi environment. ```shell pixi install ``` -------------------------------- ### Set Lock File via Environment Variable Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/howto/install.org Configure the lock file path using environment variables. The dispatcher honors an optional Python lock from the uv resolver. Formats are auto-detected: uv.lock, pylock.toml, or CycloneDX JSON. ```bash # Any of: uv.lock | pylock.toml | CycloneDX JSON export RGPKGS_LOCK=/path/to/uv.lock # or: RGPKGS_LOCK=pylock.toml # or: RGPYCRUMBS_SBOM=stack.cdx.json # alias for --sbom rgpycrumbs --lock "$RGPKGS_LOCK" eon plt-neb ... ``` -------------------------------- ### nebpath Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/quickstart.org A lightweight container for storing a NEB path snapshot, including normalized and arc distances along with energies. ```APIDOC ## nebpath ### Description A lightweight container for storing a NEB path snapshot, including normalized and arc distances along with energies. ### Parameters - `norm_dist` (list) - Required - Normalized distances along the path. - `arc_dist` (list) - Required - Arc distances along the path. - `energy` (list) - Required - Energy values at each point. ### Request Example ```python from rgpycrumbs.basetypes import nebpath path = nebpath( norm_dist=[0.0, 0.25, 0.5, 0.75, 1.0], arc_dist=[0.0, 1.2, 2.4, 3.6, 4.8], energy=[0.0, -0.5, 0.3, -0.2, 0.0], ) ``` ``` -------------------------------- ### Example: Run surfaces tests Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/contributing/test_requirements.org Runs the 'surfaces' test suite in the 'surfaces' environment. ```bash pixi run -e surfaces pytest -m surfaces ``` -------------------------------- ### Plot NEB or ConFrame list with plot() Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/quickstart.org Commented-out examples showing how to call plot() on a NEB object or a ConFrame list, optionally specifying plot_type and output_file. Use config="plot.toml" for strip/surface-fit settings. ```python # Live pyeonclient objects or ConFrame lists # plot(neb, plot_type="profile", output_file="1d.pdf") # plot(frames, kind="neb", plot_type="profile", output_file="1d.pdf") ``` -------------------------------- ### Set RGPYCRUMBS_AUTO_DEPS in GitHub Actions CI Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/howto/install.org Configures the RGPYCRUMBS_AUTO_DEPS environment variable in a GitHub Actions workflow step so that pytest runs with auto-install enabled. ```yaml # .github/workflows/ci.yml - name: Run tests env: RGPYCRUMBS_AUTO_DEPS: "1" run: pytest ``` -------------------------------- ### Install rgpycrumbs via pip Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/tutorials/saddle-search-visualization.org Placeholder description. ```bash pip install rgpycrumbs # plot heavies via library AUTO_DEPS / ensure_import ``` -------------------------------- ### Plot with custom file prefix using --prefix Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/tutorials/minimization-visualization.org Use --prefix to match files with a custom prefix, like qm_min, for minimization jobs. The example shows plotting a profile from a job directory with the prefix qm_min. ```shell # For jobs with qm_min, qm_min.dat, qm_min.con rgpycrumbs eon plt-min --job-dir job/ --prefix qm_min --plot-type profile ``` -------------------------------- ### B-spline fit with spline_interp Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/quickstart.org Provides a quick B-spline fit for 1D energy profiles, e.g., along a reaction coordinate. The snippet is incomplete in the source; only the import and module reference are shown. ```python import numpy as np from rgpycrumbs.interpolation import spline_interp ``` -------------------------------- ### Install rgpycrumbs with JAX Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/howto/faq.org Install the package and optionally JAX. The comment shows an alternative: set RGPYCRUMBS_AUTO_DEPS=1 to auto-install JAX. ```bash pip install rgpycrumbs pip install jax # or: export RGPYCRUMBS_AUTO_DEPS=1 # With JAX ``` -------------------------------- ### Library API: plot_neb example Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/tools/eon/plt_neb.org Python example using plot_neb from rgpycrumbs.eon to generate a 2D landscape with gradient IMQ surface, critical point structures, and optional TOML config. ```python from rgpycrumbs.eon import plot_neb, plot # Job files / patterns (same as CLI) plot_neb( plot_type="landscape", con_file="neb.con", surface_type="grad_imq", plot_structures="crit_points", output_file="neb_2d.pdf", config="plot.toml", # optional TOML ) ``` -------------------------------- ### Batch Output Example Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/tools/chemgp/batch_command.org Example output from the batch command showing success and failure messages. The batch continues processing remaining plots if one fails. Exit code is 1 if any plots failed, 0 if all succeeded. ```text [OK] reaction1_surface.pdf [FAIL] reaction2_convergence.pdf: Input not found: ./data/reaction2.h5 [OK] reaction3_quality.pdf Batch complete: 2 ok, 1 failed ``` -------------------------------- ### Install rgpycrumbs with uv Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/source/llms.txt Adds rgpycrumbs as a dependency using the uv package manager. ```sh uv add rgpycrumbs ``` -------------------------------- ### CLI command with click Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/dev/best_practices.org Use click for CLI commands. The example defines a command with a required --input option. ```python import click @click.command() @click.option("--input", "-i", required=True) def my_command(input): """My CLI command.""" ... ``` -------------------------------- ### Run rgpycrumbs with auto-install enabled Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/howto/faq.org Prefix the command with the environment variable to enable auto-install for the current invocation. ```bash RGPYCRUMBS_AUTO_DEPS=1 rgpycrumbs chemgp ... ``` -------------------------------- ### Visualize NEB path convergence with CLI Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/tutorials/first-project.org Run the rgpycrumbs CLI to plot energy vs. iteration for each image from the eOn NEB output. Use --start and --end to select the iteration range and -o to specify the output PDF. If the plot is empty, check that neb_*.dat files exist and contain energy data in column 2. ```bash python -m rgpycrumbs.cli eon plt-neb --start 0 --end 50 -o neb_convergence.pdf ``` -------------------------------- ### Download sample NEB data Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/tutorials/first-project.org Download and extract sample NEB calculation output files (neb_*.dat and path.con) needed for the tutorial. ```bash wget https://example.com/sample-neb-data.tar.gz tar xzf sample-neb-data.tar.gz cd sample-neb-data ``` -------------------------------- ### Test auto-install with RGPYCRUMBS_AUTO_DEPS Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/dev/lazy_imports.org Runs a Python command with the RGPYCRUMBS_AUTO_DEPS environment variable set to 1, which enables auto-installation of missing dependencies. The example imports spline_interp from rgpycrumbs.interpolation and expects scipy to be auto-installed if missing. ```bash # Test with auto-install enabled RGPYCRUMBS_AUTO_DEPS=1 uv run python -c " from rgpycrumbs.interpolation import spline_interp # Should auto-install scipy if missing " ``` -------------------------------- ### Dependency Map for Optional Dependencies Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/dev/lazy_imports.org Maps module names to pip install specifications, used by ensure_import for auto-installation. ```python _DEPENDENCY_MAP: dict[str, str] = { "jax": "jax>=0.4", "scipy": "scipy>=1.11", "ase": "ase>=3.22", # ... } ``` -------------------------------- ### CLI: Using a Product Reference Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/tools/eon/plt_saddle.org Uses (initial, product) as the reference pair instead of the default (initial, saddle), showing the full reaction path context. ```shell rgpycrumbs eon plt-saddle --job-dir results/ --plot-type landscape --ref-product product.con ``` -------------------------------- ### Plot NEB energy profiles from eOn .dat files Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/quickstart.org Plots NEB energy profiles from eOn .dat files using the rgpycrumbs eon plt-neb command. The first example plots iterations 100-150 and saves to neb_profile.pdf; the second creates an interactive plot of the latest iterations starting at 280. ```bash # Plot NEB energy profiles from eOn .dat files (iterations 100-150) rgpycrumbs eon plt-neb --start 100 --end 150 -o neb_profile.pdf # Interactive plot of the latest iterations rgpycrumbs eon plt-neb --start 280 ``` -------------------------------- ### SaddleMeasure Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/quickstart.org A container for tracking saddle search results, including the number of PES calls, success status, barrier height, and method used. ```APIDOC ## SaddleMeasure ### Description A container for tracking saddle search results, including the number of PES calls, success status, barrier height, and method used. ### Parameters - `pes_calls` (int) - Required - Number of potential energy surface calls. - `success` (bool) - Required - Whether the search succeeded. - `barrier` (float) - Required - Barrier height. - `method` (str) - Required - Method used (e.g., "gprdimer"). ### Request Example ```python from rgpycrumbs.basetypes import SaddleMeasure result = SaddleMeasure( pes_calls=142, success=True, barrier=0.35, method="gprdimer", ) ``` ``` -------------------------------- ### Convergence visualization with all optimization steps Source: https://github.com/haozeke/rgpycrumbs/blob/main/README.md Overlays all optimization steps using --landscape-path all to visualize convergence from initial guess to final path. Uses gradient-enhanced IMQ surface and saves to neb_convergence.png. ```bash python -m rgpycrumbs.cli eon plt-neb \ --con-file neb.con \ --plot-type landscape \ --landscape-path all \ --surface-type grad_imq \ --show-legend \ -o neb_convergence.png ``` -------------------------------- ### Install rgpycrumbs via pip Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/howto/troubleshooting.org Install the rgpycrumbs package in the current Python environment to resolve 'ModuleNotFoundError: No module named rgpycrumbs'. ```bash python -m pip install rgpycrumbs ``` -------------------------------- ### Run plot-reactions command Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/tools/chemgp/method_comparisons.org Reads CON structures, aligns atoms by rigid rotations, and evaluates GFN2-xTB single points. Requires the xtb executable to be installed; other dependencies use the standard uv dispatcher. ```bash rgpycrumbs chemgp plot-reactions --config reactions.toml --xtb xtb ``` -------------------------------- ### Log eOn config to MLFlow with log_config_ini Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/tools/eon/mlflow.org Sets the MLFlow tracking URI and experiment, then starts a run and calls log_config_ini to log parameters from a local config.ini file. The w_artifact flag uploads the file as an artifact, and track_overrides logs parameters the user explicitly changed as 'Overrides/Section/Key' params. ```python import mlflow from rgpycrumbs.eon._mlflow.log_params import log_config_ini from pathlib import Path mlflow.set_tracking_uri("http://localhost:5000") mlflow.set_experiment("eOn_Oxadiazole_Reaction") with mlflow.start_run(): # Log parameters from the local config file log_config_ini( Path("config.ini"), w_artifact=True, # Upload file as artifact track_overrides=True # Log 'Overrides/Section/Key' params ) print("Configuration logged.") ``` -------------------------------- ### Parallel Workers Example (4 and 8 workers) Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/tools/chemgp/batch_command.org Shows how to run batch plotting with parallel workers using the -j flag. The first command uses 4 workers, the second uses 8 for larger batches. Speedup depends on I/O bandwidth and CPU cores. ```bash # Use 4 parallel workers rgpycrumbs chemgp plot-gp batch -c plots.toml -j 4 # Use 8 workers for large batches rgpycrumbs chemgp plot-gp batch -c plots.toml -j 8 ``` -------------------------------- ### xyzrender CLI: one-off render with paton preset and flags Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/tutorials/rendering-backends.org Renders a structure to PNG using the xyzrender CLI with the paton preset and flags --hy, --bo, --nci. For strips inside plt-neb/plot_neb, only --strip-renderer and --xyzrender-config (or TOML) matter; dependencies resolve lazily. ```shell xyzrender structure.xyz -o output.png --config paton --hy --bo --nci ``` -------------------------------- ### Run the Script (Bash) Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/tutorials/first-project.org Executes the Python script that evaluates, plots, and analyzes the energy profile. Run from the directory containing first_project.py. ```bash python first_project.py ``` -------------------------------- ### Cache location for auto-installed packages Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/howto/install.org Auto-installed packages are cached in ~/.cache/rgpycrumbs/deps/, shared across all Python environments. ```bash ~/.cache/rgpycrumbs/deps/ ``` -------------------------------- ### batch command usage examples Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/tools/chemgp/batch_command.org Shows sequential and parallel usage of the batch command. The --parallel (or -j) option enables concurrent plot generation with the specified number of workers. ```bash # Sequential processing (default) rgpycrumbs chemgp plot-gp batch --config plots.toml # Parallel processing with 4 workers rgpycrumbs chemgp plot-gp batch --config plots.toml --parallel 4 # Short form rgpycrumbs chemgp plot-gp batch -c plots.toml -j 4 ``` -------------------------------- ### Set viewing angle with --rotation Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/tutorials/neb-visualization.org Controls the viewing angle for all backends using the --rotation flag. The example uses "45x,30y,0z" to specify rotations around x, y, and z axes. ```shell rgpycrumbs eon plt-neb ... --rotation "45x,30y,0z" ``` -------------------------------- ### Evaluate, Plot, and Analyze Energy Profile (Python) Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/tutorials/first-project.org Evaluates the fitted Matérn model on a fine grid, plots the NEB energy profile with 95% confidence interval, and prints the barrier height in eV. Requires the model and path objects from earlier steps in the tutorial. ```python # 3. Evaluate x_fine = np.linspace(x_obs.min(), x_obs.max(), 300).reshape(-1, 1) y_fine = model(x_fine) y_var = model.predict_var(x_fine) # 4. Plot fig, ax = plt.subplots(figsize=(4, 3), dpi=300) ax.plot( path.arc_dist.to("angstrom").magnitude, path.energy.to("eV").magnitude, 'o', color='#004D40', markersize=6, label='NEB images', zorder=10 ) ax.plot( x_fine.flatten(), y_fine * 27.2114, '-', color='#FF655D', linewidth=2, label='Matérn fit', zorder=5 ) ax.fill_between( x_fine.flatten(), (y_fine - 2*np.sqrt(y_var)) * 27.2114, (y_fine + 2*np.sqrt(y_var)) * 27.2114, alpha=0.2, color='#FF655D', label='95% CI' ) ax.set_xlabel('Reaction Coordinate (Å)') ax.set_ylabel('Energy (eV)') ax.legend(frameon=False, loc='upper right') fig.tight_layout() fig.savefig('energy_profile.pdf', bbox_inches='tight') # 5. Analyze ts_idx = np.argmax(y_fine) print(f"Barrier: {(y_fine[ts_idx] - y_fine[0]) * 27.2114:.3f} eV") ``` -------------------------------- ### Detect fragments in Python with find_fragments_geometric Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/tools/geom/detect_fragments.org Python example creating a water dimer with ASE and detecting fragments using geometric criteria (Cordero radii). The expected output shows two fragments with labels [0 0 0 1 1 1]. ```python from ase import Atoms from ase.build import molecule from rgpycrumbs.geom.detect_fragments import find_fragments_geometric # 1. Construct a water dimer # One water at the origin, another separated by 3.5 Angstroms water_a = molecule("H2O") water_b = molecule("H2O") water_b.translate([3.5, 0, 0]) dimer = water_a + water_b # 2. Detect fragments using geometric criteria (Cordero radii) # A standard covalent bond check would treat these as separate. n_frags, labels = find_fragments_geometric(dimer, bond_multiplier=1.2) print(f"System contains {n_frags} fragments.") print(f"Atom labels: {labels}") # Expected Output: # System contains 2 fragments. # Atom labels: [0 0 0 1 1 1] ``` -------------------------------- ### Split multi-image .con trajectory into individual frames Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/quickstart.org Splits a multi-image .con trajectory into individual frames using `rgpycrumbs eon con-splitter`. Outputs files like `initial_images/ipath_000.con`, `ipath_001.con`, etc., suitable for initializing a new NEB calculation (e.g., with IDPP via ASE). ```bash # Split a multi-image .con trajectory into individual frames rgpycrumbs eon con-splitter neb_final_path.con -o initial_images ``` -------------------------------- ### Install OVITO Python module via conda Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/tutorials/rendering-backends.org Installs the OVITO Python module from OVITO's own conda channel. The ovito package on conda-forge is a retired desktop build without the Python module; since 3.17.2 the desktop app is ovito-pro. In an rgpycrumbs checkout, pixi install -e ptm sets up an environment with the module. ```shell conda install --strict-channel-priority -c https://conda.ovito.org -c conda-forge ovito ``` -------------------------------- ### Run all tests with analysis extra Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/dev/testing.org Runs tests marked 'pure' or 'analysis' using uv with both 'test' and 'analysis' extras. Requires the 'analysis' extra for fragment detection and RMSD alignment tests. ```bash uv run --extra test --extra analysis pytest -m "pure or analysis" ``` -------------------------------- ### Import library modules with optional dependencies Source: https://github.com/haozeke/rgpycrumbs/blob/main/README.md Shows how to import rgpycrumbs modules. Dependencies resolve automatically when RGPYCRUMBS_AUTO_DEPS=1 is set (requires uv on PATH), or install extras explicitly. Surface fitting requires jax, structure analysis requires ase and scipy, spline interpolation requires scipy, and data types have no extra dependencies. ```python # Surface fitting (requires jax: pip install jax # or AUTO_DEPS) from rgpycrumbs.surfaces import get_surface_model model = get_surface_model("tps") # Structure analysis (requires ase, scipy: export RGPYCRUMBS_AUTO_DEPS=1) from rgpycrumbs.geom.analysis import analyze_structure # Spline interpolation (requires scipy: pip install scipy # or AUTO_DEPS) from rgpycrumbs.interpolation import spline_interp # Data types (no extra deps) from rgpycrumbs.basetypes import nebpath, SaddleMeasure ``` -------------------------------- ### Apply perspective tilt with --perspective-tilt Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/tutorials/neb-visualization.org Applies a small Rodrigues off-axis rotation to reveal hidden atoms when they overlap in orthographic projection. The example uses --perspective-tilt 8 to tilt the view by 8 degrees. ```shell rgpycrumbs eon plt-neb \ --plot-type landscape --landscape-mode path --no-project-path \ --con-file data/diels_alder/neb.con --sp-file data/diels_alder/sp.con \ --plot-structures crit_points \ --strip-dividers \ --perspective-tilt 8 \ -o gallery_tilted.pdf ``` -------------------------------- ### Calculate barriers and print results Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/tutorials/first-project.org Computes forward and reverse barriers from transition state and reactant/product energies, then prints the transition state position, barriers, and reaction energy. ```python # Calculate barriers forward_barrier = ts_energy - reactant_energy reverse_barrier = ts_energy - product_energy print(f"Transition state at: {ts_x:.2f} Å") print(f"Forward barrier: {forward_barrier:.3f} eV") print(f"Reverse barrier: {reverse_barrier:.3f} eV") print(f"Reaction energy: {product_energy - reactant_energy:.3f} eV") ``` -------------------------------- ### Fit thin-plate spline surface with get_surface_model("tps") Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/quickstart.org Fits a thin-plate spline (TPS) surface to 2D sample data using the factory function get_surface_model. Predicts on a grid and computes posterior variance for uncertainty estimates. Other models include "matern", "imq", and gradient-enhanced kernels. ```python import numpy as np from rgpycrumbs.surfaces import get_surface_model # Generate sample 2D data rng = np.random.default_rng(42) x_train = rng.uniform(-2, 2, size=(30, 2)) y_train = np.sin(x_train[:, 0]) * np.cos(x_train[:, 1]) # Fit a thin-plate spline surface TPS = get_surface_model("tps") model = TPS(x_train, y_train) # Predict on a grid x_grid = np.mgrid[-2:2:50j, -2:2:50j].reshape(2, -1).T y_pred = model(x_grid) # Posterior variance (uncertainty estimate) y_var = model.predict_var(x_grid) ``` -------------------------------- ### Generate initial path from generic XYZ file Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/tools/eon/con_splitter.org Command to convert a reactant/product pair from a generic .xyz file into eOn format, fixing coordinate and mapping issues. Uses --images-per-path 2, --box-diagonal, --center, --align-type endpoints, --use-ira, and --ira-kmax 1.8. ```bash python -m rgpycrumbs.cli eon con-splitter --images-per-path 2 initial.xyz --box-diagonal 25 25 25 --center --align-type endpoints --use-ira --ira-kmax 1.8 ``` -------------------------------- ### Enable auto-deps for chemgp Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/howto/troubleshooting.org Set the RGPYCRUMBS_AUTO_DEPS environment variable to enable automatic installation of ase and scipy via ensure_import, resolving the missing chemgp module. ```bash export RGPYCRUMBS_AUTO_DEPS=1 # ase/scipy via ensure_import ``` -------------------------------- ### Load NEB Data and Access Path Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/tutorials/first-project.org Loads the final iteration data from 'neb_49.dat' using extract_neb_data, then accesses the NEB path and prints the number of images and the energy barrier in eV. Requires sample NEB data files; marked with SKIP-DOCTEST. ```python # SKIP-DOCTEST -- requires sample NEB data files from rgpycrumbs.basetypes import nebpath from rgpycrumbs.eon.plt_neb import extract_neb_data import matplotlib.pyplot as plt # Load the final iteration data data = extract_neb_data("neb_49.dat") # Last iteration # Access the path path = data.nebpath print(f"Number of images: {len(path.energy)}") print(f"Barrier: {max(path.energy) - min(path.energy):.4f} eV") ``` -------------------------------- ### Full ASV run with sample recording Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/devnotes.org Run a full ASV benchmark with sample recording, using the pixi-managed Python via the -E "existing:..." flag. Results land in .asv/results/ (gitignored). ```bash pixi run -e bench asv run \ -E "existing:$(pixi run -e bench which python)" \ --record-samples ``` -------------------------------- ### Spline interpolation of a coarse energy profile Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/quickstart.org Interpolates a coarse energy profile along a reaction coordinate to 200 points using spline_interp. Leave out num to get a grid derived from the samples; the default cubic spline has 3 * (len(rc) - 1) + 1 points and passes through every sample of an evenly spaced rc. ```python # Coarse energy profile along a reaction coordinate rc = np.linspace(0, 1, 10) energy = np.array([0.0, -0.3, -0.8, -1.0, -0.5, 0.2, 0.8, 0.5, -0.1, 0.0]) # Interpolate to 200 points rc_fine, energy_fine = spline_interp(rc, energy, num=200) ``` -------------------------------- ### Single Environment (uv): sync and run pure tests Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/howto/dev_testing.org For basic development with uv, sync the test extra and run the pure test marker. Use this when you only need the core test environment without optional dependency sets. ```shell cd rgpycrumbs uv sync --extra test uv run pytest tests/ -m pure ``` -------------------------------- ### Release process commands Source: https://github.com/haozeke/rgpycrumbs/blob/main/README.md Run the same checks as the tag-triggered release workflow, preview the next semantic version, build release notes, commit, tag, and push. ```bash # 1. Run the same checks the tag-triggered release workflow expects uv sync --extra test --extra release uv run --extra test pytest -m pure uv run --extra test pytest --pep723-check -m pep723 --override-ini="python_files=" --ignore=rgpycrumbs/chemgp rgpycrumbs/ uvx prek run -a -vvv pixi run -e docs docbld # 2. Preview the next semantic version from Conventional Commits # cog is not on PyPI; cargo builds it from the cocogitto crate, # which needs a Rust toolchain with edition 2024 support cargo install --locked cocogitto@7.0.0 V=$(cog bump --dry-run --auto) V=${V#v} : "${V:?cog bump --dry-run --auto printed no version}" # 3. Build the release notes from towncrier fragments # towncrier headings use X.Y.Z, while the git tag stays vX.Y.Z uvx towncrier build --version "${V:?}" # 4. Commit the release notes (historically: release: vX.Y.Z) git add CHANGELOG.rst docs/newsfragments git commit -m "release: v${V:?}" python3 scripts/check_version.py # 5. Tag the release commit (hatch-vcs derives the package version from tags) cog bump --auto # 6. Push main and tags; GitHub Actions handles build/publish/release git push origin main --tags ``` -------------------------------- ### Type Hint Example for ensure_import Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/dev/contributing.org Example of a type-hinted function with a docstring, targeting 90%+ type hint coverage. ```python def ensure_import(module_name: str): """Import module through 5-step priority chain.""" ... ``` -------------------------------- ### Build documentation locally with pixi run docbld Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/contributing/doc_builds.org Runs the local documentation build. The build fails on any Sphinx warning because sphinxbld runs sphinx-build -W --keep-going, which lists every warning before failing. ```shell pixi run docbld ``` -------------------------------- ### Enable auto-install with RGPYCRUMBS_AUTO_DEPS Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/howto/faq.org Set the environment variable to enable automatic dependency installation. ```bash export RGPYCRUMBS_AUTO_DEPS=1 ``` -------------------------------- ### Install required packages Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/tools/chemgp/batch_tutorial.org Install the necessary Python packages for the batch tutorial: rgpycrumbs, chemparseplot, h5py, and plotnine. ```bash pip install rgpycrumbs chemparseplot h5py plotnine ``` -------------------------------- ### Band evolution with --show-evolution Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/tutorials/neb-visualization.org Plots band evolution where older bands are drawn with lower opacity. Uses --show-evolution to enable the fading effect. ```shell rgpycrumbs eon plt-neb \ --plot-type landscape --landscape-mode path --no-project-path \ --con-file data/diels_alder/neb.con \ --show-evolution \ -o evolution.pdf ``` -------------------------------- ### Test lazy import with ensure_import Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/dev/lazy_imports.org Tests the ensure_import function from rgpycrumbs._aux. Verifies that importing an installed package (numpy) works and that a missing package raises an ImportError with a message containing 'pip install'. ```python def test_lazy_import(): """Test that lazy imports work correctly.""" from rgpycrumbs._aux import ensure_import # Should work for installed packages np = ensure_import("numpy") assert hasattr(np, "array") # Should raise clear error for missing packages with pytest.raises(ImportError, match="pip install"): ensure_import("nonexistent_package_xyz") ``` -------------------------------- ### Fit Smooth Surface with get_surface_model Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/tutorials/first-project.org Fits a gradient-enhanced Matérn surface to 1D NEB data using get_surface_model('matern'), converts energies to hartree, and evaluates the model on a fine grid for smooth plotting. Includes uncertainty estimation via predict_var. Requires sample NEB data files; marked with SKIP-DOCTEST. Troubleshooting: use 'tps' kernel for stability, adjust 'ls' for data smoothness, and increase 'smoothing' to 1e-3 if needed. ```python # SKIP-DOCTEST -- requires sample NEB data files from rgpycrumbs.surfaces import get_surface_model import numpy as np # Prepare 1D data for surface fitting x_obs = path.arc_dist.reshape(-1, 1) # Arc distance as 2D array y_obs = path.energy.to("hartree").magnitude # Convert to hartree # Fit a gradient-enhanced Matérn surface # (Use standard Matern if you don't have force data) model = get_surface_model("matern")( x_obs, y_obs, ls=0.5, # Initial length scale guess smoothing=1e-4 # Noise regularization ) # Evaluate on a fine grid for smooth plotting x_fine = np.linspace(x_obs.min(), x_obs.max(), 300).reshape(-1, 1) y_fine = model(x_fine) # Get uncertainty estimates y_var = model.predict_var(x_fine) ``` -------------------------------- ### Example plot_config.example.toml Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/tools/eon/plot_config.org Full example TOML configuration file for eOn plot commands. Defines shared settings (energy_unit, theme, dpi, figsize, strip_renderer, xyzrender_config, ira_kmax, auto_thin, max_surface_points) and per-command sections for neb, min, and saddle. ```toml [shared] energy_unit = "eV" theme = "ruhi" dpi = 200 figsize = [5.37, 5.37] strip_renderer = "xyzrender" xyzrender_config = "paton" ira_kmax = 1.8 # Surface fit (chemparseplot; default off) auto_thin = false max_surface_points = 64 [neb] con_file = "neb.con" plot_type = "landscape" output_file = "neb_landscape.pdf" surface_type = "grad_imq" plot_structures = "crit_points" [min] job_dir = ["min_reactant"] plot_type = "landscape" prefix = "minimization" surface_type = "grad_imq" plot_structures = "endpoints" # Opt in for dense eOn write_movies clouds: # auto_thin = true output = "min_landscape.pdf" [saddle] job_dir = ["saddle_run"] plot_type = "profile" output = "saddle_profile.pdf" ``` -------------------------------- ### Single-plot usage examples for plot-gp subcommands Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/tools/chemgp/plt_gp.org Run plot-gp subcommands from the command line to generate publication-quality PDF figures from ChemGP HDF5 files. Each command requires --input and --output; the convergence, surface, and nll subcommands are shown with example file paths. ```bash # Convergence curve from a minimize run rgpycrumbs chemgp plot-gp convergence -i output/leps_minimize.h5 -o convergence.pdf # 2D surface with NEB path overlay rgpycrumbs chemgp plot-gp surface -i output/leps_neb.h5 -o surface.pdf # NLL landscape rgpycrumbs chemgp plot-gp nll -i output/leps_nll.h5 -o nll.pdf ``` -------------------------------- ### CLI: Convergence Panel Source: https://github.com/haozeke/rgpycrumbs/blob/main/docs/orgmode/tools/eon/plt_saddle.org Generates side-by-side plots of force norm and step size vs iteration. ```shell rgpycrumbs eon plt-saddle --job-dir results/ --plot-type convergence ```