.. include:: ../substitutions

.. oe:namespace:: OEChem

.. meta::
   :keywords: OESetMMCIFChemCompData

.. oe:function:: OESetMMCIFChemCompData

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

      .. oe:api::

         bool OESetMMCIFChemCompData(OEMolBase& mol,
                                     const OEMolBase& chemCompMol,
                                     const bool strict = false)

   .. oe:language:: python

      .. oe:api:: python

         OESetMMCIFChemCompData(mol: Union[OEGraphMol,OEMol,OEQMol],
                                chemCompMol: Union[OEGraphMol,OEMol,OEQMol],
                                strict: bool = False) -> bool

   Updates _chem_comp sections in the MMCIF header metadata with information from the input chemCompMol molecule.
   First, a single-residue chemCompMol is checked to name match with a residue in mol molecule.
   The chemCompMol atom and bond data is then used to replace the _chem_comp header data for a similarly named residue
   in the mol. If strict is used, an additional check for atom name matching is made between the matched residue in
   the molecule and the chemCompMol.

   The following categories need to be present and properly populated in the input molecules header for this
   function. If any attributes are missing, running OEUpdateMMCIFData with ChemComp perception should populate any
   missing attributes:

     * _chem_comp.
     * _chem_comp_atom.
     * _chem_comp_bond.

   If the molecule already exists, it will replace all chemical component references of that molecule with the
   new molecule.
   By default, residue atom name matching is enforced. If strict is turned off, an :ref:`OESubSearch <OEChem_OESubSearch>`
   is used to identify structural similarity with the new molecule. If a match is found, the matching structure
   atom names will be used in the _chem_comp atom naming scheme.

   .. seealso::

      * :oe:cls:`OEChem::OECIFData` class for cif data manipulation
      * :ref:`section_moldata_MMCIF` section

   .. admonition:: Code Example

      * :ref:`section_example_oechem_setchemcomp` example
