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.5.0.tar.gz (38.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.5.0-py3-none-any.whl (27.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: polymcsim-0.5.0.tar.gz
  • Upload date:
  • Size: 38.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.5.0.tar.gz
Algorithm Hash digest
SHA256 3a357ca73797692ba16c49db024247825d3ef3ae029069033365c8125d1fe4b0
MD5 2a0f9b146fa3fd4a4e757614de3352f5
BLAKE2b-256 e3070113f7c49a2d235d36f9891cdda58f78c1b4eb096b4e84c87ed3a3c6d1fa

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: polymcsim-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 27.7 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.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6a120b0fa7e337d7edf61b00f3bdb864180fd655178ee2e8102ddb32156cfdc2
MD5 e5e3aa3a26e1cd0c42ba2d0b5d613dae
BLAKE2b-256 79dca4c085aa0fc2b1510fa4b16a149492f6db4cb02f6c9674c50421a179df92

See more details on using hashes here.

Provenance

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