Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
FROM ghcr.io/becksteinlab/streaming-md-docker:main-common-cpu

FROM ghcr.io/becksteinlab/streaming-namd-docker:main-common-gpu

COPY env.yaml env.yaml
RUN . /opt/conda/etc/profile.d/conda.sh && \
conda env create -n workshop --file=env.yaml
Expand Down
Binary file not shown.
Binary file not shown.
207 changes: 207 additions & 0 deletions gromacs-demos/msd/demo.ipynb

Large diffs are not rendered by default.

40 changes: 40 additions & 0 deletions gromacs-demos/msd/demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from imdclient.IMDREADER import IMDReader
import numpy as np
import MDAnalysis as mda
import logging
import dynplot as dyn
import vdos as vd
import time as t

# %%
logger = logging.getLogger("imdclient.IMDClient")
file_handler = logging.FileHandler("imdreader.log")
formatter = logging.Formatter(
"%(asctime)s - %(name)s - %(levelname)s - %(message)s"
)
file_handler.setFormatter(formatter)
logger.addHandler(file_handler)
logger.setLevel(logging.INFO)

# %%
u = mda.Universe("mda.tpr", "imd://localhost:8888",buffersize = 10*1024*1024)
sel = u.select_atoms("resname SOL")
vdos = vd.vdos(sel,200)

vd.vdosLib.omp_set_num_threads(2)
tStep = 0
for ts in u.trajectory:
vdos.single_frame(tStep,ts.time)
if tStep == 0:
d = dyn.dynamicPlot([0,1000],"wavenumber (cm^-1)",[0,12000],"VDoS (arb. u.)","")
elif tStep % 200 == 0:
vdos.copyResidueList()
vdos.postProcess(vdos.residueListCopy,mode = "total+single")
total = np.array(vdos.totVDoS[0])
single = np.array(vdos.totVDoS[1])
d.update(vdos.wavenumber, total, single)
tStep += 1
# %%
logger.info(f"Parsed {tStep} frames")


35 changes: 35 additions & 0 deletions gromacs-demos/msd/dynplot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_theme()
plt.ion()

class dynamicPlot:
def __init__(self,xRange,xLabel,yRange,yLabel,title):
self.xRange = xRange
self.xLabel = xLabel
self.yRange = yRange
self.yLabel = yLabel
self.title = title
self.prepare()

def prepare(self):
#Set up plot
self.figure, self.ax = plt.subplots()
self.l1, = self.ax.plot([],[], color = "red", linewidth = 2.0, label = "total")
self.l2, = self.ax.plot([],[], color = "blue", linewidth = 2.0, label = "single molecule")
self.ax.set_xlim(self.xRange[0], self.xRange[1])
self.ax.set_ylim(self.yRange[0], self.yRange[1])
self.ax.set_xlabel(self.xLabel)
self.ax.set_ylabel(self.yLabel)
self.ax.set_title(self.title)
self.ax.legend()

def update(self, xData, yData1, yData2):
#Update data (with the new _and_ the old points)
self.l1.set_xdata(xData)
self.l1.set_ydata(yData1)
self.l2.set_xdata(xData)
self.l2.set_ydata(yData2)
#We need to draw *and* flush
self.figure.canvas.draw()
self.figure.canvas.flush_events()
57 changes: 57 additions & 0 deletions gromacs-demos/msd/imd.mdp
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
title = PRODUCTION IN NPT
; Run parameters
integrator = md ; leap-frog integrator
nsteps = 25000 ; 1 * 25000 = 25 ps
dt = 0.001 ; 1 fs
; Output control
nstxout = 5000 ; save coordinates every 5 ps
nstvout = 5000 ; save velocities every 5 ps
nstenergy = 5000 ; save energies every 5 ps
nstlog = 5000 ; update log file every 5 ps
; Center of mass (COM) motion
nstcomm = 10 ; remove COM motion every 10 steps
comm-mode = Linear ; remove only COM translation (liquids in PBC)
; Bond parameters
continuation = yes ; first dynamics run
constraint_algorithm = lincs ; holonomic constraints
constraints = all-bonds ; all bonds lengths are constrained
lincs_iter = 1 ; accuracy of LINCS
lincs_order = 4 ; also related to accuracy
; Nonbonded settings
cutoff-scheme = Verlet ; Buffered neighbor searching
ns_type = grid ; search neighboring grid cells
nstlist = 10 ; 10 fs, largely irrelevant with Verlet
rcoulomb = 1.0 ; short-range electrostatic cutoff (in nm)
rvdw = 1.0 ; short-range van der Waals cutoff (in nm)
DispCorr = EnerPres ; account for cut-off vdW scheme
; Electrostatics
coulombtype = PME ; Particle Mesh Ewald for long-range electrostatics
pme_order = 4 ; cubic interpolation
fourierspacing = 0.12 ; grid spacing for FFT
; Temperature coupling is on
tcoupl = Nose-Hoover ; good for production, after equilibration
; we define separate thermostats for the solute and solvent (need to adapt)
; see default groups defined by Gromacs for your system or define your own (make_ndx)
tc-grps = Protein non-Protein ; the separate groups for the thermostats
tau-t = 1.0 1.0 ; time constants for thermostats (ps)
ref-t = 300 300 ; reference temperature for thermostats (K)
; Pressure coupling is off
pcoupl = Parrinello-Rahman ; good for production, after equilibration
tau-p = 2.0 ; time constant for barostat (ps)
compressibility = 4.5e-5 ; compressibility (1/bar) set to water at ~300K
ref-p = 1.0 ; reference pressure for barostat (bar)
; Periodic boundary conditions
pbc = xyz ; 3-D PBC
; Velocity generation
gen_vel = no
; IMD group
IMD-group = System
IMD-version = 3
IMD-nst = 5
IMD-time = yes
IMD-box = yes
IMD-coords = yes
IMD-unwrap = yes
IMD-forces = no
IMD-vels = yes
IMD-energies = no
139 changes: 139 additions & 0 deletions gromacs-demos/msd/imdreader.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
2024-11-14 11:29:27,762 - imdclient.IMDClient - INFO - Parsed 63 frames
2024-11-14 11:31:10,543 - imdclient.IMDClient - INFO - Parsed 200 frames
2024-11-14 11:56:53,090 - imdclient.IMDClient - INFO - Parsed 1032 frames
2024-11-14 11:56:53,090 - imdclient.IMDClient - INFO - Parsed 1032 frames
2024-11-14 11:56:53,090 - imdclient.IMDClient - INFO - Parsed 1032 frames
2024-11-14 12:14:45,608 - imdclient.IMDClient - INFO - Parsed 3126 frames
2024-11-15 11:26:42,832 - imdclient.IMDClient - INFO - Parsed 242 frames
2024-11-15 11:29:59,980 - imdclient.IMDClient - INFO - Parsed 368 frames
2024-11-15 11:29:59,980 - imdclient.IMDClient - INFO - Parsed 368 frames
2024-11-19 11:40:03,661 - imdclient.IMDClient - INFO - Parsed 3126 frames
2024-11-20 11:23:33,248 - imdclient.IMDClient - INFO - Parsed 658 frames
2024-11-20 17:47:37,419 - imdclient.IMDClient - INFO - Parsed 950 frames
2024-11-20 17:49:17,983 - imdclient.IMDClient - INFO - Parsed 9 frames
2024-11-20 17:49:17,983 - imdclient.IMDClient - INFO - Parsed 9 frames
2024-11-20 17:50:29,314 - imdclient.IMDClient - INFO - Parsed 487 frames
2024-11-20 17:50:29,314 - imdclient.IMDClient - INFO - Parsed 487 frames
2024-11-20 17:50:29,314 - imdclient.IMDClient - INFO - Parsed 487 frames
2024-11-20 17:51:10,677 - imdclient.IMDClient - INFO - Parsed 287 frames
2024-11-20 17:51:10,677 - imdclient.IMDClient - INFO - Parsed 287 frames
2024-11-20 17:51:10,677 - imdclient.IMDClient - INFO - Parsed 287 frames
2024-11-20 17:51:10,677 - imdclient.IMDClient - INFO - Parsed 287 frames
2024-11-20 17:51:47,083 - imdclient.IMDClient - INFO - Parsed 259 frames
2024-11-20 17:51:47,083 - imdclient.IMDClient - INFO - Parsed 259 frames
2024-11-20 17:51:47,083 - imdclient.IMDClient - INFO - Parsed 259 frames
2024-11-20 17:51:47,083 - imdclient.IMDClient - INFO - Parsed 259 frames
2024-11-20 17:51:47,083 - imdclient.IMDClient - INFO - Parsed 259 frames
2024-11-20 17:58:52,086 - imdclient.IMDClient - INFO - Parsed 118 frames
2024-11-20 18:00:27,665 - imdclient.IMDClient - INFO - Parsed 255 frames
2024-11-20 18:00:27,665 - imdclient.IMDClient - INFO - Parsed 255 frames
2024-11-20 18:09:20,440 - imdclient.IMDClient - INFO - Parsed 1 frames
2024-11-20 18:09:47,407 - imdclient.IMDClient - INFO - Parsed 3 frames
2024-11-20 18:09:47,407 - imdclient.IMDClient - INFO - Parsed 3 frames
2024-11-20 18:39:34,249 - imdclient.IMDClient - INFO - Parsed 138 frames
2024-11-20 18:41:00,368 - imdclient.IMDClient - INFO - Parsed 309 frames
2024-11-20 18:41:00,368 - imdclient.IMDClient - INFO - Parsed 309 frames
2024-11-20 18:41:53,435 - imdclient.IMDClient - INFO - Parsed 178 frames
2024-11-20 18:41:53,435 - imdclient.IMDClient - INFO - Parsed 178 frames
2024-11-20 18:41:53,435 - imdclient.IMDClient - INFO - Parsed 178 frames
2024-11-20 18:43:04,857 - imdclient.IMDClient - INFO - Parsed 208 frames
2024-11-20 18:43:04,857 - imdclient.IMDClient - INFO - Parsed 208 frames
2024-11-20 18:43:04,857 - imdclient.IMDClient - INFO - Parsed 208 frames
2024-11-20 18:43:04,857 - imdclient.IMDClient - INFO - Parsed 208 frames
2024-11-20 18:54:00,943 - imdclient.IMDClient - INFO - Parsed 778 frames
2024-11-20 18:56:25,123 - imdclient.IMDClient - INFO - Parsed 373 frames
2024-11-20 18:56:25,123 - imdclient.IMDClient - INFO - Parsed 373 frames
2024-11-20 18:57:46,316 - imdclient.IMDClient - INFO - Parsed 26 frames
2024-11-20 18:57:46,316 - imdclient.IMDClient - INFO - Parsed 26 frames
2024-11-20 18:57:46,316 - imdclient.IMDClient - INFO - Parsed 26 frames
2024-11-20 18:58:58,910 - imdclient.IMDClient - INFO - Parsed 247 frames
2024-11-20 18:58:58,910 - imdclient.IMDClient - INFO - Parsed 247 frames
2024-11-20 18:58:58,910 - imdclient.IMDClient - INFO - Parsed 247 frames
2024-11-20 18:58:58,910 - imdclient.IMDClient - INFO - Parsed 247 frames
2024-11-20 19:10:17,605 - imdclient.IMDClient - INFO - Parsed 3126 frames
2024-11-20 19:10:17,605 - imdclient.IMDClient - INFO - Parsed 3126 frames
2024-11-20 19:10:17,605 - imdclient.IMDClient - INFO - Parsed 3126 frames
2024-11-20 19:10:17,605 - imdclient.IMDClient - INFO - Parsed 3126 frames
2024-11-20 19:10:17,605 - imdclient.IMDClient - INFO - Parsed 3126 frames
2024-11-20 19:11:29,729 - imdclient.IMDClient - INFO - Parsed 44 frames
2024-11-20 19:11:29,729 - imdclient.IMDClient - INFO - Parsed 44 frames
2024-11-20 19:11:29,729 - imdclient.IMDClient - INFO - Parsed 44 frames
2024-11-20 19:11:29,729 - imdclient.IMDClient - INFO - Parsed 44 frames
2024-11-20 19:11:29,729 - imdclient.IMDClient - INFO - Parsed 44 frames
2024-11-20 19:11:29,729 - imdclient.IMDClient - INFO - Parsed 44 frames
2024-11-20 19:20:41,617 - imdclient.IMDClient - INFO - Parsed 3082 frames
2024-11-20 19:20:41,617 - imdclient.IMDClient - INFO - Parsed 3082 frames
2024-11-20 19:20:41,617 - imdclient.IMDClient - INFO - Parsed 3082 frames
2024-11-20 19:20:41,617 - imdclient.IMDClient - INFO - Parsed 3082 frames
2024-11-20 19:20:41,617 - imdclient.IMDClient - INFO - Parsed 3082 frames
2024-11-20 19:20:41,617 - imdclient.IMDClient - INFO - Parsed 3082 frames
2024-11-20 19:20:41,617 - imdclient.IMDClient - INFO - Parsed 3082 frames
2024-11-20 20:14:15,389 - imdclient.IMDClient - INFO - Parsed 303 frames
2024-11-20 20:14:15,389 - imdclient.IMDClient - INFO - Parsed 303 frames
2024-11-20 20:14:15,389 - imdclient.IMDClient - INFO - Parsed 303 frames
2024-11-20 20:14:15,389 - imdclient.IMDClient - INFO - Parsed 303 frames
2024-11-20 20:14:15,389 - imdclient.IMDClient - INFO - Parsed 303 frames
2024-11-20 20:20:25,324 - imdclient.IMDClient - INFO - Parsed 337 frames
2024-11-20 20:23:04,235 - imdclient.IMDClient - INFO - Parsed 105 frames
2024-11-20 20:23:04,235 - imdclient.IMDClient - INFO - Parsed 105 frames
2024-11-20 20:25:14,369 - imdclient.IMDClient - INFO - Parsed 106 frames
2024-11-20 20:25:14,369 - imdclient.IMDClient - INFO - Parsed 106 frames
2024-11-20 20:25:14,369 - imdclient.IMDClient - INFO - Parsed 106 frames
2024-11-20 20:26:32,546 - imdclient.IMDClient - INFO - Parsed 76 frames
2024-11-20 20:26:32,546 - imdclient.IMDClient - INFO - Parsed 76 frames
2024-11-20 20:26:32,546 - imdclient.IMDClient - INFO - Parsed 76 frames
2024-11-20 20:26:32,546 - imdclient.IMDClient - INFO - Parsed 76 frames
2024-11-20 20:32:05,845 - imdclient.IMDClient - INFO - Parsed 608 frames
2024-11-20 20:32:43,482 - imdclient.IMDClient - INFO - Parsed 455 frames
2024-11-20 20:32:43,482 - imdclient.IMDClient - INFO - Parsed 455 frames
2024-11-20 20:33:42,577 - imdclient.IMDClient - INFO - Parsed 446 frames
2024-11-20 20:33:42,577 - imdclient.IMDClient - INFO - Parsed 446 frames
2024-11-20 20:33:42,577 - imdclient.IMDClient - INFO - Parsed 446 frames
2024-11-20 20:39:16,276 - imdclient.IMDClient - INFO - Parsed 522 frames
2024-11-20 20:39:42,412 - imdclient.IMDClient - INFO - Parsed 260 frames
2024-11-20 20:39:42,412 - imdclient.IMDClient - INFO - Parsed 260 frames
2024-11-21 06:49:48,501 - imdclient.IMDClient - INFO - Parsed 1913 frames
2024-11-21 06:55:35,490 - imdclient.IMDClient - INFO - Parsed 844 frames
2024-11-21 06:56:13,066 - imdclient.IMDClient - INFO - Parsed 103 frames
2024-11-21 06:56:13,066 - imdclient.IMDClient - INFO - Parsed 103 frames
2024-11-21 06:57:09,594 - imdclient.IMDClient - INFO - Parsed 604 frames
2024-11-21 06:57:09,594 - imdclient.IMDClient - INFO - Parsed 604 frames
2024-11-21 06:57:09,594 - imdclient.IMDClient - INFO - Parsed 604 frames
2024-11-21 06:57:09,594 - imdclient.IMDClient - INFO - Parsed 604 frames
2024-11-21 07:13:06,546 - imdclient.IMDClient - INFO - Parsed 171 frames
2024-11-21 07:13:06,546 - imdclient.IMDClient - INFO - Parsed 171 frames
2024-11-21 07:13:06,546 - imdclient.IMDClient - INFO - Parsed 171 frames
2024-11-21 07:13:06,546 - imdclient.IMDClient - INFO - Parsed 171 frames
2024-11-21 07:13:06,546 - imdclient.IMDClient - INFO - Parsed 171 frames
2024-11-21 07:32:22,935 - imdclient.IMDClient - INFO - Parsed 448 frames
2024-11-21 07:32:22,935 - imdclient.IMDClient - INFO - Parsed 448 frames
2024-11-21 07:32:22,935 - imdclient.IMDClient - INFO - Parsed 448 frames
2024-11-21 07:32:22,935 - imdclient.IMDClient - INFO - Parsed 448 frames
2024-11-21 07:32:22,935 - imdclient.IMDClient - INFO - Parsed 448 frames
2024-11-21 07:32:22,935 - imdclient.IMDClient - INFO - Parsed 448 frames
2024-11-21 07:43:08,295 - imdclient.IMDClient - INFO - Parsed 104 frames
2024-11-21 07:43:08,295 - imdclient.IMDClient - INFO - Parsed 104 frames
2024-11-21 07:43:08,295 - imdclient.IMDClient - INFO - Parsed 104 frames
2024-11-21 07:43:08,295 - imdclient.IMDClient - INFO - Parsed 104 frames
2024-11-21 07:43:08,295 - imdclient.IMDClient - INFO - Parsed 104 frames
2024-11-21 07:43:08,295 - imdclient.IMDClient - INFO - Parsed 104 frames
2024-11-21 07:43:08,295 - imdclient.IMDClient - INFO - Parsed 104 frames
2024-11-21 07:43:41,155 - imdclient.IMDClient - INFO - Parsed 281 frames
2024-11-21 07:43:41,155 - imdclient.IMDClient - INFO - Parsed 281 frames
2024-11-21 07:43:41,155 - imdclient.IMDClient - INFO - Parsed 281 frames
2024-11-21 07:43:41,155 - imdclient.IMDClient - INFO - Parsed 281 frames
2024-11-21 07:43:41,155 - imdclient.IMDClient - INFO - Parsed 281 frames
2024-11-21 07:43:41,155 - imdclient.IMDClient - INFO - Parsed 281 frames
2024-11-21 07:43:41,155 - imdclient.IMDClient - INFO - Parsed 281 frames
2024-11-21 07:43:41,155 - imdclient.IMDClient - INFO - Parsed 281 frames
2024-11-21 08:08:23,598 - imdclient.IMDClient - INFO - Parsed 794 frames
2024-11-21 08:08:23,598 - imdclient.IMDClient - INFO - Parsed 794 frames
2024-11-21 08:08:23,598 - imdclient.IMDClient - INFO - Parsed 794 frames
2024-11-21 08:08:23,598 - imdclient.IMDClient - INFO - Parsed 794 frames
2024-11-21 08:08:23,598 - imdclient.IMDClient - INFO - Parsed 794 frames
2024-11-21 08:08:23,598 - imdclient.IMDClient - INFO - Parsed 794 frames
2024-11-21 08:08:23,598 - imdclient.IMDClient - INFO - Parsed 794 frames
2024-11-21 08:08:23,598 - imdclient.IMDClient - INFO - Parsed 794 frames
2024-11-21 08:08:23,598 - imdclient.IMDClient - INFO - Parsed 794 frames
2024-11-21 08:23:24,180 - imdclient.IMDClient - INFO - Parsed 3126 frames
2024-11-21 08:37:03,919 - imdclient.IMDClient - INFO - Parsed 3126 frames
Binary file added gromacs-demos/msd/mda.tpr
Binary file not shown.
30 changes: 30 additions & 0 deletions gromacs-demos/msd/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

echo "setting GROMACS version"
source /scratch/hcho96/Research/imd-v3/gromacs-imd-v3/bin/GMXRC

#if [ ! -f libvdos.so ]; then
#echo "compiling C libraries"
#gcc -O3 -fopenmp -fpic -lgsl -lgslcblas -c vdos.c
#gcc -L/home/hcho96/.conda/envs/imdreader-test/lib -I/home/hcho96/.conda/envs/imdreader-test/include -O3 -fopenmp -fpic -lgsl -lgslcblas -c vdos.c
#gcc -shared -lgomp -lgsl -lgslcblas vdos.o -o libvdos.so
#gcc -L/home/hcho96/.conda/envs/imdreader-test/lib -I/home/hcho96/.conda/envs/imdreader-test/include -shared -lgomp -lgsl -lgslcblas vdos.o -o libvdos.so
#fi

mkdir -p imd
cd imd
if [ ! -f topol.tpr ]; then
echo "running grompp"
gmx grompp -f ../imd.mdp -c ../start.gro -p ../topol.top -o >& grompp.out
fi
echo "starting mdrun"
echo ""
echo "**************************************************************"
echo "wait a few seconds, then:"
echo "run (in separate terminal): python demo.py"
echo "**************************************************************"
echo ""
# modify gromacs execution string according to available resources
# here we use 2 parallel threads
gmx mdrun -v -nt 12 -imdwait -imdport 8891
cd ..
Loading