.. include:: ../substitutions

.. oe:namespace:: OEChem

.. meta::
   :keywords: OEGetTorsion

.. oe:function:: OEGetTorsion

   .. oe:language:: c++ java csharp

      .. oe:api::

         double OEGetTorsion(const OEMolBase& mol, const OEAtomBase* a,
                             const OEAtomBase* b, const OEAtomBase* c,
                             const OEAtomBase* d)
         double OEGetTorsion(const OEConfBase& conf, const OEAtomBase* a,
                             const OEAtomBase* b, const OEAtomBase* c,
                             const OEAtomBase* d)

   .. oe:language:: python

      .. oe:api:: python

         OEGetTorsion(arg1: Union[OEGraphMol,OEMol,OEQMol], a: OEAtomBase,
                      b: OEAtomBase, c: OEAtomBase, d: OEAtomBase) -> float
         OEGetTorsion(arg1: OEConfBase, a: OEAtomBase, b: OEAtomBase,
                      c: OEAtomBase, d: OEAtomBase) -> float


   Returns the torsion formed by the four atoms `a`, `b`, `c`, and `d`.
   The return value is in radians and varies from ``+PI`` to ``-PI``.
   If any of the arguments are null pointers, the function returns ``FLT_MAX`` to indicate an error.
   All of the atoms must be contained in the molecule (or conformer)
   which is passed to the function.  The :ref:`OEConfBase <OEChem_OEConfBase>` is
   strictly for efficiency.  If the absolute value of the torsion can be
   used instead, the function :oe:func:`OEChem::OEGetAbsTorsion` is much
   more efficient than calculating the absolute value of the return of
   this function.

   *mol*
      The molecule that the atoms belong to.

   *conf*
      The conformer that the atoms belong to.

    *a*
      One of the end atoms in the torsion.

    *b*
      Atom that is connected to `a` in the torsion.

    *c*
      Atom that is connected to `d` in the torsion.

    *d*
      The other end atom in the torsion.

  .. seealso::

     * :oe:func:`OEBio::OEGetTorsion` **OEBio TK** function for regular dihedral angles in standard protein residues. 
