Skip to content

Instantly share code, notes, and snippets.

View Steboss's full-sized avatar

Steboss Steboss

View GitHub Profile
@Steboss
Steboss / Cython_call.pyx
Created March 27, 2018 10:50
Cython code to call the C function
cpdef rectangle(np.ndarray[double, ndim=3, mode="c"] boxes,
np.ndarray[double, ndim=2, mode="c"] points):
#as input we have 2 arrays, one with the boxes cartesian coords
#the other with points cartesian coords (2D)
#mode C ensure you have a one D array
#boxes and points generated in python
#now we need C to compute the number of points within the rectangle
#transform into memory view the arrays
B, M = boxes.shape[0], boxes.shape[1]*2 #B number of rectangles, M rect coords
N, y = points.shape[0], points.shape[1]
@Steboss
Steboss / Makefile
Created March 27, 2018 10:54
Makefile to compile Cython and C codes
all:
cython rect_in.pyx
gcc -g -O3 -fpic -c rect_in.c `python-config --cflags` -std=c99
gcc rect_in.o -o rect_in.so -shared `python-config --ldflags` -std=c99
@Steboss
Steboss / Kendall_tau.c
Created March 27, 2018 11:59
Kendall tau implementation in C
double kendalT(double *x, int len_x, double * y, int len_y)
{
//the two array MUST be have the same length
int n2=0, n1=0, k, j;
int is =0;
double aa, a2, a1;
for(j=1;j<len_x;j++){
for(k=(j+1);k<=len_x;k++){
a1=x[j]-x[k];
@Steboss
Steboss / Benchmark.csv
Created March 27, 2018 12:23
Not efficient Kendall tau calculation
# values Cython Python
100 0.01 s 0.01 s
10k 0.16 s 0.80 s
100k 27.89 10.22 s
@Steboss
Steboss / mbar.csv
Created April 6, 2018 13:47
CBC-G4 mbar tests
Phase Process Analysis No Subsampling Subsampling
Bound Discharge MBAR -51.99 -51.95
Bound Discharge TI -51.97 -52.11
Bound Vanish MBAR -3.39 -30.80
Bound Vanish TI -17.32 -10.06
Free Discharge MBAR -62.63 -62.65
Free Discharge TI -62.60 -62.54
Free Vanish MBAR -37.74 -40.13
Free Vanish TI -39.67 -40.44
Phase Process Analysis No Subsampling Subsampling
Bound Discharge MBAR -51.99 -51.95
Bound Discharge TI -51.97 -52.11
Bound Vanish MBAR -30.39 -30.80
Bound Vanish TI -17.32 -10.06
Free Discharge MBAR -62.63 -62.65
Free Discharge TI -62.60 -62.54
Free Vanish MBAR -37.74 -40.13
Free Vanish TI -39.67 -40.44
SAMPL6 Bound Phase NaCl 1 3 4
Free Phase NaCl 1 -4.76 -3.10 -7.60
3 -5.40 -3.75 -8.24
4 -5.50 -3.84 -8.34
NaCl Content Bound 1 Bound 3 Bound 4
Free 1 -4.76 -3.10 -7.60
Free 3 -5.40 -3.75 -8.24
Free 4 -5.50 -3.84 -8.34
NaCl Content Bound 1 Bound 3 Bound 4
Free 1 -8.15 -4.04 -7.33
Free 3 -8.94 -4.74 -8.12
Free 4 -9.06 -4.93 -8.23
Solute AMBER CHARMM GROMACS SOMD
methane 2.47(1) 2.48(1) 2.44(1) 2.52(2)
methanol -3.73(1) -3.71(1) -3.51(1) -3.70(5)
ethane 2.50(1) 2.50(1) 2.48(1) 2.56(1)
toluene -0.72(1) -0.64(1) -0.72(1) -0.55(2)
neopentane 2.61(1) 2.58(1) 2.63(1) 2.71(6)
2-methylfuran -0.49(1) -0.42(1) -0.51(1) -0.39(2)
2-methylindole -6.24(2) -6.05(1) -6.35(1) -6.06(3)
2-CPI -6.05(3) -6.17(3) -6.54(1) -6.14(9)
7-CPI -5.66(3) -6.27(2) -6.52(2) -6.10(9)