# Example: Geometry Optimization: H2O¶

#! /bin/sh

# Summary:
# - geometry optimization in delocalized coordinates
# - geometry optimization in internal coordinates
# - start-up Hessian defined in the input file
# - geometry optimization in Cartesian coordinates

# Geometry optimization of the water molecule, using the (default) local density
# functional approximation (LDA)

# Fair quality basis set: triple zeta with polarization. Four equivalent
# computations are carried out. The first optimization is done in delocalized
# coordinates, which requires that atomic coordinates in the input are
# Cartesian. In the three other optimizations the atomic coordinates are input
# in Z-matrix format. The optimization is carried out by optimization of the
# internal coordinates in the second and third calculations, and by optimizing
# the Cartesian coordinates in the fourth one. In calculation #3 the start-up
# Hessian is defined in the input file; in #1,2, and 4 the default start-up
# Hessian (from a force-field approximation) is applied.

# As expected all final results are the same, within the range that might be
# expected from the convergence thresholds (here: the default values).

# == Optimization in delocalized coordinates ==

# A title is supplied. This title is printed in the output header. It is also
# written to any result files from the calculation and will be printed out when
# such a file is attached to another calculation, for instance as a fragment
# the adf release number and the date and time. The jobidentification is also
# printed in the output header and dumped on any result files.

# The atomic positions are given with the key atoms. The Cartesian atomic
# coordinates are in Angstrom. The structure used here does not necessary imply
# that the two HO bonds must remain equal in the optimization. The symmetry will
# keep them equal.

# The key geometry must be supplied to let the program do an optimization:
# otherwise a single point calculation would be carried out. The geometry data
# block is empty here, meaning that no default values are reset for the options
# that are controlled with this key.

# No symmetry is specified by a Schonfliess type symbol (key symmetry). The
# program will use the true symmetry of the nuclear frame (accounting for any
# fields, if present). In this case that is C(2v). If such symmetry would not be
# acceptable for adf (not all point groups are supported!) or when you want to
# run in a lower symmetry, the symmetry to be used must be specified.

# The fragment files are defined implicitly with the Basis keyword. In this case
# (as well as in most other samples) the fragment files reside in the local
# directory since they were created there in the same job. If they would have
# been located elsewhere you could specify a full path for each of the files, or
# alternatively (if all fragmentfiles are in one single directory) write the
# directory after the keyword fragments (on the same line).

$ADFBIN/adf <<eor Title WATER Geometry Optimization with Delocalized Coordinates Atoms O 0.000000 0.000000 0.000000 H 0.000000 -0.689440 -0.578509 H 0.000000 0.689440 -0.578509 End Basis Type TZP Core Small End Geometry Converge grad=0.0000001 End eor rm TAPE21 logfile # == Optimization in Cartesian coordinates ==$ADFBIN/adf <<eor
Title WATER Geometry Optimization in Cartesians

Atoms
O             0.000000     0.000000     0.000000
H             0.000000    -0.689440    -0.578509
H             0.000000     0.689440    -0.578509
End

Basis
Type TZP
Core Small
End

Geometry
Optim Cartesian
End

eor

rm TAPE21 logfile

# == Optimization with Internal Coordinates ==

$ADFBIN/adf <<eor Title WATER Geometry Optimization with Internal Coordinates Atoms Z-Matrix 1. O 0 0 0 2. H 1 0 0 0.9 3. H 1 2 0 0.9 100 End Basis Type TZP Core Small End Geometry Converge grad=0.0000001 End eor rm TAPE21 logfile # == Definition of (diagonal) start-up Hessian == # The key HessDiag defines the start-up Hessian to be diagonal with values 1.0 # and 0.1 for the entries related to bondlengths and angles respectively.$ADFBIN/adf <<eor
Title WATER   optimization with (partial) specification of Hessian

Atoms    Z-Matrix
1. O   0 0 0
2. H   1 0 0   0.9
3. H   1 2 0   0.9  100
End

Fragments
H   t21.H
O   t21.O
End

Geometry
End

eor

rm TAPE21 logfile

# In the last calculation the atomic coordinates are input in the same way as
# before, but the geometry block now specifies, with the subkey optim, that the
# cartesian coordinates are to be varied and monitored for convergence.

# If different coordinates are specified in the optim instruction than were used
# for the input in the atoms block, no constraints can be used.

# The placement of 0.9 (and 100) in the define block has a completely
# different meaning. define merely associates a numerical value with an
# identifier. Wherever the identifier occurs in input (not only in the atoms
# block) it will be replaced by the numerical value. This means that there are
# now nine (9) variables: the x,y,z coordinates of the three atoms.

# Pure translations and rotations will be filtered out by the program and the
# symmetry (explicitly specified or internally computed), C(2v) here, will be
# enforced on all developments so that the situation is equivalent to the
# previous calculation as regards the degrees of freedom of the system.

# Remark: the define block must occur in input before the variables defined in
# it are used. This is one of the few cases where the relative position of keys
# in the input stream is relevant.

Title WATER Geometry Optimization in Cartesians

Geometry
Optim Cartesian
End

Atoms    Z-Matrix
1. O   0 0 0
2. H   1 0 0   0.9
3. H   1 2 0   0.9 100
End

Fragments
H   t21.H
O   t21.O
End

eor

mv TAPE21 H2O.t21