.. include:: ../substitutions

.. oe:namespace:: OEBio

.. meta::
   :keywords: OESetCrystalSymmetry

.. oe:function:: OESetCrystalSymmetry

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

      .. oe:api::

         bool OESetCrystalSymmetry(OEChem::OEMolBase& mol,
                                   const OECrystalSymmetryParams& params,
                                   bool force = false)

   .. oe:language:: python

      .. oe:api:: python

         OESetCrystalSymmetry(mol: Union[OEGraphMol,OEMol,OEQMol],
                              params: OECrystalSymmetryParams,
                              force: bool = False) -> bool

   Sets the crystal symmetry stored in a :ref:`OECrystalSymmetryParams <OEBio_OECrystalSymmetryParams>`
   object for a given molecule.

   The above functions return ``false`` if the space group number 
   (returned by  :oe:meth:`OEBio::OECrystalSymmetryParams::GetSpaceGroup`) 
   is not found or the symmetry cannot be set on the molecule because the
   constraints on the spacegroup are violated.

   If ``force`` is set to true, then parameters that violate the constraints of
   the given spacegroup will be applied.  (This is sometimes necessary based on 
   slight rounding errors for deposited CRYST1 cards).

   .. note::

      Use this overloaded function in the supported wrapped
      languages: Python, Java and C#.

   **Example:**

   .. oe:source:: OESetCrystalSymmetry.py
      :language: python
      :noindent:
      :frag:     SNIPPET-OESETCRYSTALSYMMETRY

   .. oe:source:: OESetCrystalSymmetry.cpp
      :language: c++
      :noindent:
      :frag:     SNIPPET-OESETCRYSTALSYMMETRY

   .. oe:source:: OESetCrystalSymmetry.java
      :language: java
      :noindent:
      :frag:     SNIPPET-OESETCRYSTALSYMMETRY

   .. oe:source:: OESetCrystalSymmetryDoc.cs
      :language: csharp
      :noindent:
      :frag:     SNIPPET-OESETCRYSTALSYMMETRY

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

      .. oe:api::

         bool OESetCrystalSymmetry(OEChem::OEMolBase& mol, float a, float b,
                                   float c, float alpha, float beta,
                                   float gamma, unsigned int sgnumber,
                                   bool force = false)

   .. oe:language:: python

      .. oe:api:: python

         OESetCrystalSymmetry(mol: Union[OEGraphMol,OEMol,OEQMol], a: float,
                              b: float, c: float, alpha: float, beta: float,
                              gamma: float, sgnumber: int, force: bool = False) -> bool

   Sets the crystal symmetry for a given molecule. 

   The above functions return ``false`` if the indicated space group number is
   not found or the symmetry cannot be set on the molecule because the
   constraints on the spacegroup are violated, such as a=b for tetragonal
   spacegroups.

   If ``force`` is set to true, then parameters that violate the constraints of
   the given spacegroup will be applied.  (This is sometimes necessary based on 
   slight rounding errors for deposited CRYST1 cards).

   .. seealso::

      * :oe:func:`OEBio::OEGetCrystalSymmetry` function
