Skip to content

Instantly share code, notes, and snippets.

View jarvist's full-sized avatar

Jarvist Moore Frost jarvist

View GitHub Profile
@jarvist
jarvist / launch_coms.sh
Created March 27, 2012 14:04
Latest version of Jarv's scripts to automatically launch Electronic Structure (Gaussian and NWCHEM) jobs on CX1 of Imperial College London's HPC
#!/bin/sh
#Automagic .com CX1 (Imperial College London HPC) job submitter. A WIP.
#JMF 2007-09
#Bash is a stranger in an open car...
#2012-04-27: Finally got around to adding single CPU defaults (for quick semi-empirical QC)
#2012-06-19: Merged in 'these are my options' echo from the NWCHEM branch of this script, as it is well useful
#Get Options
@jarvist
jarvist / launch_tpr.sh
Created March 27, 2012 14:07
Launch Gromacs jobs (TPRs) on CX1 of the HPC at Imperial College London
#!/bin/sh
#Automagic .com CX1 job submitter. A WIP.
#JMF 2007-09
#Bash is a stranger in an open car...
#Get Options
NCPUS=8
MEM=11800mb #Simon Burbidge correction - lots of nodes with 12GB physical memory, leaves no overhead for OS
@jarvist
jarvist / r4
Created March 29, 2012 13:45
Play Radio 4 from the command line, linux
#!/bin/sh
mplayer -playlist "http://bbc.co.uk/radio/listen/live/r4.asx"
#Nb: also replace with r4x, r6 etc.
#Also you can write get the script to ask for the stream with the same name as
# it's called with (i.e. ${0}) and then generate a load of sym-links from r4/r4x/r6 to this script
@jarvist
jarvist / filthy_html_email_stripper.sh
Created April 25, 2012 21:28
#Strip emails from mediauk via some horrific re hacks + direct parsing of HTML.
#Strip emails from mediauk via some horrific re hacks + direct parsing of HTML.
# Their site breaks Beautiful Soup :(
#B wants all the email addresses in this linked to page
wget -O - "http://www.mediauk.com/tags/local" | sed 's/>/\n/g' | grep "href" | cut -f2 -d\' | grep "^\/" > urls.list
#I think I manually deleted the false ones in the top + bottom of urls.list
for URL in ` cat urls.list `
do
echo -n "${URL} "
@jarvist
jarvist / pi.c
Created April 27, 2012 17:41
Generates a 'pi trumpet' with circles coloured by the base 12 digits of Pi, circles shrinking as you go along the series.
/* C99 so compile with 'c99 -o pi pi.c'
/* From http://www.codecodex.com/wiki/Calculate_digits_of_pi#C */
#include "stdio.h"
#include "stdlib.h"
//now generates in base 12...
#define SCALE 12 //4096 //8*8*8*8
#define ARRINIT 2 //1024
@jarvist
jarvist / better_convolve.py
Last active October 4, 2015 03:18
(incorrect) and badly written convolve wavelength function for simulating absorb. spectra
import fileinput
import numpy as np
#expects input as:
#Energy(eV) Lambda(nm) OscillatorStrength
oscillators=[]
for line in fileinput.input():
oscillators.append(map(float, line.split()))
#print oscillators
@jarvist
jarvist / generate_gaussian_gnuplots.awk
Created May 1, 2012 16:09
Generates Gaussians from a set of Dirac Delta inputs, to simulate vibrational / experimental broadening, Currently designed for raman spectra
#!/usr/bin/awk -f
#Generates Gaussians from a set of Dirac Delta inputs, to simulate vibrational / experimental broadening
#Currently designed for raman spectra
BEGIN{
}
{
c=0.1
if ($2>10.0)
@jarvist
jarvist / qjobs.sh
Created May 9, 2012 18:06
Checks out your jobs running + queued on HPC, and guesses GFLOPS.
#!/bin/sh
qstat > ~/q.tmp
running=` grep \ R\ ~/q.tmp | wc -l `
qd=` grep \ Q\ ~/q.tmp | wc -l `
echo "My Jobs: ${running} running, ${qd} queued."
echo
@jarvist
jarvist / projectorator.awk
Created May 11, 2012 10:42
File to explode a PBC Translation Vector Gaussian .com file into separate TV molecular pair com files. Nb: Known bug of print rounding distances to whole number, breaking Gaussian.
#! /bin/awk -f
#Filthy hack to project a 'pair' of molecules by reading the TV vectors from a .com file
#~Jarv 2012-05-10
BEGIN{
}
{
if ($1=="0")
{
@jarvist
jarvist / b3lyp_jobs_and_shell_script_from_pdb.sh
Created May 16, 2012 12:23
Automatic job to calculate transfer integrals from a 'molecular pair' PACKMOL generated PDB file, for the HPC/CX1.
for file
do
#separate out A and B molecules
grep -v "UNK B" "${file}" > A.pdb
grep -v "UNK A" "${file}" > B.pdb
#Now we have coords of both in $file, molecule A in A.pdb and B in B.pdb
babel -ipdb A.pdb -ogau "${file%.*}_A.com"
babel -ipdb B.pdb -ogau "${file%.*}_B.com"
babel -ipdb "${file}" -ogau "${file%.*}_AB.com"