Python interface

The Python package exposes DEM-Engine’s solver, setup objects, trackers, and CUDA-aware data access. Start with the quickstart, then use the focused guides for device placement and result retrieval.

Import and compatibility

Use the lowercase package in new code:

import deme

import DEME re-exports the same API for backward compatibility. The capitalized spelling should not be used in new examples.

Version

The runtime version is available as:

assert deme.__version__ == "3.0.11"

API conventions

The current bindings intentionally retain the C++ method names, such as SetGravitationalAcceleration and DoDynamics. Pythonic snake-case aliases and type stubs are planned, but are not yet part of the stable interface.

CUDA vector types exposed by the API are generally accepted as three- or four-element Python sequences and returned as tuples. Quaternion ordering is (x, y, z, w).

Objects returned by solver setup methods frequently own or reference native simulation state. Keep the solver alive for as long as trackers, inspectors, or other solver-owned handles are in use.

Reference status

The Python API overview inventories the main Python objects and points to the task-oriented guides. The extension also contains runtime pybind11 docstrings; use help(deme.DEMSolver) or help(deme.Tracker) in an installed environment. The generated C++ API reference remains the exhaustive low-level reference for APIs shared with C++.