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.
Metadata
Release files for polymcsim 0.8.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 | |
|---|---|---|---|
| polymcsim-0.8.0.tar.gz | 41.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| polymcsim-0.8.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 72.6 kB
Release files / polymcsim-0.8.0.tar.gz
| Download URL | polymcsim-0.8.0.tar.gz |
|---|---|
| Size | 41.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
38828574ac1f580febc0128935a21a313d099cbfdc926d2da0e21237936a9eb6
|
|
BLAKE2b-256 checksum How to use checksums |
4325e004a0e69eecd53a4d40e16d80b37d9da388ac43103e0432ff3dbbe04363
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 3, 2025.
Transparency logRelease files / polymcsim-0.8.0-py3-none-any.whl
| Download URL | polymcsim-0.8.0-py3-none-any.whl |
|---|---|
| Size | 30.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d553c2ff32d9d9b516f3f83cea955bc162fb2949dab2ebfb0254f32097de1ed0
|
|
BLAKE2b-256 checksum How to use checksums |
16ec1559c9189f5c5c497e7eed3ca170804366bc2ac0656532e3ef470f58ff13
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 3, 2025.
Transparency log