Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View rmcgibbo's full-sized avatar

Robert T. McGibbon rmcgibbo

View GitHub Profile
@rmcgibbo
rmcgibbo / Makefile
Created November 13, 2012 13:38
What is going on!!!!
all:
gcc -DHEADER client.c lib.c -o withheader
gcc client.c lib.c -o withoutheader
make an empty list called medoids
for cluster i:
let t be a trajectory containing all of the structures assigned to cluster i
let D = the full len(t) x len(t) pairwise RMSD distance matrix
set medoid[i] = argmin( rowsums (D) )
@rmcgibbo
rmcgibbo / rmagic.py
Created November 29, 2012 03:33
Easy/simplistic rpy2 wrapper -- simple version of IPython's RMagic for use outside of IPython
import numpy as np
import sys
import rpy2.rinterface as ri
import rpy2.robjects as ro
from rpy2.robjects.numpy2ri import numpy2ri
ro.conversion.py2ri = numpy2ri
from IPython.extensions.rmagic import RInterpreterError, Rconverter
from IPython.utils.py3compat import str_to_unicode, unicode_to_str, PY3
__all__ = ['r']
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rmcgibbo
rmcgibbo / hb.py
Last active December 11, 2015 16:29
hydrogen bond code
import numpy as np
from msmbuilder.metrics import AbstractDistanceMetric, Vectorized
# multithreaded distance and angle engines
from msmbuilder.geometry import angle, contact
import itertools
class HydrogenBond(Vectorized, AbstractDistanceMetric):
"""
Distance metric class for calculating distance between frames based
on their hydrogen bond contact maps, which are NON-SYMMETRIC matrices
@rmcgibbo
rmcgibbo / neb.py
Created January 30, 2013 03:51
Nudged Elastic Band in Python
from __future__ import division
import numpy as np
import IPython as ip
import matplotlib.pyplot as pp
import warnings
from collections import namedtuple
import scipy.optimize
#symbolic algebra
import theano
@rmcgibbo
rmcgibbo / gist:4693441
Created February 1, 2013 19:22
pbs python shim for embarrassingly parallel job execution
#!/bin/sh
# probably need to set up some PBS directives up here...
N_PROCS=4
# Set up a little python "shim" using mpi4py that farms
# out a set of command line commands to multiple nodes
# using MPI. This shim gets written to a little file
rm -f ./temp_shim.py
#!/bin/sh
# start up the controller on the main node
ipcontroller --ip="*" &
sleep 5
mpirun --hostfile $PBS_NODEFILE --bynode ipengine &
sleep 5