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

.. _chapter-sprucetk-validate-design-unit:

.. oe:namespace:: OESpruce

.. meta::
   :keywords: OEValidateDesignUnit, ValidateDesignUnit, ValidateDU


.. _OESpruce_OEValidateDesignUnit:

.. oe:class:: OEValidateDesignUnit

   .. attention::

      |TWOLANGUAGE|

   .. oe:api::

      class OEValidateDesignUnit


   This class performs a structural check after running Spruce preparation.

   It looks for:
    * Partial side chains
    * Partial charges
    * Implicit hydrogens
    * Incorrect terminal residues
    * Heavy atom overlap
    * Broken chains

   :ref:`OEDesignUnitIssueCodes <OESpruce_OEDesignUnitIssueCodes>` shows the type of issue codes.

   .. admonition:: Code Example

      * :ref:`spruce_examples_validate_design_unit`

   .. oe:method:: Constructors

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

         .. oe:api::

            OEValidateDesignUnit()
            OEValidateDesignUnit(const OEValidateDesignUnit& rhs)

      .. oe:language:: python

         .. oe:api:: python

            OEValidateDesignUnit() -> OEValidateDesignUnit
            OEValidateDesignUnit(rhs: OEValidateDesignUnit) -> OEValidateDesignUnit

      Default and copy constructors for the OEValidateDesignUnit class.


   .. oe:method:: operator=
      :language: c++

      .. oe:api::

         OEValidateDesignUnit& operator=(const OEValidateDesignUnit& rhs)

      Assignment operator.

   .. oe:method:: Validate

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

         .. oe:api::

            unsigned Validate(OEBio::OEDesignUnit& du,
                              const OESpruce::OEStructureMetadata& mdata = OESpruce::OEStructureMetadata())

      .. oe:language:: python

         .. oe:api:: python

            Validate(du: OEDesignUnit,
                     mdata: OEStructureMetadata = OEStructureMetadata()) -> int

      Returns a code which indicates the issues that are detected for this structure.

   .. oe:method:: GetMessages

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

         .. oe:api::

            std::string GetMessages(const unsigned errorTypes = OEDesignUnitIssueCodes::ALL)

      .. oe:language:: python

         .. oe:api:: python

            GetMessages(errorTypes: int) -> str

      Returns the error message according to the provided error code.

   .. oe:method:: GetProblematicResidues

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

         .. oe:api::

            std::vector<OEChem::OEResidue> GetProblematicResidues(const unsigned errorTypes = OEDesignUnitIssueCodes::ALL)

      .. oe:language:: python

         .. oe:api:: python

            GetProblematicResidues(errorTypes: int) -> OEResidueVector

      Returns the problematic residues that have the issues indicated by the input error code.
      
 
