#!/bin/bash # # 1_PESscan.bash, a bash script for generating input files for calculating PESs. # # Any problems, drop a line. damian@somewhereville.com, www.somewhereville.com # # # usage ./1_PESscan.bash $1 $2 $3 $4 $5 $6 # as in... # usage ./1_PESscan.bash Kdiphenylmethanide gjf g03 100 25 25 # # $1 = name of the input file template (no extension) # $2 = name of the file extension (gjf for Gaussian, inp for GAMESS, etc.) # $3 = command line executable (g03 for Gaussian, gms... for GAMESS # $4 = decimal increments for the X axis (100 = unit, no decimals) # $5 = decimal increments for the Y axis (100 = unit, no decimals) # $6 = decimal increments for the Z axis (100 = unit, no decimals) # # the script does a sweep from MINX to MAXX, MINY to MAXY, MINZ to MAXZ and is written around # a bash limitation of doing decimals in names (unless someone shows me otherwise) # # define the maxima and minima here # define the maxima and minima here # define the maxima and minima here # define the maxima and minima here # # modify these numbers to match the range of the sweeps. # # if this is for a planar molecule, then the plane should be aligned along two axes. # for instance, if scanning with a vertical height of X, the molecule should be along # X=0 for all atoms (again, assumed planar) # # negative values work fine, too. # MINX=2 MAXX=5 MINY=0 MAXY=5 MINZ=0 MAXZ=5 # # this section hits all of the cases that AREN'T at maximum values of X, Y, Z # this section hits all of the cases that AREN'T at maximum values of X, Y, Z # this section hits all of the cases that AREN'T at maximum values of X, Y, Z # this section hits all of the cases that AREN'T at maximum values of X, Y, Z # for((X=$MINX; X<=$MAXX-1; X++)) ; do for((x=0; x<100; x++)) ; do if [ "$x" = 0 ]; then Xx=$X.$x'00000' else Xx=$X.$x'0000' fi x=$x+$4-1 for((Y=$MINY; Y<=$MAXY-1; Y++)) ; do for((y=0; y<100; y++)) ; do if [ "$y" = 0 ]; then Yy=$Y.$y'00000' else Yy=$Y.$y'0000' fi y=$y+$5-1 for((Z=$MINZ; Z<=$MAXZ-1; Z++)) ; do for((z=0; z<100; z++)) ; do if [ "$z" = 0 ]; then Zz=$Z.$z'00000' else Zz=$Z.$z'0000' fi z=$z+$6-1 sed "s/REPLACEX/$Xx/g;s/REPLACEY/$Yy/g;s/REPLACEZ/$Zz/g" $1.$2 > $1'_X_'$Xx'_Y_'$Yy'_Z_'$Zz'.'$2 done done done done done done # # this section hits all of the cases that AREN'T at maximum values of X, Y, Z # this section hits all of the cases that AREN'T at maximum values of X, Y, Z # this section hits all of the cases that AREN'T at maximum values of X, Y, Z # this section hits all of the cases that AREN'T at maximum values of X, Y, Z # # # This section hits all cases where the X is at its maximum (except the final maximim) # This section hits all cases where the X is at its maximum (except the final maximim) # This section hits all cases where the X is at its maximum (except the final maximim) # This section hits all cases where the X is at its maximum (except the final maximim) # for((X=$MAXX; X<=$MAXX; X++)) ; do Xx=$X.'000000' for((Y=$MINY; Y<=$MAXY-1; Y++)) ; do for((y=0; y<100; y++)) ; do if [ "$y" = 0 ]; then Yy=$Y.$y'00000' else Yy=$Y.$y'0000' fi y=$y+$5-1 for((Z=$MINZ; Z<=$MAXZ-1; Z++)) ; do for((z=0; z<100; z++)) ; do if [ "$z" = 0 ]; then Zz=$Z.$z'00000' else Zz=$Z.$z'0000' fi z=$z+$6-1 sed "s/REPLACEX/$Xx/g;s/REPLACEY/$Yy/g;s/REPLACEZ/$Zz/g" $1.$2 > $1'_X_'$Xx'_Y_'$Yy'_Z_'$Zz'.'$2 done done done done done # # This section hits all cases where the X is at its maximum (except the final maximim) # This section hits all cases where the X is at its maximum (except the final maximim) # This section hits all cases where the X is at its maximum (except the final maximim) # This section hits all cases where the X is at its maximum (except the final maximim) # # # This section hits all cases where the Y is at its maximum (except the final maximim) # This section hits all cases where the Y is at its maximum (except the final maximim) # This section hits all cases where the Y is at its maximum (except the final maximim) # This section hits all cases where the Y is at its maximum (except the final maximim) # for((Y=$MAXY; Y<=$MAXY; Y++)) ; do Yy=$Y.'000000' for((X=$MINX; X<=$MAXX-1; X++)) ; do for((x=0; x<100; x++)) ; do if [ "$x" = 0 ]; then Xx=$X.$x'00000' else Xx=$X.$x'0000' fi x=$x+$4-1 for((Z=$MINZ; Z<=$MAXZ-1; Z++)) ; do for((z=0; z<100; z++)) ; do if [ "$z" = 0 ]; then Zz=$Z.$z'00000' else Zz=$Z.$z'0000' fi z=$z+$6-1 sed "s/REPLACEX/$Xx/g;s/REPLACEY/$Yy/g;s/REPLACEZ/$Zz/g" $1.$2 > $1'_X_'$Xx'_Y_'$Yy'_Z_'$Zz'.'$2 done done done done done # # This section hits all cases where the Y is at its maximum (except the final maximim) # This section hits all cases where the Y is at its maximum (except the final maximim) # This section hits all cases where the Y is at its maximum (except the final maximim) # This section hits all cases where the Y is at its maximum (except the final maximim) # # # This section hits all cases where the Z is at its maximum (except the final maximim) # This section hits all cases where the Z is at its maximum (except the final maximim) # This section hits all cases where the Z is at its maximum (except the final maximim) # This section hits all cases where the Z is at its maximum (except the final maximim) # for((Z=$MAXZ; Z<=$MAXZ; Z++)) ; do Zz=$Z.'000000' for((X=$MINX; X<=$MAXX-1; X++)) ; do for((x=0; x<100; x++)) ; do if [ "$x" = 0 ]; then Xx=$X.$x'00000' else Xx=$X.$x'0000' fi x=$x+$4-1 for((Y=$MINY; Y<=$MAXY-1; Y++)) ; do for((y=0; y<100; y++)) ; do if [ "$y" = 0 ]; then Yy=$Y.$y'00000' else Yy=$Y.$y'0000' fi y=$y+$5-1 sed "s/REPLACEX/$Xx/g;s/REPLACEY/$Yy/g;s/REPLACEZ/$Zz/g" $1.$2 > $1'_X_'$Xx'_Y_'$Yy'_Z_'$Zz'.'$2 done done done done done # # This section hits all cases where the Z is at its maximum (except the final maximim) # This section hits all cases where the Z is at its maximum (except the final maximim) # This section hits all cases where the Z is at its maximum (except the final maximim) # This section hits all cases where the Z is at its maximum (except the final maximim) # # # This section gets the maximum X, Y and all remaining values of Z # This section gets the maximum X, Y and all remaining values of Z # This section gets the maximum X, Y and all remaining values of Z # This section gets the maximum X, Y and all remaining values of Z # for((X=$MAXX; X<=$MAXX; X++)) ; do Xx=$X.'000000' for((Y=$MINY; Y<=$MAXY; Y++)) ; do Yy=$Y.'000000' for((Z=$MINZ; Z<=$MAXZ-1; Z++)) ; do for((z=0; z<100; z++)) ; do if [ "$z" = 0 ]; then Zz=$Z.$z'00000' else Zz=$Z.$z'0000' fi z=$z+$6-1 sed "s/REPLACEX/$Xx/g;s/REPLACEY/$Yy/g;s/REPLACEZ/$Zz/g" $1.$2 > $1'_X_'$Xx'_Y_'$Yy'_Z_'$Zz'.'$2 done done done done # # This section gets the maximum X, Y and all remaining values of Z # This section gets the maximum X, Y and all remaining values of Z # This section gets the maximum X, Y and all remaining values of Z # This section gets the maximum X, Y and all remaining values of Z # # # This section gets the maximum X, Z and all remaining values of Y # This section gets the maximum X, Z and all remaining values of Y # This section gets the maximum X, Z and all remaining values of Y # This section gets the maximum X, Z and all remaining values of Y # for((Z=$MAXZ; Z<=$MAXZ; Z++)) ; do Zz=$Z.'000000' for((X=$MINX; X<=$MAXX; X++)) ; do Xx=$X.'000000' for((Y=$MINY; Y<=$MAXY-1; Y++)) ; do for((y=0; y<100; y++)) ; do if [ "$y" = 0 ]; then Yy=$Y.$y'00000' else Yy=$Y.$y'0000' fi y=$y+$5-1 sed "s/REPLACEX/$Xx/g;s/REPLACEY/$Yy/g;s/REPLACEZ/$Zz/g" $1.$2 > $1'_X_'$Xx'_Y_'$Yy'_Z_'$Zz'.'$2 done done done done # # This section gets the maximum X, Z and all remaining values of Y # This section gets the maximum X, Z and all remaining values of Y # This section gets the maximum X, Z and all remaining values of Y # This section gets the maximum X, Z and all remaining values of Y # # # This section gets the maximum Y, Z and all remaining values of X # This section gets the maximum Y, Z and all remaining values of X # This section gets the maximum Y, Z and all remaining values of X # This section gets the maximum Y, Z and all remaining values of X # for((Z=$MAXZ; Z<=$MAXZ; Z++)) ; do Zz=$Z.'000000' for((Y=$MINY; Y<=$MAXY; Y++)) ; do Yy=$Y.'000000' for((X=$MINX; X<=$MAXX-1; X++)) ; do for((x=0; x<100; x++)) ; do if [ "$x" = 0 ]; then Xx=$X.$x'00000' else Xx=$X.$x'0000' fi x=$x+$4-1 sed "s/REPLACEX/$Xx/g;s/REPLACEY/$Yy/g;s/REPLACEZ/$Zz/g" $1.$2 > $1'_X_'$Xx'_Y_'$Yy'_Z_'$Zz'.'$2 done done done done # # This section gets the maximum Y, Z and all remaining values of X # This section gets the maximum Y, Z and all remaining values of X # This section gets the maximum Y, Z and all remaining values of X # This section gets the maximum Y, Z and all remaining values of X # # # This section gets the last integer positions in the grid # This section gets the last integer positions in the grid # This section gets the last integer positions in the grid # This section gets the last integer positions in the grid # for((Z=$MINZ; Z<=$MAXZ; Z++)) ; do Zz=$Z.'000000' for((X=$MINX; X<=$MAXX; X++)) ; do Xx=$X.'000000' for((Y=$MINY; Y<=$MAXY; Y++)) ; do Yy=$Y.'000000' sed "s/REPLACEX/$Xx/g;s/REPLACEY/$Yy/g;s/REPLACEZ/$Zz/g" $1.$2 > $1'_X_'$Xx'_Y_'$Yy'_Z_'$Zz'.'$2 done done done # # This section gets the last integer positions in the grid # This section gets the last integer positions in the grid # This section gets the last integer positions in the grid # This section gets the last integer positions in the grid # # # This section makes the batch file # This section makes the batch file # This section makes the batch file # This section makes the batch file # # if you defines $3 correctly, the batch file should contain all the info to execute the # scan files. The final batch name will be 4_batchscript.bat. # ls $1_*.$2 > 4_batch.batch sed "s/$1/$3 $1/g" 4_batch.batch > 4_batchscript.bat rm 4_batch.batch