Example: FDE NMR shielding: Acetonitrile in water
*************************************************

"Download FDE_NMR_relax.run"

   #! /bin/sh


   # This examples demonstrates both the calculation of NMR shieldings using FDE,
   # and how the approximate environment density can be improved by partial
   # relaxation of individual solvent molecules. The test system is a cluster of
   # acetonitrile and 12 solvent water molecules, of which for two the densities
   # are relaxed, while for the remaining 10 the frozen density of the isolated
   # water is used. For details, see Refs. C. R. Jacob, J. Neugebauer, and L.
   # Visscher, A flexible implementation of frozendensity embedding for use in
   # multilevel simulation, submitted, 2007. R. E. Bulo, Ch. R. Jacob, and L.
   # Visscher, NMR Solvent Shifts of Acetonitrile from Frozen-Density Embedding
   # Calculation

   # First, the isolated solvent water molecule is prepared. Again, because this
   # will be rotated and translated afterwards, the option NOSYMFIT has to be
   # included.


   # create atomic fragment files

   AMS_JOBNAME=O $AMSBIN/ams <<eor
   System
     Atoms
       O 0.0 0.0 0.0
     End
   End
   Task SinglePoint
   Engine ADF
     create O file=$AMSRESOURCES/ADF/DZP/O
     Relativity Level=None
   EndEngine
   eor
   mv O.results/adf.rkf t21.O.DZP

   AMS_JOBNAME=H $AMSBIN/ams <<eor
   System
     Atoms
       H 0.0 0.0 0.0
     End
   End
   Task SinglePoint
   Engine ADF
     create H file=$AMSRESOURCES/ADF/DZP/H
     Relativity Level=None
   EndEngine
   eor
   mv H.results/adf.rkf t21.H.DZP

   AMS_JOBNAME=C $AMSBIN/ams <<eor
   System
     Atoms
       C 0.0 0.0 0.0
     End
   End
   Task SinglePoint
   Engine ADF
     create C file=$AMSRESOURCES/ADF/DZP/C
     Relativity Level=None
   EndEngine
   eor
   mv C.results/adf.rkf t21.C.DZP

   AMS_JOBNAME=N $AMSBIN/ams <<eor
   System
     Atoms
       N 0.0 0.0 0.0
     End
   End
   Task SinglePoint
   Engine ADF
     create N file=$AMSRESOURCES/ADF/DZP/N
     Relativity Level=None
   EndEngine
   eor
   mv N.results/adf.rkf t21.N.DZP

   #############################
   # prepare H2O
   #############################

   AMS_JOBNAME=H2O $AMSBIN/ams <<eor
   System
     atoms
        O       -1.46800        2.60500        1.37700
        H       -0.95200        3.29800        0.96500
        H       -1.16100        1.79900        0.96100
     end
   end

   Task SinglePoint

   Engine ADF
     eprint
       scf NOPOP
       sfo NOEIG NOOVL NOORBPOP
     end
     fragments
        H        t21.H.DZP
        O        t21.O.DZP
     end
     noprint BAS FUNCTIONS
     numericalquality GOOD
     scf
       converge 1.0e-06 1.0e-06
       iterations 100
     end
     symmetry NOSYM
     symmetrytolerance 1e-2
     title Input generated by PyADF and later modified
     xc
       lda
     end
     Relativity Level=None
   EndEngine
   eor

   mv H2O.results/adf.rkf t21.h2o


   # Afterwards, the FDE calculation is performed. In addition to the nonfrozen
   # acetonitrile molecule, three different fragments are used for the solvent
   # water molecules. The first two fragments frag1 and frag2 are relaxed (in up to
   # two freeze-and-thaw cycles), while the third fragment is used for the
   # remaining 10 solvent molecules. Since a calculation of the shielding is
   # performed afterwards, the option has to be included.

   ######################################
   # and the embedding calculation
   ######################################

   AMS_JOBNAME=FDE $AMSBIN/ams <<eor
   System
     atoms
        C        0.83000        0.66100       -0.44400
        N        0.00000        0.00000        0.00000
        C        1.87800        1.55900       -0.81900
        H        1.78500        2.40300       -0.13500
        H        1.76200        1.94900       -1.83000
        H        2.82900        1.12200       -0.51300
        O       -1.46800        2.60500        1.37700    adf.f=frag1|1
        H       -0.95200        3.29800        0.96500    adf.f=frag1|1
        H       -1.16100        1.79900        0.96100    adf.f=frag1|1
        O        2.40400       -2.51000       -0.36200    adf.f=frag2|1
        H        2.70000       -3.41900       -0.40900    adf.f=frag2|1
        H        1.77500       -2.50000        0.35900    adf.f=frag2|1
        O       -3.22800       -1.61500        1.18500    adf.f=frag3|1
        H       -3.33300       -2.55300        1.03000    adf.f=frag3|1
        H       -3.14200       -1.23600        0.31000    adf.f=frag3|1
        O        0.84000       -2.61200        2.89000    adf.f=frag3|2
        H        0.58800       -3.43700        3.30500    adf.f=frag3|2
        H        0.02500       -2.11500        2.82900    adf.f=frag3|2
        O        2.95400       -0.85100        2.99700    adf.f=frag3|3
        H        2.12000       -1.22400        2.71200    adf.f=frag3|3
        H        2.71800       -0.24100        3.69600    adf.f=frag3|3
        O        3.62200       -0.74000       -2.19300    adf.f=frag3|4
        H        3.05100       -1.25200       -1.62100    adf.f=frag3|4
        H        4.08100       -0.14200       -1.60200    adf.f=frag3|4
        O       -3.80000       -1.13100       -1.71100    adf.f=frag3|5
        H       -3.02600       -0.80900       -2.17400    adf.f=frag3|5
        H       -4.31600       -0.34500       -1.53300    adf.f=frag3|5
        O       -1.77100       -3.79600       -2.15500    adf.f=frag3|6
        H       -2.71500       -3.79000       -2.31700    adf.f=frag3|6
        H       -1.65100       -3.19400       -1.42100    adf.f=frag3|6
        O        1.60000       -0.17800       -3.98800    adf.f=frag3|7
        H        2.40800       -0.18200       -3.47500    adf.f=frag3|7
        H        1.13900       -0.97100       -3.71300    adf.f=frag3|7
        O       -1.63900       -1.73400        3.28100    adf.f=frag3|8
        H       -1.97000       -1.69700        4.17900    adf.f=frag3|8
        H       -2.38200       -2.04200        2.76400    adf.f=frag3|8
        O        1.57900        2.85500        2.45800    adf.f=frag3|9
        H        0.92600        2.71500        3.14400    adf.f=frag3|9
        H        1.85200        3.76600        2.57000    adf.f=frag3|9
        O       -3.44400        2.36700        3.13700    adf.f=frag3|10
        H       -2.70200        2.29200        2.53700    adf.f=frag3|10
        H       -3.47300        3.29500        3.36800    adf.f=frag3|10
     end
   end

   Task SinglePoint

   Engine ADF
     eprint
       scf NOPOP
       sfo NOEIG NOOVL NOORBPOP
     end
     fde
       pw91k
     end
     fragments
        H      t21.H.DZP
        C      t21.C.DZP
        N      t21.N.DZP
        frag1  t21.h2o
        frag2  t21.h2o
        frag3  t21.h2o
     end
     fdefragments
        frag1  type=FDE  &
           fdeoptions RELAX
           RELAXCYCLES 2
        SubEnd
        frag2  type=FDE  &
           fdeoptions RELAX
           RELAXCYCLES 2
        SubEnd
        frag3  type=FDE  &
           FDEDENSTYPE SCFexact
        SubEnd
     end
     noprint BAS FUNCTIONS
     numericalquality GOOD
     save TAPE10
     scf
       converge 1.0e-07 1.0e-07
       iterations 100
     end
     symmetrytolerance 1e-2
     title Input generated by PyADF and later modified
     xc
       gga BP86
     end
     Relativity Level=None
   EndEngine
   eor


   # Finally, the calculation of the NMR shielding of the nitrogen atom is
   # performed using the NMR program.


   $AMSBIN/nmr <<eor
    tape10file FDE.results/TAPE10
    adffile FDE.results/adf.rkf
    NMR
     out tens iso
     nuc 3 
    END
   eor
