
.. _tutorial_basin_hopping:

======================
Basin Hopping Tutorial
======================

This tutorial explains how to run a basin hopping global optimization
calculation on a Lennard-Jones 13 particle.

.. image:: fig/lj13.png
    :align: center

Here is the con file of our starting structure:

.. literalinclude:: lj13.con

Here is the config.ini file::

    [Main]
    job=basin_hopping
    temperature=500 #specifiy the temperature used in the Monte-Carlo
                    #step acceptance

    [Potential]
    potential=lj #use the lennard-jones potential, in reduced-units

    [Communicator]
    type=local #run the client locally
    number_of_cpus=1 #only run 1 client at a time
    num_jobs=10 #only one run job per invocation of eon
    client_path=eonclient #search $PATH for a binary named eonclient

    [Basin Hopping]
    steps=10 # perform 100 Monte-Carlo steps
    displacement_distribution=gaussian #use a gaussian distribution
                                       #for the displacements instead
                                       #of a uniform distribution
    displacement=0.3 #the standard deviation for the gaussian
                         #which is used to displace each degree of
                         #freedom
    initial_md_probability=0.9 #each basin hopping job has a 90% chance
                               #of running molecular dynamics before
                               #starting the basin hopping calculation
    initial_md_temperature=300 #the temperature of the initial molecular
                               #dynamics calculation

    [Optimizer]
    opt_method=lbfgs #use the lbfgs optimizer
    converged_force=0.001 #stop the optimization once the max
                          #force per atom drops below 0.001 eV/A
    lbfgs_inverse_curvature=0.01 #specifies the value of 1/H0 used in
                                 #the lbfgs optimizer

You should now have a directory with two files in it: ``config.ini`` and
``reactant.con``. To run the calculation run the ``eon`` script::

   $ eon 
   registering results
   0 (result) searches processed
   0 searches in the queue
   making 10 searches
   10 from random structures 0 from previous minima
   job finished in .//jobs/scratch/0
   job finished in .//jobs/scratch/1
   job finished in .//jobs/scratch/2
   job finished in .//jobs/scratch/3
   job finished in .//jobs/scratch/4
   job finished in .//jobs/scratch/5
   job finished in .//jobs/scratch/6
   job finished in .//jobs/scratch/7
   job finished in .//jobs/scratch/8
   job finished in .//jobs/scratch/9
   10 searches created

Eon first looks for any completed jobs. As this is the first time you have run
Eon, it finds no previous calculations to register. It then makes the input
files needed for the 10 basin hopping jobs and writes them to
``jobs/scratch/0..9``. Then eonclient is run in each of these directories. 
