Skip to main content

Random Sequential Addition (RSA) particle packing with a fast C++ core.

Project description

PackLab logo

Meta

Python

Documentation Status

Testing

Unittest Status

Unittest coverage

Google Colab

PyPI

PyPI version

PyPI downloads

Anaconda

Anaconda version

Anaconda downloads

Latest release date

PackLab

PackLab is a fast Random Sequential Addition (RSA) particle packing library with a C plus plus core and Python bindings. It helps you generate non overlapping sphere configurations inside a 3D box with optional periodic boundaries. It supports mono disperse and poly disperse radius sampling through a flexible sampling interface.

Features

  • Fast C++ implementation with Python bindings

  • 3D box domain with optional periodic boundaries

  • Configurable stopping criteria: maximum attempts, maximum consecutive rejections, target packing fraction, maximum spheres

  • Radius samplers designed for future extension to poly disperse systems

  • Python level convenience API with plotting utilities and summary statistics

Installation

From PyPI:

pip install packlab

From conda:

conda install -c martinpdes packlab

From source:

git clone https://github.com/MartinPdeS/PackLab.git
cd PackLab
pip install -e .[testing]

Quick start

 from PackLab import Domain, Options, Simulator, UniformRadiusSampler

 domain = Domain(
     length_x=6.0,
     length_y=6.0,
     length_z=6.0,
     use_periodic_boundaries=True
 )

 radius_sampler = UniformRadiusSampler(
     minimum_radius=0.1,
     maximum_radius=0.4
 )

 options = Options()
 options.random_seed = 42
 options.maximum_attempts = 4_000_000
 options.maximum_consecutive_rejections = 80_000
 options.target_packing_fraction = 0.55
 options.minimum_center_separation_addition = 0.0

 rsa_simulator = Simulator(
     domain=domain,
     radius_sampler=radius_sampler,
     options=options
 )

 result = rsa_simulator.run()

 result.statistics.print()

 result.plot_slice_2d()

 result.plot_pair_correlation(maximum_number_of_pairs=3_000_000)

import PackLab

Testing

To test locally, clone the repository, install dependencies, and run pytest.

git clone https://github.com/MartinPdeS/PackLab.git
cd PackLab
pip install -e .[testing]
pytest

Documentation

The documentation includes tutorials, API reference, and gallery examples.

See Documentation Status.

Contributing

Issues and pull requests are welcome. If you are using PackLab in research, citations and links to your work are appreciated.

Contact Information

As of 2025, the project is still under development. If you want to collaborate, it would be a pleasure. Feel free to contact me.

PackLab was written by Martin Poinsinet de Sivry Houle.

Email: martin.poinsinet.de.sivry@gmail.com.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

packlab-0.0.12-cp313-cp313-win_amd64.whl (6.4 MB view details)

Uploaded CPython 3.13Windows x86-64

packlab-0.0.12-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

packlab-0.0.12-cp313-cp313-macosx_15_0_arm64.whl (2.6 MB view details)

Uploaded CPython 3.13macOS 15.0+ ARM64

packlab-0.0.12-cp312-cp312-win_amd64.whl (4.3 MB view details)

Uploaded CPython 3.12Windows x86-64

packlab-0.0.12-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

packlab-0.0.12-cp312-cp312-macosx_15_0_arm64.whl (2.1 MB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

packlab-0.0.12-cp311-cp311-win_amd64.whl (2.2 MB view details)

Uploaded CPython 3.11Windows x86-64

packlab-0.0.12-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (687.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

packlab-0.0.12-cp311-cp311-macosx_15_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

File details

Details for the file packlab-0.0.12-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: packlab-0.0.12-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 6.4 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for packlab-0.0.12-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 2c962a9a27d1888d2e69935c3ccdac676dac59ceea8aec0e7ad6c18e6462d809
MD5 136e0d684adbbfe2c6a49331834b3e0e
BLAKE2b-256 51b3ee47b0cc9f06fcfd6124c680cf9734ecca9db77328a6dca3de258285268c

See more details on using hashes here.

File details

Details for the file packlab-0.0.12-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for packlab-0.0.12-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 e750c134a0291d3ee7ab79f8ed6ad26984b8d021fcb28d30e1ec8da45d4f3105
MD5 df8827f0c6a61332485ee3fbfa496a33
BLAKE2b-256 4efe6a4b120dcb587e6de99946815483608ab18dd08d5391e15c307f141a9762

See more details on using hashes here.

File details

Details for the file packlab-0.0.12-cp313-cp313-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for packlab-0.0.12-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 e1127f25c9b7eb579044906e2208b16f982d29589495b7abc9f31a7e31c6ceb3
MD5 b8a8f80ef6592226c0c3d16fef51c4d1
BLAKE2b-256 903cc91d1277ff50377a490097fff2e3388f26812852e1aa06b7f0d822a7280c

See more details on using hashes here.

File details

Details for the file packlab-0.0.12-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: packlab-0.0.12-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 4.3 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for packlab-0.0.12-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5592a3d4c90b5cc52bf3ae3664bbb5620006947b49437ca7f33395209a13dc1e
MD5 934e5d8536a8c457c7447e8f4077a242
BLAKE2b-256 c68680a48ec60fc3ddb8855faaeefa0acbcc02651bd64012eef97851ffe3202a

See more details on using hashes here.

File details

Details for the file packlab-0.0.12-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for packlab-0.0.12-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 957ce2455ed68ecc104255e5424929513a1422d9fc267f7f4b8847393fb76ca6
MD5 6085c6c0d66eb05e2cf84ecf5eff5acb
BLAKE2b-256 35b1ea4c0026040232923a037ebcd0ba2154309cce7942aece1ff98d2b0ae7ec

See more details on using hashes here.

File details

Details for the file packlab-0.0.12-cp312-cp312-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for packlab-0.0.12-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 dc21c5eb814942b64b7cbe615cf4a3639241a39d1790f2035340b1ec0cdbad8e
MD5 8b3f98c200ad43611644f82dfc406de7
BLAKE2b-256 9981e36f323922555cef19b8198b5dadebf4fc1a3b04010827602ef5dbedaf51

See more details on using hashes here.

File details

Details for the file packlab-0.0.12-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: packlab-0.0.12-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 2.2 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for packlab-0.0.12-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 4313f4652cfa43d560300d9f69c7fc03bc355052b731b70c5a59e057a3f7677b
MD5 b9ed413929fc4f517004e73615afe92a
BLAKE2b-256 e68e52cdd7520c5ef3fc4822069f325e9b95c949a1478aeb92ce34c451f68689

See more details on using hashes here.

File details

Details for the file packlab-0.0.12-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for packlab-0.0.12-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 70b7c56bfcd44d30d84ed56a8be73ef37b94003e639303de9c3ff4b38d0b53d6
MD5 6b249abf1a95dccca30789faa98dab7b
BLAKE2b-256 8c2c02570dbcf1a9140b12d56c4742f633e32246cf6adf4fef78c78b007a7d4c

See more details on using hashes here.

File details

Details for the file packlab-0.0.12-cp311-cp311-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for packlab-0.0.12-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 a31ec91e5c4ad90142354f75693e2117fa3819fae31940e56ebd0f7805cd54e1
MD5 39d3ae139f6e89320ca717737827bc17
BLAKE2b-256 9a283a18d774cca12ceadc8d57eca6ea72b54b428e89e418ede782e9ad8ec211

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