.. _ffield:

**********************************
Appendix: Generating a Force Field
**********************************

.. toctree::
   :maxdepth: 1
   :caption: Contents:
      
.. note:: The scripts for this step in the tutorial can be found in ``mgo_surface/mgo_fit``.

This tutorial will show you how to manually generate a force field for use in 
**MM** calculations. This is only relevant if you do not have a suitable 
forcefield to work with in your QM/MM calculations.

We will use GULP to generate our forcefield. We need the following information 
about our system:
        * Cell parameters
        * MgO structure in fractional or Cartesian (must be specified)
        * Species (core/shell and charge)
        * Starting guess for force field

All of this information is then structured in an input file with file extension 
``.gin``, e.g. input.gin. A full example file is shown below:

.. literalinclude:: ../../samples/mgo_surface/mgo_fit/input.gin

The first line of this input file dictates the type of calculation being run
and should be kept the same in most cases:
   * ``fit`` means that the forcefield will be fitted, rather than the system altered
   * ``conp`` ensures fitting is down under constant pressure conditions
   * ``prop`` allows evaluation of system properties once completed
   * ``simul`` provides simultaneous fitting and coordinate optimisation
   * ``opti`` is necessary to also perform the unit cell optimisation

After this line, most of the file is specific to your system. 
Line three are the cell parameters in the order ``A`` (length of cell side 
**A**), ``B`` (length of cell side **B**), ``C`` (length of cell side **C**), 
:math:`\alpha` (angle between **X** and **Y**), :math:`\beta` (angle between **X** 
and **Y**) and :math:`\gamma` (angle between **X** and **Y**\).

To specify *fractional* and *Cartesian* structures, the next line in the script 
should read ``fractional`` or ``Cartesian`` respectively.
Following the format ``Atom``, ``core``/``shell``, ``X``, ``Y``, ``Z``, input 
your structural data immediately below.
