Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fabian-paul
fabian-paul / vamp_for_two.py
Last active August 13, 2019 15:50
Find the main kinetic dividing plane using the Variational Approach to Markov Processes (VAMP)
import numpy as np
import scipy
import scipy.optimize
import warnings
__all__ = ['VAMP42']
__author__ = 'Fabian Paul <fapa@uchicago.edu>'
def sigma(x):
return scipy.special.expit(x)
@fabian-paul
fabian-paul / TRAM-short-presentation.pdf
Last active August 19, 2019 20:40
slides: Estimating transition rates of ultimate rare events using the transition-based reweighting analysis method (TRAM)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fabian-paul
fabian-paul / colvars_def_reader.py
Last active October 16, 2019 16:13
Reads some NAMD colvar defintions in Python
import pyparsing as pp
from pyparsing import pyparsing_common as ppc
__all__ = ['load_colvars', 'handle_colvars']
pp.ParserElement.setDefaultWhitespaceChars(' \t')
vector = pp.Group(pp.Literal('(').suppress() +
pp.delimitedList(ppc.number, delim=',') +
pp.Literal(')').suppress())
@fabian-paul
fabian-paul / strip_most_water.py
Last active March 9, 2020 23:16
delete all water molecules from MD trajectory, except molecules close to ligand
#!/usr/bin/env python
import numpy as np
import mdtraj
def tl(filename, chunk=100):
with mdtraj.open(filename, mode='r') as fh:
try:
return (len(fh) - 1) // chunk + 1
except:
@fabian-paul
fabian-paul / induced_fit_parameter_inference.ipynb
Created March 27, 2020 18:04
parameter inference for kinetic model using HMC
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fabian-paul
fabian-paul / mutate.py
Last active April 5, 2020 08:18
Generate trajectories for computational alanine scan (mass generation of mutant structures)
import numpy as np
import mdtraj
import os
import os.path
import argparse
def prepare_maps(mut_pdb='mutant.pdb', wt_pdb=None):
if wt_pdb is None:
wt_pdb = os.path.expanduser('~/system/crystal.pdb')
@fabian-paul
fabian-paul / sort_real_schur.py
Last active May 31, 2020 21:08
Python code for sorting real Schur forms based on the original work of Jan Brandts http://dx.doi.org/10.1002/nla.274
# Python version of the following original work:
# Title: Sorting Real Schur Forms
# Author: Jan Brandts
# E-Mail: brandts-AT-science.uva.nl
# http://m2matlabdb.ma.tum.de/download.jsp?MC_ID=3&MP_ID=119
# http://dx.doi.org/10.1002/nla.274
# Institution: University of Amsterdam
# Description: In Matlab 6, there exists a command to generate a real Schur form, wheras another transforms a real
# Schur form into a complex one. There do not exist commands to prescribe the order in which the eigenvalues appear on
# the diagonal of the upper (quasi-) triangular factor T.
@fabian-paul
fabian-paul / short_widest_path.c
Created July 30, 2020 07:53
An implementation of Dijkstra's algorithm for the shortest path, the widest path, and an "interpolation" between shortest and widest path.
#include <math.h>
#include <stddef.h>
#include <signal.h>
#include <assert.h>
static volatile sig_atomic_t interrupted;
static void (*old_handler)(int);
static void signal_handler(int signo) {
interrupted = 1;