Skip to main content

rovibrational-excitation

CI License: MIT

日本語

A Python library for time-dependent rovibrational quantum dynamics driven by laser fields. Version 0.3.0 is intentionally incompatible with v0.2.

The library provides explicit-unit model construction, generated or externally sampled electric fields, typed propagation choices, optimal-control methods, linear-response spectroscopy, batch execution, strict result/checkpoint schemas, and plotting helpers.

Current status

CPU calculations are the verified production path. CI runs Python 3.10–3.13, the complete CPU suite, physics references, branch coverage, supported examples, type checks, and clean-wheel imports; see the CI workflow.

Real-CUDA execution is numerically accepted for the supported dense pure-state RK4 and split-operator routes. On clean main merge commit 4f7efaed, all 15 GPU-marked tests and the five-case schema-v1 report passed through the manual GitHub workflow on an RTX 5070 Ti; see the accepted evidence. Results stayed as CuPy complex128 arrays and met the fixed parity and norm bounds. This 32-state diagnostic does not establish a general GPU speed advantage. A requested CuPy backend never silently falls back to NumPy.

Supported physical models

Model Coupling and current scope
Two-level Scalar coupling; explicit gap and dipole units
Vibrational ladder Scalar harmonic or Morse ladder; Morse requires nonzero anharmonicity
Linear molecule Harmonic or Morse vibration with rotation; Cartesian M-resolved propagation or scalar-z incoherent M averaging
Symmetric top Rigid parallel band in signed `

Symmetric-top simulation requires explicit axes, all constants and units, and exactly one nuclear-spin isomer sector. CuPy, split operator, all-isomer pure states, and optimization are rejected explicitly for this model.

Numerical capability summary

  • Pure-state Schrödinger propagation supports RK4 with NumPy dense or CSR storage. The Numba CSR path performs sparse matvecs inside the compiled RK4 loop.
  • Split-operator propagation provides the exact Cartesian interaction route and an explicit helicity-projected approximation. The interaction mode is always required; it is never selected by fallback.
  • Incoherent mixtures use a dedicated mixed-state propagator and normalized statistical weights.
  • Density-matrix/Liouville propagation supports NumPy dense RK4 only.
  • The electric-field sampling interval is half a propagation step. Canonical RK4 fields therefore contain 2 * n_steps + 1 samples.
  • The interaction convention is H(t) = H0 - mu E(t) throughout.

See physics contracts and the Cartesian split-operator explanation for the fixed conventions and limitations.

Installation

Python 3.10 or newer is required.

pip install rovibrational-excitation

For the current source checkout:

python -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
pip install -e ".[dev,io,plot]"

The optional gpu extra installs cupy-cuda12x[ctk], including the CUDA 12 user-space runtime, headers, and libraries needed on a driver-only host. It still requires a compatible NVIDIA driver; the accepted target-host evidence is linked above.

Quick start

This generated-field example is executed directly by the README contract test. Every physical scalar carries an explicit unit, and the caller explicitly selects the generated-field route with field=None.

# README_SMOKE
import numpy as np

from rovibrational_excitation import run_simulation_case

params = {
    "basis_type": "twolevel",
    "energy_gap": 0.2,
    "energy_gap_units": "rad/fs",
    "dipole_scale": 3.0e-30,
    "dipole_scale_units": "C*m",
    "t_start": -10.0,
    "t_start_units": "fs",
    "t_end": 10.0,
    "t_end_units": "fs",
    "dt": 0.1,
    "dt_units": "fs",
    "duration": 4.0,
    "duration_units": "fs",
    "t_center": 0.0,
    "t_center_units": "fs",
    "envelope_kind": "gaussian_fwhm",
    "modulation_kind": "none",
    "carrier_frequency": 0.05,
    "carrier_frequency_units": "PHz",
    "amplitude": 1.0e8,
    "amplitude_units": "V/m",
    "initial_states": [0],
    "backend": "numpy",
    "storage": "dense",
    "algorithm": "rk4",
    "return_traj": True,
    "sample_stride": 1,
    "nondimensional": False,
    "renorm": False,
    "save": False,
}

population = run_simulation_case(params, field=None)
np.testing.assert_allclose(population.sum(axis=1), 1.0, rtol=1e-9, atol=1e-11)
print("final populations:", population[-1])

For externally supplied waveforms, construct TimeGrid and ScalarField or CartesianField explicitly. Samples are copied and converted once to the canonical V/m representation; they are never resampled, padded, normalized, or repaired. See example_external_scalar_field.py.

Public API

The package root deliberately exports only:

__version__, ElectricField, TimeGrid, ExecutionPolicy,
PropagationProblem, PropagationOptions, PropagationResult,
run_simulation_case

Use explicit subpackages for the rest:

  • rovibrational_excitation.models — schemas and model construction;
  • rovibrational_excitation.core — low-level states, operators, units, and model-independent contracts;
  • rovibrational_excitation.fields — sampled fields, envelopes, and modulation;
  • rovibrational_excitation.dynamics — propagators and capability contracts;
  • rovibrational_excitation.optimization — GRAPE, standard Krotov, legacy_batch_overlap, and local control;
  • rovibrational_excitation.spectroscopy — standard absorption and typed complex analyzer response;
  • rovibrational_excitation.visualization — optional plotting helpers.

There are no compatibility shims for the old v0.2 root convenience names.

CLI and supported examples

Run the executable parameter template without writing results:

rve-simulate examples/params_template.py --no-save

List or run the three supported examples:

python examples/launcher.py --list
python examples/launcher.py --run quickstart --quick
python scripts/smoke_examples.py

Only the top-level files listed in examples/README.md are supported. examples/archives/v0_2/ is historical migration evidence and is not executed or repaired.

For optimization, start from one of the three strict current configurations:

rve-optimize --config configs/example_local_viblad_v3.yaml --no-plot

See configs/README.md for the different time-grid contracts, required seed/penalty/gain units, and Python-supplied field routes.

Spectroscopy

Standard absorption uses a typed projection and returns mOD. A Cartesian analyzer can instead return the projected complex molecular response. Analyzer intensity/absorbance and a production thermal-state constructor are not implemented; the library raises rather than inventing a reference field or measurement convention.

Results and restart

Saved simulations use immutable result generations selected by an atomic result_current.json pointer. Checkpoints use the corresponding versioned pair and validate the complete ordered expanded run before resume. Invalid, unversioned, corrupt, or different-run data raises; no legacy fallback or implicit repair is attempted. See result storage.

Development checks

pytest -q
coverage run --data-file=/tmp/rve-coverage \
  --source=src/rovibrational_excitation --branch -m pytest -q
coverage report --data-file=/tmp/rve-coverage --show-missing --fail-under=47
ruff check --no-fix src tests examples benchmarks scripts
ruff format --check src tests examples benchmarks scripts
python -m mypy --no-incremental

The current local checkpoint is 1537 passing CPU tests with 15 optional-GPU skips and 81% measured branch coverage. A skipped GPU test is not CUDA evidence.

Documentation

License

MIT

Metadata

Release files for rovibrational-excitation 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rovibrational-excitation 0.3.0
File Size Uploaded Provenance Actions
rovibrational_excitation-0.3.0.tar.gz 233.9 kB With provenance Details for rovibrational_excitation-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rovibrational-excitation 0.3.0
File Interpreter ABI Platform Actions
rovibrational_excitation-0.3.0-py3-none-any.whl Python 3 none any Details for rovibrational_excitation-0.3.0-py3-none-any.whl

Total release size: 487.2 kB

Release files / rovibrational_excitation-0.3.0.tar.gz

Download URL rovibrational_excitation-0.3.0.tar.gz
Size 233.9 kB
Tags Source
SHA-256 checksum
How to use checksums
27bc6f922dadf992680c3029f9bb790b0b269895645556bfbee4670a88767e22
BLAKE2b-256 checksum
How to use checksums
a00e5270c9b6a6cf8f8877e6a47a8f69c70ef81238b8742b119748d4288030ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 2, 2026.

Transparency log

Release files / rovibrational_excitation-0.3.0-py3-none-any.whl

Download URL rovibrational_excitation-0.3.0-py3-none-any.whl
Size 253.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
11b0d0989b83b127fac4da426a92d9c336c598963da792a8913e236d9de02b72
BLAKE2b-256 checksum
How to use checksums
8908734942c8dc6df95214bcfbb4f774903511e0ea0824eec3a9d0739761672a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 2, 2026.

Transparency log

Security for rovibrational-excitation 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for rovibrational_excitation-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page