Skip to content

Instantly share code, notes, and snippets.

View jarvist's full-sized avatar

Jarvist Moore Frost jarvist

View GitHub Profile
# Physics Constants for electronic structure + stat physics
# defined as const to help with type stability
# 2016-07 - Updated accuracy from https://github.com/DataWookie/PhysicalConstants.jl
const c = 2.99792458e8; # m / s # speed of light in this universe
#const G = 6.673e-11; # m^3 / kg s^2
const h= 6.62606896e-34; # kg m^2 / s
const hbar = const ħ = 1.05457162825e-34; # kg m^2 / s
const eV = const q = const ElectronVolt = 1.602176487e-19; # kg m^2 / s^2
const MassElectron = 9.10938188e-31; # kg
@jarvist
jarvist / raman.sh
Created January 1, 2012 15:19
Tiny awk-driven shell script to extract Raman frequencies + Activity from a Gaussian (quantum chemical program) .log output file.
#!/usr/bin/awk -f
BEGIN{j=0
a=0}
{
if (($1=="Frequencies"))
{
freq[j]=$3
j++
freq[j]=$4
j++
@jarvist
jarvist / furthest.py
Created May 27, 2013 13:22
What are the distances to the furthest reaches of Draenen?
# Requires: https://github.com/speleo3/inkscape-speleo/blob/master/extensions/survex.py by Thomas Holder
from survex import Survex3D
#This is the Oxford Draenen data:
# http://www.oucc.org.uk/DraenenSurvey/
mig=Survex3D('OD2.3d')
for destination in 'wiggly2.1','luck3.19','rifleman.1','pow.44':
print "OD2 entrance.20 <> ",destination
length, path = mig.shortestpath('entrance.20',destination)
@jarvist
jarvist / employment.sh
Created May 9, 2013 08:04
A few lines that have sat at the end of my .bashrc for the last few years. Originally this warned me when my PhD was ending + the date I needed to submit my thesis, and as I passed into PostDoc purgatory, I use it to remind me how long I have till the end of the next contract. As a bonus, it works correctly once you've passed the deadline, infor…
theend=` date --date "30 December 2013 17:00" +%s `
now=` date +%s `
diff=` expr $theend - $now `
echo "Really Unemployed in: " `expr $diff / 86400` days `expr \( $diff % 86400 \) / 3600` hours `expr \( \( $diff % 86400 \) % 3600 \) / 60` minutes `expr $diff % 60` seconds.
@jarvist
jarvist / northern_caves_cavemapsorg_etrex_6char_pack.gpx
Created October 29, 2012 18:20
Repack of the CaveMaps 2009 Northern Caves entrance GPS waypoints for old (eTrex, Gecko) 6-char only GPSes.
<gpx version="1.1" xmlns="http://www.topografix.com/GPX/1/1">
<wpt lat="54.164537" lon="-2.026381">
<name>DowCav</name>
</wpt>
<wpt lat="54.098515" lon="-1.974449">
<name>Fossil</name>
</wpt>
@jarvist
jarvist / sysmig_vrtnarija.err
Created October 15, 2012 20:10
Survey Errors, Sysmig / Vrtnarija 2012 data
Original length 12.87m ( 1 legs), moved 0.49m ( 0.49m/leg). Error 3.79%
Original length 17.43m ( 1 legs), moved 0.19m ( 0.19m/leg). Error 1.10%
Original length 21.24m ( 1 legs), moved 0.46m ( 0.46m/leg). Error 2.17%
Original length 5.98m ( 1 legs), moved 0.02m ( 0.02m/leg). Error 0.34%
Original length 13.45m ( 2 legs), moved 0.57m ( 0.28m/leg). Error 4.22%
Original length 21.15m ( 2 legs), moved 0.33m ( 0.16m/leg). Error 1.56%
Original length 26.66m ( 2 legs), moved 0.13m ( 0.06m/leg). Error 0.48%
Original length 32.36m ( 2 legs), moved 0.00m ( 0.00m/leg). Error 0.00%
Original length 23.05m ( 3 legs), moved 0.36m ( 0.12m/leg). Error 1.56%
Original length 50.81m ( 3 legs), moved 0.00m ( 0.00m/leg). Error 0.00%
#!/usr/bin/env python
# Version 1.5
# one dimensional chain
# Copyright under GNU General Public License 2010, 2012
# by Sinisa Coh and David Vanderbilt (see gpl-pytb.txt)
from pytb import * # import TB model class
import pylab as pl
@jarvist
jarvist / FOOTER
Created August 24, 2012 08:57
Build NWCHEM job from Gaussian logfile via extraction of Cartesian coords
for i #in */*.out
do
# echo -n "${i}"
#'sed -n 1p' will print 1st line, etc.
ELECTRONS=` grep "No. of electrons :" "${i}" | sed -n 1p | awk '{print $5/2}' `
#OK, this is now orbitals, not electrons (i.e. #electrons / 2)
ENERGY=` grep "Total DFT energy" "${i}" | sed -n 1p | awk '{print $5}' `
CAM=` grep " cam " "${i}" | sed -n 1p | awk '{print $2}' `
@jarvist
jarvist / AAA - Update 2014
Last active October 6, 2015 02:48
Vague notes written on upload - scripts to calculate Reorganisation Energies with Gaussian
Forgot about this gist, and made a full blown GitHub repo separately:- https://github.com/jarvist/polaron-lambda
Slight edits to allow more easy Method for the E calculations, a version to work from .log files rather than checkpoints, and a better description (perhaps).
Consider this Gist obsolete.