# Molecular mechanics

## Contents

## Introduction

In molecular mechanics, equations are used to calculate the interations and the corresponding energies. These equations follow the classical laws of physics and the atoms are represented as particles (nuclei) without considering the electrons. The atoms are connected via bonds, this means that it is not possible to simulate reactions in molecular mechanics. Bonds cannot be formed or broken (More advanced techniques such as QM/MM could be used for this).

A force field is a set of equations and parameters for these equations. A simple forcefield looks like this:

Each of these individual energy terms needs parameters which depend on the atom types for the interaction. See the wiki force fields pages for more details about the functional form for each force field. The parameter files can be found in the Open Babel data/ directory.

See the Obenergy man page for information on how to calculate the energy for a molecule using Open Babel.

## Energy minimalization

Using a force field the energy for a given molecule can be calculated. To minimize the energy (find more stable conformation), the forces acting on each atom can be calculated by taking the negative derivative of the energy function with respect to the coordinates of the atom.

Once the forces on all atoms are known, taking small steps along the direction of the forces acting on them reduces the energy. If this process is repeated several times, a local minimum is reached. It is not directly possible to locate the global minimum since the forces acting on the atoms at the local minimum are zero. Other methods exist to sample the conformational space in a 'smart' way to reduce computational cost.

See the Obminimize man page for information on how to perform these minimizations using Open Babel.

### Line search

This algorithm is part of a bigger energy minimalization algorithm such as steepest descent or conjugate gradients. In the line search algorithm the local minimum is found be taking succesive steps along a search direction. The line search can be simplified to a one-dimentional problem. The first step size in the direction of the search direction is always the same. If the energy for the new position is lower the step is accepted and the step size is increased (stepsize * 1.2). If the energy is higher, the step is rejected and the step size is decreased (stepsize * 0.5). This results in a convergence towards the minimum. To speed this process up a convergence criteria is used: when the energy difference between successive is lower than 1e-7, no more steps are taken.

### Steepest descent

Steepest descent is an iterative optimization algorithm. It works by repeatably moving the atoms to the local minimum in the direction of their forces. This means that the directions of successive steps are orthogonal. As a result, the steepest descent algorithm converges rather slow in narrow valleys in the energy surface. Steepest descent is well suited for an initial minimization to relieve the molecule from large forces.

See the online resources for more information about steepest descent.

### Conjugate gradients

Conjugate gradients is an iterative optimization algorithm. It works by repeatably moving the atoms to the local minimum in the direction .

Here is the gradient for the current step, is the gradient for the previous step. Since there is no for the first step, the first step is identical to the first step for steepest descent. Conjugate gradients theoretically converges in the same number of steps as there are variables (3N, N is number of atoms). However, the linesearch never finds the real minimum (see convergence criteria) so some additional steps are needed.

See the online resources for more information about conjugate gradients.

## Current implementations

Currently, the 2.2 development code includes three force fields:

## Performance

Going from version 2.1 to 2.2, the force fields performance has increased significantly.

### Compiling with SSE/AltiVec

SSE stands for streaming SIMD (single instruction multiple data) extensions. AltiVec is the same concept for PowerPC.

The step-by-step procedure below applies to x86/GCC.

Download and extract the archive:

$tar zxvf openbabel-2.2.tar.gz $cd openbabel-2.2

Run `configure`

and specify the compiler flags:

$./configure CXXFLAGS="-g -O2 -msse3 -mfpmath=sse"

Now you can run `make`

and `make install`

:

$make $sudo make install