Skip to main content

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

  1. Install Poetry (if not already installed):

    curl -sSL https://install.python-poetry.org | python3 -
    
  2. Clone the repository:

    git clone <repository-url>
    cd polymcsim
    
  3. Install dependencies:

    poetry install
    
  4. 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 Numba for 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

polymcsim-0.4.0.tar.gz (37.9 kB view details)

Uploaded Source

Built Distribution

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

polymcsim-0.4.0-py3-none-any.whl (27.4 kB view details)

Uploaded Python 3

File details

Details for the file polymcsim-0.4.0.tar.gz.

File metadata

  • Download URL: polymcsim-0.4.0.tar.gz
  • Upload date:
  • Size: 37.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for polymcsim-0.4.0.tar.gz
Algorithm Hash digest
SHA256 e78ef9b04c17f7224b0e16ef48b46fa080abcef20003a2b601606a82dcde54c3
MD5 5bfc63cf78290c0d0496908222d27e3f
BLAKE2b-256 5460fad3966c8fd1607dbe560132f5244141147e1f5b42a6b3d82b0af1de9b60

See more details on using hashes here.

Provenance

The following attestation bundles were made for polymcsim-0.4.0.tar.gz:

Publisher: publish.yml on JulianKimmig/polymcsim

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file polymcsim-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: polymcsim-0.4.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

Hashes for polymcsim-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b80abee823744e969537282131bdab9c0533535296cc21c2d10cbcabc8eac185
MD5 664a0e551fa27632cc82be01a99a12a4
BLAKE2b-256 30507a28414b90f1daabad50fa8be231ab70e13198f34b675c3317d059b15a17

See more details on using hashes here.

Provenance

The following attestation bundles were made for polymcsim-0.4.0-py3-none-any.whl:

Publisher: publish.yml on JulianKimmig/polymcsim

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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