1.02.2010

Snappy Holla-daze!

I'm not so much a grinch as just a guy that could really give a rats-ass about the holidays. In the end I like what I like about it, and that's not much...mostly just the food. After Thanksgiving, I usually cannot wait until January 2nd...that's today. Anyway, a bit has happened since I last blogged and I will try to summarize as I am watching the kids.

At school, my French colleague and two of the Asians have left. Also my Vermont friend is gone to go teach ski racing to teens, but plans to come back to write his thesis in April.

Much of my time has been split between writing my dissertation and playing with the new $40,000 computer cluster. It was assembled and configured by a gifted 22 y.o. UNH undergrad who did a really nice job. It consists of a head node and 6 compute nodes running OpenSuSE, each with 24gb memory and the newest, fastest intel nahelem procs in a dual-quad core configuration. The nodes are networked with gigabit up/down cables. That's about the extent of what I can remember. Of course it has a slew of useful computational chemistry packages.

Although I don't have any training in CS, I managed to piece together a useful python script based on a similar one that I used as a template...though I added a number of useful bits for my own preference. Here it is:


#!/usr/bin/python

import sys
import os
import commands
import datetime

print "*************************************************************\n**See g03jobLOG in Home Directory for Log of Jobs Submitted**\n************
*************************************************\n\nEnter the Following Information for Your Gaussian Calculation:\n"

xyzFile = raw_input("Enter .xyz File Name (omit extension) > ")
uniqueID = raw_input("Enter Unique Identifier (no spaces; optional) > ")
g03root = raw_input("Enter Root Section (#) > ")
charge = raw_input("Enter Charge > ")
multiplicity = raw_input("Enter Multiplicity > ")
title = raw_input("Enter Title; optional > ")
queue = raw_input("Enter Queue (short (s) or long (l)) > ")

if uniqueID == "":
UID = ""
else:
UID = "_"+uniqueID

if queue == "s":
SGEQ = "short"
if queue == "l":
SGEQ = "long"

if title == "":
title = xyzFile+" / "+uniqueID

f = open(""+xyzFile+UID+".com", 'w')
f.write("%chk=/tmp1/"+xyzFile+UID+".chk \n")
f.write("%mem=20gb \n")
f.write("%nprocshared=8 \n")
f.write("%nproclinda=1 \n")
f.write("# "+g03root+" \n")
f.write(" \n")
f.write(" "+title+" \n")
f.write(" \n")
f.write(charge+" "+multiplicity+" \n")
f.close()

inp = open(""+xyzFile+".xyz", "r")
outp = open(""+xyzFile+UID+".com", "a")

for line in inp:
outp.write(line)

inp.close()
outp.close()

lines = open(""+xyzFile+UID+".com", "r")
list = lines.readlines()
lines.close()

del list[9:10+1]

fout = open(""+xyzFile+UID+".com", "w")
fout.writelines(list)
fout.write("\n")
fout.close()

print "Gaussian .com file ("+xyzFile+UID+".com) generated ... submitting"

jobName = "g03job"

f = open(jobName, 'w')
f.write("#!/bin/csh \n")
f.write("#$ -S /bin/csh \n")
f.write("#$ -N "+xyzFile+UID+" \n")
f.write("#$ -q "+SGEQ+".q \n")
f.write("#$ -cwd \n")
f.write("source /opt/g03/environment.csh \n")
f.write("g03l "+xyzFile+UID+".com \n")
f.close()

#command to submit
task = "qsub "+jobName
subJob = commands.getstatusoutput(task)
log = "/home/"+os.environ["USER"]+"/Computation/g03jobLOG"
cwd = os.getcwd()
now = datetime.datetime.now()

if subJob[0] == 0:
print(subJob[1])
f = open(log, 'a')
f.write("\n")
f.write(subJob[1]+"...\n")
f.write("Job Directory: "+str(cwd)+"\n")
f.write("Submission Time: "+str(now)+"\n")
f.close()
else:
print("...Failed : "+subJob[1])
sys.exit(2)

To Summarize - this script conveniently takes user input and edits an XYZ coordinate file to generate the appropriate Gaussian .com input file. It then writes a jobscript , submits it to the SGE queue, and logs (appends) the date/time and directory in a single file.

At home, I have enjoyed running ubuntu 9.10 and hope to do some recording with it soon.