Example: Restarting a geometry optimization

Download GO_restart.run

#!/bin/sh

# Step 1: Run the entire optimization in one go to get the reference result.

AMS_JOBNAME=reference $AMSBIN/ams 2>&1 << EOF

Task GeometryOptimization

System
    Atoms
        Mg      0.00000000       0.00000000       0.00000000
        H      -1.27917000       4.11016000       4.72389000
        O       2.16655000      -0.38813000      -7.10271000
        H      -1.42939000       1.48933000      -2.39439000
        H       1.09521000       1.50513000     -11.11199000
        C      -1.73924000      -3.56815000      -7.25491000
        O       1.13468000       2.30574000      -6.31297000
        H      -1.00635000      -3.89600000       0.57440000
        C       2.39949000       1.96079000      -8.76280000
        H      -0.50312000      -2.26723000       5.55260000
        H       0.50312000       2.26723000      -5.55260000
        C      -1.58070000       0.43033000       8.37317000
        C       1.68553000       0.69328000      -9.20655000
        H       3.10514000       2.27128000      -9.54815000
        C      -2.12273000       1.75783000       3.90134000
        C      -1.41195000      -3.08564000       8.52014000
        C      -0.80701000       1.55547000       8.71125000
        H       2.96787000       1.75892000      -7.84715000
        H      -3.10514000      -2.27128000       9.54815000
        H       1.41484000      -2.74396000      -7.00335000
        H       1.12426000      -3.20203000       2.78552000
        C      -0.17468000       1.56294000       9.95926000
        C      -0.72719000      -2.63659000      -6.99325000
        C      -1.09765000      -3.99973000       9.52904000
        H      -0.25814000      -8.23193000      -3.30969000
        C       1.14520000      -2.61556000      -3.22986000
        O       0.72583000      -0.95806000      -1.56717000
        H      -2.36816000      -5.34341000      -4.50996000
        H      -2.96787000      -1.75892000       7.84715000
        H      -2.25336000       0.75053000       3.46787000
        N       2.80755000      -2.14965000      -4.91471000
        C      -0.30154000       0.48014000      10.82965000
        C       0.54101000      -2.17341000      -2.01004000
        C       2.39908000       0.51189000       4.29012000
        H      -1.63623000      -3.94265000      10.47839000
        H       0.19490000       0.50042000      11.80153000
        N       0.47889000       1.91215000      -0.81627000
        C      -0.66060000      -2.05093000       2.26021000
        H      -0.20633000      -7.24015000      -5.59602000
        H       1.49008000       0.40226000       3.68367000
        H      -0.39995000       4.15871000      -4.93170000
        H      -1.12426000       3.20203000      -2.78552000
        C      -1.03828000      -0.64018000      10.44800000
        H       1.56169000       4.33269000       8.01583000
        C      -0.11223000      -4.97150000       9.34588000
        C      -0.03554000       7.26375000       2.87602000
        H      -1.09521000      -1.50513000      11.11199000
        H       3.22983000       0.79151000       3.62424000
        C       3.45382000      -1.03521000      -6.98441000
        O      -0.72583000       0.95806000       1.56717000
        H       2.36816000       5.34341000       4.50996000
        C      -1.68553000      -0.69328000       9.20655000
        H       4.21952000      -0.40168000      -7.46345000
        H      -1.28611000      -2.92413000       2.51305000
        C       1.07673000      -4.19100000       5.79908000
        C       0.46002000       6.10723000       3.76764000
        H       0.19942000       5.47949000       5.84797000
        H      -0.11989000       5.68080000     -10.14146000
        N      -2.80755000       2.14965000       4.91471000
        H       1.23144000      -6.29513000      -5.15638000
        C       3.74078000      -1.20712000      -5.50076000
        N      -0.47889000      -1.91215000       0.81627000
        C      -0.57607000       5.02038000      -8.13428000
        H       1.60192000      -5.15615000       5.75895000
        H      -1.13094000      -1.13799000       2.64965000
        C      -0.23845000      -3.15299000      -1.28978000
        C      -0.05550000      -4.76579000      -3.14405000
        H      -1.35753000       5.76910000      -7.98196000
        H       3.72395000      -0.21480000      -5.00525000
        H      -1.13142000       7.24453000       2.78458000
        H      -4.76310000       1.61527000       5.41439000
        H       4.76310000      -1.61527000      -5.41439000
        C       2.12273000      -1.75783000      -3.90134000
        C      -0.28104000       4.13616000      -7.08959000
        C       0.73514000       3.17615000      -7.28394000
        C       0.81335000      -3.86199000      -3.77035000
        C      -2.39908000      -0.51189000      -4.29012000
        H       2.25336000      -0.75053000      -3.46787000
        C       1.41195000       3.08564000      -8.52014000
        C      -0.52384000      -4.40125000      -1.88411000
        C      -1.84973000       1.90289000      -4.97333000
        H       0.20633000       7.24015000       5.59602000
        C       1.09765000       3.99973000      -9.52904000
        H       0.11989000      -5.68080000      10.14146000
        H       0.25814000       8.23193000       3.30969000
        H      -1.49008000      -0.40226000      -3.68367000
        H       1.63623000       3.94265000     -10.47839000
        C      -2.10065000       3.07251000      -5.70877000
        C       0.57607000      -5.02038000       8.13428000
        H      -1.56169000      -4.33269000      -8.01583000
        C       0.11223000       4.97150000      -9.34588000
        H      -1.13449000      -5.10187000      -1.30711000
        H       0.39995000      -4.15871000       4.93170000
        H       1.35753000      -5.76910000       7.98196000
        C      -3.29750000       3.15241000      -6.42939000
        C       0.23845000       3.15299000       1.28978000
        H      -3.22983000      -0.79151000      -3.62424000
        C      -0.59486000       2.70197000       7.73655000
        C       0.28104000      -4.13616000       7.08959000
        C       0.52384000       4.40125000       1.88411000
        H       0.43755000       2.42353000      10.23864000
        H      -3.50575000       4.04950000      -7.01656000
        H       0.38971000       7.20647000       1.86361000
        H       1.13449000       5.10187000       1.30711000
        C       1.84973000      -1.90289000       4.97333000
        C      -1.07673000       4.19100000      -5.79908000
        H       0.62192000      -3.64814000      -8.29677000
        C      -4.20635000       2.09524000      -6.41695000
        C       2.10065000      -3.07251000       5.70877000
        O      -0.62968000       1.82005000      -4.28278000
        C       0.03554000      -7.26375000      -2.87602000
        C       1.99778000       6.16492000       3.88117000
        C       3.29750000      -3.15241000       6.42939000
        H      -1.41484000       2.74396000       7.00335000
        O      -0.07653000      -0.68618000      -5.67912000
        H      -5.13801000       2.17027000      -6.98038000
        H       3.50575000      -4.04950000       7.01656000
        C      -3.45382000       1.03521000       6.98441000
        C      -1.14520000       2.61556000       3.22986000
        H      -2.30900000      -7.11968000      -4.33255000
        C       4.20635000      -2.09524000       6.41695000
        H       0.78141000      -0.75072000      -6.17605000
        H       1.13142000      -7.24453000      -2.78458000
        C      -0.54101000       2.17341000       2.01004000
        H       5.13801000      -2.17027000       6.98038000
        C      -3.91320000       0.93142000      -5.70744000
        H      -1.60192000       5.15615000      -5.75895000
        H      -0.43755000      -2.42353000     -10.23864000
        C       3.91320000      -0.93142000       5.70744000
        C       0.72575000      -2.17732000       2.89574000
        H      -4.21952000       0.40168000       7.46345000
        H      -4.60197000       0.08443000      -5.74068000
        H       4.60197000      -0.08443000       5.74068000
        H      -0.62192000       3.64814000       8.29677000
        H       2.30900000       7.11968000       4.33255000
        H       1.27917000      -4.11016000      -4.72389000
        C       2.72586000      -0.80591000       4.97465000
        C      -2.72586000       0.80591000      -4.97465000
        H      -0.19942000      -5.47949000      -5.84797000
        H       1.42939000      -1.48933000       2.39439000
        C       0.96682000       1.65125000       6.01252000
        C      -1.99778000      -6.16492000      -3.88117000
        C       0.59486000      -2.70197000      -7.73655000
        C      -0.96682000      -1.65125000      -6.01252000
        C       2.18562000       1.61836000       5.30149000
        C       0.05550000       4.76579000       3.14405000
        H       3.43079000      -2.01409000      -7.48984000
        C       1.58070000      -0.43033000      -8.37317000
        C       3.16089000       2.57613000       5.58075000
        C      -3.74078000       1.20712000       5.50076000
        C      -0.81335000       3.86199000       3.77035000
        H      -3.43079000       2.01409000       7.48984000
        H       4.09911000       2.55793000       5.02051000
        C      -2.18562000      -1.61836000      -5.30149000
        C       0.80701000      -1.55547000      -8.71125000
        H      -2.47896000      -6.08599000      -2.89560000
        C       2.94890000       3.55128000       6.55908000
        C      -0.13167000       6.28247000       5.17426000
        C       0.13167000      -6.28247000      -5.17426000
        C       0.17468000      -1.56294000      -9.95926000
        H       3.71667000       4.29632000       6.77231000
        C      -3.16089000      -2.57613000      -5.58075000
        C      -0.46002000      -6.10723000      -3.76764000
        C      -0.61444000      -2.98553000       0.08587000
        C       1.73924000       3.56815000       7.25491000
        O       0.62968000      -1.82005000       4.28278000
        H      -0.38971000      -7.20647000      -1.86361000
        H       2.47896000       6.08599000       2.89560000
        H      -4.09911000      -2.55793000      -5.02051000
        C      -0.72575000       2.17732000      -2.89574000
        O       0.07653000       0.68618000       5.67912000
        C       0.61444000       2.98553000      -0.08587000
        O      -2.16655000       0.38813000       7.10271000
        C       0.30154000      -0.48014000     -10.82965000
        H      -3.72395000       0.21480000       5.00525000
        H       1.00635000       3.89600000      -0.57440000
        H      -0.78141000       0.75072000       6.17605000
        C      -2.94890000      -3.55128000      -6.55908000
        C       0.72719000       2.63659000       6.99325000
        C       0.66060000       2.05093000      -2.26021000
        H      -1.23144000       6.29513000       5.15638000
        H      -0.19490000      -0.50042000     -11.80153000
        C      -2.39949000      -1.96079000       8.76280000
        H       1.28611000       2.92413000      -2.51305000
        O      -1.13468000      -2.30574000       6.31297000
        H      -3.71667000      -4.29632000      -6.77231000
        C       1.03828000       0.64018000     -10.44800000
        H       1.13094000       1.13799000      -2.64965000
        C      -0.73514000      -3.17615000       7.28394000
    End
End

GeometryOptimization
   CoordinateType Cartesian
End

Engine DFTB
   ResourcesDir DFTB.org/3ob-3-1
   Model DFTB3
   DispersionCorrection D3-BJ
EndEngine

EOF


# Step 2: Start the optimization but abort after 5 steps.

AMS_JOBNAME=aborted $AMSBIN/ams 2>&1 << EOF

Task GeometryOptimization

GeometryOptimization
    MaxIterations 5
    CoordinateType Cartesian
End

LoadSystem
   File reference.results/ams.rkf
   Section InputMolecule
End

LoadEngine reference.results/dftb.rkf

EOF


# Step 3: Restart the aborted optimization and finish it.

AMS_JOBNAME=resume $AMSBIN/ams 2>&1 << EOF

Task GeometryOptimization

GeometryOptimization
   CoordinateType Cartesian
End

LoadSystem
   File aborted.results/ams.rkf
End

LoadEngine aborted.results/dftb.rkf
EngineRestart aborted.results/dftb.rkf

EOF