.. include:: ../../toolkit-substitutions

.. oe:namespace:: OESpruce

..  _OESpruce_oemakedesignunit:

.. oe:function:: OEMakeDesignUnit

   .. attention::

      |TWOLANGUAGE|

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

      .. oe:api::

         bool OEMakeDesignUnit(OEBio::OEDesignUnit& du,
                               const OEChem::OEMolBase& nonLigandComplex,
                               const OEChem::OEMolBase& ligand,
                               const OESpruce::OEMakeDesignUnitOptions& opts = OESpruce::OEMakeDesignUnitOptions())

   .. oe:language:: python

      .. oe:api:: python

         OEMakeDesignUnit(du: OEDesignUnit,
                          nonLigandComplex: Union[OEGraphMol,OEMol,OEQMol],
                          ligand: Union[OEGraphMol,OEMol,OEQMol],
                          opts: OEMakeDesignUnitOptions = OEMakeDesignUnitOptions()) -> bool

   Constructs and populates an input :ref:`OEDesignUnit <OEBio_OEDesignUnit>` object (`du`) from the
   input, a `nonLigandComplex` (typically a protein or DNA) and a `ligand`. An options
   :ref:`OEMakeDesignUnitOptions <OESpruce_OEMakeDesignUnitOptions>` object can be passed in to control the
   behavior during design unit preparation.

   .. note::

      We strongly recommend running :ref:`OESpruceFilter <OESpruce_OESpruceFilter>` for standardization and filtering prior to running the design unit preparation.

   .. note::

      The function will construct an :ref:`OEDesignUnit <OEBio_OEDesignUnit>` (`du`), where the system's
      molecules have been binned into categories given by the
      :oe:constns:`OEBio::OEDesignUnitComponents` namespace. Although an
      :oe:constns:`OEBio::OEDesignUnitComponents::Metals` category exists, depending on the proximity of the metal to
      the design unit's binding site, the metal may be contained in either the
      :oe:constns:`OEBio::OEDesignUnitComponents::Cofactors` category if it falls within a cutoff to the binding site,
      or in the :oe:constns:`OEBio::OEDesignUnitComponents::Metals` category if not.

   .. admonition:: Code Example

      * :ref:`spruce_examples_make_design_units` example

.. seealso::

  * :ref:`OEMakeDesignUnitOptions <OESpruce_OEMakeDesignUnitOptions>`, :ref:`OEMakeBioDesignUnits <OESpruce_OEMakeBioDesignUnits>`, and :ref:`OESpruceFilter <OESpruce_OESpruceFilter>`
