.. include:: ../substitutions

.. oe:namespace:: OEChem

.. meta::
   :keywords: OEWriteMol2File

.. oe:function:: OEWriteMol2File

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

      .. oe:api::

         void OEWriteMol2File(oemolostream& ofs, OEMolBase& mol,
                              bool m2h = true, bool substruct = false)

   .. oe:language:: python

      .. oe:api:: python

         OEWriteMol2File(ofs: oemolostream,
                         mol: Union[OEGraphMol,OEMol,OEQMol], m2h: bool = True,
                         substruct: bool = False) -> None

   Writes the molecule as a Tripos mol2 format file to the output stream
   'ofs'.  The 'm2h' parameter specifies whether implicit hydrogens
   should be written out as explicit hydrogens in the mol2 file.  If the
   value of 'm2h' is ``false``, the mol2 file writer attempts to suppress
   writing hydrogens, if the resulting connection table can be read
   unambiguously.

