Simulating CHARMM-GUI systems in Google Colab
Simulating CHARMM-GUI systems in Google Colab¶
Alex Dickson, Michigan State University
BMB 961, Machine Learning for Molecular Dynamics
This workbook assumes that you have already used CHARMM-GUI to setup your system and that you have selected openmm
in the Simulation Script section.
No need to unpack the charmm-gui.tgz
file. We will upload this directly to Colab!
To get started, upload this notebook to Colab if you aren’t already there.
Also, change your runtime type to GPU, using Runtime > Change runtime type > Hardware accelerator > GPU
First install csh
so you can run the CHARMM-GUI script
!sudo apt-get install csh
Install OpenMM and other packages (this will take a few minutes):
import sys
print(sys.version)
!wget https://repo.anaconda.com/miniconda/Miniconda3-py37_4.10.3-Linux-x86_64.sh
!bash Miniconda3-py*.sh -bfp /usr/local
!conda config --set always_yes yes
!conda config --add channels conda-forge
!conda install python=3.7 cudatoolkit=10.0 git jupyterlab numpy pandas scipy matplotlib ipympl rdkit openbabel openmm mdtraj pymbar pdbfixer parmed openff-toolkit openmoltools openmmforcefields
sys.path.append('/usr/local/lib/python3.7/site-packages')
import openmm.testInstallation
openmm.testInstallation.main()
Upload your charmm-gui tarball.
To upload, select the Files icon on the left, then click “Upload to Session Storage”, or link to your Google Drive. Select the file charmm-gui.tgz
that you downloaded at the last step of your CHARMM-GUI setup.
Unpack the tarball.
After uploading, run this command to unpack. You can see the unpacked files by pressing the Refresh button in the Files menu.
! tar xzf charmm-gui.tgz
Change to the openmm directory
Note: you will need to change the Run ID below from “4908284510” to whatever yours is.
%cd charmm-gui-4908284510/openmm
Now change README
into an executable
The README
file is a csh
script that contains all of the commands for heating up our system and running some preliminary trajectories.
!chmod +x README
Run the README!
Note that this will take a long time. You can get updates by refreshing your file list. The first output file is step5_equilibration.out
in the openmm
directory. The last column gives you estimates for how long this will take.
After the equilibration there will be 10 trajectory segments (step6_*
). You can download the .dcd
and .rst
files after they are generated. (Note that the step indices (e.g. 5, 6) might differ depending on which CHARMM-GUI tool you used for setup.)
!./README
To run longer (or shorter) simulations you could modify the nstep
parameter in the step5_production.inp
file.