Loading...
Searching...
No Matches
OBGridData Class Reference

`#include <openbabel/griddata.h>`

Inheritance diagram for OBGridData:
[legend]

## Public Types

enum | Unit { BOHR , ANGSTROM , OTHER }

## Public Member Functions

| OBGridData ()
| ~OBGridData ()
virtual OBGenericData * | Clone (OBBase *) const
void | SetAttribute (const std::string &v)
void | SetOrigin (const DataOrigin s)
virtual const std::string & | GetAttribute () const
unsigned int | GetDataType () const
virtual const std::string & | GetValue () const
virtual DataOrigin | GetOrigin () const
Property Methods
void | GetAxes (double x[3], double y[3], double z[3]) const
vector3 | GetXAxis () const
vector3 | GetYAxis () const
vector3 | GetZAxis () const
void | GetAxes (vector3 &v1, vector3 &v2, vector3 &v3) const
void | GetNumberOfPoints (int &nx, int &ny, int &nz) const
int | GetNumberOfPoints () const
void | GetNumberOfSteps (int steps[3]) const
std::vector< double > | GetValues () const
double | GetValue (int i, int j, int k) const
double | GetValue (vector3 pos) const
Unit | GetUnit () const
double | GetMinValue () const
double | GetMaxValue () const
vector3 | GetOriginVector () const
void | GetOriginVector (double o[3]) const
vector3 | GetMaxVector () const
bool | GetUnrestricted () const
int | GetNumSymmetries () const

## Protected Attributes

std::string | _attr
unsigned int | _type
DataOrigin | _source

## Modification Methods

void | SetNumberOfPoints (int nx, int ny, int nz)
void | SetLimits (const vector3 &origin, const vector3 &x, const vector3 &y, const vector3 &z)
void | SetLimits (const double origin[3], const double x[3], const double y[3], const double z[3])
bool | SetValue (int i, int j, int k, double val)
void | SetValues (const std::vector< double > &v)
void | SetUnit (Unit u)
void | SetUnrestricted (bool u)
void | SetNumSymmetries (int s)

## Detailed Description

Store values for numeric grids such as orbitals or electrostatic potential.

Since
  version 2.2

See also
  OBFloatGrid

OBGridData facilitates attaching grids and cubes to molecular data. A "grid" is data representing some function f(x,y,z), such as a molecule's electrostatic potential or molecular orbitals. This need not be a "cube" even though this file format from Gaussian is frequently used. Axes need not be identical, and indeed do not need to be orthogonal.

Open Babel supports reading several types of grid file formats, including Gaussian cube, and OpenDX. The latter is notably used by the APBS program for numeric evaluation of molecular and protein electrostatic potential.

OBGridData *gd = new OBGridData;
gd->SetAttribute("Example Grid"); // the title of the grid -- e.g., for user display
vector<int> voxels(3); // the number of voxels in each direction
vector3 origin; // the beginning x, y, z coordinate of the grid
vector<vector3> axes; // the xyz displacements for each of the grid axes
...
gd->SetNumberOfPoints(voxels[0], voxels[1], voxels[2]);
gd->SetLimits(origin, axes[0], axes[1], axes[2]);
gd->SetUnit(OBGridData::ANGSTROM);
gd->SetOrigin(fileformatInput); // i.e., is this data from a file or determined by Open Babel
for (int k = 0; k < voxels[2]; ++k)
for (int j = 0; j < voxels[1]; ++j)
for (int i = 0; i < voxels[0]; ++i)
{
gd->SetValue(i, j, k,
grid[k*voxels[0]*voxels[1] + j*voxels[0] + i]);
}
mol->SetData(gd);
OpenBabel::OBGenericData::SetOrigin
void SetOrigin(const DataOrigin s)
Set the origin of this data, which can be used to filter the data.
Definition base.h:219
OpenBabel::OBGenericData::SetAttribute
void SetAttribute(const std::string &v)
Set the attribute (key), which can be used to retrieve this data.
Definition base.h:216
OpenBabel::OBGridData::SetLimits
void SetLimits(const vector3 &origin, const vector3 &x, const vector3 &y, const vector3 &z)
Definition griddata.cpp:238
OpenBabel::OBGridData::SetUnit
void SetUnit(Unit u)
Set the unit of measure.
Definition griddata.cpp:256
OpenBabel::OBGridData::OBGridData
OBGridData()
Constructor.
Definition griddata.cpp:99
OpenBabel::OBGridData::SetValue
bool SetValue(int i, int j, int k, double val)
Set an individual value, grid must have been initialised.
Definition griddata.cpp:244
OpenBabel::OBGridData::ANGSTROM
@ ANGSTROM
Definition griddata.h:49
OpenBabel::vector3
Represents a vector in 3-dimensional real space.
Definition vector3.h:45
OpenBabel::fileformatInput
@ fileformatInput
Read from an input file.
Definition base.h:178
if (mol->HasData(OBGenericDataType::GridData)) {
vector<OBGenericData*> grids = mol->GetAllData(OBGenericDataType::GridData)
// Output the name of the grid
if (grids[0] != nullptr)
cout << grids[0]->GetAttribute();
}
OpenBabel::OBGenericDataType::GridData
@ GridData
Grid Data (e.g., 3D grids of data a.k.a. cubes).
Definition base.h:138

## Member Enumeration Documentation

## Unit

enum Unit

Unit of measure for grid spacings.

Enumerator
BOHR |
ANGSTROM |
OTHER |

## Constructor & Destructor Documentation

## OBGridData()

OBGridData | ( |  | ) |

Constructor.

## ~OBGridData()

~OBGridData | ( |  | ) |

Destructor.

## Member Function Documentation

## GetAxes() [1/2]

void GetAxes | ( | double | x[3],
|  | double | y[3],
|  | double | z[3] ) const

Returns
  the three axes parallel to the grid edges. The length of the returned vector is the step along that direction.

## GetXAxis()

vector3 GetXAxis | ( |  | ) | const

Returns
  X axis direction.

## GetYAxis()

vector3 GetYAxis | ( |  | ) | const

Returns
  Y axis direction.

## GetZAxis()

vector3 GetZAxis | ( |  | ) | const

Returns
  Z axis direction.

## GetAxes() [2/2]

void GetAxes | ( | vector3 & | v1,
|  | vector3 & | v2,
|  | vector3 & | v3 ) const

Returns
  the three axes parallel to the grid edges

## GetNumberOfPoints() [1/2]

void GetNumberOfPoints | ( | int & | nx,
|  | int & | ny,
|  | int & | nz ) const

Returns
  number of points along the three axes parallel to the grid edges.

## GetNumberOfPoints() [2/2]

int GetNumberOfPoints | ( |  | ) | const

Returns
  total number of points in the grid.

## GetNumberOfSteps()

void GetNumberOfSteps | ( | int | steps[3] | ) | const

Returns
  number of points along the three axes parallel to the grid edges.

## GetValues()

std::vector< double > GetValues | ( |  | ) | const

Returns
  grid values as a vector of doubles.

## GetValue() [1/3]

double GetValue | ( | int | i,
|  | int | j,
|  | int | k ) const

Returns
  the value at position i, j, k in the grid.

Referenced by OBForceField::GetGrid().

## GetValue() [2/3]

double GetValue | ( | vector3 | pos | ) | const

Returns
  the value at a position in the grid (by interpolation)

## GetUnit()

OBGridData::Unit GetUnit | ( |  | ) | const

Returns
  the unit of measure for grid spacings.

## GetMinValue()

double GetMinValue | ( |  | ) | const

Returns
  the minimum value of all points in the grid.

## GetMaxValue()

double GetMaxValue | ( |  | ) | const

Returns
  the maximum value of all points in the grid.

## GetOriginVector() [1/2]

vector3 GetOriginVector | ( |  | ) | const

Returns
  vector3 of the origin (i.e., the minimum x, y, and z coords of the grid).

## GetOriginVector() [2/2]

void GetOriginVector | ( | double | o[3] | ) | const

Parameters

  o | set to the origin (i.e., the minimum x, y, and z coords of the grid).

Deprecated
  Will be removed.

See also
  GetOriginVector()

## GetMaxVector()

vector3 GetMaxVector | ( |  | ) | const

Returns
  The maximum point in the grid.

## GetUnrestricted()

bool GetUnrestricted | ( |  | ) | const

Returns
  the unrestricted flag.

## GetNumSymmetries()

int GetNumSymmetries | ( |  | ) | const

Returns
  the number of symmetries.

## SetNumberOfPoints()

void SetNumberOfPoints | ( | int | nx,
|  | int | ny,
|  | int | nz )

Set number of points along the three axes.

Referenced by OBForceField::GetGrid().

## SetLimits() [1/2]

void SetLimits | ( | const vector3 & | origin,
|  | const vector3 & | x,
|  | const vector3 & | y,
|  | const vector3 & | z )

Set the limits (i.e., the origin point and the axes) NOTE: You must set the number of points first, with SetNumberOfPoints so the grid spacing can be calculated

Referenced by OBForceField::GetGrid().

## SetLimits() [2/2]

void SetLimits | ( | const double | origin[3],
|  | const double | x[3],
|  | const double | y[3],
|  | const double | z[3] )

Deprecated
  Will be removed.

See also
  SetLimits(const vector3 &origin, const vector3 &x, const vector3 &y, const vector3 &z)

## SetValue()

bool SetValue | ( | int | i,
|  | int | j,
|  | int | k,
|  | double | val )

Set an individual value, grid must have been initialised.

Referenced by OBForceField::GetGrid().

## SetValues()

void SetValues | ( | const std::vector< double > & | v | ) |

Set the values, this vector must match the dimensions of the grid.

## SetUnit()

void SetUnit | ( | OBGridData::Unit | u | ) |

Set the unit of measure.

## SetUnrestricted()

void SetUnrestricted | ( | bool | u | ) |

Set the unrestricted flag.

## SetNumSymmetries()

void SetNumSymmetries | ( | int | s | ) |

Set the number of symmetries.

## Clone()

virtual OBGenericData * Clone | ( | OBBase * |  | ) | const

inline virtual inherited

Reimplemented in AliasData, OBAngleData, OBCisTransStereo, OBCommentData, OBConformerData, OBDOSData, OBElectronicTransitionData, OBExternalBondData, OBMatrixData, OBNasaThermoData, OBOrbitalData, OBPairData, OBPairTemplate< ValueT >, OBPairTemplate< bool >, OBPairTemplate< double >, OBPairTemplate< int >, OBRateData, OBRingData, OBRotamerList, OBRotationData, OBSerialNums, OBSetData, OBSquarePlanarStereo, OBSymmetryData, OBTetrahedralStereo, OBTorsionData, OBUnitCell, OBVectorData, OBVibrationData, and OBVirtualBond.

Referenced by OBBase::CloneData(), OBAtom::Duplicate(), OBMoleculeFormat::MakeCombinedMolecule(), and OBMol::operator=().

## SetAttribute()

void SetAttribute | ( | const std::string & | v | ) |

inline inherited

Set the attribute (key), which can be used to retrieve this data.

Referenced by OBGastChrg::AssignPartialCharges(), OBMol::DoTransformations(), AliasData::Expand(), OBMol::FindLSSR(), OBMol::FindSSSR(), OBForceField::GetAtomTypes(), OBMol::GetFormula(), OBMol::GetLSSR(), OBForceField::GetPartialCharges(), OBMol::GetSSSR(), OBDescriptor::PredictAndSave(), and OBMol::SetFormula().

## SetOrigin()

void SetOrigin | ( | const DataOrigin | s | ) |

inline inherited

Set the origin of this data, which can be used to filter the data.

Referenced by OBGastChrg::AssignPartialCharges(), OBMol::DoTransformations(), OBMol::FindAngles(), OBMol::FindLSSR(), OBMol::FindSSSR(), OBMol::FindTorsions(), OBMol::GetFormula(), OBMol::GetLSSR(), OBMol::GetSSSR(), OBDescriptor::PredictAndSave(), and OBMol::SetFormula().

## GetAttribute()

virtual const std::string & GetAttribute | ( |  | ) | const

inline virtual inherited

Returns
  The attribute (key), which can be used to retrieve this data

Referenced by OBMoleculeFormat::MakeCombinedMolecule().

## GetDataType()

unsigned int GetDataType | ( |  | ) | const

inline inherited

Returns
  the data type for this object as defined in OBGenericDataType

## GetValue() [3/3]

virtual const std::string & GetValue | ( |  | ) | const

inline virtual inherited

Base class returns a default value (the attribute type) but should never be called.

Reimplemented in OBCommentData, and OBPairData.

Referenced by OBDepict::DrawMolecule(), OBDescriptor::FilterCompare(), and OBDescriptor::GetValues().

## GetOrigin()

virtual DataOrigin GetOrigin | ( |  | ) | const

inline virtual inherited

## Member Data Documentation

## _attr

std::string _attr

protected inherited

attribute tag (e.g., "UnitCell", "Comment" or "Author")

Referenced by OBRotamerList::Clone(), GetAttribute(), GetValue(), OBGenericData(), OBNasaThermoData::OBNasaThermoData(), OBRotamerList::OBRotamerList(), OBSymmetryData::OBSymmetryData(), and SetAttribute().

## _type

unsigned int _type

protected inherited

attribute type – declared for each subclass

Referenced by OBRotamerList::Clone(), GetDataType(), OBGenericData(), OBNasaThermoData::OBNasaThermoData(), OBRotamerList::OBRotamerList(), and OBSymmetryData::OBSymmetryData().

## _source

DataOrigin _source

protected inherited

source of data for accounting

Referenced by GetOrigin(), OBGenericData(), OBSymmetryData::OBSymmetryData(), OBAngleData::operator=(), OBConformerData::operator=(), OBSymmetryData::operator=(), OBTorsionData::operator=(), and SetOrigin().

The documentation for this class was generated from the following files:

- griddata.h
- griddata.cpp