[package]
name = "cp2k-rs"
version = "0.2.3"
edition = "2024"
description = "Rust bindings for CP2K with Python interface"
license = "GPL-2.0-or-later"
build = "build.rs"
authors = ["CP2K-RS Developers"]
repository = "https://zivgitlab.uni-muenster.de/ag-salinga/cp2k-rs"
homepage    = "https://zivgitlab.uni-muenster.de/ag-salinga/cp2k-rs"
keywords    = ["cp2k", "quantum-chemistry", "dft", "mpi", "python"]
categories  = ["science", "api-bindings"]
readme = "README.md"
include = [
    "**/*.rs",
    "Cargo.toml",
    "README.md",
    "LICENSE",
    "NOTICE",
    "build.rs",
    "pyproject.toml",
    "libcp2k.h",
    "extensions/**",
    "cp2k_rs/licenses/**",
]

[lib]
name = "cp2k_rs"
crate-type = ["cdylib", "rlib"]

[dependencies]
ndarray = "0.17"
libc = "0.2.148"

# Optional MPI support
mpi = { version = "0.8", optional = true }

# Static BLAS/LAPACK via OpenBLAS (activated when build-cp2k is enabled)
openblas-src = { version = "0.10", features = ["static", "cblas"], optional = true }

# Python bindings
pyo3 = { version = "0.27", features = ["extension-module"], optional = true }
numpy = { version = "0.27", optional = true }

# Error handling
thiserror = "2.0"

# IPC serialization (used by worker binary and python frontend)
bincode = "1.3"
serde = { version = "1.0", features = ["derive"] }

[build-dependencies]
bindgen = { version = "0.72", optional = true }
num_cpus = "1.16"

[features]
default = ["python", "bindgen"]
mpi = ["dep:mpi"]
python = ["dep:pyo3", "dep:numpy"]
bindgen = ["dep:bindgen"]
build-cp2k = ["dep:openblas-src"]  # Feature to enable full CP2K compilation (also builds OpenBLAS statically)
extended = []  # Feature to enable extended DFT interface
worker-debug = []  # Feature to enable verbose worker logging for debugging

[package.metadata.maturin]
name = "cp2k_rs"

[[bin]]
name = "cp2k_rs_worker"
path = "src/bin/worker.rs"
required-features = ["mpi"]

[[example]]
name = "basic_usage"
path = "examples/basic_usage.rs"

[[example]]
name = "run_and_save_npz"
path = "examples/run_and_save_npz.rs"
required-features = ["extended"]

[[example]]
name = "rust_mpi_example"
path = "examples/rust_mpi_example.rs"
required-features = ["mpi"]

[[example]]
name = "test_worker_ipc"
path = "examples/test_worker_ipc.rs"
required-features = ["mpi"]

[patch.crates-io]
# Patched to enable USE_OPENMP=1 (use_openmp not exposed as a feature in upstream 0.10.x)
openblas-src = { path = "vendor/openblas-src" }
