.. |A|         replace:: Å

.. _chapter_freeform:

********************************************************************************
*freeform* Theory
********************************************************************************

*freeform* has two distinct functions:

"freeform -calc conf...": Evaluation of the conformer free energy in solution,
meaning the free energy required to select a particular conformer out of the whole
conformational ensemble in solution.

"freeform -calc solv...": Fast estimation of the small molecule solvation free energy
and the XLogP calculated partition coefficient
(with graphical representation of fragment-based contributions to these physical
quantities).

.. _section_conformerDG:

Conformer Free Energies
================================================================================

Calculating the partition function
----------------------------------
The method is based upon combining ligand conformational search, energy minimization,
and entropy estimation in the workflow shown in
:ref:`Figure: Stages and workflow in the conformer free energy calculation<figure_confstages>`
below.

.. _figure_confstages:

.. figure:: ../images/freeform_conf_stages.png
   :scale: 80
   :align: center
   :alt: Stages and workflow in the conformer free energy calculation

   **Stages and workflow in the conformer free energy calculation**

The conformational search is done at a very high resolution
using the conformation generator OMEGA \ [Hawkins-2010]_\ .
The energy minimization uses Halgren's MMFF94s force field \ [Halgren-VI-1999]_\ and
consists of several stages, all aimed at arriving at the most thorough sampling of the
accessible conformational space of the ligand. Duplicate conformers are removed from
the final minimized set, leaving an ensemble of :math:`n_c` unique conformers which we use
to create an approximation to the partition function of the unbound ligand.
This is illustrated conceptually in
:ref:`Figure: Concept of ligand entropy as a sum-over-states of conformers<figure_EntropyWells>`.

.. _figure_EntropyWells:

.. figure:: ../images/EntropyWells.png
   :scale: 80
   :align: center
   :alt: Concept of ligand entropy as a sum-over-states of conformers

   **Concept of ligand entropy as a sum-over-states of conformer entropies**

To the molecule's gas-phase potential based on the MMFF94 force field (shown by the red line),
Sheffield solvation energies are added to give a solvation-corrected potential
(shown by the blue line) for which the minima are identified.
The analytic second derivative of each minimum is then used to
calculate the entropy contribution of each energy well according to \ [Wlodek-2010]_\.
An energy minimum with a wider than average energy well will have a higher entropy,
which will decrease the conformer free energy to select that conformer,
while the converse will be true for a narrower than average energy well.

With this, the contribution
:math:`Q_i` of each energy minimum to the overall partition function :math:`Q` can be calculated:

.. math::

   Q_i = q_t q_{ir} q_{iv} e^{-\epsilon_i /RT}

.. math::

   Q = \sum_{i=1}^{n_c} Q_i

Here :math:`\epsilon_i` is the relative internal energy (including solvation energy)
of the conformer relative to the global minimum conformation.
:math:`q_t`, :math:`q_ir` and :math:`q_iv` are the translational,
rotational and vibrational partition functions respectively, describing the
entropic contributions from that conformation.
:math:`n_c` is the number of unique conformations in the ensemble.
More details on these terms are given in the theory section of the szybki documentation.

Computing the conformer free energies
-------------------------------------
Based upon this approximation to the partition function, we calculate conformer free
energies: the free energy required to select a particular conformation from the unbound
ensemble of all conformers equilibrating in aqueous solution. Strictly speaking,
this is a Helmholtz free energy, not a Gibb's free energy, because we are neglecting
the differential PV (Pressure*Volume) contribution between conformers, but this
should be negligible. Based on the above conformer and ensemble partition functions, the
conformer free energy for any conformer is calculated straightforwardly as:

.. math::

   \Delta A_i = -RT ( \ln Q_i - \ln Q )

In addition to the graphic output file which shows a plot of the calculated free energies of
conformations vs. their relative intrinsic energies, numerical results are stored in the
log and csv files. For each conformation the following data are reported: rotational
and vibrational entropies, total force field energy, solvation energy, the sum of solvation
energy and force field energy, relative energy, free energy, and heavy atoms RMSD displacement
from the input 3D structure (the latter only when the ``-useInput3D`` option is used).

Ligand strain in the input 3D structure
---------------------------------------
When conformer free energies are calculated with the ``-useInput3D`` flag, *freeform*
pays attention to the 3-D structure in the input file and keeps track of it,
writing out the conformer free energy quantities associated with it. The idea is
that the user can input a bioactive confirmation from an x-ray crystal structure,
or a hypothetical model-built structure of interest, and get a direct readout of the energy
required to select that particular conformation out of the aqueous ensemble. A key issue,
however, is that the input 3D coordinates may be of artificially high energy,
usually due to small deviations of bond lengths and bond angles from optimum;
this is often true particularly of ligands from Xray structures. For this reason
a "cleanup" pre-optimization is done using harmonic constraints to the input
coordinates, thus retaining the shape of the ligand but resolving the artificially
high energy. This "cleanup"
energy is discarded. Since conformer free energies are calculated from energy
minima in order to characterize the entropy, an unconstrained minimization is
now required to find the closest energy minimum to the cleaned-up structure,
which we refer to as the input 3D minimum.  This minimization allows the torsions
in the input structure to relax away from where they may have been distorted from
the nearby local minimum, for example in order to fit into the active site.
*freeform* keeps track of this "distortion" strain energy as Estrain.
From this point, *freeform* simply includes the relaxed input 3D minimum as just
another energy minimum in the aqueous ensemble and calculates its conformer
free energy, which is specifically reported in the pdf and log output (see examples).
Keep in mind that the free energy required to adopt the input 3D minimum
may be significant and probably should be considered a component of the
strain energy also. Thus, within *freeform*, the overall strain energy for the
input 3D structure would be considered to consists of a) the conformer free energy
required to adopt the input 3D minimum (i.e. the closest local minimum to the input
structure), and b) the additional energy ``Estrain``
required to distort the torsions of that minimum so the ligand can adopt the
shape of the actual input 3D structure.

.. _section_solvationFe:

Solvation energy estimation
================================================================================

How it is calculated
--------------------
The term "Solvation energy" is defined here as the standard free energy of transferring
a compound from the gaseous phase into dilute aqueous solution, :math:`\Delta G_{solv}^{0}`.

Solvation energy is a crucial component of the solubility energetics,
and is directly related to hydrophilicity/hydrophobicity of a compound, therefore one can
expect it is correlated with another measure of hydrophobicity logP, as illustrated on the diagram
below (:ref:`Figure: Solvation, solubility and hydrophobicity<figure_solv_solu_hydro>`).
Such a correlation, particularly when functional groups contribution is
considered might not exist. *freeform* shows side-by-side the graphical group
contributions to solvation free energy and XLogP.

.. _figure_solv_solu_hydro:

.. figure:: ../images/solvation-solubility.png
   :scale: 100
   :align: center

   **Solvation, solubility and hydrophobicity**

The method is based on the continuum solvent model in which a PB solver ZAP
\ [Grant-2001]_\  is used. The calculation is performed on the lowest energy gas-phase
conformation found with the MMFF94 force field from the optimized set of conformations
generated by the conformation generator OMEGA \ [Hawkins-2010]_\ .
A set of atomic radii ZAP9 and AM1BCC partial charges as described in \ [Nicholls-2010]_\
is applied for all PB calculations. Atomic and group contributions to the free energy of
solvation for the input compound are calculated from atomic electrostatic potentials and
atomic area terms representing hydrophobic part of solvation. Assuming that a functional
group has :math:`n` atoms, its calculated solvation free energy :math:`\Delta G_s` is:

.. math::

   \Delta G_s = \sum_{i}^{n}[(V_{i,s}-V_{i,v})q_i+S_i]

where :math:`V_{i,s}` and  :math:`V_{i,v}` are calculated electrostatic potentials
on atom :math:`i` in solution and in vacuum respectively, :math:`q_i` is atom partial
charge and :math:`S_i` is atomic contribution to hydrophobic part of solvation
evaluated from a simple surface area model assuming 6.3 cal/(mol |A|:math:`\AA`) as a value for
microscopic surface tension coefficient. Graphical representation of group (or atomic)
contributions to the free energy of solvation is performed with the OE toolkits OEDepict and
Grapheme.

Counterintuitive group contributions to solvation energies
----------------------------------------------------------
Solvation free energy for molecular ions might not be trivial to interpret
because of very strong intrinsic electrostatic interactions. One can most
easily begin to understand these effects by considering zwitterions.  A common
zwitterion will contain both a group with a positive formal charge and a group
with a negative formal charge.  It is well known that zwitterions, though still
having high solvation energies, have significantly smaller solvation energies
than compounds with two formal charges of the same sign.  In fact, zwitterion
solvation energies are typically smaller than the solvation energy of the
analog molecule with a single charge.  For instance, as the following figures show
:ref:`Figure: Solvation energy of phenylalanine<figure_phenylalanine>`,
:ref:`Figure: Solvation energy of amide analog of phenylalanine<figure_phenylalanine1>` and
:ref:`Figure: Solvation energy of methoxy analog of phenylalanine<figure_phenylalanine2>`
the solvation energy of zwitterionic phenylalanine is -32.8 kcal/mol, while the solvation energy
of the formamide analog and the methyl ester analog are -73.4 and -63.4 kcal/mol respectively.

.. _figure_phenylalanine:

.. figure:: ../images/ph1.png
   :scale: 100
   :align: center

   **Solvation energy of phenylalanine**

.. _figure_phenylalanine1:

.. figure:: ../images/ph2.png
   :scale: 100
   :align: center

   **Solvation energy of amide analog of phenylalanine**

.. _figure_phenylalanine2:

.. figure:: ../images/ph3.png
   :scale: 100
   :align: center

   **Solvation energy of methoxy analog of phenylalanine**

One can consider then, that adding a charge that is the opposite
charge of the current molecular ion contributes a positive 30 to 40 kcal/mol
to the solvation energy.
A similar situation, perhaps even more dramatic, occurs in the case of intramolecular
salt bridges, where positively and negatively charged groups are positioned in
a very short distance (that kind of interaction not only exists in macromolecules:
NMR and hydrogen exchange rate experiments have confirmed the presence of salt
bridges between arginine or lysine and aspartate or glutamate side chains also
in short peptides \ [Otter-1989]_, [Mayne-1998]_\).
Making positive contributions to the solvation energy is generally considered a
hydrophobic effect, yet here the contribution is made by a charged species --
something that is somewhat counterintuitive at first.  Nevertheless, in this
context, one can understand how, under the right conditions, a normally
hydrophilic functional group can make a significant positive contribution to
the solvation energy.
The more confusing circumstance is when, rather than a simple zwitterion, we
see a similar effect in a molecule with either multiple charges of one type
(either positive or negative) and a single charge of the opposite sign.
Consider a molecule with 2 negative ions, one positive ion and a total charge
of -1, like the one shown on
:ref:`Figure: Example of counterintuitive group contributions to solvation<figure_counterint>`
below.

.. _figure_counterint:

.. figure:: ../images/counterintuitive.png
   :scale: 80
   :align: center
   :alt: Example of counterintuitive group contributions to solvation

   **Counterintuitive group contributions to solvation**

In this case, the positive ion will be changing the formal charge from
-2 to -1.  This will make the total solvation energy significantly less
negative (a positive contribution to the solvation energy).  The positive ionic
functional group in this case will have a large positive solvation energy.
While a charged group is indeed not hydrophobic, in this instance, one can
understand that it makes the solvation energy less negative in a manner similar
to the way a hydrophobic group might, but to a larger degree.
In more subtle cases, one can observe a similar though less dramatic hydrophobicity
in a molecule with a single charge, either positive or negative and another fragment
that makes a large neutralizing contribution to the partial charge of the
molecule.

In order to alert the user, species which contain strong intramolecular
electrostatic interactions of the nature described above are depicted on a
light pink background.  This should act as a reminder to users to consider the
net charge of the molecule in interpreting the relative contribution of each
fragment to the solvation energy.

