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.1.0.tar.gz (31.1 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.1.0-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for polymcsim-0.1.0.tar.gz
Algorithm Hash digest
SHA256 465f3039ee65d689539c5886fcd4c787baa78521c24025db14764d5f10b93a7a
MD5 44c34e176504a92660df777758db1342
BLAKE2b-256 32d2a2018dc298b6c2604df8e6d21f0e91b56a3b89bbbccf84a726b53d954d15

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: polymcsim-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 20.6 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d1c327353ea08e8243765e99e29ff980df85d8e39c062d2f35731bd9cfc4a3ee
MD5 004456099a3c6fe5a8604f42090af608
BLAKE2b-256 832db705220f69ab4a387b1da06f3566ccc1fa3be322c23063d715bfe91630a4

See more details on using hashes here.

Provenance

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