Skip to main content

Periodic atom-centered voxel grids for atomistic structures.

Project description

AtomVoxelizer

AtomVoxelizer builds periodic atom-centered voxel grids for atomistic structures. The core VoxelGrid class stores a 3D NumPy grid over a periodic cell and provides helpers for adding, setting, scaling, sampling, and plotting spherical regions.

Installation

Install from this repository:

pip install .

Install optional acceleration backends with extras:

pip install ".[numba]"
pip install ".[taichi]"
pip install ".[cupy]"
pip install ".[analysis]"

VoxelGrid is always the NumPy backend. Optional acceleration backends are explicit: VoxelGridNumba, VoxelGridTaichi, and VoxelGridCuPy. VoxelGridAnalysis provides connected-volume and marching-cubes surface-area analysis when the analysis extra is installed.

For development, examples, tests, and documentation:

pip install -e ".[dev,examples]"

Basic Usage

import numpy as np

from atomvoxelizer import VoxelGrid

cell = np.eye(3) * 10.0
grid = VoxelGrid(cell=cell, resolution=0.25)

grid.add_sphere(center=np.array([5.0, 5.0, 5.0]), radius=1.0, value=1.0)
grid.set_sphere(center=np.array([2.0, 2.0, 2.0]), radius=0.5, value=-1.0)
grid.clamp_grid(min_val=-1.0, max_val=1.0)

Zeolite Example

The zeolite example and CIF files live in examples/.

pip install -e ".[examples]"
python examples/zeolite_voxel.py BEA

The script reads a framework CIF, builds voxel grids at several resolutions, plots middle XZ slices, benchmarks supercell scaling, and opens a 3D scatter plot.

The analysis example estimates pore volume and internal surface area:

pip install -e ".[examples,analysis]"
python examples/zeolite_analysis.py BEA --resolution 0.25
python examples/zeolite_analysis.py BEA --convergence 1.0 0.75 0.5 --plot bea_convergence.png

Tests and Benchmarks

Run the correctness tests with:

pytest

Run the backend benchmark with:

python benchmarks/benchmark_backends.py --backends numpy numba taichi cupy

Run the built-in structure benchmarks for a zeolite and a roughly 1000 atom Wulff construction with:

python benchmarks/benchmark_structures.py

Backends whose optional dependencies are not installed are reported as missing.

Documentation

Documentation is scaffolded with Sphinx for Read the Docs.

Build it locally with:

pip install -e ".[docs]"
sphinx-build -b html docs/source docs/build/html

Read the Docs can use .readthedocs.yaml directly.

Publishing

Build and check PyPI artifacts with:

pip install -e ".[publish]"
python -m build
twine check dist/*

Upload to TestPyPI first, then PyPI:

twine upload --repository testpypi dist/*
twine upload dist/*

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

atomvoxelizer-0.1.0.tar.gz (24.4 kB view details)

Uploaded Source

Built Distribution

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

atomvoxelizer-0.1.0-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file atomvoxelizer-0.1.0.tar.gz.

File metadata

  • Download URL: atomvoxelizer-0.1.0.tar.gz
  • Upload date:
  • Size: 24.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for atomvoxelizer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 55a484d52abcc7741c7bd496f6d8a694f746c76b8a940b546654df821c68e4be
MD5 75770368761a5e13df932edc3481ea16
BLAKE2b-256 211c5c23ba57d370ce000e5b5f068860148dda580ee3618d024d4e76b4786126

See more details on using hashes here.

File details

Details for the file atomvoxelizer-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: atomvoxelizer-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for atomvoxelizer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f076d10794786bac690ff452430407af6703e5bf56b9c7c79f939c4bc6839bb7
MD5 175d781701d8f16da11ddee60f6e00ba
BLAKE2b-256 da0ab6a26f49316b129cca26039b7a9cdd41047120a8d633b1bcbdbb03ed9d2e

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