Main /
Doing An Energy-only Geometry Optimization In ParallelSince geometry optimizations are best done with analytic gradients (and CFOUR has analytic gradients for most methods), an energy-only geometry optimization is something which one should avoid doing. However, there are cases (for example, EOM-CCSDT) where there are no gradients available for a useful method, and the METHOD=ENERONLY (or METHOD=TSENERONLY for transition states) approach to a geometry optimization is unavoidable. Running such a calculation in serial can be quite costly as a number of energy points must be run to evaluate each numerical gradient used in the optimization. Fortunately, a strategy entirely analogous to those used for parallel harmonic and anharmonic frequencies can also be used for optimizations, which is outlined here for a normal optimization. TSENERONLY jobs can be run in the same fashion. 1. Create a directory that will be your "workspace" for the optimization. In this directory, everything will be done except for the actual quantum chemical energy calculations. 2. Now, construct your ZMAT file for the optimization, making sure to use the keywords METHOD=ENERONLY and FREQ_ALGORITHM=PARALLEL (actually you are not calculating frequencies, so this is perhaps a strange keyword choice...). An example is given below for formamide, using SCF and a small basis (which makes this a good example test case to make sure you are doing all steps correctly). formamide 4. After the jobs run, you will have a number of fja.xxx files in your directory. Process these and generate the Cartesian gradient and do one cycle of optimization with the following script (you might want to send the output to a file):
create ZMAT file The following script will "babysit" such an optimization. "qsub" below should be replaced with the appropriate command for submitting a job. #!/bin/bash #Usage: Optional first argument is polling time in seconds # requires green.sh below in current directory. Run pfindif_setup first. # remove any fja files or opt_out.txt before running, please foreach () { func=$1; shift; for arg in $@; do ${func} ${arg}; done } numjobs=`ls zmat* | wc -l` if [ ! -z "`ls fja* opt_out.txt 2>/dev/null`" ]; then echo "Please remove fja files and/or opt_out.txt." echo "If you are mid-optimization, just rename opt_out.txt temporarily." exit fi if [ -z "$1" ]; then time1=600 # default to check every 10 minutes else time1=`echo $1 | cut -d. -f1` # dump fractions of a second fi time2=$time1 until [ ! -z "`grep completed opt_out.txt 2>/dev/null`" ]; do foreach qsub run.0* > /dev/null sleep $time2 until [ `ls fja* 2>/dev/null | wc -l` == $numjobs ] && [ -z "`wc -l fj* 2>/dev/null | grep -v total | awk '{print $1}' | grep ^0$`" ] && [ 1 -lt "`wc -l fj* 2>/dev/null | grep -v total | awk '{print $1}' | uniq | wc -l`" ]; do sleep $time1 if [ ! -z "`wc -l fj* 2>/dev/null | grep -v total | awk '{print $1}' |grep ^0$`" ]; then echo "Zero line fja in "`pwd` fi if [ 1 -lt "`wc -l fj* 2>/dev/null | grep -v total | awk '{print $1}' | uniq | wc -l`" ]; then echo "Not all the fja's are the same length in "`pwd` fi done time2=`tail -n 1 out* | grep walltime | awk 'max=="" || $4 > max {max=$4} END{ print max-'$time1'}' | cut -d. -f1 | sed 's/-//'` green.sh grep "RMS f" opt_out.txt | tail -n 1 done # put this in ./green.sh, and chmod +x green.sh ##!/bin/csh #foreach i (fja.*) #cp $i FJOBARC #xja2fja > /dev/null #xsymcor >> opt_out.txt #mv $i old.$i #end #xjoda >> opt_out.txt #rm zmat* #rm GRD ALLDONE #xsymcor >> opt_out.txt |