.. include:: ../substitutions

.. oe:namespace:: OEChem

.. meta::
   :keywords: OEGetCenterOfMass

.. oe:function:: OEGetCenterOfMass

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

      .. oe:api::

         void OEGetCenterOfMass(const OEMolBase& mol, float* com,
                                bool weightAtoms = false)

   .. oe:language:: python

      .. oe:api:: python

         OEGetCenterOfMass(mol: Union[OEGraphMol,OEMol,OEQMol],
                           com: OEFloatArray, weightAtoms: bool = False) -> None


   Calculates the center-of-mass of the molecule. The ``weightAtoms`` can be
   specified to weight each of the atom coordinates with the corresponding atom weights.

   *mol*
       The molecule to calculate center-of-mass.

    *com*
       The output center-of-mass array.  The array must have a defined size of at least three.

    *weightAtoms*
       Flag indicating if the atom weights should be used to weight the coordinates during calculation.
