#!/usr/bin/perl if (scalar(@ARGV) == 0 || $ARGV[0] eq "-h" || $ARGV[0] eq "--help") { print "\n"; print "This is Gaussian 16 revision A03. MGCF website has details. \n"; print "Normal usage is: \n"; print "run_gaussian jobname\n"; print "\n"; print "jobname is your com file name, with or without the .com extension. \n"; print "\n"; print "The number of cpus is 1 unless the com file has a line: \%nproc=value. \n"; print "Sensible values for nproc are: 1,2,8,16,32,64. \n"; print "\n"; print "Track your jobs. You will be charged for any unattended calculations. \n"; print "\n"; exit; } $rev = "g16.revA03_sse4_2"; $input = $ARGV[0]; $input =~ s/.com$|.gjf$//; #next line is to strip out everything before the final / #needed for Gaussview $input =~ s/^.*\///; $comname = $input . ".com"; unless (-e $comname ) { $gjfname = $input . ".gjf"; unless (-e $gjfname ) { print "There is no input file! \n"; exit; } `/bin/mv $gjfname $comname`; print "Renamed $gjfname to $comname\n"; } `/usr/bin/dos2unix -q -n $comname $comname`; $directory = `/bin/pwd`; $myname= `/usr/bin/whoami`; chomp $directory; chomp $myname; $jobname = $input . ".job"; $pe = ""; $sharedcheck = ""; $mem = ""; #should expand to check if there are mupltiple nprocs $sharedcheck = `/bin/grep -i -m 1 "%nproc" $comname`; $sharedcheck =~ s/\D//g; if ($sharedcheck == "") { $sharedcheck = 1; } if ($sharedcheck > 64) { print "Your nproc requested more than 64 core. This has been replaced by 64.\n"; $sharedcheck = 64; } if ($sharedcheck > 1) { $pe = "#\$ -pe shared $sharedcheck"; } # print "sharecheck $sharedcheck \n"; $mem = (int($sharedcheck * 7.5)) . "GB"; #print "mem $mem \n"; #replaced with multiplier above # %mem_tiger = ( # 1 => "3700MB", # 2 => "7200MB", # 3 => "11GB", # 4 => "15GB", # 5 => "19GB", # 6 => "23GB", # 7 => "27GB", # 8 => "31GB", # 9 => "35GB", # 10 => "39GB", # 32 => "250GB", # 64 => "500GB", # ); # # $mem = $mem_tiger{$sharedcheck}; # print "mem= $mem \n"; `sed -i 's/^%nproc.*/%nproc=$sharedcheck/Ig' $comname`; `sed -i 's/^%mem.*/%mem=$mem/Ig' $comname`; 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 g-$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 "cd $directory","\n"; print FILE "/bin/mkdir -p /scr/$myname/\$JOB_ID","\n"; print FILE "\n"; print FILE "setenv g16root /usr/software/gaussian16/$rev","\n"; print FILE "setenv GAUSS_SCRDIR /scr/$myname/\$JOB_ID","\n"; print FILE "setenv PATH /usr/software/nbo6_g16/bin:\${PATH}","\n"; print FILE "source /usr/software/gaussian16/$rev/g16/bsd/g16.login","\n"; print FILE "echo Job submitted to: > $input.out","\n"; print FILE "/bin/hostname >> $input.out","\n"; #print FILE "which gaunbo6 >> $input.out","\n"; print FILE "/usr/software/gaussian16/$rev/g16/g16 < $input.com >> $input.out","\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 &"; $command2 = "/usr/bin/ssh tiger \"$command1\""; #print $command2, "\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; }