.. # split from OESystemFunctions.rst:1686

.. include:: ../substitutions

.. oe:namespace:: OESystem

.. meta::
   :keywords: OEMakeGridFromCenterAndExtents

.. oe:function:: OEMakeGridFromCenterAndExtents

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

      .. oe:api::

         template<class T>
         bool OEMakeGridFromCenterAndExtents(OESystem::OEGrid<T>& fgrid,
                                             const float* center,
                                             const float* extents,
                                             float spacing)
         bool OEMakeGridFromCenterAndExtents(OESystem::OEScalarGrid& fgrid,
                                             const float* center,
                                             const float* extents,
                                             float spacing)

   .. oe:language:: python

      .. oe:api:: python

         OEMakeGridFromCenterAndExtents(fgrid: OEScalarGrid,
                                        center: OEFloatArray,
                                        extents: OEFloatArray, spacing: float) -> bool

   Initiates the geometry of 'fgrid' from the midpoint ('center'),
   dimensions ('extents'), and length between grid points
   ('spacing').

   This is useful for creating grids that are guaranteed to
   encapsulate an arbitrary set of coordinates. For example, the
   following code uses :oe:func:`OEChem::OEGetCenterAndExtents` on the
   molecule and then uses
   :oe:func:`OESystem::OEMakeGridFromCenterAndExtents` to construct the
   grid.

   .. oe:source:: OEMakeGridFromCenterAndExtents.cpp
      :language: c++
      :noindent:
      :frag:     SNIPPET-OEMakeGridFromCenterAndExtents
      :caption:  Initializing grid geometry from the coordinates of a molecule

   .. oe:source:: OEMakeGridFromCenterAndExtents.py
      :language: python
      :noindent:
      :frag:     SNIPPET-OEMakeGridFromCenterAndExtents
      :caption:  Initializing grid geometry from the coordinates of a molecule

   .. oe:source:: OEMakeGridFromCenterAndExtents.java
      :language: java
      :noindent:
      :frag:     SNIPPET-OEMakeGridFromCenterAndExtents
      :caption:  Initializing grid geometry from the coordinates of a molecule

   .. oe:source:: OEMakeGridFromCenterAndExtents.cs
      :language: csharp
      :noindent:
      :frag:     SNIPPET-OEMakeGridFromCenterAndExtents
      :caption:  Initializing grid geometry from the coordinates of a molecule

