Skip to content

Instantly share code, notes, and snippets.

View kyleabeauchamp's full-sized avatar

Kyle Beauchamp kyleabeauchamp

View GitHub Profile
import numpy as np
from scipy.optimize.minpack import _lazywhere, _relerr
def fixed_point_zhou(func, x0, args=(), xtol=1E-14, maxiter=100000, p=6, rcond=1E-6):
"""
Find a fixed point of the function.
Given a function of one or more variables and a starting point, find a
fixed-point of the function: i.e. where ``func(x0) == x0``.
import simtk.openmm.app as app
import numpy as np
import simtk.openmm as mm
from simtk import unit as u
from openmmtools import integrators, testsystems
temperature = 300 * u.kelvin
testsystem = testsystems.WaterBox()
@kyleabeauchamp
kyleabeauchamp / script
Created November 19, 2014 21:29
script.sh
#!/bin/bash
#set -x
# Shows you the largest objects in your repo's pack file.
# Written for osx.
#
# @see http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
# @author Antony Stubbs
# set the internal field spereator to line break, so that we can iterate easily over the verify-pack output
@kyleabeauchamp
kyleabeauchamp / selection.py
Created November 16, 2014 15:59
mdtraj selection
import mdtraj as md
import simtk.openmm.app as app
import pdbfixer
fixer = pdbfixer.PDBFixer(pdbid='4fmu')
fixer.findMissingResidues()
fixer.findNonstandardResidues()
fixer.replaceNonstandardResidues()
fixer.findMissingAtoms()
fixer.addMissingAtoms()
@kyleabeauchamp
kyleabeauchamp / out.txt
Last active August 29, 2015 14:06
MPI Tests
-bash-4.1$ cat mpitest.o2365443
3,2,1
3,2,1
3,2,1
3,2,1
gpu-1-4.local
gpu-1-4.local
gpu-1-4.local
gpu-1-5.local
grep: /var/spool/torque/aux/2365443.mskcc-fe1.localgpu: No such file or directory
@kyleabeauchamp
kyleabeauchamp / test_mdtraj_on_pdb.py
Last active August 29, 2015 14:05
Test MDTraj on PDB
import os
import mdtraj as md
import gzip
import tempfile
import glob
directories = glob.glob("./all_pdb/*")
for directory in directories:
filenames = glob.glob("%s/*.gz" % directory)
for filename in filenames:
@kyleabeauchamp
kyleabeauchamp / bench.py
Last active August 29, 2015 14:05
MBAR benchmark with lots of empty states
import pandas as pd
import numpy as np
import pymbar
samples_per_state = 250
n_states = 100
rates = np.linspace(1, 3, n_states)
N_k = np.ones(n_states, 'int') * samples_per_state
n_samples = n_states * samples_per_state
@kyleabeauchamp
kyleabeauchamp / dipole.py
Created July 2, 2014 22:15
calculate dipole moment
import mdtraj as md
import numpy as np
def dipole_moment(traj, charges):
"""Compute the dipole moment of an MDTraj object."""
xyz = md.compute_displacements(traj, np.array([[0, i] for i in range(traj.n_atoms)])).astype('float')
return xyz.transpose(0, 2, 1).dot(charges)
This file has been truncated, but you can view the full file.
<?xml version="1.0" ?>
<State time="0" type="State" version="1">
<PeriodicBoxVectors>
<A x="8.294880307685814" y="0" z="0" />
<B x="0" y="8.294880307685814" z="0" />
<C x="0" y="0" z="8.294880307685814" />
</PeriodicBoxVectors>
<Parameters MonteCarloPressure="1.01325" />
<Energies KineticEnergy="143998.28275239374" PotentialEnergy="23807.646244278643" />
<Positions>
@kyleabeauchamp
kyleabeauchamp / ExperimentalData.ipynb
Last active August 29, 2015 13:57
Examples for EXPT data
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.