Skip to content

Instantly share code, notes, and snippets.

View mpharrigan's full-sized avatar

Matthew Harrigan mpharrigan

View GitHub Profile
@mpharrigan
mpharrigan / violinplot-median.py
Created July 28, 2017 20:47
Violin plot with inner median
"""Violin plot with just the median drawn
By default, when plotting a split violin plot, the inner
box plot is for both splits. You can change this with `inner='quartile'`
to plot the quartiles for each split, but by default it uses a dashed
line (small dashes) for the 25 and 75-%ile and another dashed line
(big dashes) for the median, which is very ugly and cluttered.
This patching the `draw_quartiles` function to just draw the median
as a solid line.
@mpharrigan
mpharrigan / sherlock2.md
Last active March 28, 2017 01:17
Sherlock 2 benchmarks

12.2k atoms (cys-ala-val)

num where code what parallel speed (approx)
1 xstream amber K40 GPU on Xstream cuda 143
10 sherlock2 amber gcc 6 + openblas openmpi 28
10 sherlock2 amber icc 2017 + mkl openmpi (intel) 28
20 sherlock2 amber gcc 6 + openblas openmpi 40
20 sherlock2 amber icc 2017 + mkl openmpi (intel) 50
10 sherlock2 amber icc 2017 + mkl intel mpi 2.3 (something is probably wrong here)
@mpharrigan
mpharrigan / gist:c179a4b32f1f5fc8d8ee0b01c7353c1a
Last active March 20, 2017 20:52
Use VMD to rotate something
set M [transaxis z 45 deg]
$sel move $M
$sel writepdb file.pdb
@mpharrigan
mpharrigan / networkplot.py
Created February 15, 2017 21:56
network plot
def graph(weights, cutoff=1e-5):
trunc_weights = np.copy(weights)
# Remove transitions below the cutoff
if cutoff is not None:
trunc_weights[trunc_weights < cutoff] = 0.0
# Ignore self transitions
diag_inds = np.arange(len(weights))
CMakeFiles/TestCudaAmoebaTorsionTorsionForce.dir/TestCudaAmoebaTorsionTorsionForce.cpp.o: In function `testTorsionTorsion(int)':
/conda-dev-recipes/openmm/openmm/plugins/amoeba/platforms/cuda/tests/TestCudaAmoebaTorsionTorsionForce.cpp:2589: undefined reference to `OpenMM::System::System()'
/conda-dev-recipes/openmm/openmm/plugins/amoeba/platforms/cuda/tests/TestCudaAmoebaTorsionTorsionForce.cpp:2594: undefined reference to `OpenMM::LangevinIntegrator::LangevinIntegrator(double, double, double)'
/conda-dev-recipes/openmm/openmm/plugins/amoeba/platforms/cuda/tests/TestCudaAmoebaTorsionTorsionForce.cpp:2596: undefined reference to `OpenMM::AmoebaTorsionTorsionForce::AmoebaTorsionTorsionForce()'
/conda-dev-recipes/openmm/openmm/plugins/amoeba/platforms/cuda/tests/TestCudaAmoebaTorsionTorsionForce.cpp:2647: undefined reference to `OpenMM::AmoebaTorsionTorsionForce::addTorsionTorsion(int, int, int, int, int, int, int)'
/conda-dev-recipes/openmm/openmm/plugins/amoeba/platforms/cuda/tests/TestCudaAmoebaTorsionTorsio
@mpharrigan
mpharrigan / 1-ffmpeg.sh
Last active June 3, 2019 05:11
Make a quality movie using ffmpeg
ffmpeg -i molecule.%5d.ppm -c:v libx264 -preset slow -crf 18 molecule.mkv
# -i input filenames
# -c:v codec (libx264 --> H.264)
# -preset duh
# -crf quality factor, lower = better, 18 = practically lossless
# output filename
# For colors, make sure you're using yuv444 which should be the default in newer ffmpeg
@mpharrigan
mpharrigan / 0-basic.py
Created May 7, 2015 23:18
More Ideas for Datasets
ds = dataset("**/*.dcd", top='struct.pdb')
diheds = ds.fit_transform_with(DihedralFeaturizer(), 'diheds')
ticas = diheds.fit_transform_with(tICA(), 'ticas')
kmeans = KMeans(n_clusters=8)
clusters = ticas.fit_transform_with(kmeans, 'clusters')
msm = MSM().fit(clusters)
dump(msm, 'msm.pkl')
@mpharrigan
mpharrigan / 0-basic.py
Last active August 29, 2015 14:19
Potential msmbuilder workflow
# Basic usage / workflow
ds = dataset("**/*.dcd")
dihed = ds.derive('dihed', fmt='dir-npy')
dihed += DihedralFeaturizer().fit_transform(ds)
tica = dihed.derive('tica', fmt='hdf5')
tica += tICA().fit_transform(dihed)
clusters = tica.derive('clusters', fmt='hdf5')
from __future__ import print_function
import simtk.openmm as mm
import simtk.openmm.app as app
d = dict(base_dir="RUN2",
state='state.xml')
with open("{base_dir}/system.xml".format(**d)) as f:
system = mm.XmlSerializer.deserialize(f.read())
@mpharrigan
mpharrigan / gist:61ce6cf4caab5dcd2398
Last active August 29, 2015 14:18
Pull Structures
from mdtraj.formats.dcd import DCDTrajectoryFile
from mdtraj.formats.prmtop import load_prmtop
km = KMedoids(...)
# "centers" is a pandas DataFrame with metadata about each trajectory
# from which we are pulling structures
def get_top(struc):
return centers.query("structure == @struc")['top_fn'].iloc[0]