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.6.0.tar.gz (39.7 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.6.0-py3-none-any.whl (29.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for polymcsim-0.6.0.tar.gz
Algorithm Hash digest
SHA256 f42a630ee0323f017f815bccd2edfbd2d210bfb47a999b32c92072c93080fc53
MD5 44a458bf184df82283d30e238f70a237
BLAKE2b-256 533e65a32e8f1f166cac64511ef2ec6afbed46a164a397293d30a462067cfabc

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: polymcsim-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 29.1 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.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b5dff90ed709d83915e4d516cd4e03ecfd4bf54353a86f33c3ea077aae62819f
MD5 696b76383f611cd3d3a23fd823d6a0ce
BLAKE2b-256 c8e8605cd88616f447aba49f6d776998178e97a518e25c24efaf108d72417732

See more details on using hashes here.

Provenance

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