
.. _szybki_part_examples:
.. _chapter_szybki_examples:

********************************************************************************
Examples: Working with Szybki TK
********************************************************************************

The basic *Szybki TK* API is provided to the users in the :ref:`OESzybki <OESz_OESzybki>`,
:ref:`OESzybkiOptions <OESz_OESzybkiOptions>`, :ref:`OESzybkiResults <OESz_OESzybkiResults>` and
:ref:`OESzybkiEnsembleResults <OESz_OESzybkiEnsembleResults>` classes. In addition, when the purpose is to
calculate compound properties, such as solvation free energy or free energy of
selecting specific conformations out of the ensemble, the higher level API are defined in
the free functions, :oe:func:`OESz::OEEstimateSolvFreeEnergy` and
:oe:func:`OESz::OEEstimateConfFreeEnergies`.

Ligand Energetics and Optimization
==================================

.. _section_simple_vacuum_example:

Single ligand in vacuum
-----------------------
The following example illustrates how to optimize a single ligand in vacuum. As one
can see assuming a molecule is successfully read, only two objects are needed to
perform the optimization: :ref:`OESzybki <OESz_OESzybki>` and :ref:`OESzybkiResults <OESz_OESzybkiResults>`.
The latter is passed as the second parameter to the parenthesis operator
:oe:meth:`OESz::OESzybki::operator()`. Molecule with the optimized coordinates is
returned as a first parameter. Optimization is done using the default MMFF94. Final
energy results are available as SD tags in the returned molecule and optionally with
a call of a method :oe:meth:`OESz::OESzybkiResults::Print`.


.. oe:source:: simple_vacuum.cpp
   :language: c++
   :caption:  Simple Ligand in a Vacuum
   :refnum:   1

.. oe:language:: c++

   .. only:: oehtml

      .. admonition:: Download code

         :download:`simple_vacuum.cpp <../../../../sublibs/tklibs/szybki/examples/simple_vacuum.cpp>`

.. oe:source:: simple_vacuum.py
   :language: python
   :caption:  Simple Ligand in a Vacuum
   :refnum:   1

.. oe:language:: python

   .. only:: oehtml

      .. admonition:: Download code

         :download:`simple_vacuum.py <../../../../wrappers/python/examples/szybki/simple_vacuum.py>`


.. oe:source:: SimpleVacuum.java
   :language: java
   :caption:  Simple Ligand in a Vacuum
   :refnum:   1


.. oe:language:: java

   .. only:: oehtml

      .. admonition:: Download code

         :download:`SimpleVacuum.java <../../../../wrappers/java/examples/openeye/examples/oeszybki/SimpleVacuum.java>`

.. oe:source:: SimpleVacuum.cs
   :language: csharp
   :caption:  Simple Ligand in a Vacuum
   :refnum:   1


.. oe:language:: csharp

   .. only:: oehtml

      .. admonition:: Download code

         :download:`SimpleVacuum.cs <../../../../wrappers/csharp/Csharp-Examples/OESzybki/SimpleVacuum.cs>`


.. _section_simple_vacuum_smirnoff_example:

Single ligand in vacuum using SMIRNOFF
----------------------------------------

The following example illustrates how to optimize a single ligand in vacuum using
SMIRNOFF (see :ref:`section_smirnoff`). Only two objects are needed to perform
the optimization: :ref:`OESzybki <OESz_OESzybki>` and :ref:`OESzybkiResults <OESz_OESzybkiResults>`.
The latter is passed as the second parameter to the parenthesis operator
:oe:meth:`OESz::OESzybki::operator()`. Partial charges have to be preassigned to the
input molecule. Molecule with the optimized coordinates is returned as a first parameter.
Final energy results are available as SD tags in the returned molecule and optionally
with a call of a method :oe:meth:`OESz::OESzybkiResults::Print`.

.. oe:source:: simple_smirnoff.cpp
   :language: c++
   :caption:  Simple Ligand in a Vacuum Using SMIRNOFF
   :refnum:   2

.. oe:language:: c++

   .. only:: oehtml

      .. admonition:: Download code

         :download:`simple_vacuum.cpp <../../../../sublibs/tklibs/szybki/examples/simple_vacuum.cpp>`

.. oe:source:: simple_smirnoff.py
   :language: python
   :caption:  Simple Ligand in a Vacuum Using SMIRNOFF
   :refnum:   2

.. oe:language:: python

   .. only:: oehtml

      .. admonition:: Download code

         :download:`simple_smirnoff.py <../../../../wrappers/python/examples/szybki/simple_smirnoff.py>`


.. oe:source:: SimpleSmirnoff.java
   :language: java
   :caption:  Simple Ligand in a Vacuum Using SMIRNOFF
   :refnum:   2

.. oe:language:: java

   .. only:: oehtml

      .. admonition:: Download code

         :download:`SimpleSmirnoff.java <../../../../wrappers/java/examples/openeye/examples/oeszybki/SimpleSmirnoff.java>`

.. oe:source:: SimpleSmirnoff.cs
   :language: csharp
   :caption:  Simple Ligand in a Vacuum Using SMIRNOFF
   :refnum:   2

.. oe:language:: csharp

   .. only:: oehtml

      .. admonition:: Download code

         :download:`SimpleSmirnoff.cs <../../../../wrappers/csharp/Csharp-Examples/OESzybki/SimpleSmirnoff.cs>`



.. _section_ligand_multiple_options_example:

Optimization of a set of ligands
--------------------------------

The next example illustrates the usage of Szybki TK to optimize a set of compounds with
the MMFF94 force field in vacuum or in solution using Sheffield solvation model.
Optionally attractive VdW can be removed. The optimization is done by default in full
Cartesian coordinates, however torsion space optimization or single point calculation
could be done too. A group of atoms which belong to specified SMARTS pattern might be
excluded from optimization so their positions will be fixed at their initial coordinates.
Note that the :ref:`OESzybki <OESz_OESzybki>` object is made with a constructor which takes
the instance of the :ref:`OESzybkiOptions <OESz_OESzybkiOptions>` class.

.. oe:source:: ligand_multiple_options.cpp
   :language: c++
   :caption:  Optimization of a Set of Ligands
   :refnum:   3

.. oe:language:: c++

   .. only:: oehtml

      .. admonition:: Download code

         :download:`ligand_multiple_options.cpp <../../../../sublibs/tklibs/szybki/examples/ligand_multiple_options.cpp>`

.. oe:source:: ligand_multiple_options.py
   :language: python
   :caption:  Optimization of a Set of Ligands
   :refnum:   3

.. oe:language:: python

   .. only:: oehtml

      .. admonition:: Download code

         :download:`ligand_multiple_options.py <../../../../wrappers/python/examples/szybki/ligand_multiple_options.py>`


.. oe:source:: LigandMultipleOptions.java
   :language: java
   :caption:  Optimization of a Set of Ligands
   :refnum:   3

.. oe:language:: java

   .. only:: oehtml

      .. admonition:: Download code

         :download:`LigandMultipleOptions.java <../../../../wrappers/java/examples/openeye/examples/oeszybki/LigandMultipleOptions.java>`

.. oe:source:: LigandMultipleOptions.cs
   :language: csharp
   :caption:  Optimization of a Set of Ligands
   :refnum:   3

.. oe:language:: csharp

   .. only:: oehtml

      .. admonition:: Download code

         :download:`LigandMultipleOptions.cs <../../../../wrappers/csharp/Csharp-Examples/OESzybki/LigandMultipleOptions.cs>`

.. _section_simple_newton_example:

Optimization of a single ligand with the Newton-Raphson method
--------------------------------------------------------------

The next example in this section shows how to use Newton-Raphson optimization
method, rather than the default BFGS:

.. oe:source:: simple_newton.cpp
   :language: c++
   :caption:  Optimization of a Single Ligand with the Newton-Raphson Method
   :refnum:   4

.. oe:language:: c++

   .. only:: oehtml

      .. admonition:: Download code

         :download:`simple_newton.cpp <../../../../sublibs/tklibs/szybki/examples/simple_newton.cpp>`

.. oe:source:: simple_newton.py
   :language: python
   :caption:  Optimization of a Single Ligand with the Newton-Raphson Method
   :refnum:   4

.. oe:language:: python

   .. only:: oehtml

      .. admonition:: Download code

         :download:`simple_newton.py <../../../../wrappers/python/examples/szybki/simple_newton.py>`

.. oe:source:: SimpleNewton.java
   :language: java
   :caption:  Optimization of a Single Ligand with the Newton-Raphson Method
   :refnum:   4

.. oe:language:: java

   .. only:: oehtml

      .. admonition:: Download code

         :download:`SimpleNewton.java <../../../../wrappers/java/examples/openeye/examples/oeszybki/SimpleNewton.java>`

.. oe:source:: SimpleNewton.cs
   :language: csharp
   :caption:  Optimization of a Single Ligand with the Newton-Raphson Method
   :refnum:   4

.. oe:language:: csharp

   .. only:: oehtml

      .. admonition:: Download code

         :download:`SimpleNewton.cs <../../../../wrappers/csharp/Csharp-Examples/OESzybki/SimpleNewton.cs>`

.. _section_simple_conformer_example:

Optimization of all conformers of a ligand
--------------------------------------------------------------

Finally, the last example in this section shows how to use Newton-Raphson optimization
method on all conformers of a ligand. The current charges of the ligand are used and will
not be changed during the optimization.

.. oe:source:: simple_conformer.cpp
   :language: c++
   :caption:  Optimization of All Conformers of a Ligand
   :refnum:   5

.. oe:language:: c++

   .. only:: oehtml

      .. admonition:: Download code

         :download:`simple_conformer.cpp <../../../../sublibs/tklibs/szybki/examples/simple_conformer.cpp>`

.. oe:source:: simple_conformer.py
   :language: python
   :caption:  Optimization of All Conformers of a Ligand
   :refnum:   5

.. oe:language:: python

   .. only:: oehtml

      .. admonition:: Download code

         :download:`simple_conformer.py <../../../../wrappers/python/examples/szybki/simple_conformer.py>`



.. oe:source:: SimpleConformer.java
   :language: java
   :caption:  Optimization of All Conformers of a Ligand
   :refnum:   5

.. oe:language:: java

   .. only:: oehtml

      .. admonition:: Download code

         :download:`SimpleConformer.java <../../../../wrappers/java/examples/openeye/examples/oeszybki/SimpleConformer.java>`

.. oe:source:: SimpleConformer.cs
   :language: csharp
   :caption:  Optimization of All Conformers of a Ligand
   :refnum:   5

.. oe:language:: csharp

   .. only:: oehtml

      .. admonition:: Download code

         :download:`SimpleConformer.cs <../../../../wrappers/csharp/Csharp-Examples/OESzybki/SimpleConformer.cs>`

.. _section_simple_protein_example:

Optimization of a single bound ligand
-------------------------------------

The simplest case is illustrated below.
Notice the usage of the method :oe:meth:`OESz::OESzybki::SetProtein` which tells Szybki
that the ligand is placed inside the protein. Since no protein-ligand electrostatics have been
specified, neither the coordinates types which should be used by the optimizer, the code below
performs the optimization for a rigid ligand using 6 translational-rotational coordinates in
the MMFF94 VdW potential field.

.. oe:source:: simple_protein.cpp
   :language: c++
   :caption:  Optimization of a Single Bound Ligand
   :refnum:   5

.. oe:language:: c++

   .. only:: oehtml

      .. admonition:: Download code

         :download:`simple_protein.cpp <../../../../sublibs/tklibs/szybki/examples/simple_protein.cpp>`

.. oe:source:: simple_protein.py
   :language: python
   :caption:  Optimization of a Single Bound Ligand
   :refnum:   5

.. oe:language:: python

   .. only:: oehtml

      .. admonition:: Download code

         :download:`simple_protein.py <../../../../wrappers/python/examples/szybki/simple_protein.py>`

.. oe:source:: SimpleProtein.java
   :language: java
   :caption:  Optimization of a Single Bound Ligand
   :refnum:   5

.. oe:language:: java

   .. only:: oehtml

      .. admonition:: Download code

         :download:`SimpleProtein.java <../../../../wrappers/java/examples/openeye/examples/oeszybki/SimpleProtein.java>`

.. oe:source:: SimpleProtein.cs
   :language: csharp
   :caption:  Optimization of a Single Bound Ligand
   :refnum:   5

.. oe:language:: csharp

   .. only:: oehtml

      .. admonition:: Download code

         :download:`SimpleProtein.cs <../../../../wrappers/csharp/Csharp-Examples/OESzybki/SimpleProtein.cs>`


Protein-Ligand Energetics and Optimization
==========================================

Examples in this section show how to optimize a bound ligand.

.. _section_protein_multiple_options_example:

Optimization of a set of bound ligands in a rigid receptor
----------------------------------------------------------
The next example illustrates the usage of Szybki TK to optimize a set of ligands with MMFF94 force
field inside a protein receptor. By default only VdW protein-ligand interaction is used.
Optionally exact or grid Coulomb potential as well as PB solvent screening potentials could be added.
When grid potential is selected (either Coulomb or PB) optionally it could be saved or read in when
the corresponding grid file is present in the specified directory. Notice that when the exact
Coulomb electrostatics is chosen, also the exact VdW potential is chosen (method
:oe:meth:`OESz::OESzybkiProteinOptions::SetExactVdWProteinLigand`) which allows for tight gradients
convergence (methods :oe:meth:`OESz::OESzybkiOptOptions::SetMaxIter` and :oe:meth:`OESz::OESzybkiOptOptions::SetGradTolerance`). By default ligand is treated as
a solid body, that is only its translational and rotational degrees of freedom are optimized. Optionally
also torsional degrees could be optimized. In this example protein receptor is rigid. Molecular input
file should contain initial 3D coordinates of molecules in any format supported by OEChem TK. Output
file is specified with the -out flag. In addition a log file containing energy data terms values is
written to stdout or a file specified by -log.

.. oe:source:: protein_multiple_options.cpp
   :language: c++
   :caption:  Optimization of a Set of Bound Ligands in a Rigid Receptor
   :refnum:   7

.. oe:language:: c++

   .. only:: oehtml

      .. admonition:: Download code

         :download:`protein_multiple_options.cpp <../../../../sublibs/tklibs/szybki/examples/protein_multiple_options.cpp>`

.. oe:source:: protein_multiple_options.py
   :language: python
   :caption:  Optimization of a Set of Bound Ligands in a Rigid Receptor
   :refnum:   7

.. oe:language:: python

   .. only:: oehtml

      .. admonition:: Download code

         :download:`protein_multiple_options.py <../../../../wrappers/python/examples/szybki/protein_multiple_options.py>`

.. oe:source:: ProteinMultipleOptions.java
   :language: java
   :caption:  Optimization of a Set of Bound Ligands in a Rigid Receptor
   :refnum:   7

.. oe:language:: java

   .. only:: oehtml

      .. admonition:: Download code

         :download:`ProteinMultipleOptions.java <../../../../wrappers/java/examples/openeye/examples/oeszybki/ProteinMultipleOptions.java>`

.. oe:source:: ProteinMultipleOptions.cs
   :language: csharp
   :caption:  Optimization of a Set of Bound Ligands in a Rigid Receptor
   :refnum:   7

.. oe:language:: csharp

   .. only:: oehtml

      .. admonition:: Download code

         :download:`ProteinMultipleOptions.cs <../../../../wrappers/csharp/Csharp-Examples/OESzybki/ProteinMultipleOptions.cs>`

.. _section_flexible_protein_example:

Optimization of a set of bound ligands in a partially flexible receptor
------------------------------------------------------------------------
The next example is very similar with respect to the previous one, but the side chains of the
protein which are within the specified range from the ligand, are made flexible during optimization
(methods :oe:meth:`OESz::OESzybkiProteinOptions::SetProteinFlexibilityType` and
:oe:meth:`OESz::OESzybkiProteinOptions::SetProteinFlexibilityRange`). Optionally, partially optimized
structure can be saved to a file.

.. oe:source:: flexible_protein.cpp
   :language: c++
   :caption:  Optimization of a Set of Bound Ligands in a Partially Flexible Receptor
   :refnum:   8

.. oe:language:: c++

   .. only:: oehtml

      .. admonition:: Download code

         :download:`flexible_protein.cpp <../../../../sublibs/tklibs/szybki/examples/flexible_protein.cpp>`

.. oe:source:: flexible_protein.py
   :language: python
   :caption:  Optimization of a Set of Bound Ligands in a Partially Flexible Receptor
   :refnum:   8

.. oe:language:: python

   .. only:: oehtml

      .. admonition:: Download code

         :download:`flexible_protein.py <../../../../wrappers/python/examples/szybki/flexible_protein.py>`


.. oe:source:: FlexibleProtein.java
   :language: java
   :caption:  Optimization of a Set of Bound Ligands in a Partially Flexible Receptor
   :refnum:   8

.. oe:language:: java

   .. only:: oehtml

      .. admonition:: Download code

         :download:`FlexibleProtein.java <../../../../wrappers/java/examples/openeye/examples/oeszybki/FlexibleProtein.java>`

.. oe:source:: FlexibleProtein.cs
   :language: csharp
   :caption:  Optimization of a Set of Bound Ligands in a Partially Flexible Receptor
   :refnum:   8

.. oe:language:: csharp

   .. only:: oehtml

      .. admonition:: Download code

         :download:`FlexibleProtein.cs <../../../../wrappers/csharp/Csharp-Examples/OESzybki/FlexibleProtein.cs>`

.. _section_flexible_residue_example:

Optimization of a bound ligand in a partially flexible receptor
------------------------------------------------------------------------

The next example is very similar with respect to the previous one, but the list of
residue numbers of the protein that are made flexible during optimization is specified
by the ``-residues`` flag (see method :oe:meth:`OESz::OESzybkiProteinOptions::AddFlexibleResidue`).
Partially optimized ligand and protein structures are saved to files specified by the
``-outl`` and ``-outp`` flags, respectively.

.. oe:source:: flex_residues.cpp
   :language: c++
   :caption:  Optimization of a Bound Ligand in a Partially Flexible Feceptor
   :refnum:   9

.. oe:language:: c++

   .. only:: oehtml

      .. admonition:: Download code

         :download:`flex_residues.cpp <../../../../sublibs/tklibs/szybki/examples/flex_residues.cpp>`

.. oe:source:: flex_residues.py
   :language: python
   :caption:  Optimization of a Bound Ligand in a Partially Flexible Receptor
   :refnum:   9

.. oe:language:: python

   .. only:: oehtml

      .. admonition:: Download code

         :download:`flex_residues.py <../../../../wrappers/python/examples/szybki/flex_residues.py>`

.. oe:source:: FlexResidues.java
   :language: java
   :caption:  Optimization of a Bound Ligand in a Partially Flexible Feceptor
   :refnum:   9

.. oe:language:: java

   .. only:: oehtml

      .. admonition:: Download code

         :download:`FlexResidues.java <../../../../wrappers/java/examples/openeye/examples/oeszybki/FlexResidues.java>`

.. oe:source:: FlexResidues.cs
   :language: csharp
   :caption:  Optimization of a Bound Ligand in a Partially Flexible Feceptor
   :refnum:   9

.. oe:language:: csharp

   .. only:: oehtml

      .. admonition:: Download code

         :download:`FlexResidues.cs <../../../../wrappers/csharp/Csharp-Examples/OESzybki/FlexResidues.cs>`


.. _section_protein_ligand_PB_example:

Estimation of PB binding for a set of ligands
--------------------------------------------------

This example shows how to fast estimate binding for a set of ligands using PB electrostatics.
Two :ref:`OESzybki <OESz_OESzybki>` objects are instantiated: one for the optimization of bound ligands
in VdW-Coulomb potential, and the second one which performs single-point PB calculations.
Final results are attached as SD tags to the output molecules.

.. oe:source:: protein_ligand_PB.cpp
   :language: c++
   :caption:  Estimation of PB Binding for a Set of Ligands
   :refnum:   10

.. oe:language:: c++

   .. only:: oehtml

      .. admonition:: Download code

         :download:`protein_ligand_PB.cpp <../../../../sublibs/tklibs/szybki/examples/protein_ligand_PB.cpp>`


.. oe:source:: protein_ligand_PB.py
   :language: python
   :caption:  Estimation of PB Binding for a Set of Ligands
   :refnum:   10

.. oe:language:: python

   .. only:: oehtml

      .. admonition:: Download code

         :download:`protein_ligand_PB.py <../../../../wrappers/python/examples/szybki/protein_ligand_PB.py>`

.. oe:source:: ProteinLigandPB.java
   :language: java
   :caption:  Estimation of PB Binding for a Set of Ligands
   :refnum:   10

.. oe:language:: java

   .. only:: oehtml

      .. admonition:: Download code

         :download:`ProteinLigandPB.java <../../../../wrappers/java/examples/openeye/examples/oeszybki/ProteinLigandPB.java>`

.. oe:source:: ProteinLigandPB.cs
   :language: csharp
   :caption:  Estimation of PB Binding for a Set of Ligands
   :refnum:   10

.. oe:language:: csharp

   .. only:: oehtml

      .. admonition:: Download code

         :download:`ProteinLigandPB.cs <../../../../wrappers/java/examples/openeye/examples/oeszybki/ProteinLigandPB.java>`

.. _section_ligand_flexprotein_newton_example:

Optimization of a bound ligand using Newton-Raphson method
------------------------------------------------------------------------

The last example in this section illustrates how to use SzybkiTK to optimize a ligand in
partially flexible protein with Newton-Raphson optimization method.

.. oe:source:: ligand_flexprotein_newton.cpp
   :language: c++
   :caption:  Optimization of a Bound Ligand Using Newton-Raphson Method
   :refnum:   11

.. oe:language:: c++

   .. only:: oehtml

      .. admonition:: Download code

         :download:`ligand_flexprotein_newton.cpp <../../../../sublibs/tklibs/szybki/examples/ligand_flexprotein_newton.cpp>`

.. oe:source:: ligand_flexprotein_newton.py
   :language: python
   :caption:  Optimization of a Bound Ligand Using Newton-Raphson Method
   :refnum:   11

.. oe:language:: python

   .. only:: oehtml

      .. admonition:: Download code

         :download:`ligand_flexprotein_newton.py <../../../../wrappers/python/examples/szybki/ligand_flexprotein_newton.py>`


.. oe:source:: LigandFlexProteinNewton.java
   :language: java
   :caption:  Optimization of a Bound Ligand Using Newton-Raphson Method
   :refnum:   11

.. oe:language:: java

   .. only:: oehtml

      .. admonition:: Download code

         :download:`LigandFlexProteinNewton.java <../../../../wrappers/java/examples/openeye/examples/oeszybki/LigandFlexProteinNewton.java>`

.. oe:source:: LigandFlexProteinNewton.cs
   :language: csharp
   :caption:  Optimization of a Bound Ligand Using Newton-Raphson Method
   :refnum:   11

.. oe:language:: csharp

   .. only:: oehtml

      .. admonition:: Download code

         :download:`LigandFlexProteinNewton.cs <../../../../wrappers/csharp/Csharp-Examples/OESzybki/LigandFlexProteinNewton.cs>`


DU Protein-Ligand Optimization with FF14SB-Parsley
===================================================

Examples in this section show how to optimize a ligand in the protein 
active site using the :ref:`OEFixedProteinLigandOptimizer <OESz_OEFixedProteinLigandOptimizer>` and
the :ref:`OEFlexProteinLigandOptimizer <OESz_OEFlexProteinLigandOptimizer>` classes. Both of these
classes allow use of the FF14SB-Parsley forcefield, along with the MMFF and
the MMFF-AMBER forcefields. These examples also demonstrate how to use
design units as a source for the protein or the ligand. The first example
optimizes an external ligand in a protein active site from a design unit,
and the second example uses both the ligand and the protein from the same
design unit.


Optimization of ligand in a rigid active site
--------------------------------------------------

This examples shows how to optimize a series of ligands in a rigid active site.
The active site input is taken from a OEDesignUnit.

.. oe:source:: OptimizeLigandInDU.py
   :language: python
   :caption:  Optimization of Ligand in a Rigid Active Site
   :refnum:   12

.. oe:language:: python

   .. only:: oehtml

      .. admonition:: Download code

         :download:`OptimizeLigandInDU.py <../../../../wrappers/python/examples/szybki/OptimizeLigandInDU.py>`


Optimization of ligand in a partially flexible active site
------------------------------------------------------------

This examples shows how to optimize a ligand in a partially flexible active site.
In this example, both the ligand and the active site is taken from a single OEDesignUnit.

.. oe:source:: OptimizeDU.py
   :language: python
   :caption:  Optimization of Ligand in a Partially Flexible Active Site
   :refnum:   13

.. oe:language:: python

   .. only:: oehtml

      .. admonition:: Download code

         :download:`OptimizeDU.py <../../../../wrappers/python/examples/szybki/OptimizeDU.py>`


Entropy estimation
======================================

.. _section_ligand_entropy_example:

Estimation of solution ligand entropy
-------------------------------------
The following code illustrates how to estimate compound entropy in solution with Szybki TK.

.. oe:source:: ligand_entropy.cpp
   :language: c++
   :caption:  Ligand Entropy
   :refnum:   14

.. oe:language:: c++

   .. only:: oehtml

      .. admonition:: Download code

         :download:`ligand_entropy.cpp <../../../../sublibs/tklibs/szybki/examples/ligand_entropy.cpp>`


.. oe:source:: ligand_entropy.py
   :language: python
   :caption:  Ligand Entropy
   :refnum:   14

.. oe:language:: python

   .. only:: oehtml

      .. admonition:: Download code

         :download:`ligand_entropy.py <../../../../wrappers/python/examples/szybki/ligand_entropy.py>`

.. oe:source:: LigandEntropy.java
   :language: java
   :caption:  Ligand Entropy
   :refnum:   14

.. oe:language:: java

   .. only:: oehtml

      .. admonition:: Download code

         :download:`LigandEntropy.java <../../../../wrappers/java/examples/openeye/examples/oeszybki/LigandEntropy.java>`


.. oe:source:: LigandEntropy.cs
   :language: csharp
   :caption:  Ligand Entropy
   :refnum:   14

.. oe:language:: csharp

   .. only:: oehtml

      .. admonition:: Download code

         :download:`LigandEntropy.cs <../../../../wrappers/csharp/Csharp-Examples/OESzybki/LigandEntropy.cs>`


.. _section_bound_entropy_example:

Estimation of bound ligand entropy
----------------------------------

The next example below shows how to calculate entropy of a bound ligand.

.. oe:source:: bound_entropy.cpp
   :language: c++
   :caption:  Estimation of Bound Ligand Entropy
   :refnum:   15

.. oe:language:: c++

   .. only:: oehtml

      .. admonition:: Download code

         :download:`bound_entropy.cpp <../../../../sublibs/tklibs/szybki/examples/bound_entropy.cpp>`

.. oe:source:: bound_entropy.py
   :language: python
   :caption:  Estimation of Bound Ligand Entropy
   :refnum:   15

.. oe:language:: python

   .. only:: oehtml

      .. admonition:: Download code

         :download:`bound_entropy.py <../../../../wrappers/python/examples/szybki/bound_entropy.py>`

.. oe:source:: BoundEntropy.java
   :language: java
   :caption:  Estimation of Bound Ligand Entropy
   :refnum:   15

.. oe:language:: java

   .. only:: oehtml

      .. admonition:: Download code

         :download:`BoundEntropy.java <../../../../wrappers/java/examples/openeye/examples/oeszybki/BoundEntropy.java>`

.. oe:source:: BoundEntropy.cs
   :language: csharp
   :caption:  Estimation of Bound Ligand Entropy
   :refnum:   15

.. oe:language:: csharp

   .. only:: oehtml

      .. admonition:: Download code

         :download:`BoundEntropy.cs <../../../../wrappers/csharp/Csharp-Examples/OESzybki/BoundEntropy.cs>`

.. _section_freeformsolv_example:

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

.. oe:source:: freeformsolv.cpp
   :language: c++
   :caption:  Solvation Free Energy Estimation
   :refnum:   16

.. oe:language:: c++

   .. only:: oehtml

      .. admonition:: Download code

         :download:`freeformsolv.cpp <../../../../sublibs/tklibs/szybki/examples/freeformsolv.cpp>`

.. oe:source:: freeformsolv.py
   :language: python
   :caption:  Solvation Free Energy Estimation
   :refnum:   16

.. oe:language:: python

   .. only:: oehtml

      .. admonition:: Download code

         :download:`freeformsolv.py <../../../../wrappers/python/examples/szybki/freeformsolv.py>`

.. oe:source:: FreeFormSolv.java
   :language: java
   :caption:  Solvation Free Energy Estimation
   :refnum:   16

.. oe:language:: java

   .. only:: oehtml

      .. admonition:: Download code

         :download:`FreeFormSolv.java <../../../../wrappers/java/examples/openeye/examples/oeszybki/FreeFormSolv.java>`

.. oe:source:: FreeFormSolv.cs
   :language: csharp
   :caption:  Solvation Free Energy Estimation
   :refnum:   16

.. oe:language:: csharp

   .. only:: oehtml

      .. admonition:: Download code

         :download:`FreeFormSolv.cs <../../../../wrappers/csharp/Csharp-Examples/OESzybki/FreeFormSolv.cs>`

.. _section_freeformconf_example:

Conformations free energy estimation
======================================

   .. warning::

      This capability should not be used on 32-bit platforms because
      the memory requirements are too high.

Simple free energy estimation
------------------------------

The following code illustrates how to use the high level commands from :ref:`OEFreeFormConf <OESz_OEFreeFormConf>`
to estimate conformer free energies in solution with Szybki TK.

.. oe:source:: freeformconf.cpp
   :language: c++
   :caption:  Simple Free Energy Estimation
   :refnum:   17

.. oe:language:: c++

   .. only:: oehtml

      .. admonition:: Download code

         :download:`freeformconf.cpp <../../../../sublibs/tklibs/szybki/examples/freeformconf.cpp>`

.. oe:source:: freeformconf.py
   :language: python
   :caption:  Simple Free Energy Estimation
   :refnum:   17

.. oe:language:: python

   .. only:: oehtml

      .. admonition:: Download code

         :download:`freeformconf.py <../../../../wrappers/python/examples/szybki/freeformconf.py>`


.. oe:source:: FreeFormConf.java
   :language: java
   :caption:  Simple Free Energy Estimation
   :refnum:   17

.. oe:language:: java

   .. only:: oehtml

      .. admonition:: Download code

         :download:`FreeFormConf.java <../../../../wrappers/java/examples/openeye/examples/oeszybki/FreeFormConf.java>`

.. oe:source:: FreeFormConf.cs
   :language: csharp
   :caption:  Simple Free Energy Estimation
   :refnum:   17

.. oe:language:: csharp

   .. only:: oehtml

      .. admonition:: Download code

         :download:`FreeFormConf.cs <../../../../wrappers/csharp/Csharp-Examples/OESzybki/FreeFormConf.cs>`

Simple restriction energy estimation
-------------------------------------

The following code illustrates how to use the high level commands from :ref:`OEFreeFormConf <OESz_OEFreeFormConf>`
to estimate restriction energies on conformers, along with conformer free energies in solution, with Szybki TK.

.. oe:source:: freeformconfrstr.cpp
   :language: c++
   :caption:  Simple Restriction Energy Estimation
   :refnum:   18

.. oe:language:: c++

   .. only:: oehtml

      .. admonition:: Download code

         :download:`freeformconfrstr.cpp <../../../../sublibs/tklibs/szybki/examples/freeformconfrstr.cpp>`

.. oe:source:: freeformconfrstr.py
   :language: python
   :caption:  Simple Restriction Energy Estimation
   :refnum:   18

.. oe:language:: python

   .. only:: oehtml

      .. admonition:: Download code

         :download:`freeformconfrstr.py <../../../../wrappers/python/examples/szybki/freeformconfrstr.py>`


.. oe:source:: FreeFormConfRstr.java
   :language: java
   :caption:  Simple Restriction Energy Estimation
   :refnum:   18

.. oe:language:: java

   .. only:: oehtml

      .. admonition:: Download code

         :download:`FreeFormConfRstr.java <../../../../wrappers/java/examples/openeye/examples/oeszybki/FreeFormConfRstr.java>`

.. oe:source:: FreeFormConfRstr.cs
   :language: csharp
   :caption:  Simple Restriction Energy Estimation
   :refnum:   18

.. oe:language:: csharp

   .. only:: oehtml

      .. admonition:: Download code

         :download:`FreeFormConfRstr.cs <../../../../wrappers/csharp/Csharp-Examples/OESzybki/FreeFormConfRstr.cs>`

Advanced free energy estimation
------------------------------------

The following code illustrates how to use the low level commands from :ref:`OEFreeFormConfAdvanced <OESz_OEFreeFormConfAdvanced>`
to estimate the conformer free energies in solution with Szybki TK.
These low level methods of estimation gives an advantage over the high level methods of :ref:`OEFreeFormConf <OESz_OEFreeFormConf>`
in that these gives the user control over better managing certain expensive parts of the calculation.

.. oe:source:: freeformconfadvanced.cpp
   :language: c++
   :caption:  Advanced Free Energy Estimation
   :refnum:   19

.. oe:language:: c++

   .. only:: oehtml

      .. admonition:: Download code

         :download:`freeformconfadvanced.cpp <../../../../sublibs/tklibs/szybki/examples/freeformconfadvanced.cpp>`

.. oe:source:: freeformconfadvanced.py
   :language: python
   :caption:  Advanced Free Energy Estimation
   :refnum:   19

.. oe:language:: python

   .. only:: oehtml

      .. admonition:: Download code

         :download:`freeformconfadvanced.py <../../../../wrappers/python/examples/szybki/freeformconfadvanced.py>`


.. oe:source:: FreeFormConfAdvanced.java
   :language: java
   :caption:  Advanced Free Energy Estimation
   :refnum:   19

.. oe:language:: java

   .. only:: oehtml

      .. admonition:: Download code

         :download:`FreeFormConfAdvanced.java <../../../../wrappers/java/examples/openeye/examples/oeszybki/FreeFormConfAdvanced.java>`

.. oe:source:: FreeFormConfAdvanced.cs
   :language: csharp
   :caption:  Advanced Free Energy Estimation
   :refnum:   19

.. oe:language:: csharp

   .. only:: oehtml

      .. admonition:: Download code

         :download:`FreeFormConfAdvanced.cs <../../../../wrappers/csharp/Csharp-Examples/OESzybki/FreeFormConfAdvanced.cs>`

Advanced restriction energy estimation
-----------------------------------------

The following code illustrates how to use the low level commands from :ref:`OEFreeFormConfAdvanced <OESz_OEFreeFormConfAdvanced>`
to estimate the restriction energies of conformers, along with conformer free energies in solution, with Szybki TK.
These low level methods of estimation gives an advantage over the high level methods of :ref:`OEFreeFormConf <OESz_OEFreeFormConf>`
in that these gives the user control over better managing certain expensive parts of the calculation.

.. oe:source:: freeformconfadvrstr.cpp
   :language: c++
   :caption:  Advanced Restriction Energy Estimation
   :refnum:   20

.. oe:language:: c++

   .. only:: oehtml

      .. admonition:: Download code

         :download:`freeformconfadvrstr.cpp <../../../../sublibs/tklibs/szybki/examples/freeformconfadvrstr.cpp>`

.. oe:source:: freeformconfadvrstr.py
   :language: python
   :caption:  Advanced Restriction Energy Estimation
   :refnum:   20

.. oe:language:: python

   .. only:: oehtml

      .. admonition:: Download code

         :download:`freeformconfadvrstr.py <../../../../wrappers/python/examples/szybki/freeformconfadvrstr.py>`

.. oe:source:: FreeFormConfAdvRstr.java
   :language: java
   :caption:  Advanced Restriction Energy Estimation
   :refnum:   20

.. oe:language:: java

   .. only:: oehtml

      .. admonition:: Download code

         :download:`FreeFormConfAdvRstr.java <../../../../wrappers/java/examples/openeye/examples/oeszybki/FreeFormConfAdvRstr.java>`

.. oe:source:: FreeFormConfAdvRstr.cs
   :language: csharp
   :caption:  Advanced Restriction Energy Estimation
   :refnum:   20

.. oe:language:: csharp

   .. only:: oehtml

      .. admonition:: Download code

         :download:`FreeFormConfAdvRstr.cs <../../../../wrappers/csharp/Csharp-Examples/OESzybki/FreeFormConfAdvRstr.cs>`

Finding similar conformers
---------------------------

The following code illustrates how to find similar conformers to the ones at hand,
from a pool of minimum energy conformers.

.. oe:source:: findsimilarconfs.cpp
   :language: c++
   :caption:  Finding Similar Conformers
   :refnum:   21

.. oe:language:: c++

   .. only:: oehtml

      .. admonition:: Download code

         :download:`findsimilarconfs.cpp <../../../../sublibs/tklibs/szybki/examples/findsimilarconfs.cpp>`

.. oe:source:: findsimilarconfs.py
   :language: python
   :caption:  Finding Similar Conformers
   :refnum:   21

.. oe:language:: python

   .. only:: oehtml

      .. admonition:: Download code

         :download:`findsimilarconfs.py <../../../../wrappers/python/examples/szybki/findsimilarconfs.py>`


.. oe:source:: FindSimilarConfs.java
   :language: java
   :caption:  Finding Similar Conformers
   :refnum:   21

.. oe:language:: java

   .. only:: oehtml

      .. admonition:: Download code

         :download:`FindSimilarConfs.java <../../../../wrappers/java/examples/openeye/examples/oeszybki/FindSimilarConfs.java>`

.. oe:source:: FindSimilarConfs.cs
   :language: csharp
   :caption:  Finding Similar Conformers
   :refnum:   21

.. oe:language:: csharp

   .. only:: oehtml

      .. admonition:: Download code

         :download:`FindSimilarConfs.cs <../../../../wrappers/csharp/Csharp-Examples/OESzybki/FindSimilarConfs.cs>`


Torsion scan
------------

The following code shows how to scan all torsions in the input molecule


.. oe:source:: TorsionScan.py
   :language: python
   :caption:  Perform torsion scan for all torsions in the input molecule
   :refnum:   22

.. oe:language:: python

   .. only:: oehtml

      .. admonition:: Download code

         :download:`TorsionScan.py <../../../../wrappers/python/examples/szybki/TorsionScan.py>`

