# Transition state optimisation¶

There are two algorithms available in DL-FIND to search for transition states: partitioned rational function optimisation (P-RFO) and the dimer method.

## P-RFO¶

P-RFO is a traditional transition state optimisation algorithm which involves a full Hessian calculation to find the transition state mode to follow. It is therefore only suitable for the optimisation of small molecules.

The directory `samples/transition_states/`

contains an example optimisation
of the transition state for ammonia inversion (`prfo_nh3.nwchem.py`

). This
follows a similar pattern to
the minimisation example, except it searches for a maximum in one dimension
(i.e. a transition state).

First, we read in the ammonia molecule from disk, and set up the QM calculation as in previous examples:

```
# Read in NH3 geometry from disk
my_mol = Fragment(coords="nh3.xyz")
# Set up the QM calculation
my_theory = NWChem(frag=my_mol, method="dft", functional="blyp", basis="3-21g")
```

We then call DL-FIND with the option `algorithm=prfo`

to specify a P-RFO
transition state optimisation:

```
# Request an optimisation using DL-FIND
opt = Opt(theory=my_theory, coordinates="dlc", algorithm="prfo", tolerance=0.0003)
opt.run()
```

Here we are using delocalised internal coordinates (`coordinates="dlc"`

) rather
than cartesian coordinates for efficiency. The advantages and disadvantages
of the various coordinate systems available in DL-FIND will be discussed in a
later tutorial.

## The dimer method¶

The dimer method defines two connected geometry images which are rotated to determine the direction to the transition state. This avoids the need to calculate a Hessian and is therefore recommended for optimising systems with many degrees of freedom.

The dimer method can be chosen by specifying `dimer=True`

as in the example
`dimer_nh3.nwchem.py`

. The recommended optimisation algorithm for use with
the dimer method is lbfgs:

```
# Request an optimisation using DL-FIND
opt = Opt(theory=my_theory, dimer=True, coordinates="dlc", algorithm="lbfgs",
delta=0.01, tolerance=0.0003, trustradius="const")
opt.run()
```

You should find that the dimer method converges to the same final energy and
structure (check `path.xyz`

) as P-RFO. Due to the approximations made by
the dimer method you may find it takes a few more cycles to converge than
P-RFO, but this is usually far outweighed by the cost of calculating the Hessian
in P-RFO.

Both the P-RFO and dimer methods require a reasonable initial guess at the transition state structure in order to converge efficiently. In the next tutorial we will look at a method which only requires knowledge of the reactant and product states.