.. oe:namespace:: OEFastROCS

.. meta::
   :keywords: OEShapeDatabasePrep

.. oe:function:: OEShapeDatabasePrep

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

      .. oe:api::

         bool OEShapeDatabasePrep(std::string filein, std::string fileout,
                                  unsigned int cfftype = OEShape::OEColorFFType::OEDefault)

   .. oe:language:: python

      .. oe:api:: python

         OEShapeDatabasePrep(filein: str, fileout: str,
                             cfftype: int = OEColorFFType_OEDefault) -> bool

   Prepares molecules stored in a :oe:const:`OEChem::OEFormat::OEB` file
   to improve the performance of loading the molecules into an
   :ref:`OEShapeDatabase <OEFastROCS_OEShapeDatabase>` object. This is a **multi-threaded**
   implementation of the :ref:`shapedatabaseprep<section_example_fastrocs_shapedatabaseprep>`
   example that takes the input ``OEB`` filename as the first argument
   and the output ``OEB`` filename as the second argument. An optional argument to
   specify the color force field type can be passed in. The default color force
   field is Implicit Mills Dean.

   Using this function to prep a database will result in as much as 10-fold
   performance improvement of
   :oe:meth:`OEFastROCS::OEShapeDatabase::Open`. OEShapeDatabasePrep does the
   following:

   - Pre-compresses the output file with :oe:func:`OEChem::OEPRECompress`,
     alleviating the need to Gzip the ``OEB`` and improving the
     performance of :oe:meth:`OEChem::OEMolDatabase::Open`.
   - Sets the energy of each conformer to ``0.0`` to avoid writing it
     to ``OEB``.
   - Suppresses hydrogens and reorders reference conformers for
     compression.
   - Pre-calculates color atoms.
   - Pre-calculates self-color and self-shape terms for all conformers.

   .. note::

      :oe:func:`OEFastROCS::OEShapeDatabasePrep` will
      cache color atoms and self color terms for the
      :oe:const:`OEShape::OEColorFFType::ImplicitMillsDean` color
      force field.

   .. warning::
      This function is non-deterministic so molecules will not appear in the
      same order as the input file.

   .. warning::
      This function should not be used to prepare a database intended to be
      used with a :oe:const:`OEFastROCS::OEShapeDatabaseType::Sitehopper`
      database
