ColPackAgent core simulation package
Project description
ColPack
Hard-particle Monte Carlo packing simulations for colloidal systems, built on HOOMD-blue's HPMC integrator. ColPack orchestrates the full pipeline — problem setup, parameter sweep planning, simulation execution, and analysis — and exposes it both as a Python API and as an MCP tool surface for agent-driven workflows.
Installation
ColPack depends on HOOMD-blue and OVITO, which are not available on
PyPI and must be installed from conda-forge. The recommended setup is a conda
environment with those two packages, then pip install colpack on top:
conda create -n colpack python=3.11
conda activate colpack
conda install -c conda-forge hoomd ovito
pip install colpack
The remaining dependencies (numpy, gsd, freud-analysis, matplotlib,
pydantic, mcp) are resolved automatically by pip.
Capabilities
Dimensions, shapes, and ensembles
| Dimension | Allowed shapes |
|---|---|
| 2D | disk, ellipse, triangle, square, rectangle, capsule |
| 3D | sphere, ellipsoid, cube, octahedron, tetrahedron, capsule |
| Ensemble | What's fixed | Tunable system parameter |
|---|---|---|
| NVT | particle count + box volume | volume_fraction |
| NPT | particle count + pressure | P |
Variations supported in a sweep
Across the dimension × shape × ensemble grid above, ColPack can express five kinds of variation. Any combination of these can be specified as a parameter sweep through the planner.
-
System volume fraction (NVT) — sweep
volume_fraction. With fixed N and shape, compress the box to a series of target packing fractions to trace an equation-of-state isotherm at fixed composition. -
Per-component relative volume fraction — sweep
particle_specs.<i>.relative_volume_fraction. In a multi-component system this controls how the total volume budget is split across particle types. The first component is normalized to 1; values for other components set their volume share relative to it. -
Per-shape geometric parameters — sweep any shape's intrinsic geometry, e.g.
particle_specs.<i>.diameter(disk, sphere, capsule),particle_specs.<i>.length(capsule, rectangle),particle_specs.<i>.width(rectangle),particle_specs.<i>.a/b/c(ellipse, ellipsoid),particle_specs.<i>.side(triangle, square, cube, octahedron, tetrahedron). The full per-shape default set lives incolpack/colpack_config.jsonunderdimensions.<d>.shape_parameters. -
System pressure (NPT) — sweep
P. With fixed N, the box volume fluctuates to reach a target pressure. Sweeping P traces the equation of state at the chosen shape and composition. -
Mixtures — pass a multi-entry
particle_shape_listat setup to build binary or higher-order mixtures in 2D or 3D. Variations 1–4 then apply on top of any per-component knob.HPMC compatibility constraint (inherited from HOOMD-blue):
- In 2D,
ellipsecannot be mixed with polygon/rod shapes (triangle,square,rectangle,capsule). - In 3D,
ellipsoidcannot be mixed with polyhedron/rod shapes (cube,octahedron,tetrahedron,capsule). disk(2D) andsphere(3D) promote to whichever integrator the rest of the mixture needs and are compatible with everything.
The compatibility matrix and integrator-selection logic live in
colpack/initialize.py(select_optimal_integrator). - In 2D,
Sweeps are submitted to plan_simulation_runs_tool via two arguments:
baseline_parameters (fixed overrides on the setup) and tunable_parameters
(parameter path → list of values). Both support nested dot-paths
(e.g. particle_specs.0.diameter). Tunable entries expand
one-parameter-at-a-time over the baseline rather than as a full Cartesian
product.
Workflow pipeline
A simulation goes through four stages in order. Each stage has both a Python
function in colpack/workflow.py and an MCP tool in
colpack/mcp/server.py.
| Stage | MCP tool | Outputs |
|---|---|---|
| 1. Setup | setup_simulation_problem_tool |
simulation_problem.json in a canonical working_dir |
| 2. Plan | plan_simulation_runs_tool |
simulation_baseline.json, simulation_plan.json, one run_*/ dir per planned run |
| 3. Execute | execute_simulation_workflow_tool |
per-run init.gsd, compress.gsd, sample.gsd; updates to workflow_status.csv |
| 4. Analyze | analyze_simulation_runs_tool |
per-run order-parameter time series, RDF, plots; updates to workflow_status.csv |
The capabilities tool get_colpack_capabilities_tool returns the live config
(supported shapes, ensembles, key parameters, workflow steps) and is the
recommended source of truth for agents.
Inside the Execute stage
Each run cycles through three sub-steps before analysis:
- Initialize — generate a low-density configuration and
init.gsdwith the integrator and shape definitions selected automatically per shape. - Compress — drive the system from the initial dilute state to the
target packing fraction (NVT) or pressure (NPT) via staged
QuickCompress(NVT) orBoxMCupdaters (NPT). - Sample — equilibrate and record a trajectory at the target state
point. Auto-tunes HPMC trial-move sizes; for NPT also auto-tunes the
BoxMCvolume move.
Equilibrium is detected on the fly from a pointwise sigma gate over the sampled time series.
Analysis
ColPack drives freud for order-parameter and density analysis. Defaults are shape-aware, and additional parameters can be added per call.
Order parameters (per shape default)
| Shape | Default order params |
|---|---|
disk |
Hexatic ψ₆ |
triangle |
Hexatic ψ₃ |
square |
Hexatic ψ₄ |
rectangle |
Nematic + Hexatic ψ₂ |
ellipse, ellipsoid, capsule |
Nematic |
sphere |
Steinhardt q₆, q₄ + SolidLiquid |
tetrahedron |
Steinhardt q₃ + SolidLiquid |
cube |
Steinhardt q₄ + Cubatic |
Any of the following can be added via the extra_order_params argument:
| Type | Notes |
|---|---|
Hexatic |
2D bond-orientational order; pick k to match lattice symmetry |
Nematic |
Nematic order from per-particle orientation vectors |
Steinhardt |
3D bond-orientational order; pick l per target lattice |
SolidLiquid |
Per-particle solid/liquid classification (3D) |
Cubatic |
Cubatic order via simulated annealing |
ContinuousCoordination |
Voronoi-based continuous coordination |
RotationalAutocorrelation |
Rotational time autocorrelation |
Density analysis
| Type | Notes |
|---|---|
RDF |
Radial distribution function g(r); auto-computed for multi-component systems |
LocalDensity |
Per-particle local number density / packing fraction |
GaussianDensity |
Gaussian-smeared density field on a grid |
CorrelationFunction |
Spatial correlation of per-particle scalar quantities |
System analysis
| Type | Notes |
|---|---|
VolumeFraction |
Per-frame system packing fraction φ from the simulated box volume |
Outputs
Per working_dir:
simulation_problem.json,simulation_baseline.json,simulation_plan.jsonrun_*/init.gsd,compress.gsd,sample.gsd(HOOMD trajectory)run_*/order_params.json,rdf.json, plot imagesworkflow_status.csv— one row per run, latest state per rowworkflow_progress.json,workflow_events.log— async progress for the agent / monitor CLI to consume
Programmatic use
from colpack.workflow import (
setup_simulation_problem,
plan_simulaiton_runs, # note: legacy spelling preserved in the API
execute_simulation_workflow,
analyze_simulation_runs,
)
setup_simulation_problem(
dimension=3,
total_particle_number=500,
particle_shape_list=["sphere"],
ensemble="NVT",
)
setup_simulation_problem resolves and returns the canonical working_dir;
pass that same value through to the planner, executor, and analyzer.
MCP server
The package ships an MCP server exposing the five workflow tools. Launch it with:
python -m colpack.mcp.server
The wrapper in agent/app.py connects to this server when the agent runs
end-to-end workflows.
Configuration
colpack/colpack_config.json is the live config: allowed shapes per dimension,
ensemble requirements, default integration / compression / sampling
parameters, analysis catalog, and per-shape order-parameter defaults.
The capabilities tool reads from this file, so editing it propagates to
both the Python API and the agent.
Dependencies
Provided by conda-forge (system prerequisites, see Installation above):
- hoomd-blue (HPMC integrator)
- ovito (rendering / per-frame visualization)
Resolved automatically by pip:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file colpack-0.1.0.tar.gz.
File metadata
- Download URL: colpack-0.1.0.tar.gz
- Upload date:
- Size: 50.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b1edc815f01786427d433de1ecf31ea44dc0cf5a7f7855ebd6fad2699dc44bc
|
|
| MD5 |
27879f2d5e6049be01d7fb48a1cb5064
|
|
| BLAKE2b-256 |
34dd112706577e7ffb64bf6ba5ac2ab6323535d73f4ef48a3240f8fec55f626f
|
Provenance
The following attestation bundles were made for colpack-0.1.0.tar.gz:
Publisher:
publish.yml on ljding94/ColPackAgent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
colpack-0.1.0.tar.gz -
Subject digest:
3b1edc815f01786427d433de1ecf31ea44dc0cf5a7f7855ebd6fad2699dc44bc - Sigstore transparency entry: 1394333206
- Sigstore integration time:
-
Permalink:
ljding94/ColPackAgent@fd5d33e6883abf9f374f84efda770d3429111272 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ljding94
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fd5d33e6883abf9f374f84efda770d3429111272 -
Trigger Event:
push
-
Statement type:
File details
Details for the file colpack-0.1.0-py3-none-any.whl.
File metadata
- Download URL: colpack-0.1.0-py3-none-any.whl
- Upload date:
- Size: 53.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee5c9fc00b909432b8456fb4eb87ed8a72dd9e8b51132560412227bab46b3d5c
|
|
| MD5 |
66f98a4f8bf58c370728cc6c688258c3
|
|
| BLAKE2b-256 |
a6beb20cf7e5d828ddd76b0770540ca74a200d5fd086bf453cf950125e627ff4
|
Provenance
The following attestation bundles were made for colpack-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on ljding94/ColPackAgent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
colpack-0.1.0-py3-none-any.whl -
Subject digest:
ee5c9fc00b909432b8456fb4eb87ed8a72dd9e8b51132560412227bab46b3d5c - Sigstore transparency entry: 1394333243
- Sigstore integration time:
-
Permalink:
ljding94/ColPackAgent@fd5d33e6883abf9f374f84efda770d3429111272 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ljding94
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fd5d33e6883abf9f374f84efda770d3429111272 -
Trigger Event:
push
-
Statement type: