pbg-mem3dg
Process-bigraph wrapper for Mem3DG, a membrane mechanics simulator using discrete differential geometry on triangulated surface meshes.
View Interactive Demo Report -- osmotic deflation, membrane patch bulging, and tubular constriction with 3D mesh viewers, Plotly charts, and bigraph architecture diagrams.
What it does
Wraps the Mem3DG simulation engine as a process-bigraph Process, enabling membrane mechanics simulations to be composed with other biological processes in the bigraph framework. The wrapper uses the bridge pattern: it lazily initializes a Mem3DG System and Euler integrator internally, and on each update() call advances the simulation by the requested time interval using manual stepping.
Installation
# System dependency (macOS)
brew install netcdf-cxx
# Install into a virtual environment
uv venv .venv && source .venv/bin/activate
uv pip install -e .
Quick Start
from process_bigraph import Composite, allocate_core, gather_emitter_results
from process_bigraph.emitter import RAMEmitter
from pbg_mem3dg import Mem3DGProcess, make_membrane_document
core = allocate_core()
core.register_link('Mem3DGProcess', Mem3DGProcess)
core.register_link('ram-emitter', RAMEmitter)
doc = make_membrane_document(
mesh_type='icosphere',
radius=1.0,
subdivision=3,
Kbc=8.22e-5,
tension_modulus=0.1,
osmotic_strength=0.02,
preferred_volume_fraction=0.7,
interval=100.0,
)
sim = Composite({'state': doc}, core=core)
sim.run(1000.0)
results = gather_emitter_results(sim)
emitter_data = results[('emitter',)]
for entry in emitter_data:
print(f"t={entry['time']:.0f} E={entry['total_energy']:.6f} V={entry['volume']:.4f}")
API Reference
Mem3DGProcess (Process)
| Config | Type | Default | Description |
|---|---|---|---|
mesh_type |
string | 'icosphere' |
Initial mesh shape (icosphere, hexagon, cylinder) |
radius |
float | 1.0 |
Mesh radius |
subdivision |
integer | 3 |
Mesh subdivision level |
Kbc |
float | 8.22e-5 |
Bending rigidity coefficient |
H0c |
float | 0.0 |
Spontaneous curvature coefficient |
tension_modulus |
float | 0.1 |
Surface tension modulus (harmonic model) |
preferred_area |
float | 0.0 |
Preferred surface area (0 = auto from mesh) |
osmotic_strength |
float | 0.02 |
Osmotic pressure strength |
preferred_volume_fraction |
float | 0.7 |
Target volume as fraction of initial |
Kse, Ksl, Kst |
float | 0.0 |
Spring regularization constants |
characteristic_timestep |
float | 2.0 |
Euler integrator base timestep |
tolerance |
float | 1e-11 |
Convergence tolerance |
shape_variation |
boolean | True |
Enable shape evolution |
protein_variation |
boolean | False |
Enable protein density evolution |
Output ports (all overwrite — absolute values, not deltas):
| Port | Type | Description |
|---|---|---|
vertex_positions |
list | Vertex coordinates [[x,y,z], ...] |
mean_curvatures |
list | Per-vertex mean curvature |
total_energy |
float | Total system energy |
bending_energy |
float | Bending (spontaneous curvature) energy |
surface_energy |
float | Surface tension energy |
pressure_energy |
float | Osmotic pressure energy |
surface_area |
float | Total surface area |
volume |
float | Enclosed volume |
converged |
boolean | Whether integrator reached tolerance |
make_membrane_document()
Factory function that returns a composite document dict with:
membrane: theMem3DGProcesswired to storesstores: shared stateemitter: RAM emitter collecting energy, area, volume time series
Architecture
Composite
├── membrane (Mem3DGProcess)
│ └── internally manages:
│ ├── pymem3dg.System (mesh + physics)
│ └── pymem3dg.Euler (integrator)
├── stores/
│ ├── vertex_positions
│ ├── mean_curvatures
│ ├── total_energy, bending_energy, ...
│ ├── surface_area, volume
│ └── converged
└── emitter (RAMEmitter)
└── records energy, area, volume vs time
The bridge pattern: on each update(state, interval), the process advances Mem3DG's Euler integrator by interval time units using march(), then reads updated geometry and energy back into PBG output ports.
Demo
python demo/demo_report.py
Produces demo/demo_output.png showing energy, surface area, and volume evolution during membrane relaxation.
Tests
pytest tests/ -v
Metadata
Release files for pbg-mem3dg 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pbg_mem3dg-0.1.0.tar.gz | 7.9 kB | Without provenance | Details for pbg_mem3dg-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pbg_mem3dg-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for pbg_mem3dg-0.1.0-py3-none-any.whl |
Total release size: 15.7 kB
Release files / pbg_mem3dg-0.1.0.tar.gz
| Download URL | pbg_mem3dg-0.1.0.tar.gz |
|---|---|
| Size | 7.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6447db88d59cd25fb5406e6320d2d40df792afe43e0b8bd0b3523d5080c91f4e
|
|
BLAKE2b-256 checksum How to use checksums |
1e3aa9fec96ef6186d70c601dab0e83ce312ff39aa70bc6473ea734bc61183cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / pbg_mem3dg-0.1.0-py3-none-any.whl
| Download URL | pbg_mem3dg-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f1763ab251844b0d0ba2ce52228a5c93037aa57043b18a2dd0f6375ed3701b44
|
|
BLAKE2b-256 checksum How to use checksums |
ce479074e7cefb3fd481f1bb91b820b324a4bf27c22f4975ad0be4ac99e53c96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for pbg-mem3dg 0.1.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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.