Example: Restart analytical Hessian calculation
***********************************************

"Download HessianRestart.run"

   #!/bin/sh

   # This example demonstrates how one can complete an analytical Hessian calculation
   # in three steps without re-doing CPKS for all atoms and the subsequent steps.
   # We will define regions for the first and second steps right away. 
   # Note that the region for the second step includes atoms of the first one. 
   # This is necessary because we want the resulting Hessian in the subsequent steps
   # to include the atoms done in the previous calculations.
   # First, we calculate the Hessian sub-matrix corresponding to the C atoms.

   AMS_JOBNAME=step1 "$AMSBIN/ams" << eor

   Task SinglePoint
   Properties
       NormalModes Yes
       SelectedRegionForHessian step1
   End

   System
       Atoms
           C -2.711485799381603 -2.593393872048840 -0.00016442137955 region=step2,step1
           C -1.846368848888818 -1.340467404429865  0.00016453093935 region=step2,step1
           H -2.203636997435432 -3.429266061978078 -0.51549899454129 region=step2
           H -3.673159561801013 -2.414816382275922 -0.51564516686341 region=step2
           H -2.938101685663578 -2.921829124623212  1.03094752484358 region=step2
           H -0.884694282363284 -1.519047266416641  0.51564280107136 
           H -2.354216233206031 -0.504595127574485  0.51550071600252 
           H -1.619753333793463 -1.012031055604717 -1.03094699007257 
       End
       BondOrders
            1 2 1.0
            1 3 1.0
            1 4 1.0
            1 5 1.0
            2 6 1.0
            2 7 1.0
            2 8 1.0
       End
   End

   Engine ADF
    save TAPE13
   EndEngine
   eor

   # In the second calculation, we add the Hessian sub-matrix corresponding to H atoms 
   # of the first methyl group. We use as much data as possible from the first one.
   # This includes the part of the analytical Hessian computed for atoms of the "step1" 
   # region in the previous calculation.
   # We use the adf.rkf file for restart but if the 1st calculation had crashed or 
   # stopped uncontrollably, we would have to use the TAPE13 file instead.
   #

   AMS_JOBNAME=step2 "$AMSBIN/ams" << eor

   Task SinglePoint

   Properties
       NormalModes Yes
       SelectedRegionForHessian step2
   End

   LoadSystem
       File step1.results/ams.rkf
   End

   LoadEngine step1.results/adf.rkf
   EngineRestart step1.results/adf.rkf
   eor

   # In the third calculation, we do not use the SelectedRegionForHessian key, because
   # we want the full Hessian. In this calculation we use data from the second step.

   AMS_JOBNAME=step3 "$AMSBIN/ams" << eor

   Task SinglePoint

   Properties
       NormalModes Yes
   End

   LoadSystem
       File step2.results/ams.rkf
   End

   LoadEngine step2.results/adf.rkf
   EngineRestart step2.results/adf.rkf
   eor

