EMMA

Introduction

PyEMMA project

PyEMMA is a Python library for the estimation, validation and analysis Markov models of molecular kinetics and other kinetic and thermodynamic models from molecular dynamics (MD) data.

Installation

PyEMMA installation is based on the Anaconda Python distribution.

Tutorials use Jupyter and Jupyter notebooks.

Docker installation

Installation of Anaconda and Jupyter in docker containers (Tutorial).

In Windows, it becomes:

C:\Users\cassmedchem\dockers\docker-data-science> docker run --rm -it -p 8888:8888 -p 8889:8889 -v "c:\Users\cassmedchem\dockers\docker-data-science:/home/jovyan" jupyter_emma

A jupyter server starts and it is possible to reach the server with the suggested instructions:

Copy/paste this URL into your browser when you connect for the first time, to login with a token: http://(0d68dd74c6db or 127.0.0.1):8888/?token=99476f67906b4de587128cd15e043719fd3ff55173e32c20

In c:\Users\cassmedchem\dockers\docker-data-science there will be the notebook with the PyEMMA tutorial that can be loaded in Jupyter.

It is necessary to install PyEMMA using a Conda terminal:

PyEMMA protocol

Setup of the system

%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import pyemma

# uncertain

from pyemma.util.contexts import settings

# for visualization of molecular structures:

import nglview
import mdtraj
from threading import Timer
from nglview.player import TrajectoryPlayer

# import operative system tools

import os

Setting of the topology and trajectory files

It is possible to check the contents of the directory using ls statement and then switch to the correct directory

os.chdir('Pep26_wat')
os.getcwd()

Definition of the topology file

# define the topology of the system
top = 'cPep26_1_wat_p.gro'

Preparing a file with all trajectories name

files=[]
      
for f in os.listdir():
    if '.trr' in f:
    files.append(f)
      
print (len(files), files)

Definition of the featuring topology

# define features: torsions
torsions_feat = pyemma.coordinates.featurizer(top)

Features addition (torsion angles)

torsions_feat.add_backbone_torsions(cossin=True, periodic=False)
torsions_feat.add_sidechain_torsions(cossin=True, periodic=False, which='chi1')
torsions_feat.add_sidechain_torsions(cossin=True, periodic=False, which='chi2')
torsions_data = pyemma.coordinates.load(files, features=torsions_feat)
labels = ['torsions']
data_concatenated = np.concatenate(torsions_data)
fig, ax = pyemma.plots.plot_feature_histograms(data_concatenated, feature_labels=torsions_feat)
fig.set_size_inches(11,18)