Skip to content

timbernat/polymerist

Polymer-Oriented LibrarY of Monomer Expression Rules and In-silico Synthesis Tools

GitHub Actions Build Status codecov

A unified set of tools for setting up molecular dynamics simulations of general organic polymer systems. Based upon concepts introduced in "Parameterization of General Organic Polymers within the Open Force Field Framework" (Davel, Connor M., Bernat, Timotej, Wagner, Jeffrey R., and Shirts, Michael R.)

abstract

Features

Includes functionality for:

  • Generating chemical information-rich monomer residue templates
  • Enumeration of all possible repeat units of a polymer ensemble given initial monomers and a target polymerization mechanism
  • Building of linear homopolymers and copolymers (both topologies and coordinates)
  • Solvating polymer systems
  • Packing of many polymer chains into melt-like boxes
  • Force-field parameterization within the OpenFF framework
  • Interfaces to semi-empirical and graph neural network-based atomic partial charge assignment
  • Reproducible simulation specification API
  • Interfaces to OpenMM for running serial simulations with different thermodynamic parameters
  • Much more!

Documentation

Complete documentation for polymerist can be found on the polymerist ReadTheDocs page

Examples

Examples of how to import and invoke the core features of polymerist can be found in the accompanying polymerist_examples repository.

Requirements

OS

polymerist is compatible with Linux (recommended) and Mac machines capable of installing Python 3.11. Due to lack of support from AmberTools, direct installation on Windows machines is not supported; however, this can easily be circumvented by using the Windows Subsystem for Linux (WSL2)

Python package manager

Before proceeding with installation, ensure you have some iteration of a Python package and environment management system installed on your machine. We recommend using mamba, installable via Miniforge. Miniconda and other Anaconda manager also work; however if you opt to use conda over mamba, be prepared for a markedly slower and more tedious install process!

Installation

The distribution for polymerist is hosted on PyPI. For detailed instruction on how to install polymerist and other required toolkits, see the installation docs. Here we provide an abridged summary to get you going

Base install

A fully-featured install in a safe virtual environment (named "polymerist-env", here) can be obtained by running the following terminal commands:

Mamba install (basic)

mamba create -n polymerist-env python=3.11
mamba activate polymerist-env
pip install polymerist
mamba install -c conda-forge openff-toolkit mbuild openbabel "packmol<=20.15.1"

Mamba install (extended)

An extended install with Jupyter Notebook support, molecular visualization capability, and chemical data querying capability can be obtained very similarly:

mamba create -n polymerist-env python=3.11
mamba activate polymerist-env
pip install polymerist[interactive,chemdb]
mamba install -c conda-forge openff-toolkit mbuild openbabel "packmol<=20.15.1"

Testing installation

To see if the installation was successful, one can run the following short set of commands which should yield the outputs shown:

mamba activate polymerist-env; python
>>> import polymerist as ps
>>> print(ps.pascal(5))
    1    
   1 1   
  1 2 1  
 1 3 3 1 
1 4 6 4 1

Parameterization toolkits

Assigning atomic partial charges using some flavor of AM1-BCC and enhanced conformer generation also requires installation of some supplementary toolkits. These can be installed as follows:

mamba activate polymerist-env
mamba install -c openeye openeye-toolkits
mamba install -c conda-forge espaloma_charge "torchdata<=0.9.0"
mamba install -c conda-forge openff-nagl "torchdata<=0.9.0"

Installing from source (optional)

polymerist and all required dependencies can also be installed directly from the source code in this repository. To install, execute the following set of terminal commands in whichever directory you'd like the installation to live on your local machine:

git clone https://github.com/timbernat/polymerist
cd polymerist
mamba env create -n polymerist-env -f devtools/conda-envs/release-build.yml
mamba activate polymerist-env
pip install .

Developer installation (for advanced users only)

Those developing for polymerist may like to have an editable local installation, in which they can make changes to the source code and test behavior changes in real-time. This type of installation proceeds as follows:

git clone https://github.com/timbernat/polymerist
cd polymerist
mamba env create -n polymerist-dev -f devtools/conda-envs/dev-build.yml
mamba activate polymerist-dev
pip install -e . --config-settings editable_mode=strict

The --config-settings editable_mode flag in the final line allows this installation to "play nicely" with PyLance, making auto-completion and navigation to source code much easier for VSCode users. It is optional, and can be removed if this compatibility is not desired

Copyright

Copyright (c) 2024, Timotej Bernat ([email protected])

Acknowledgements

Project based on the Computational Molecular Science Python Cookiecutter version 1.1.

About

Polymer-Oriented LibrarY of Monomer-Expression Rules and In-silico Synthesis Tools

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages