A high-performance Python library for Monte Carlo polymer graph generation
Project description
PolyMCsim
A high-performance Python library for computational chemists to generate polymer graph structures through Monte Carlo simulations. The library models polymerization reactions using monomers as nodes and chemical bonds as edges, enabling emergent generation of diverse polymer architectures.
Features
- Monte Carlo simulation of polymer growth
- Numba-optimized performance
- JSON/Pydantic configuration
- Batch simulation capabilities
- Support for complex monomer structures
- Parallel processing for large-scale simulations
Installation
PolyMCsim requires Python 3.8 or later. To install, run:
# Using Poetry (recommended)
poetry install
# Using pip
pip install .
Development Setup
-
Install Poetry (if not already installed):
curl -sSL https://install.python-poetry.org | python3 -
-
Clone the repository:
git clone <repository-url> cd polymcsim
-
Install dependencies:
poetry install -
Install pre-commit hooks:
poetry run pre-commit install
Usage
Basic example of polymer generation:
from polymcsim import PolymerSimulation
# Configure simulation
sim = PolymerSimulation(
monomers_config="path/to/monomers.json",
n_steps=1000
)
# Run simulation
result = sim.run()
# Export results
result.export_graph("polymer.graphml")
Testing
Run the test suite:
poetry run pytest
License
[License Type] - See LICENSE file for details
Contributing
Contributions are welcome! Please read our Contributing Guidelines for details on how to submit pull requests, report issues, and contribute to the project.
- High Performance: Built with
Numbafor C-like speed in computationally intensive parts. - Extensible: Easily define new monomer types, reactions, and simulation parameters.
- Rich Visualization: Generate insightful plots and analyses right out of the box.
For detailed information, visit the full documentation at juliankimmig.github.io/polymcsim/.
Installation
You can install polymcsim via pip:
pip install polymcsim
Alternatively, you can use uv:
uv pip install polymcsim
Quick Start
Here's a minimal example of how to simulate the formation of a branched polymer and visualize its structure:
from polymcsim import PolymerSimulation
# 1. Define monomers and reactions
monomers = [
# ... existing code ...
# 4. Run the simulation
sim = PolymerSimulation(simulation_input)
polymer_graph = sim.run()
# 5. Visualize the largest polymer structure
sim.visualize_polymer(polymer_graph)
This will produce an image of the largest polymer's network structure. polymcsim also offers more advanced visualizations, such as molecular weight distribution plots and comprehensive analysis dashboards.
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 polymcsim-0.3.0.tar.gz.
File metadata
- Download URL: polymcsim-0.3.0.tar.gz
- Upload date:
- Size: 37.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6697ede7770b4aec9605adc838dbb5b0e9965ca10cd6cefa585abc39d6d3e60
|
|
| MD5 |
a779c3daebd80517d5a8bd0fa43fac81
|
|
| BLAKE2b-256 |
895e0c837ee06dbef67bbfb591c5b185de9cd186b9d370a0d4a56e8bc3e787ae
|
Provenance
The following attestation bundles were made for polymcsim-0.3.0.tar.gz:
Publisher:
publish.yml on JulianKimmig/polymcsim
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
polymcsim-0.3.0.tar.gz -
Subject digest:
a6697ede7770b4aec9605adc838dbb5b0e9965ca10cd6cefa585abc39d6d3e60 - Sigstore transparency entry: 246257228
- Sigstore integration time:
-
Permalink:
JulianKimmig/polymcsim@edbb92ce3eb9cff07006b5c1ff6fa5e78b9c0522 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/JulianKimmig
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@edbb92ce3eb9cff07006b5c1ff6fa5e78b9c0522 -
Trigger Event:
workflow_run
-
Statement type:
File details
Details for the file polymcsim-0.3.0-py3-none-any.whl.
File metadata
- Download URL: polymcsim-0.3.0-py3-none-any.whl
- Upload date:
- Size: 27.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d3d0c1b7a9ae3c421adb0b18fa5bd82eb9b5dfea16bfa6fbd8fa4cf5704930e
|
|
| MD5 |
124045c5a301127e87a5095154743366
|
|
| BLAKE2b-256 |
1873559e65ca35cbbff4fe540cc4bdb5334e1fa25ad7b49d05c0788814b83f4c
|
Provenance
The following attestation bundles were made for polymcsim-0.3.0-py3-none-any.whl:
Publisher:
publish.yml on JulianKimmig/polymcsim
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
polymcsim-0.3.0-py3-none-any.whl -
Subject digest:
5d3d0c1b7a9ae3c421adb0b18fa5bd82eb9b5dfea16bfa6fbd8fa4cf5704930e - Sigstore transparency entry: 246257236
- Sigstore integration time:
-
Permalink:
JulianKimmig/polymcsim@edbb92ce3eb9cff07006b5c1ff6fa5e78b9c0522 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/JulianKimmig
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@edbb92ce3eb9cff07006b5c1ff6fa5e78b9c0522 -
Trigger Event:
workflow_run
-
Statement type: