Skip to content

Instantly share code, notes, and snippets.

View cstein's full-sized avatar

Casper Steinmann cstein

View GitHub Profile
@cstein
cstein / GaH.log
Created April 20, 2012 12:58
code to parse the first atom of a dalton input file along with its basis set
****************************************************************************
*************** DALTON2011 - An electronic structure program ***************
****************************************************************************
This is output from DALTON Release Dalton2011 (Rev. 0, July 2011)
----------------------------------------------------------------------------
NOTE:
DALTON is an experimental code for the evaluation of molecular
properties using (MC)SCF, DFT, CI, and CC wave functions.
@cstein
cstein / exercise_1_start.py
Created May 2, 2012 13:48
Starting point of an MD simulation of non-interacting particles.
import random
import pylab as plt
npart = 100
nsteps = 10000
dt = 0.001
X = [random.random() for i in range(npart)]
Y = [2*(random.random()-0.5) for i in range(npart)]
@cstein
cstein / exercise_1_final.py
Created May 2, 2012 13:51
Solution of exercise 1
import random
import pylab as plt
npart = 100
nsteps = 10000
dt = 0.001
X = [random.random() for i in range(npart)]
Y = [2*(random.random() - 0.5) for i in range(npart)]
dX = [2*(random.random() - 0.5) for i in range(npart)]
@cstein
cstein / gist:2583990
Created May 3, 2012 07:23
updating particle coordinates
for i in range(npart)
X[i] = X[i] + dt*dX[i]
Y[i] = Y[i] + dt*dY[i]
@cstein
cstein / gist:2586660
Created May 3, 2012 15:42
keeping particles inside the box
if abs(X[i] + dt*dX[i])>1:
dX[i] = -dX[i]
if abs(Y[i] + dt*dY[i])>1:
dY[i] = -dY[i]
@cstein
cstein / Makefile
Created June 14, 2012 09:53
basic gui for simulation program
simulator_ui.py: simulator.ui
pyuic4 simulator.ui -o simulator_ui.py
clean:
rm -f *.pyc
@cstein
cstein / Makefile
Created June 26, 2012 18:53
basic threaded gui for simulation program
simulator_ui.py: simulator.ui
pyuic4 simulator.ui -o simulator_ui.py
clean:
rm -f *.pyc *~
@cstein
cstein / demo.py
Created July 5, 2012 03:16
Running a GAMESS calculation using an Open Babel molecule
from qm import Gamess
from util import loadOBMoleculeFromFile
mol = loadOBMoleculeFromFile('myfile.xyz')
method = Gamess(mol)
E = method.getEnergy()
print E
@cstein
cstein / aminoacids.py
Created August 8, 2012 12:57
Generating and depicting structures using the Open Babel API
def getAminoAcids(include_protonated=False):
molecules = dict()
molecules['GLY'] = 'NCC(=O)O'
molecules['ALA'] = 'NC(C)C(=O)O'
molecules['SER'] = 'NC(CO)C(=O)O'
molecules['THR'] = 'NC(C(C)O)C(=O)O'
molecules['CYS'] = 'NC(CS)C(=O)O'
molecules['VAL'] = 'NC(C(C)C)C(=O)O'
molecules['LEU'] = 'NC(CC(C)C)C(=O)O'
molecules['ILE'] = 'NC(C(C)CC)C(=O)O'
@cstein
cstein / center.sh
Created August 9, 2012 13:41
How to center a molecule from an MD-simulation in Gromacs
#!/usr/bin/env bash
TRAJIN=traj.xtc
TRAJOUT=trajfin.xtc
# delete the trajectory so gromacs wont display silly backup messages
if [ -e $TRAJOUT ]
then
rm -f $TRAJOUT
fi