.. _section_macrocycle:


Macrocycle Conformations
------------------------

Torsion driving conformational sampling methods such as described in the
:ref:`chapter_omegatheory` section often perform poorly
for macrocyclic molecules due to the problem of ring closure after the torsion driving step. 
Conformational sampling of macrocycles therefore requires a different approach;
we address this issue with **OMEGA** using distance geometry (DG) [Hawkins-2020]_. Other methods have been applied to this
problem, such as distance geometry (DG) [Crippen-1988]_, molecular dynamics (MD/LLMOD) [Watts-2014]_,
MD with perturbation along low energy eigenvectors [Labute-2010]_, and inverse kinematics
[Coutsias-2016]_. It is important to note that **OMEGA** DG also works well for very flexible linear molecules which have
such a large conformational space that torsion driving may not be able to adequately sample it.

**OMEGA**'s method of conformational sampling of macrocycles is an adaptation of the distance geometry method 
of Spellmeyer et al. [Spellmeyer-1997]_. In this method, a traditional embedding DG algorithm is replaced
with a direct error function minimization of the random atomic coordinates, followed by force field 
refinement. Each initial Cartesian atomic coordinate *x* is assigned by choosing a random number *r* 
between *-1* and *1*, multiplied by a factor :math:`f\sqrt{N}` which determines the box of maximum extent 
for a molecule with *N* atoms:

.. math:: x = f\sqrt{N}r
   :label: eqtnext

Alternatively, instead of randomly placing atoms in Cartesian space, the method allows for random
placement of rigid fragments such as aromatic rings, nitro groups, and so on. After randomly
placing molecules, atoms, or rigid fragments, an error function of the form:

.. math:: F = \sum_{i,j} (d_{ij}-c_{i,j})^2 + \sum_k V_k
   :label: eqtnerror

is optimized. In the above equation, the first sum runs over all pairs of atoms in the molecule,
where :math:`d_{ij}` are the interatomic distances and :math:`c_{ij}` are elements of the constraint matrix;
they are obtained from the MMFF94 force field parameters. When atoms *(i,j)* are
bonded or are the first and last atoms in a bond angle, the upper and lower bounds
are the same and are taken as the corresponding equilibrium force field distances. When
atoms *(i,j)* are the first and last atoms of a torsion angle, the lower bound corresponds to the cis configuration and
the upper bound to the trans configuration of those atoms. Finally, when atoms *(i,j)* are separated
by more than three bonds, the lower bound is taken as the sum of the vdW radii and the upper
bound as the sum of bond lengths which separate the pair. The second summation in
equation :eq:`eqtnerror` is over the tetrahedral constraints which result from:


1. planarity

2. chirality

3. cis-trans isomerism

Optimization of the error function :eq:`eqtnerror` leads to a rough conformation. No hydrogen atoms
except those which are bonded to chiral atoms are included in the error function minimization.
Each rough conformation is checked for chirality correctness before refinement. 
If the rough conformation passes the chirality checks, it is refined against a forcefield, MMFF94
([Halgren-I-1996]_, [Halgren-II-1996]_, [Halgren-III-1996]_, [Halgren-IV-1996]_, [Halgren-V-1996]_).
Solvent forces can be included in the refinement step using a simple continuum
solvation model (the Sheffield model [Grant-2007]_). When the sequence of random
placement followed by error function minimization and force field refinement is repeated for a large enough
number of times for a given macrocycle, its conformational space is reasonably well covered.

Special measures are taken for zwitterionic molecules (containing both positively and negatively
charged groups, such as :math:`CO_2^-` and :math:`NH_3^+`). In order to prevent possible Coulombic collapse
in the absence of a stabilizing receptor, zwitterionic molecules are neutralized before performing 
the distance geometry calculation and the refined structures are recharged before writing them out. 
This approach meaningfully improves **OMEGA**’s ability to reproduce solid-state conformations of
zwitterionic ligands.

This method of conformation sampling is completely general and can be used to generate conformations
for any molecule, whether or not it contains a large ring. However the ``macrocycle`` mode in **OMEGA** has
been specifically developed and parameterized to perform well on macrocycles, therefore its performance
on linear and small ring molecules is worse than with ``classic`` **OMEGA**.

