Generate a single conformer

There are several steps involved in generating a low-energy conformer from a 0D or 2D structure.

OBBuilder

The :obapi:`OBBuilder` class is the part of Open Babel that can take a 2D or 0D structure and generate a 3D structure. The 3D structure is made very quickly using a combination of rules (e.g. sp3 atoms should have four bonds arranged in a tetrahedron) and ring templates (e.g. cyclohexane is shaped like a chair).

The 3D structures that come straight out of OBBuilder may be useful for some purposes but most people will want to “clean them up”. This is because they may have clashes or have high energy structures due to some strain. The conformer search or geometry optimization methods described below are typically used after calling OBBuilder.

A more severe limitation of OBBuilder is that due to the limited number of ring templates (and any finite number of ring templates is limited) stereochemistry in rings is not necessarily preserved (a warning message will be issued whenever this is the case). While efforts are ongoing to improve this situation, if preserving stereochemistry is a priority then you will need to look elsewhere for this functionality.

The functionality of OBBuilder is not directly available through obabel but it is used as the necessary first step of the Gen3D operation discussed below.

Conformer searching

Given a 3D structure, the goal of conformer searching is to find a low energy conformation. This may be useful as a “clean-up” procedure after an initial 3D structure generation. Note that conformer searching does not alter stereochemistry.

The Open Babel library provides access to several algorithms for conformer searching. All of these algorithms adopt the torsion-driving approach; that is, conformations are generated by setting torsion angles to one of a number of allowed values. The allowed values are listed in the data file torlib.txt; for example, C-C bonds in alkanes have three allowed values: -60, 60 and 180.

  1. :obapi:`Systematic Rotor Search <SystematicRotorSearch>`: Systematically iterate through all possible conformers according to Open Babel’s torsion library. This approach is thorough and will find the global minimum. However as the number of conformations increases by multiples for each additional rotational bond, this can take quite a while for molecules with even just 7 rotatable bonds. This approach scales to the power of N, where N is the number of rotatable bonds.
  2. :obapi:`Fast Rotor Search <FastRotorSearch>`: This iterates through the same conformer space as the SystematicRotorSearch but it greedily optimises the torsion angle at each rotatable bond in turn, starting from the most central. Thus it scales linearly with the number of rotatable bonds.
  3. :obapi:`Random Rotor Search <RandomRotorSearch>`: Conformations are generated by randomly choosing from the allowed torsion angles.
  4. :obapi:`Weighted Rotor Search <WeightedRotorSearch>`: This method uses an iterative procedure to find a global minimum. As with the Random Rotor Search, it randomly choses from the allowed torsion angles but the choice is reweighted based on the energy of the generated conformer. Over time, the generated conformer for each step should become increasingly better.

For each of these methods, the lowest energy conformation found is selected. In some cases, the entire set of conformations generated is also available. Many of these methods include an option to optimize the geometry of conformations during the search. This greatly slows down the procedure but may produce more accurate results.

The choice of which algorithm to use depends on the speed/accuracy tradeoff with which you are happy, and also on the number of rotatable bonds in the molecule. Are you looking for a reasonable structure for 3D display? Or are you looking for a structure close to the global minimum?

To use from obabel, see the help for the conformer operation (obabel -L conformer). This operation is used both for conformer searching and for the genetic algorithm conformer generation described below.

Here is an example of use from Python:

>>> ff = ob.OBForceField.FindForceField("mmff94")
>>> ff.Setup(obmol)
True
>>> print ff.Energy()
15.179054202
>>> ff.SystematicRotorSearch(100)
>>> print ff.Energy()
10.8861155747

Gen3D

To illustrate how some of the above methods might be used in practice, consider the gen3d operation. This operation (invoked using --gen3d at the commandline) generates 3D structures for 0D or 2D structures using the following series of steps, all of which have been described above:

  1. Use the OBBuilder to create a 3D structure using rules and ring templates
  2. Do 250 steps of a steepest descent geometry optimization with the MMFF94 forcefield
  3. Do 200 iterations of a Weighted Rotor conformational search (optimizing each conformer with 25 steps of a steepest descent)
  4. Do 250 steps of a conjugate gradient geometry optimization

Taken together, all of these steps ensure that the generated structure is likely to be the global minimum energy conformer. However, for many applications where 100s if not 1000s of molecules need to be processed, gen3d is rather slow. A future version of Open Babel will provide options for slow/medium/fast 3D structure generation which will involve different compromises between speed and finding the global energy minimum.