Skip to content

Instantly share code, notes, and snippets.

View jrhaberstroh's full-sized avatar

John H. jrhaberstroh

  • Upstart
  • Oakland, CA
View GitHub Profile
@jrhaberstroh
jrhaberstroh / MDAnalysis modify atom file
Last active February 22, 2017 06:24
Simple MDAnalysis script to read in coordinates, modify them, and write them back out
from MDAnalysis import *
filename_in ="fakefile_{}.gro".format("in")
filename_out="fakefile_{}.gro".format("out")
ref = Universe(filename)
R = [[1, 0, 0], [0, 0, 1], [0, 1, 0]]
ref.atoms.translate(-ref.atoms.center_of_mass())
ref.atoms.rotate(R)
@jrhaberstroh
jrhaberstroh / aminoacid_dihedrals.txt
Last active July 25, 2016 01:14
Ordered list of atomtypes from amino acid residues. Can be used to construct all sidechain dihedral angles.
# Names of atom types involved in dihedral angles for amino acids.
# Atom names based on conventions from GROMACS 4.6.7 amber99sb-ildn.ff/aminoacids.rtp
ARG C CA CB CG CD NE CZ NH1
LYS C CA CB CG CD CE NZ
MET C CA CB CG SD CE
GLU C CA CB CG SD OE1
GLN C CA CB CG SD OE1
ILE C CA CB CG1 CD
LEU C CA CB CG CD1
ASP C CA CB CG OD1
#!/bin/bash
help()
{
sed --silent -e '/^: <<.*HELPDOC/,/^HELPDOC$/p' ${BASH_SOURCE[0]} | tail -n+2 | head -n-1
}
SRCDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
: <<'HELPDOC'
#!/bin/bash
help()
{
sed --silent -e '/^: <<.*HELPDOC/,/^HELPDOC$/p' ${BASH_SOURCE[0]} | tail -n+2 | head -n-1
}
SRCDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
: <<'HELPDOC'
# START: SAFESAVEPLOT
if not args.o is None:
import matplotlib
matplotlib.use("agg")
import matplotlib.pyplot as plt
def safesaveplot(out=None, suffix=None, transparent=False, clf=True):
fig = plt.gcf()
if out:
plt.savefig(out+suffix, transparent=transparent)
if clf:
@jrhaberstroh
jrhaberstroh / pip_upgrade.sh
Created October 22, 2015 17:55
Upgrades all outdated python packages
#!/usr/bin/env bash
# ==============================================================================
usage() { cat <<- DOCUMENT
usage: pip_upgrade [-h] [3]
AUTHOR: Sang Han
CREATED: 08/23/2014
REVISION: 1.0