# HG changeset patch # User malex # Date 1348023781 14400 # Node ID ed472dc06c20a3ecd15eb6c277859f1a6d28824c # Parent 28ebcfcb10a2d816469300ced2adbb01d3f18e5d Uploaded 1.0.0 diff -r 28ebcfcb10a2 -r ed472dc06c20 gaussian.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gaussian.py Tue Sep 18 23:03:01 2012 -0400 @@ -0,0 +1,54 @@ +#/usr/bin/env python +""" +Copyright (C) 2012 +Ying Zhang and Oleksandr Moskalenko +University of Florida Research Computing + +This script checks the user permission for using gaussian software. +If permission is granted, it runs g09 with inputfile. + +It takes 2 command line options: + $name: the $__user_name__ template preset that corresponds to the real +username. + $inputfile: a input file for g09 +""" +import sys, os, shutil +from subprocess import Popen, PIPE + +if len(sys.argv) == 3: + name = sys.argv[1] + ginput = sys.argv[2] +else: + msg = "Error: wrong number of parameters provided.\n" + sys.stderr.write(msg) + sys.exit(1) + +command = "groups " + name + " | grep gaussian" +result = Popen([command], shell=True, stdout=PIPE, stderr=PIPE, close_fds=True) +stdout, stderr = result.communicate() +return_code = result.returncode +if return_code: + errmsg = "Error: only users in the gaussian group can use this software.\n" + sys.stdout.write(stdout) + sys.stderr.write(errmsg) + sys.stderr.write(stderr) + sys.stderr.write("Return error code %i from command:\n" % return_code) + sys.stderr.write("%s\n" % command) + sys.exit(2) +else: + if not os.path.exists('gaussian.com'): + shutil.copyfile(ginput, 'gaussian.com') + cmd = 'source /galaxy/run/dev/tools/chemistry/env.sh; g09 gaussian.com' + result = Popen([cmd], shell=True, stdout=PIPE, stderr=PIPE, close_fds=True) + stdout, stderr = result.communicate() + return_code = result.returncode + if return_code: + sys.stdout.write(stdout) + sys.stderr.write(stderr) + sys.stderr.write("Return error code %i from command:\n" % return_code) + sys.stderr.write("%s\n" % result) + sys.exit(1) + else: + sys.stdout.write(stdout) + sys.stdout.write(stderr) + sys.exit(0) diff -r 28ebcfcb10a2 -r ed472dc06c20 gaussian.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gaussian.xml Tue Sep 18 23:03:01 2012 -0400 @@ -0,0 +1,52 @@ + + + Computational Chemistry software for electronic structure modeling. + gaussian.py $__user_name__ $infile + + + + + + + + + + + + + + + +**Gaussian version g09** + +Gaussian is Electronic Structure Modeling Software. It has license restrictions. +To run it you must sign the Gaussian Confidentiality Agreement. The agreement +form is available in NPB 2238 during normal business hours. + + +Running Gaussian from Galaxy is currently in testing stage. Please report any +problems to the `UF HPC Support <http://support.hpc.ufl.edu>`_. + + +Batch job resource request can be specified at the beginning of the input file +as in the following example: + +%nproc=8 - number of cores (ppn). + +%mem=2000mb - memory size (pmem) can be set in kb, mb, gb, kw, mw, or gw. Words are used as the default. + +!walltime=12:00:00 - run time (walltime) in HH:MM:SS format. + + +Detailed information on program usage is available from `the Gaussian website <http://www.gaussian.com/>`_. + + diff -r 28ebcfcb10a2 -r ed472dc06c20 gaussian_datatype.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gaussian_datatype.xml Tue Sep 18 23:03:01 2012 -0400 @@ -0,0 +1,1 @@ + diff -r 28ebcfcb10a2 -r ed472dc06c20 gaussian_job_rules.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gaussian_job_rules.py Tue Sep 18 23:03:01 2012 -0400 @@ -0,0 +1,54 @@ +def gaussian(job): + inp_data = dict( [ ( da.name, da.dataset ) for da in job.input_datasets ] ) + inp_data.update( [ ( da.name, da.dataset ) for da in job.input_library_datasets ] ) + src_comfile = inp_data[ "infile" ].file_name + comfile = open(src_comfile, 'r') + ppn='1' + pmem = '900mb' + overhead = 200 + walltime = '11:59:59' + for line in comfile: + line = line.strip().lower() + if ( "%nproc=" in line): + try: + ppn = line.split('=')[1] + except Exception, e: + log.debug(e) + sys.stdout.write(e) + if ("%mem=" in line): + try: + mem_str = line.split('=')[1] + if ( "kb" in mem_str ): + mem_num = mem_str.split('kb')[0] + mem_num = int(int(mem_num) / 1024.0) + overhead + if ( "mb" in mem_str ): + mem_num = mem_str.split('mb')[0] + mem_num = int(mem_num) + overhead + elif ( "gb" in mem_str ): + mem_num = mem_str.split('gb')[0] + mem_num = (int(mem_num) * 1024) + overhead + elif ( "kw" in mem_str ): + mem_num = mem_str.split('kw')[0] + mem_num = int(int(mem_num) * 8 / 1024.0) + overhead + elif ( "mw" in mem_str ): + mem_num = mem_str.split('mw')[0] + mem_num = (int(mem_num) * 8) + overhead + elif ( "gw" in mem_str ): + mem_num = mem_str.split('gw')[0] + mem_num = (int(mem_num) * 8 * 1024) + overhead + else: + #Assume words + mem_num = int(int(mem_str) * 8 / 1024.0 / 1024.0) + overhead + pmem_num = int(mem_num / int(ppn)) + pmem = str(pmem_num) + 'mb' + except Exception, e: + log.debug(e) + sys.stdout.write(e) + if ("!walltime=" in line): + try: + walltime = line.split('=')[1] + except Exception, e: + log.debug(e) + sys.stdout.write(e) + request = "-l nodes=1:ppn=%s,pmem=%s,walltime=%s" % (ppn, pmem, walltime) + return 'drmaa://%s/' % request