Installation

MDCraft is a Python package and can be installed using pip, the package installer for Python, or a Python package manager like Conda or Mamba. MDCraft requires Python 3.9 or later.

Prerequisites

Virtual environement

It is highly recommended that you use a virtual environment for MDCraft to prevent dependency conflicts. If you do not already have a virtual environment for MDCraft and related simulation packages and tools, you can create one for the package installer/manager you use using the instructions below.

Conda

  1. Optional: Make conda-forge the default channel for dependencies:

    conda config --add channels conda-forge
    
  2. Create an environment named mdcraft with Python:

    conda create -n mdcraft python
    
  3. Activate the environment:

    conda activate mdcraft
    

venv

  1. Create an environment named mdcraft:

    python3 -m venv mdcraft
    
  2. Activate the environment using one of the following commands:

    source mdcraft/bin/activate        # POSIX: bash or zsh
    
    mdcraft\Scripts\activate.bat       # Windows: cmd.exe
    
    mdcraft\Scripts\Activate.ps1       # Windows: PowerShell
    

virtualenv

  1. Create an environment named mdcraft:

    virtualenv mdcraft
    
  2. Activate the environment using one of the following commands:

    source mdcraft/bin/activate       # Linux or macOS
    
    .\mdcraft\Scripts\activate        # Windows
    

OpenMM

If you plan on using the high-performance OpenMM simulation toolkit, you must

  • compile and build it yourself using the instructions here if you are using pip, or

  • install it (and optionally, a specific CUDA toolkit) using the instructions here if you are using Conda/Mamba.

Install from PyPI

Install MDCraft and required dependencies using pip:

python3 -m pip install mdcraft

Install from Anaconda

Install MDCraft and required dependencies using Conda:

conda install bbye98::mdcraft

Install from source

  1. Grab a copy of the MDCraft repository:

    git clone https://github.com/bbye98/mdcraft.git
    
  2. Enter the repository directory:

    cd mdcraft
    
  3. Optional: The required dependencies will be installed automatically alongside MDCraft in the next step. To install all dependencies, including those used for development and unit tests, use one of the following commands:

    python3 -m pip install -r requirements.txt       # pip package installer
    
    conda env update --file environment.yml          # Conda/Mamba package manager
    
  4. Install MDCraft (and required dependencies, if you have not already done so) using pip (even if you are using a Conda/Mamba environment):

    python3 -m pip install -e .
    

Postrequisites

Try importing MDCraft in Python:

python3 -c "import mdcraft"

If no errors like ModuleNotFoundError: No module named 'mdcraft' are raised, you have successfully installed MDCraft!

Method of image charges

If you plan on using the method of image charges (mdcraft.openmm.system.add_image_charges()) in your OpenMM simulations, you must compile and install constvplugin or openmm-ic-plugin.