Mercurial > repos > malex > gaussian
changeset 2:ed472dc06c20 draft default tip
Uploaded 1.0.0
author | malex |
---|---|
date | Tue, 18 Sep 2012 23:03:01 -0400 |
parents | 28ebcfcb10a2 |
children | |
files | gaussian.py gaussian.xml gaussian_datatype.xml gaussian_job_rules.py |
diffstat | 4 files changed, 161 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /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 <zhang@hpc.ufl.edu> and Oleksandr Moskalenko <om@hpc.ufl.edu> +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)
--- /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 @@ +<tool id="gaussian" name="Gaussian" version="1.0.0"> +<!-- +Copyright (C) 2012 +Ying Zhang <zhang@hpc.ufl.edu> and Oleksandr Moskalenko <om@hpc.ufl.edu> +University of Florida Research Computing +--> + <description>Computational Chemistry software for electronic structure modeling.</description> + <command interpreter="python">gaussian.py $__user_name__ $infile</command> + <inputs> + <param format="txt" name="infile" type="data" label="Gaussian Input File"/> + </inputs> + <outputs> + <data format="txt" name="outfile" type="data" from_work_dir="gaussian.log" label="${tool.name} on ${on_string}: Output" /> + </outputs> + <!-- + <stdio> + <exit_code range="1:" level="fatal" description="Tool Error - see debug log." /> + <exit_code range="2:" level="fatal" description="Unauthorized user - see help." /> + </stdio> + --> + <tests> + <test> + <param name="infile" value="chemistry/gaussian/gaussian.com"/> + <output name="outfile" file="chemistry/gaussian/gaussian.log"/> + </test> +</tests> + + <help> +**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/>`_. + </help> +</tool>
--- /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 @@ +<datatype extension="com" type="galaxy.datatypes.data:Text" subclass="True" display_in_upload="true"/>
--- /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