Skip to main content

High-performance GW/BSE implementation with PySCF integration

Project description

QuasiX Python Bindings

This directory contains the Python package for QuasiX, providing PyO3 bindings to the high-performance Rust computational kernel.

Structure

quasix/
├── Cargo.toml          # Rust/PyO3 configuration
├── pyproject.toml      # Python package metadata
├── src/
│   ├── lib.rs          # PyO3 module definition
│   └── python.rs       # Python-specific wrappers
├── quasix/
│   ├── __init__.py     # Python module initialization
│   └── core.py         # High-level Python API
└── tests/
    └── test_basic.py   # Python tests

Building

Development Build

For development, use maturin to build and install the package in development mode:

# Install maturin if not already installed
pip install maturin

# Build and install in development mode
cd quasix
maturin develop --release

# Or for debug mode (faster compilation, slower execution)
maturin develop

Production Build

To build a wheel for distribution:

maturin build --release

The wheel will be created in target/wheels/.

Testing

Run the Python tests:

# Install test dependencies
pip install pytest pytest-cov

# Run tests
pytest tests/

Usage

After building, you can use QuasiX in Python:

from pyscf import gto, scf
from quasix import EvGW, BSE_TDA

# Setup molecule
mol = gto.M(atom='H 0 0 0; F 0 0 1', basis='cc-pvdz')
mf = scf.RHF(mol).run()

# Run evGW
gw = EvGW(mf, auxbasis='cc-pvdz-jkfit')
gw.kernel()

print(f"IP: {gw.get_ionization_potential():.3f} eV")
print(f"EA: {gw.get_electron_affinity():.3f} eV")

# Run BSE for optical excitations
bse = BSE_TDA(gw, nroots=10)
bse.kernel()

print(f"First excitation: {bse.omega[0]:.3f} eV")

Dependencies

Build Dependencies

  • Rust (1.70+)
  • maturin (1.7+)
  • Python (3.10+)

Runtime Dependencies

  • numpy (≥1.24.0)
  • scipy (≥1.10.0)
  • pyscf (≥2.3.0)
  • h5py (≥3.8.0)

Optional Dependencies

  • matplotlib (for visualization)
  • jupyter (for notebooks)

Architecture

The package uses PyO3 to expose Rust functionality to Python:

  1. Rust Core (src/): PyO3 bindings that wrap the quasix_core crate
  2. Python API (quasix/): High-level PySCF-compatible classes
  3. Zero-copy Arrays: NumPy arrays are passed to Rust without copying when possible
  4. GIL Release: Long computations release the Python GIL for parallelism

Performance Considerations

  • The Python layer handles I/O and PySCF integration
  • Heavy computation happens in the Rust kernel
  • DF tensor construction is optimized for memory efficiency
  • Use HDF5 for out-of-core operations with large basis sets

Development Notes

When modifying the PyO3 bindings:

  1. Update both lib.rs and python.rs in the src/ directory
  2. Ensure proper error handling with PyResult
  3. Use py.allow_threads() for GIL release in compute-intensive functions
  4. Maintain PySCF API compatibility in the Python layer
  5. Add tests for new functionality

License

MIT OR Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quasix-0.6.0.tar.gz (1.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

quasix-0.6.0-cp310-abi3-manylinux_2_35_x86_64.whl (14.4 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.35+ x86-64

File details

Details for the file quasix-0.6.0.tar.gz.

File metadata

  • Download URL: quasix-0.6.0.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for quasix-0.6.0.tar.gz
Algorithm Hash digest
SHA256 22d81398a7b71cf89ce11d5568026168e277fbb8db5a7d14e94348891a1a6006
MD5 fecedef50b8c5a000776ab63bd6d6bdc
BLAKE2b-256 f5072e63ae6f83932f197ee2d54c4eb3f246243184abefdc6c74bfff5d27f3ab

See more details on using hashes here.

File details

Details for the file quasix-0.6.0-cp310-abi3-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for quasix-0.6.0-cp310-abi3-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 a2ef4904fa020f727a5b2565fa4f57e7b3ef914f111ab08e631241844a8c4383
MD5 151cdd2de219f840fadd7c515533c8e8
BLAKE2b-256 0bd703fb6167f8265e8877c4d8107507380bee3b4edc458cd49bc7d76a5621a0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page