.. _chapter_bondproperties:

********************************************************************************
Bond Properties
********************************************************************************

.. index:: OEBondBase, bond properties

The :oe:cls:`OEBondBase<OEChem::OEBondBase>` represents the bonds of a molecule.
This section details some of its important and often used properties and methods.

.. _section_bondproperties_readwrite:

Read/Write Bond Properties
================================================================================

.. index::
   single: bond order
   single: bond aromaticity
   single: bond ring membership
   single: integer bond type
   single: bond type name
   single: bond begin atom
   single: bond end atom
   single: bond chirality
   single: bond stereo

.. list-table::
   :widths: 30 15 20 20 30
   :header-rows: 1

   * - Property Name
     - Type
     - Get Method
     - Set Method
     - See Also
   * - Bond Order
     - unsigned int
     - :oe:meth:`GetOrder<OEChem::OEBondBase::GetOrder>`
     - :oe:meth:`SetOrder<OEChem::OEBondBase::SetOrder>`
     -
   * - Aromaticity
     - bool
     - :oe:meth:`IsAromatic<OEChem::OEBondBase::IsAromatic>`
     - :oe:meth:`SetAromatic<OEChem::OEBondBase::SetAromatic>`
     - :ref:`chapter_aromaticity`
   * - Ring Membership
     - bool
     - :oe:meth:`IsInRing<OEChem::OEBondBase::IsInRing>`
     - :oe:meth:`SetInRing<OEChem::OEBondBase::SetInRing>`
     - :ref:`chapter_ring`
   * - Integer Bond Type
     - int
     - :oe:meth:`GetIntType<OEChem::OEBondBase::GetIntType>`
     - :oe:meth:`SetIntType<OEChem::OEBondBase::SetIntType>`
     -
   * - Bond Type Name
     - string
     - :oe:meth:`GetType<OEChem::OEBondBase::GetType>`
     - :oe:meth:`SetType<OEChem::OEBondBase::SetType>`
     -
   * - Begin Atom
     - :oe:cls:`OEAtomBase<OEChem::OEAtomBase>`
     - :oe:meth:`GetBgn<OEChem::OEBondBase::GetBgn>`
     - :oe:meth:`SetBgn<OEChem::OEBondBase::SetBgn>`
     -
   * - End Atom
     - :oe:cls:`OEAtomBase<OEChem::OEAtomBase>`
     - :oe:meth:`GetEnd<OEChem::OEBondBase::GetEnd>`
     - :oe:meth:`SetEnd<OEChem::OEBondBase::SetEnd>`
     -
   * - Bond Chirality
     - bool
     - :oe:meth:`IsChiral<OEChem::OEBondBase::IsChiral>`
     - :oe:meth:`SetChiral<OEChem::OEBondBase::SetChiral>`
     - :ref:`chapter_stereochemistry`
   * - Bond Stereo
     - unsigned int
     - :oe:meth:`GetStereo<OEChem::OEBondBase::GetStereo>`
     - :oe:meth:`SetStereo<OEChem::OEBondBase::SetStereo>`
     - :ref:`chapter_stereochemistry`



.. _section_bondproperties_readonly:

Read Only Bond Properties
================================================================================

.. index::
   single: bond begin atom index
   single: bond end atom index
   single: bond index
   single: bond stereo
   single: bond parent
   single: rotatable bond

.. list-table::
   :widths: 30 15 20 30
   :header-rows: 1

   * - Property Name
     - Type
     - Get Method
     - See Also
   * - Begin Atom Index
     - unsigned int
     - :oe:meth:`GetBgnIdx<OEChem::OEBondBase::GetBgnIdx>`
     - :ref:`chapter_atombondindices`
   * - End Atom Index
     - unsigned int
     - :oe:meth:`GetEndIdx<OEChem::OEBondBase::GetEndIdx>`
     - :ref:`chapter_atombondindices`
   * - Bond Index
     - unsigned int
     - :oe:meth:`GetIdx<OEChem::OEBondBase::GetIdx>`
     - :ref:`chapter_atombondindices`
   * - Bond Has Stereo
     - bool
     - :oe:meth:`HasStereoSpecified<OEChem::OEBondBase::HasStereoSpecified>`
     - :ref:`chapter_stereochemistry`
   * - Bond Parent
     - :oe:cls:`OEMolBase<OEChem::OEMolBase>`
     - :oe:meth:`GetParent<OEChem::OEBondBase::GetParent>`
     -
   * - Rotatable
     - bool
     - :oe:meth:`IsRotor<OEChem::OEBondBase::IsRotor>`
     - :term:`rotatable bond`


.. _section_bondproperties_genericdata:

Attach Generic Data to Bonds
================================================================================

Generic data (see :ref:`chapter_genericdata`) can be attached to any object
that derives from the :ref:`OEBase <OESystem_OEBase>` class. The
:ref:`OEBondBase <OEChem_OEBondBase>` API provides the following methods, publicly
inherited from :ref:`OEBase <OESystem_OEBase>`, that allow the manipulation of
generic data.

.. list-table:: **Methods to manipulate generic data**
   :widths: 15 40
   :header-rows: 1

   * - Method
     - Description

   * - :oe:meth:`SetData<OESystem::OEBase::SetData>`
     - sets a generic data associating it with the given tag

   * - :oe:meth:`AddData<OESystem::OEBase::AddData>`
     -  adds a generic data associating it with the given tag

   * - :oe:meth:`HasData<OESystem::OEBase::HasData>`
     - determines whether a molecule has any generic data with a given tag

   * - :oe:meth:`GetData<OESystem::OEBase::GetData>`
     - returns the generic data associated with the given tag

   * - :oe:meth:`DeleteData<OESystem::OEBase::DeleteData>`
     - deletes all generic data  with the given tag

   * - :oe:meth:`Clear<OESystem::OEBase::Clear>`
     - clears all stored generic data

.. note::

   Generic data attached to a molecule or any of its atoms or bonds is automatically
   saved when the molecule is written into an :file:`.oeb` file.

.. seealso::

   * :ref:`section_attaching_other_objects` section
   * :ref:`section_moltaggeddata_SD` section
   * :ref:`section_moltaggeddata_PDB` section
