.. oe:namespace:: OEChem


.. _OEChem_OEConfRMSD:

.. oe:class:: OEConfRMSD

   .. oe:api::

      class OEConfRMSD

   The :ref:`OEConfRMSD <OEChem_OEConfRMSD>` class provides fast RMSD calculation
   of conformers of the same molecule.
   During the RMSD calculation the automorphisms of the molecule graph is taken into
   consideration.
   Automorphisms are the symmetry related
   transformations of a molecule which can result in anomalously high
   RMSDs if not properly treated. For instance, t-butyl-benzene has a
   three-fold automorphism around the t-butyl group and a two-fold
   automorphism around the benzene ring.

   .. oe:method:: Constructors

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

         .. oe:api::

            OEConfRMSD(const OEMolBase& mol,
                       const OEConfRMSDOptions& opts = OEConfRMSDOptions())

      .. oe:language:: python

         .. oe:api:: python

            OEConfRMSD(mol: Union[OEGraphMol,OEMol,OEQMol],
                       opts: OEConfRMSDOptions = OEConfRMSDOptions()) -> OEConfRMSD

      Constructs an :ref:`OEConfRMSD <OEChem_OEConfRMSD>` object using a
      :ref:`OEMolBase <OEChem_OEMolBase>` and an optional
      :ref:`OEConfRMSDOptions <OEChem_OEConfRMSDOptions>`.

      .. seealso::

         * :ref:`OEConfRMSDOptions <OEChem_OEConfRMSDOptions>` class

   .. oe:method:: CalculateRMSD

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

         .. oe:api::

            double CalculateRMSD(const OEConfBase* refconf,
                                 const OEConfBase* fitconf) const
            double CalculateRMSD(const double* refcoords,
                                 const double* fitcoords) const

      .. oe:language:: python

         .. oe:api:: python

            CalculateRMSD(refconf: OEConfBase, fitconf: OEConfBase) -> float
            CalculateRMSD(refcoords: OEDoubleArray, fitcoords: OEDoubleArray) -> float

      Calculates the RMSD between the two conformations. The inputs can be
      either the :ref:`OEConfRMSD <OEChem_OEConfRMSD>` objects or their coordinates.

      For the second overload, the length of the arrays should be ``3*MaxAtomIdx`` and
      should contain the Cartesian coordinates of the two conformers being assessed. 

   .. oe:method:: GetOptions

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

         .. oe:api::

            OEConfRMSDOptions GetOptions() const

      .. oe:language:: python

         .. oe:api:: python

            GetOptions() -> OEConfRMSDOptions

      Returns the options used to set up the :ref:`OEConfRMSD <OEChem_OEConfRMSD>` object.

      .. seealso::

         * :ref:`OEConfRMSDOptions <OEChem_OEConfRMSDOptions>` class

   .. oe:method:: IsValid

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

         .. oe:api::

            bool IsValid() const

      .. oe:language:: python

         .. oe:api:: python

            IsValid() -> bool

      Returns whether the :ref:`OEConfRMSD <OEChem_OEConfRMSD>` object is valid.

   .. oe:method:: MinimizeRMSD

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

         .. oe:api::

            double MinimizeRMSD(const OEConfBase* refconf,
                                const OEConfBase* fitconf, OETrans& trans) const
            double MinimizeRMSD(const double* refcoords,
                                const double* fitcoords, OETrans& trans) const

      .. oe:language:: python

         .. oe:api:: python

            MinimizeRMSD(refconf: OEConfBase, fitconf: OEConfBase,
                         trans: OETrans) -> float
            MinimizeRMSD(refcoords: OEDoubleArray, fitcoords: OEDoubleArray,
                         trans: OETrans) -> float

      The function returns the minimum RMSD between the two conformations and reports
      the translation and rotation, *trans*, required to give this minimum RMSD.

      For the second overload, the length of the arrays should be ``3*MaxAtomIdx`` and
      should contain the Cartesian coordinates of the two conformers being assessed. 

   .. oe:method:: NumAutomorphs

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

         .. oe:api::

            unsigned int NumAutomorphs() const

      .. oe:language:: python

         .. oe:api:: python

            NumAutomorphs() -> int

      The function returns the number of automorphisms taken into account
      during the RMSD calculation.

   **Example:**

   The following example finds the two conformers of a molecule that have
   the smallest RMSD.

   .. oe:source:: ClosestConfs.py
      :language: python
      :noindent:
      :frag: SNIPPET

   .. oe:source:: ClosestConfs.cpp
      :language: c++
      :noindent:
      :frag: SNIPPET

   .. oe:source:: ClosestConfs.java
      :language: java
      :noindent:
      :frag: SNIPPET

   .. oe:source:: ClosestConfs.cs
      :language: csharp
      :noindent:
      :frag: SNIPPET

   .. seealso::

      * :oe:func:`OEChem::OERMSD` function
      * :oe:func:`OEChem::OEWeightedRMSD` function
