.. include:: ../substitutions

.. oe:namespace:: OEChem

.. meta::
   :keywords: OECalculateMolecularWeight

.. oe:function:: OECalculateMolecularWeight

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

      .. oe:api::

         double OECalculateMolecularWeight(const OEMolBase& mol,
                                           bool isotopic = false)

   .. oe:language:: python

      .. oe:api:: python

         OECalculateMolecularWeight(mol: Union[OEGraphMol,OEMol,OEQMol],
                                    isotopic: bool = False) -> float

   Calculates the molecular weight of the given molecule.
   By default, all atoms are assumed their average atomic weight, as returned
   by the :oe:func:`OEChem::OEGetAverageWeight` function.

   *isotopic*
      This parameter determines whether to use the :oe:func:`OEChem::OEGetIsotopicWeight` function
      instead of :oe:func:`OEChem::OEGetAverageWeight`. Atoms must have a specified (non-zero) isotopic 
      mass, as returned by :oe:meth:`OEChem::OEAtomBase::GetIsotope`

.. seealso::

  .. oe:language:: c++

      * Example program :ref:`sizefilter.cpp<section_example_oechem_sizefilter>`
      * Example program :ref:`molstats.cpp<section_example_oechem_molstats>`

  .. oe:language:: python

      * Example program :ref:`sizefilter.py<section_example_oechem_sizefilter>`
      * Example program :ref:`molstats.py<section_example_oechem_molstats>`

  .. oe:language:: java

      * Example program :ref:`SizeFilter.java<section_example_oechem_sizefilter>`
      * Example program :ref:`MolStats.java<section_example_oechem_molstats>`

  .. oe:language:: csharp

      * Example program :ref:`SizeFilter.cs<section_example_oechem_sizefilter>`
      * Example program :ref:`MolStats.cs<section_example_oechem_molstats>`

