.. include:: ../../toolkit-substitutions
.. include:: ../../common/cookbook/cookbook-hyperlinks

.. oe:namespace:: OEChem

.. oe:function:: OEMolToHelm

   .. attention::

      |PRELIMINARY-API|

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

      .. oe:api::

         std::string OEMolToHelm(const OEMolBase& mol,
                                 const OEMonomerSet& monomers)
         std::string OEMolToHelm(const OEMolBase& mol,
                                 const OEMonomerSet& monomers,
                                 OEHelmGenerationResult& result)
         std::string OEMolToHelm(const OEMolBase& mol,
                                 const OEMonomerSet& monomers,
                                 const OEHelmGenerationOptions& options)
         std::string OEMolToHelm(const OEMolBase& mol,
                                 const OEMonomerSet& monomers,
                                 const OEHelmGenerationOptions& options,
                                 OEHelmGenerationResult& result)

   .. oe:language:: python

      .. oe:api:: python

         OEMolToHelm(mol: Union[OEGraphMol,OEMol,OEQMol],
                     monomers: OEMonomerSet) -> str
         OEMolToHelm(mol: Union[OEGraphMol,OEMol,OEQMol],
                     monomers: OEMonomerSet, result: OEHelmGenerationResult) -> str
         OEMolToHelm(mol: Union[OEGraphMol,OEMol,OEQMol],
                     monomers: OEMonomerSet, options: OEHelmGenerationOptions) -> str
         OEMolToHelm(mol: Union[OEGraphMol,OEMol,OEQMol],
                     monomers: OEMonomerSet, options: OEHelmGenerationOptions,
                     result: OEHelmGenerationResult) -> str

   Converts a molecule into :term:`HELM` string. The function will return :term:`HELM`
   string if it can be generated successfully, otherwise
   the function will return an empty string.

   mol
    The molecule (:oe:cls:`OEChem::OEMolBase`) the HELM string is generated from.

   monomers
    The monomer set (:oe:cls:`OEChem::OEMonomerSet`) that stores the monomers that
    are used to generate the :term:`HELM` string.

    If the given monomer set supports multiple code sets, :oe:func:`OEChem::OEHelmToMol` automatically
    selects the primary code set.

   options
    The options for :term:`HELM` generation (:oe:cls:`OEChem::OEHelmGenerationOptions`).

   result
    Is specified, the :oe:cls:`OEChem::OEHelmGenerationResult` object will store additional
    information about the success or failure of the :term:`HELM` generation. 

   **Example**

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

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

   .. seealso::

      * [Zhang-2012]_ publications
      * :oe:func:`OEChem::OEHelmToMol` function

   .. admonition:: OpenEye Python Cookbook Code Example

      * `Convert SMILES to HELM`_
      * `Convert Molecule File to HELM File`_
