.. _section_example_oechem_parts2mols:

Splitting multicomponent molecules
================================================================================

A program that splits multicomponent molecules into their constituent
parts. The program will output the molecules to stdout as SMILES if no
output file is set.  The program will print the number of input and
output molecules to stderr.


Example
--------------------------------------------------------------------------------

.. oe:language:: c++

   .. code-block:: console

      prompt> parts2mols file1.oeb.gz output.oeb.gz

.. oe:language:: python

   .. code-block:: console

      prompt> parts2mols.py inputfile1.oeb.gz output.oeb.gz

.. oe:language:: java

   .. code-block:: console

      prompt> Parts2Mols inputfile1.oeb.gz output.oeb.gz

.. oe:language:: csharp

   .. code-block:: console

      prompt> Parts2Mols inputfile1.oeb.gz output.oeb.gz


If the output-file argument is omitted, the output is written to standard output.

Code
--------------------------------------------------------------------------------

.. oe:language:: c++

   .. only:: oehtml

      .. admonition:: Download code

         :download:`parts2mols.cpp <../../../../../sublibs/tklibs/oechem/examples/parts2mols.cpp>`

   .. only:: oepdf

      .. oe:source:: parts2mols.cpp
         :language: c++

.. oe:language:: python

   .. only:: oehtml

      .. admonition:: Download code

         :download:`parts2mols.py <../../../../../wrappers/python/examples/oechem/parts2mols.py>`

      .. literalinclude:: ../../../../../wrappers/python/examples/oechem/parts2mols.py


   .. only:: oepdf

      .. oe:source:: parts2mols.py
         :language: python

.. oe:language:: java

   .. only:: oehtml

      .. admonition:: Download code

         :download:`Parts2Mols.java <../../../../../wrappers/java/examples/openeye/examples/oechem/Parts2Mols.java>`

   .. only:: oepdf

      .. oe:source:: Parts2Mols.java
         :language: java

.. oe:language:: csharp

   .. only:: oehtml

      .. admonition:: Download code

         :download:`Parts2Mols.cs <../../../../../wrappers/csharp/Csharp-Examples/OEChem/Parts2Mols.cs>`

   .. only:: oepdf

      .. oe:source:: Parts2Mols.cs
         :language: csharp

.. seealso::

   * :ref:`section_ring_system_components` section
   * :oe:func:`OEChem::OEDetermineComponents` function
   * :oe:func:`OEChem::OESubsetMol` function
