.. include:: ../substitutions

.. oe:namespace:: OEChem

.. meta::
   :keywords: OECopyMol

.. oe:function:: OECopyMol

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

      .. oe:api::

         void OECopyMol(OEMolBase& dst, const OEMolBase& src,
                        OEAtomBase** atommap = 0, OEBondBase** bondmap = 0)
         void OECopyMol(OEMCMolBase& dst, const OEMCMolBase& src,
                        OEAtomBase** atommap = 0, OEBondBase** bondmap = 0)

   .. oe:language:: python

      .. oe:api:: python

         OECopyMol(dst: Union[OEGraphMol,OEMol,OEQMol],
                   src: Union[OEGraphMol,OEMol,OEQMol],
                   atommap: OEAtomBase = None, bondmap: OEBondBase = None) -> None
         OECopyMol(dst: OEMol, src: OEMol, atommap: OEAtomBase = None,
                   bondmap: OEBondBase = None) -> None

   Create a copy of the molecule ``src`` into the molecule
   ``dst``. The mapping of the atoms and bonds between the two copies
   of the molecule can be retrieved by passing in arrays to the
   ``atommap`` and ``bondmap`` arguments. The size of the ``atommap``
   array should be large enough to store ``src.GetMaxAtomIdx()``
   atoms. The size of the ``bondmap`` array should be large enough to
   store ``src.GetMaxBondIdx()`` atoms. The new atom or bond in
   ``dst`` will be stored at the ``src`` atom or bond's
   :oe:meth:`OEChem::OEAtomBase::GetIdx<OEChem::OEAtomBase::GetIdx>`
   location in the array.

   The following code demonstrates how to access the atom associations
   output by the ``OECopyMol`` function.

   .. oe:source:: CopyMol.cpp
      :language: c++
      :frag:     SNIPPET

   .. oe:source:: CopyMol.py
      :language: python
      :frag:     SNIPPET

   .. oe:source:: CopyMol.java
      :language: java
      :frag:     SNIPPET

   .. oe:source:: CopyMol.cs
      :language: csharp
      :frag:     SNIPPET

