.. include:: ../substitutions

.. oe:namespace:: OEGrapheme

.. meta::
   :keywords: OEPrepareAlignedDepictionFrom3D

.. oe:function:: OEPrepareAlignedDepictionFrom3D

   .. list-table:: **The overloaded versions of the OEPrepareAlignedDepictionFrom3D function**
      :widths: 100 200
      :header-rows: 1

      * - Link
        - Description

      * - :ref:`OEPrepareAlignedDepictionFrom3D(fitmol2D,  fitmol3D, refmol2D, refmol3D)<api_OEPrepareAlignedDepictionFrom3D>`
        - 2D molecule alignment based on 3D

      * - :ref:`OEPrepareAlignedDepictionFrom3D(fitmol2D,  fitmol3D, refmol2D, refmol3D, opts)<api_OEPrepareAlignedDepictionFrom3D_Options>`
        - 2D molecule alignment based on 3D with options

      * - :ref:`OEPrepareAlignedDepictionFrom3D(fitmol2D,  fitmol3D, shapequery)<api_OEPrepareAlignedDepictionFrom3D_OEShapeQueryDisplay>`
        - 2D molecule alignment to 3D shape query


   .. #############################################################

   .. _api_OEPrepareAlignedDepictionFrom3D:

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

      .. oe:api::

         bool OEPrepareAlignedDepictionFrom3D(OEChem::OEMolBase& fitmol2D,
                                              const OEChem::OEMolBase& fitmol3D,
                                              const OEChem::OEMolBase& refmol2D,
                                              const OEChem::OEMolBase& refmol3D,
                                              bool clearCoords = true,
                                              bool suppressH = true)

   .. oe:language:: python

      .. oe:api:: python

         OEPrepareAlignedDepictionFrom3D(fitmol2D: Union[OEGraphMol,OEMol,OEQMol],
                                         fitmol3D: Union[OEGraphMol,OEMol,OEQMol],
                                         refmol2D: Union[OEGraphMol,OEMol,OEQMol],
                                         refmol3D: Union[OEGraphMol,OEMol,OEQMol],
                                         clearFitCoords: bool = True,
                                         suppressFitH: bool = True) -> bool

   Generates the 2D coordinates of a molecule driven by the 3D overlay of the
   3D reference and the 3D fit molecules and the orientation of the 2D
   reference molecule.

   *fitmol2D*
      The molecule for which 2D coordinates are generated.

   *refmol2D*
      The 2D molecule whose orientation drives the 2D coordinate generation.

   *fitmol3D, refmol3D*
       The 3D molecule whose overlay drives the 2D coordinate generation.

   *clearCoords*
      If false and the *fitmol2D* has 2D coordinates, then these coordinates are
      used for the alignment.
      Otherwise the 2D coordinates of the fitted molecule are generated
      by calling the :oe:func:`OEGrapheme::OEPrepareDepictionFrom3D` function.

   *suppressH*
      If true, then explicit hydrogens are suppressed when generating the
      2D coordinates of the fitted molecule.
      Only hydrogens that are necessary to faithfully represent tetrahedral
      stereochemistry will be kept.

   .. #############################################################

   .. _api_OEPrepareAlignedDepictionFrom3D_Options:

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

      .. oe:api::

         bool OEPrepareAlignedDepictionFrom3D(OEChem::OEMolBase& fitmol2D,
                                              const OEChem::OEMolBase& fitmol3D,
                                              const OEChem::OEMolBase& refmol2D,
                                              const OEChem::OEMolBase& refmol3D,
                                              const OEAlignedDepictionFrom3DOptions& opts)

   .. oe:language:: python

      .. oe:api:: python

         OEPrepareAlignedDepictionFrom3D(fitmol2D: Union[OEGraphMol,OEMol,OEQMol],
                                         fitmol3D: Union[OEGraphMol,OEMol,OEQMol],
                                         refmol2D: Union[OEGraphMol,OEMol,OEQMol],
                                         refmol3D: Union[OEGraphMol,OEMol,OEQMol],
                                         opts: OEAlignedDepictionFrom3DOptions) -> bool

   Generates the 2D coordinates of a molecule driven by the 3D overlay of the
   3D reference and the 3D fit molecules and the orientation of the 2D
   reference molecule.

   *fitmol2D*
      The molecule for which 2D coordinates are generated.

   *refmol2D*
      The 2D molecule whose orientation drives the 2D coordinate generation.

   *fitmol3D, refmol3D*
       The 3D molecules whose overlay drives the 2D coordinate generation.

   *opts*
       The :ref:`OEAlignedDepictionFrom3DOptions <OEGrapheme_OEAlignedDepictionFrom3DOptions>` object that stores
       options controlling the generation of 2D coordinates.

   The following code snippet shows how to use the :oe:func:`OEGrapheme::OEPrepareAlignedDepictionFrom3D`
   function.
   See generated images in :ref:`Table: 2D depiction based on 3D molecule overlay<table_OEPrepareAlignedDepictionFrom3D>`.

   .. oe:source:: PrepareAlignedDepictFrom3D.py
      :language: python
      :noindent:
      :frag:     SNIPPET-PREPARE-ALIGNED-DEPICTION-FROM-3D

   .. oe:source:: PrepareAlignedDepictFrom3D.cpp
      :language: c++
      :noindent:
      :frag:     SNIPPET-PREPARE-ALIGNED-DEPICTION-FROM-3D

   .. oe:source:: PrepareAlignedDepictFrom3D.java
      :language: java
      :noindent:
      :frag:     SNIPPET-PREPARE-ALIGNED-DEPICTION-FROM-3D

   .. oe:language:: csharp

   .. oe:source:: PrepareAlignedDepictFrom3D.cs
      :language: csharp
      :noindent:
      :frag:     SNIPPET-PREPARE-ALIGNED-DEPICTION-FROM-3D


   .. _table_OEPrepareAlignedDepictionFrom3D:

   .. list-table:: **2D depiction based on 3D molecule overlay**
      :widths: 150 150 150
      :header-rows: 0

      * - .. image:: ../images/OEPrepareAlignedDepictionFrom3D-ref-3D.png
             :align:  center
        - .. image:: ../images/OEPrepareAlignedDepictionFrom3D-overlap.png
             :align:  center
        - .. image:: ../images/OEPrepareAlignedDepictionFrom3D-fit-3D.png
             :align:  center
      * - 3D reference molecule
        - 3D molecule overlay
        - 3D fit molecule
      * - .. image:: ../images/OEPrepareAlignedDepictionFrom3D-ref-2D.*
             :align:  center
        -
        - .. image:: ../images/OEPrepareAlignedDepictionFrom3D-fit-2D.*
             :align:  center
      * - 2D reference molecule (generated by OEPrepareDepictionFrom3D)
        -
        - 2D fit molecule (**generated by OEPrepareAlignedDepictionFrom3D**)

   .. #############################################################

   .. _api_OEPrepareAlignedDepictionFrom3D_OEShapeQueryDisplay:

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

      .. oe:api::

         bool OEPrepareAlignedDepictionFrom3D(OEChem::OEMolBase& fitmol2D,
                                              const OEChem::OEMolBase& fitmol3D,
                                              const OEShapeQueryDisplay& qdisp)

   .. oe:language:: python

      .. oe:api:: python

         OEPrepareAlignedDepictionFrom3D(fitmol2D: Union[OEGraphMol,OEMol,OEQMol],
                                         fitmol3D: Union[OEGraphMol,OEMol,OEQMol],
                                         qdisp: OEShapeQueryDisplay) -> bool

   Generates the 2D coordinates of a molecule driven by the 3D overlay of the
   shape query display object.

   *fitmol2D*
      The molecule for which 2D coordinates are generated.

   *refmol2D*
      The 2D molecule whose orientation drives the 2D coordinate generation.

   *qdisp*
       The :ref:`OEShapeQueryDisplay <OEGrapheme_OEShapeQueryDisplay>` object that drives
       the layout of the 2D coordinate generation.

   .. seealso::

      * :ref:`OEShapeQueryDisplay <OEGrapheme_OEShapeQueryDisplay>` class
