Skip to main content

burnman_cpp

A C++ translation of BurnMan, with Python bindings.

Developers

C++ authors:

  • Benedict Heinen
  • Bob (Robert) Myhill

Python authors (as of 2025, from the BurnMan README):

  • Bob (Robert) Myhill (main contributor)
  • Sanne Cottaar
  • Timo Heister
  • Ian Rose
  • Cayman Unterborn
  • Benedict Heinen
  • Robert Farla
  • Juliane Dannberg
  • Rene Gassmoeller

Requirements

  • A C++17 compiler, such as GCC or Clang.
  • CMake 3.18 or newer.
  • Eigen 3.4 or newer, GSL, NLopt with its C++ headers, cddlib with its GMP library (cddgmp), and GMP.
  • Python 3.10 or newer and its development headers for the Python package.
  • Catch2 3.4 or newer for C++ tests and benchmarks.

Installation

Native dependencies

On Ubuntu:

sudo apt-get update
sudo apt-get install -y build-essential cmake python3-dev \
  libeigen3-dev libgsl-dev libnlopt-cxx-dev libcdd-dev libgmp-dev catch2

On macOS, install the Xcode command-line tools if needed, then install the dependencies with Homebrew:

xcode-select --install
brew install python cmake eigen gsl nlopt cddlib gmp catch2

Python package

Clone the repository:

git clone https://github.com/bobmyhill/burnman_cpp.git
cd burnman_cpp
python -m pip install --upgrade pip

Build and install from source:

CMAKE_BUILD_PARALLEL_LEVEL=2 python -m pip install .
python -c "import burnman_cpp"

Pip installs the Python dependencies and builds the C++ extension. The native dependencies listed above must already be installed. Re-run the installation after changing the C++ or Python sources. Adjust CMAKE_BUILD_PARALLEL_LEVEL to suit the memory available on your machine.

C++ library

Run build and test commands from the repository root. To build the static library without Python bindings:

cmake -S . -B build/native \
  -DCMAKE_BUILD_TYPE=Release \
  -DBURNMAN_BUILD_PYTHON=OFF
cmake --build build/native --parallel 2

The library is written to build/native/libburnman_core.a. For dependencies in a nonstandard location, add -DCMAKE_PREFIX_PATH=/path/to/prefix when configuring.

Alternatively, the Makefile builds bin/libburnman.a:

make -j<N>

Replace <N> with the number of parallel build jobs, for example make -j4.

Tests

Python tests

Install the test and plotting dependencies and run the suite:

CMAKE_BUILD_PARALLEL_LEVEL=2 python -m pip install '.[test,examples]'
MPLBACKEND=Agg python -m pytest -q -ra python/tests

The plotting dependencies are needed by the tests; MPLBACKEND=Agg lets them run without a display. Comparisons with Python BurnMan are skipped when that optional reference package is absent.

C++ tests

cmake -S . -B build/native \
  -DCMAKE_BUILD_TYPE=Release \
  -DBURNMAN_BUILD_PYTHON=OFF \
  -DBURNMAN_BUILD_TESTS=ON \
  -DBURNMAN_WARNINGS_AS_ERRORS=ON
cmake --build build/native --parallel 2
ctest --test-dir build/native --output-on-failure

With Make, build and run the tests separately:

make -j<N> test WARNINGS_AS_ERRORS=1
./bin/run_tests

Make also accepts an optional BUILD_MODE argument. Available modes:

  • BUILD_MODE=release (default): enables compiler optimisation for faster execution (-O3 -DNDEBUG).
  • BUILD_MODE=debug: keeps source-line and variable information for a debugger and uses less optimisation, making it easier to follow the program's execution.
  • BUILD_MODE=test: adds runtime checks for memory errors, such as reading outside an array, and undefined C++ behaviour. These checks help identify bugs but make the program slower.

Debug and test builds use separate outputs, such as bin/run_tests_debug and bin/run_tests_test. Use CXX, EXTRA_INCLUDE and EXTRA_LIB to override the compiler and dependency paths.

Optional Python BurnMan reference comparisons

The reference version is recorded in tests/reference/burnman.json. The tests require that exact commit in a clean Git checkout. To enable the comparisons used by GitHub CI:

git clone https://github.com/geodynamics/burnman.git build/python-burnman-reference
git -C build/python-burnman-reference checkout 39b582cd23954fabd3bdbbee6526a522b1d97bc9
python -m pip install -e 'build/python-burnman-reference[dev]'
export PYTHONPATH="$PWD/build/python-burnman-reference"
export PYTHONDONTWRITEBYTECODE=1
MPLBACKEND=Agg python -m pytest -q -ra python/tests

Formatting

Install the same formatter versions used by GitHub CI:

python -m pip install -r contrib/utilities/requirements-format.txt

Check formatting without changing files:

./contrib/utilities/indent.sh --check --tracked

Run ./contrib/utilities/indent.sh to format C++, headers and Python files, including untracked sources outside ignored directories. Use --tracked to restrict formatting to tracked files. The script can be called from any working directory.

Benchmarks

Build, run and report performance benchmarks using the instructions in benchmarks/README.md.

License

burnman_cpp is licensed under GPL-3.0-or-later.

Metadata

Release files for burnman-cpp 0.2.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 burnman-cpp 0.2.0
File Size Uploaded Provenance
burnman_cpp-0.2.0.tar.gz 2.5 MB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for burnman-cpp 0.2.0
File Interpreter ABI Platform
burnman_cpp-0.2.0-cp315-cp315-macosx_26_0_arm64.whl CPython 3.15 CPython 3.15 macOS 26.0+ ARM64 Details

Total release size: 4.8 MB

Release files / burnman_cpp-0.2.0.tar.gz

Download URL burnman_cpp-0.2.0.tar.gz
Size 2.5 MB
Tags Source
SHA-256 checksum
How to use checksums
3d0a4f9e9eab2c58ee8b76d0e400fbc3591868f81b80b3a4b008819703146e1e
BLAKE2b-256 checksum
How to use checksums
7865f42135a22a38f8944f406759ee34d6f4b62e871965814a6dc2a29f2fa27a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.0rc2

Release files / burnman_cpp-0.2.0-cp315-cp315-macosx_26_0_arm64.whl

Download URL burnman_cpp-0.2.0-cp315-cp315-macosx_26_0_arm64.whl
Size 2.3 MB
Tags CPython 3.15 macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
426bfdef714ef39e2d9a39a3cf5ac8194f3e0aa115dba6b8a0dc70997125edb6
BLAKE2b-256 checksum
How to use checksums
f837c1bb1dbd26acf769f0820a98b653286a8410ed6916281a8e29892ff6315c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.0rc2

Security for burnman-cpp 0.2.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

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