#!/usr/bin/perl if (scalar(@ARGV) == 0 ) { print "\n"; print "Normal usage is :\n"; print "run_gamess jobname [num_core]\n"; print "\n"; print "Jobname should be your Gamess input file name, with or without the \n"; print ".inp extension.\n"; print "The default num_core (number of cpus) is 1. \n"; print "Sensible values for num_core are: 1,2,8,16,32,64. \n"; print "\n"; print "Examples:\n"; print "run_gamess jobname.inp\n"; print "\n"; print "run_gamess jobname 16 \n"; print "This is a 16 cpu.\n"; print "\n"; exit; } $directory = `/bin/pwd`; chomp $directory; $input = $ARGV[0]; $input =~ s/.inp$//; $inputfile = $input . ".inp"; unless (-e $inputfile ) { print "$inputfile doesn't exist in this folder!\n"; exit; } $myname= `/usr/bin/whoami`; chomp $myname; $jobname = $input . ".job"; $num_core = 1; #2nd argument if ( $ARGV[1] > 64 ) { print "This script is limited to 64 core. Talk to Kathy if you need more.\n"; print "This run will be reset to run with 64 shared core.\n"; $num_core = 64; } elsif ( $ARGV[1] >= 1 ) { $num_core = int($ARGV[1]); } $pe = "#\$ -pe shared $num_core"; local *FILE; open (FILE, ">$jobname") || die "Can't open create file named $jobname"; print FILE "#\!/bin/tcsh -f","\n"; print FILE "#\$ -cwd","\n"; print FILE "#\$ -o $jobname.o\$JOB_ID","\n"; print FILE "#\$ -j y","\n"; print FILE "#\$ -N gm-$input","\n"; print FILE "#\$ -q all.q","\n"; print FILE "$pe","\n"; print FILE "\n"; print FILE "/bin/hostname","\n"; print FILE "/usr/bin/env","\n"; print FILE "/bin/mkdir -p /scr/$myname/$input","\n"; print FILE "/bin/mkdir -p $directory/\$JOB_ID","\n"; print FILE "setenv SCR /scr/$myname/$input","\n"; print FILE "setenv USERSCR $directory/\$JOB_ID","\n"; #print FILE "cd \$SGE_O_WORKDIR","\n"; print FILE "\n"; print FILE "/usr/software/gamess/rungms $input 01 $num_core >& $input.log","\n"; print FILE "rm -rf /scr/$myname/\$JOB_ID" ,"\n"; print FILE "rmdir --ignore-fail-on-non-empty /scr/$myname" ,"\n"; #$command1 = "cd $directory\; qsub $jobname &/dev/null &"; $command1 = "cd $directory\; qsub $jobname"; $command2 = "/usr/bin/ssh tiger \"$command1\""; #print $command1, "\n"; print "Your job has been submitted to Tiger. Use qstat to follow the progress. \n"; print "Gamess supplementary USERSCR files will be in the folder\n"; print "$directory/$JOB_ID \n"; $hostname = `/bin/hostname`; if ( $hostname eq "tiger.cchem.berkeley.edu" ) { print "Your job has been submitted on Tiger. Use qstat to follow the progress. \n"; exec $command1; } else { #print "$hostname\n"; print "Your job has been submitted to Tiger. Use qstat to follow the progress. \n"; exec $command2; }