Recent Changes - Search:

edit SideBar

Doing An Energy-only Geometry Optimization In Parallel

Main.DoingAnEnergy-onlyGeometryOptimizationInParallel History

Hide minor edits - Show changes to markup

December 15, 2015, at 04:35 AM by 71.205.148.165 -
Changed lines 93-146 from:
  1. !/bin/bash
  2. Usage: Optional first argument is polling time in seconds
  3. requires green.sh below in current directory. Run pfindif_setup first.
  4. 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 ]; do
        sleep $time1
    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

  1. put this in ./green.sh, and chmod +x green.sh
    1. !/bin/csh
  2. foreach i (fja.*)
  3. cp $i FJOBARC
  4. xja2fja > /dev/null
  5. xsymcor >> opt_out.txt
  6. mv $i old.$i
  7. end
  8. xjoda >> opt_out.txt
  9. rm zmat*
  10. rm GRD ALLDONE
  11. xsymcor >> opt_out.txt
to:
  1. !/bin/bash
  2. Usage: Optional first argument is polling time in seconds
  3. requires green.sh below in current directory. Run pfindif_setup first.
  4. 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

  1. put this in ./green.sh, and chmod +x green.sh
    1. !/bin/csh
  2. foreach i (fja.*)
  3. cp $i FJOBARC
  4. xja2fja > /dev/null
  5. xsymcor >> opt_out.txt
  6. mv $i old.$i
  7. end
  8. xjoda >> opt_out.txt
  9. rm zmat*
  10. rm GRD ALLDONE
  11. xsymcor >> opt_out.txt
October 16, 2015, at 05:50 PM by 128.62.62.63 -
Changed line 1 from:

Since 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.

to:

Since 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.

October 16, 2015, at 05:49 PM by 128.62.62.63 -
Changed line 1 from:

Since 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 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.

to:

Since 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.

April 13, 2015, at 07:36 PM by 128.138.65.182 -
Changed lines 90-147 from:
to:

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 ]; do
        sleep $time1
    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
July 23, 2014, at 10:39 PM by 128.62.28.24 -
Changed lines 45-46 from:

rm GRD ALLDONE

to:

rm GRD ALLDONE
xsymcor

July 23, 2014, at 08:17 PM by 128.62.28.24 -
Changed line 1 from:

While 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 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.

to:

Since 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 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.

July 23, 2014, at 07:45 PM by 128.62.28.24 -
Changed line 45 from:

rm GRD ALLDONE \\

to:

rm GRD ALLDONE

July 23, 2014, at 07:45 PM by 128.62.28.24 -
Changed line 79 from:

submit energy points \\

to:

submit energy points, wait for them to finish \\

Changed line 81 from:

submit energy points \\

to:

submit energy points, wait for them to finish \\

Changed line 83 from:

submit energy points \\

to:

submit energy points, with for them to finish \\

July 23, 2014, at 07:42 PM by 128.62.28.24 -
Changed lines 32-34 from:

3. Now, run the pfindif_setup script which is described in Scripts For Calculating Harmonic Frequencies By Finite Differences In Parallel (it in turn relies on a run.dummy script, also described there), and a number of files called run.000.xxx will be generated. Each of these is one of the energy calculations needed to compute the gradient. Submit the various energy jobs in whatever manner you prefer. 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):

to:

3. Now, run the pfindif_setup script which is described in Scripts For Calculating Harmonic Frequencies By Finite Differences In Parallel (it in turn relies on a run.dummy script, also described there), and a number of files called run.000.xxx will be generated. Each of these is one of the energy calculations needed to compute the gradient. Submit the various energy jobs in whatever manner you prefer.

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):

Changed line 73 from:

4. Subsequent optimization steps can be run very easily. After running the script above, the next set of energy points has been generated, the corresponding zmatxxx files are in place, and the points are ready to be run. After they finish, just run the script above again.

to:

5. Subsequent optimization steps can be run very easily. After running the script above, the next set of energy points has been generated, the corresponding zmatxxx files are in place, and the points are ready to be run. After they finish, just run the script above again.

July 23, 2014, at 07:41 PM by 128.62.28.24 -
Changed line 34 from:
  1. !/bin/csh \\
to:

#!/bin/csh \\

Changed line 43 from:

rm GRD ALLDONE \\

to:

rm GRD ALLDONE \\

July 23, 2014, at 07:40 PM by 128.62.28.24 -
Changed lines 75-78 from:

create ZMAT file run pfindif_setup submit energy points run

to:

create ZMAT file
run pfindif_setup
submit energy points
run "green" script above
submit energy points
run "green" script above
submit energy points
run "green" script above
...

with the proviso that one should NOT run xclean at any point during this process (except, of course, at the very beginning).

July 23, 2014, at 07:37 PM by 128.62.28.24 -
Changed line 32 from:

Now, run the pfindif_setup script which is described in Scripts For Calculating Harmonic Frequencies By Finite Differences In Parallel (it in turn relies on a run.dummy script, also described there), and a number of files called run.000.xxx will be generated. Each of these is one of the energy calculations needed to compute the gradient. Submit the various energy jobs in whatever manner you prefer. 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):

to:

3. Now, run the pfindif_setup script which is described in Scripts For Calculating Harmonic Frequencies By Finite Differences In Parallel (it in turn relies on a run.dummy script, also described there), and a number of files called run.000.xxx will be generated. Each of these is one of the energy calculations needed to compute the gradient. Submit the various energy jobs in whatever manner you prefer. 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):

Changed lines 70-78 from:
to:
 
4. Subsequent optimization steps can be run very easily. After running the script above, the next set of energy points has been generated, the corresponding zmatxxx files are in place, and the points are ready to be run. After they finish, just run the script above again.
In summary, a geometry optimization can be run in the "workspace" directory as follows

create ZMAT file run pfindif_setup submit energy points run

July 23, 2014, at 07:33 PM by 128.62.28.24 -
Changed line 62 from:
    RCN     0.0170745866   -0.0087996101    1.3967624803    1.3879628702 \\ 
to:
    RCN     0.0170745866   -0.0087996101    1.3967624803    1.3879628702  
July 23, 2014, at 07:33 PM by 128.62.28.24 -
Added lines 46-54:
 
Numerical Cartesian gradient:
0.1055297421 0.0529894995 0.0000000000
-0.0680312859 -0.0498697873 0.0000000000
-0.0135728169 0.0028154177 0.0000000000
-0.0237936934 -0.0044146890 0.0000000000
0.0049669360 0.0033450119 0.0000000000
-0.0050988820 -0.0048654527 0.0000000000
\\
July 23, 2014, at 07:32 PM by 128.62.28.24 -
Changed line 32 from:

Now, run the pfindif_setup script which is described in Scripts For Calculating Harmonic Frequencies By Finite Differences In Parallel (it in turn relies on a run.dummy script, also described there), and a number of files called run.000.xxx will be generated. Each of these is one of the energy calculations needed to compute the gradient. Submit the various energy jobs in whatever manner you prefer. 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:

to:

Now, run the pfindif_setup script which is described in Scripts For Calculating Harmonic Frequencies By Finite Differences In Parallel (it in turn relies on a run.dummy script, also described there), and a number of files called run.000.xxx will be generated. Each of these is one of the energy calculations needed to compute the gradient. Submit the various energy jobs in whatever manner you prefer. 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):

Changed lines 45-46 from:
to:

With the test ZMAT file, the Cartesian gradient generated in xsymcor and the geometry optimization step generated in xjoda are as follows:

--------------------------------------------------------------------------
Parameter dV/dR Step Rold Rnew
--------------------------------------------------------------------------
RCO 0.1180103785 -0.0608181826 1.4035727376 1.3427545550
RCH -0.0040115546 0.0020674068 1.0822141466 1.0842815534
A1 0.0244845992 -5.0680666949 119.7453132747 114.6772465798
RCN 0.0170745866 -0.0087996101 1.3967624803 1.3879628702 \\

    A2      0.0536747672  -11.1101389972  115.5916277063  104.4814887091 
NH1 0.0027997632 -0.0014428944 1.0043425811 1.0028996867
A3 -0.0069330274 1.4350672042 120.6830303327 122.1180975369
NH2 0.0073699799 -0.0037982149 1.0035589108 0.9997606959
A4 -0.0060937575 1.2613467344 120.0229720517 121.2843187861
--------------------------------------------------------------------------
Minimum force: 0.002799763 / RMS force: 0.044549493
July 23, 2014, at 07:29 PM by 128.62.28.24 -
Changed line 32 from:

Now, run the pfindif_setup script which is described in the section on running harmonic frequency calculations in parallel (it in turn relies on a run.dummy script, also described there), and a number of files called run.000.xxx will be generated. Each of these is one of the energy calculations needed to compute the gradient. Submit the various energy jobs in whatever manner you prefer. 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:

to:

Now, run the pfindif_setup script which is described in Scripts For Calculating Harmonic Frequencies By Finite Differences In Parallel (it in turn relies on a run.dummy script, also described there), and a number of files called run.000.xxx will be generated. Each of these is one of the energy calculations needed to compute the gradient. Submit the various energy jobs in whatever manner you prefer. 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:

July 23, 2014, at 07:28 PM by 128.62.28.24 -
Added lines 45-46:
July 23, 2014, at 07:24 PM by 128.62.28.24 -
Changed lines 3-4 from:

First, 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 guinea-pig test case to make sure you are doing all steps correctly).

to:

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).

Changed line 32 from:

Now, run the pfindif_setup script which is described in the section ...., and submit the various energy jobs (this is done precisely by the same protocol as in a parallel harmonic frequency calculation. After the jobs run, you will have a number of fja files in your directory. Process these and generate the Cartesian gradient and do one cycle of optimization with the following script:

to:

Now, run the pfindif_setup script which is described in the section on running harmonic frequency calculations in parallel (it in turn relies on a run.dummy script, also described there), and a number of files called run.000.xxx will be generated. Each of these is one of the energy calculations needed to compute the gradient. Submit the various energy jobs in whatever manner you prefer. 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:

July 23, 2014, at 07:18 PM by 128.62.28.24 -
Added lines 1-42:

While 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 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.

First, 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 guinea-pig test case to make sure you are doing all steps correctly).

formamide
O
C 1 RCO*
H 2 RCH* 1 A1*
N 2 RCN* 1 A2* 3 T180
H 4 NH1* 2 A3* 1 T0
H 4 NH2* 2 A4* 1 T180

RCO = 1.4035727376
RCH = 1.0822141466
A1 = 119.7453132747
RCN = 1.3967624803
A2 = 115.5916277063
NH1 = 1.0043425811
A3 = 120.6830303327
NH2 = 1.0035589108
A4 = 120.0229720517
T180 = 180.000000000000000
T0 = 0.000000000000000

*CRAPS(CALC=SCF,ICONTL=8
BASIS=DZ,SCF_CONV=11
METHOD=ENERONLY
FREQ_ALGORITHM=PARALLEL)

Now, run the pfindif_setup script which is described in the section ...., and submit the various energy jobs (this is done precisely by the same protocol as in a parallel harmonic frequency calculation. After the jobs run, you will have a number of fja files in your directory. Process these and generate the Cartesian gradient and do one cycle of optimization with the following script:

 
#!/bin/csh
foreach i (fja.*)
cp $i FJOBARC
xja2fja
xsymcor
mv $i old.$i
end
xjoda
rm zmat*
rm GRD ALLDONE
\\
Edit - History - Print - Recent Changes - Search
Page last modified on December 15, 2015, at 04:35 AM
This page has been visited 1152 times since December 2010.
CFOUR is partially supported by the U.S. National Science Foundation.