Skip to content

Instantly share code, notes, and snippets.

@wpoely86
wpoely86 / analyse-x86
Created March 13, 2014 08:58
Counts vectors instructions in binary
#!/usr/bin/perl -w
use strict;
### Identify instruction sets used in a binary file. ###
# Tavis Ormandy <[email protected]> 2003
# Improvments by Will Woods <[email protected]>
# Perl convertion by Georgi Georgiev <[email protected]>
# Updated by Ryan Hill <[email protected]>
# Updated by Ward Poelmans <[email protected]> 2009
@wpoely86
wpoely86 / libspatialite patch
Created April 2, 2014 09:51
Fix small bug in configure.ac of libspatialite. You need to run `autoreconf` after applying this patch.
diff -urN libspatialite-4.1.1.orig/configure.ac libspatialite-4.1.1/configure.ac
--- libspatialite-4.1.1.orig/configure.ac 2013-06-29 08:53:15.000000000 +0200
+++ libspatialite-4.1.1/configure.ac 2014-04-02 11:37:56.484423000 +0200
@@ -263,7 +263,7 @@
LIBS="$GEOS_LDFLAGS"
AC_SEARCH_LIBS(GEOSTopologyPreserveSimplify,geos_c,,AC_MSG_ERROR([could not find libgeos_c - you may need to specify the directory of a geos-config file using --with-geosconfig]))
LIBS="$LIBS_SAVE"
- LIBS=$LIBS$GEOS_LDFLAGS' -lgeos_c'
+ LIBS="$LIBS $GEOS_LDFLAGS -lgeos_c"
@wpoely86
wpoely86 / arpack.cpp
Created June 18, 2014 10:22
arpack usage example
double arpackDiagonalize()
{
// dimension of the matrix
int n = dim;
// number of eigenvalues to calculate
int nev = 1;
// reverse communication parameter, must be zero on first iteration
int ido = 0;
@wpoely86
wpoely86 / diagonalize.cpp
Created June 20, 2014 08:50
use dsyevd to diagonalize
/**
* Helper for exact diagonalization: diagonalize the matrix given in mat with dimension dim, stores
* the eigenvalues in eigs and optionally the eigenvectors in mat
* @param dim the dimension of the matrix
* @param mat the actual matrix (size: dim*dim)
* @param eigs array of size dim to store eigenvalues
* @param calc_eigenvectors whether or not the calculate the eigenvectors
*/
void Diagonalize(int dim, double *mat, double *eigs, bool calc_eigenvectors)
{
@wpoely86
wpoely86 / Clebsch-Gordan.py
Created July 18, 2014 09:23
Generates Clebsch-Gordan coefficients and outputs it to html
#!/usr/bin/env python3
"""
Generates all Clebsh Gordan coefficients starting from a given j1 and j2 and
outputs a html file. How to use:
./Clebsch-Gordan.py 0.5 0.5 > output.html
Ward Poelmans <[email protected]> (2014)
"""
import sys
import numpy as np
@wpoely86
wpoely86 / input.dat
Last active August 29, 2015 14:05
mointegrals for PSI4
molecule BH {
B 0 0 0.0
H 0 0 2.328898308325
# symmetry c1
units au
}
set {
# exact ERI
SCF_TYPE PK
#include <libplugin/plugin.h>
#include "psi4-dec.h"
#include <libparallel/parallel.h>
#include <liboptions/liboptions.h>
#include <libmints/mints.h>
#include <libpsio/psio.h>
#include <hdf5.h>
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
@wpoely86
wpoely86 / README.md
Last active March 14, 2023 22:07
Diverging Stacked Bar Chart

Diverging Stacked Bar Chart

We create a diverging stacked bar chart to plot a 5 point Likert scale. There a lots of ways to plot a Likert scale but according to Robbins & Heiberger, a diverging stacked bar chart is the best and I agree.

I've used D3.js. There is also an R package by Robbins & Heiberger.

The original can be found at github

-----------------------------------------------------------------------
PSI4: An Open-Source Ab Initio Electronic Structure Package
PSI 4.0.0-beta5 Driver
J. M. Turney, A. C. Simmonett, R. M. Parrish, E. G. Hohenstein,
F. A. Evangelista, J. T. Fermann, B. J. Mintz, L. A. Burns, J. J. Wilke,
M. L. Abrams, N. J. Russ, M. L. Leininger, C. L. Janssen, E. T. Seidl,
W. D. Allen, H. F. Schaefer, R. A. King, E. F. Valeev, C. D. Sherrill,
and T. D. Crawford, WIREs Comput. Mol. Sci., (2011) (doi: 10.1002/wcms.93)
@wpoely86
wpoely86 / sointegrals.cc
Created February 11, 2015 15:19
SO integrals for PSI + CheMPS2
#include <libplugin/plugin.h>
#include "psi4-dec.h"
#include <libparallel/parallel.h>
#include <liboptions/liboptions.h>
#include <libmints/mints.h>
#include <libmints/sointegral_twobody.h>
#include <libpsio/psio.h>
#include <hdf5.h>