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.2.0.tar.gz (37.3 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.2.0-py3-none-any.whl (26.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for polymcsim-0.2.0.tar.gz
Algorithm Hash digest
SHA256 cdede7074aa3e7e1759fb2fee39885ff14589ceb5ae187a6c5267e494df5381b
MD5 729f25dc2b91d5dc901cac0d29ad2d95
BLAKE2b-256 c49737444ba439508e507c909ef8ae88ae0516ef7d17491b6de60d587fa9bac8

See more details on using hashes here.

Provenance

The following attestation bundles were made for polymcsim-0.2.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.2.0-py3-none-any.whl.

File metadata

  • Download URL: polymcsim-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 26.9 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3b0e388cd84986752bbce46961d55bcf28df3302c24906d9d7c87192ad3531fe
MD5 658684c0753c2b47ed258685171d73e2
BLAKE2b-256 bd2e4fb67e447b1af22a9621be000e97fa4955a413ec5c0f60664958cad8ec24

See more details on using hashes here.

Provenance

The following attestation bundles were made for polymcsim-0.2.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