OBFloatGrid Class Reference
Handle double precision floating point 3D grids (e.g., charge density around an OBMol). More...
#include <openbabel/grid.h>

Public Member Functions | |
OBFloatGrid () | |
~OBFloatGrid () | |
void | Init (OBMol &box, double spacing, double pad=0.0) |
vector3 | GetMin () |
void | GetMin (double *a) |
vector3 | GetMax () |
void | GetMax (double *a) |
double | GetSpacing () const |
void | GetSpacing (double &s) |
double | GetScale () const |
double | GetHalfSpace () const |
int | GetXdim () const |
int | GetYdim () const |
int | GetZdim () const |
void | GetDim (int *a) |
vector3 | GetMidpointVector () |
vector3 | GetXAxis () const |
vector3 | GetYAxis () const |
vector3 | GetZAxis () const |
void | SetNumberOfPoints (int nx, int ny, int nz) |
void | SetXAxis (vector3) |
void | SetYAxis (vector3) |
void | SetZAxis (vector3) |
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]) |
std::vector< double > | GetDataVector () |
void | SetVals (const std::vector< double > &vals) |
double * | GetVals () |
double | GetValue (int i, int j, int k) |
void | SetVals (double *ptr) |
bool | SetValue (int i, int j, int k, double val) |
vector3 | Center () |
double | Inject (double x, double y, double z) |
void | IndexToCoords (int idx, double &x, double &y, double &z) |
void | CoordsToIndex (int *, double *) |
int | CoordsToIndex (double x, double y, double z) |
double | Interpolate (double, double, double) |
double | InterpolateDerivatives (double, double, double, double *derivatives) |
virtual void | Init (OBMol &box) |
double | GetXmin () const |
double | GetYmin () const |
double | GetZmin () const |
double | GetXmax () const |
double | GetYmax () const |
double | GetZmax () const |
bool | PointIsInBox (double x, double y, double z) |
bool | PointIsInBox (double *c) |
bool | PointIsInBox (vector3 v) |
virtual bool | Clear () |
virtual OBBase * | DoTransformations (const std::map< std::string, std::string > *, OBConversion *) |
template<class T > | |
T * | CastAndClear (bool clear=true) |
virtual const char * | GetTitle (bool replaceNewlines=true) const |
virtual void | SetTitle (const char *) |
Generic data handling methods (via OBGenericData) | |
bool | HasData (const std::string &) |
bool | HasData (const char *) |
bool | HasData (const unsigned int type) |
void | DeleteData (unsigned int type) |
void | DeleteData (OBGenericData *) |
void | DeleteData (std::vector< OBGenericData * > &) |
bool | DeleteData (const std::string &s) |
void | SetData (OBGenericData *d) |
void | CloneData (OBGenericData *d) |
size_t | DataSize () const |
OBGenericData * | GetData (const unsigned int type) |
OBGenericData * | GetData (const std::string &) |
OBGenericData * | GetData (const char *) |
std::vector< OBGenericData * > & | GetData () |
std::vector< OBGenericData * > | GetData (DataOrigin source) |
std::vector< OBGenericData * > | GetAllData (const unsigned int type) |
OBDataIterator | BeginData () |
OBDataIterator | EndData () |
Static Public Member Functions | |
static const char * | ClassDescription () |
Protected Attributes | |
std::vector< double > | _values |
int * | _ival |
double | _midz |
double | _midx |
double | _midy |
int | _ydim |
int | _xdim |
int | _zdim |
double | _spacing |
double | _inv_spa |
double | _halfSpace |
vector3 | _xAxis |
vector3 | _yAxis |
vector3 | _zAxis |
double | _xmin |
double | _xmax |
double | _ymin |
double | _ymax |
double | _zmin |
double | _zmax |
std::vector< OBGenericData * > | _vdata |
Friends | |
std::ostream & | operator<< (std::ostream &, const OBFloatGrid &) |
std::istream & | operator>> (std::istream &, OBFloatGrid &) |
Detailed Description
Handle double precision floating point 3D grids (e.g., charge density around an OBMol).
Supports input/output and base functionality for simple 3D discrete grids of some function -- typically around a molecule. Typically you will want to use OBGridData which uses OBFloatGrid to store its data.
- See also:
- OBGridData
Constructor & Destructor Documentation
OBFloatGrid | ( | ) | [inline] |
~OBFloatGrid | ( | ) | [inline] |
Member Function Documentation
void Init | ( | OBMol & | box, | |
double | spacing, | |||
double | pad = 0.0 | |||
) |
Initialize the grid using this molecule as a box (plus a padding) with the supplied spacing between points.
Referenced by OBForceField::GetGrid().
vector3 GetMin | ( | ) | [inline] |
- Returns:
- the minimum point in the grid.
Referenced by OBForceField::GetGrid().
void GetMin | ( | double * | a | ) | [inline] |
vector3 GetMax | ( | ) | [inline] |
- Returns:
- the minimum point in the grid.
void GetMax | ( | double * | a | ) | [inline] |
double GetSpacing | ( | ) | const [inline] |
- Returns:
- The grid spacing.
void GetSpacing | ( | double & | s | ) | [inline] |
double GetScale | ( | ) | const [inline] |
- Returns:
- Inverse of the grid spacing.
double GetHalfSpace | ( | ) | const [inline] |
- Returns:
- Half of the spacing between grid points.
int GetXdim | ( | ) | const [inline] |
- Returns:
- Size of the grid in the x dimension.
Referenced by OBForceField::GetGrid().
int GetYdim | ( | ) | const [inline] |
- Returns:
- Size of the grid in the y dimension.
Referenced by OBForceField::GetGrid().
int GetZdim | ( | ) | const [inline] |
- Returns:
- Size of the grid in the z dimension.
Referenced by OBForceField::GetGrid().
void GetDim | ( | int * | a | ) | [inline] |
Get the x, y and z dimensions (must pass an double[3] at least).
- Deprecated:
- May be removed in future.
vector3 GetMidpointVector | ( | ) | [inline] |
- Returns:
- Position of the center of the grid.
vector3 GetXAxis | ( | ) | const [inline] |
- Returns:
- X axis direction.
vector3 GetYAxis | ( | ) | const [inline] |
- Returns:
- Y axis direction.
vector3 GetZAxis | ( | ) | const [inline] |
- Returns:
- Z axis direction.
void SetNumberOfPoints | ( | int | nx, | |
int | ny, | |||
int | nz | |||
) |
Sets the number of points in the x, y and z directions.
void SetXAxis | ( | vector3 | v | ) |
Set the direction of the x axis.
Referenced by OBFloatGrid::SetLimits().
void SetYAxis | ( | vector3 | v | ) |
Set the direction of the y axis.
Referenced by OBFloatGrid::SetLimits().
void SetZAxis | ( | vector3 | v | ) |
Set the direction of the z axis.
Referenced by OBFloatGrid::SetLimits().
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 OBFloatGrid::SetLimits().
void SetLimits | ( | const double | origin[3], | |
const double | x[3], | |||
const double | y[3], | |||
const double | z[3] | |||
) |
- Deprecated:
- Will be removed.
std::vector< double > GetDataVector | ( | ) |
Get a copy of the vector that stores the points in the grid.
void SetVals | ( | const std::vector< double > & | vals | ) |
Set the values in the grid to those in the vector passed. Note that the vector must be of the same dimensions as the grid based on the values given in SetNumberOfPoints(int nx, int ny, int nz).
double* GetVals | ( | ) | [inline] |
- Returns:
- Pointer to the first element of the grid point data stored as a one dimensional array.
- Deprecated:
- Will be removed.
- See also:
- GetDataVector()
double GetValue | ( | int | i, | |
int | j, | |||
int | k | |||
) | [inline] |
- Returns:
- Value at the point in the grid specified by i, j and k.
void SetVals | ( | double * | ptr | ) | [inline] |
- Deprecated:
- Will be removed.
bool SetValue | ( | int | i, | |
int | j, | |||
int | k, | |||
double | val | |||
) | [inline] |
Set the value at the grid point specified by i, j and k to val.
vector3 Center | ( | ) | [inline] |
- Returns:
- Position of the center of the grid.
double Inject | ( | double | x, | |
double | y, | |||
double | z | |||
) |
- Returns:
- the value at the given point (rounding as needed)
void IndexToCoords | ( | int | idx, | |
double & | x, | |||
double & | y, | |||
double & | z | |||
) |
void CoordsToIndex | ( | int * | idx, | |
double * | c | |||
) |
Referenced by OBFloatGrid::Inject().
int CoordsToIndex | ( | double | x, | |
double | y, | |||
double | z | |||
) |
double Interpolate | ( | double | x, | |
double | y, | |||
double | z | |||
) |
- Returns:
- the interpolated value for the given point
double InterpolateDerivatives | ( | double | x, | |
double | y, | |||
double | z, | |||
double * | derivatives | |||
) |
- Returns:
- the interpolated value for the given point and set the dx, dy, dz derivatives
void Init | ( | OBMol & | box | ) | [virtual, inherited] |
Initialize the grid based on a box around the molecule box
Subclasses should overload this method -- this only tracks the dimension of the box itself.
Referenced by OBProxGrid::Setup().
double GetXmin | ( | ) | const [inline, inherited] |
- Returns:
- the minimum x point of the grid
double GetYmin | ( | ) | const [inline, inherited] |
- Returns:
- the minimum y point of the grid
double GetZmin | ( | ) | const [inline, inherited] |
- Returns:
- the minimum z point of the grid
double GetXmax | ( | ) | const [inline, inherited] |
- Returns:
- the maximum x point of the grid
double GetYmax | ( | ) | const [inline, inherited] |
- Returns:
- the maximum y point of the grid
double GetZmax | ( | ) | const [inline, inherited] |
- Returns:
- the maximum z point of the grid
bool PointIsInBox | ( | double | x, | |
double | y, | |||
double | z | |||
) | [inline, inherited] |
- Returns:
- whether the supplied XYZ coordinates fall within the box
Referenced by OBProxGrid::Setup().
bool PointIsInBox | ( | double * | c | ) | [inline, inherited] |
- Returns:
- true if the point falls within the box
bool PointIsInBox | ( | vector3 | v | ) | [inline, inherited] |
- Returns:
- true if the point falls within the box
bool Clear | ( | void | ) | [virtual, inherited] |
Clear any and all data associated with this object.
This method can be called by OBConversion::Read() before reading data. Derived classes should be sure to call OBBase::Clear() to remove inherited generic data.
- Returns:
- Whether the call was successful.
- Since:
- version 2.1.
Reimplemented in OBAtom, OBMol, OBReaction, and OBResidue.
Referenced by OBResidue::Clear(), OBMol::Clear(), and OBAtom::Clear().
virtual OBBase* DoTransformations | ( | const std::map< std::string, std::string > * | , | |
OBConversion * | ||||
) | [inline, virtual, inherited] |
Perform a set of transformations specified by the user
Typically these are program options to filter or modify an object For example, see OBMol::DoTransformations() and OBMol::ClassDescription() Base type does nothing
Reimplemented in OBMol.
static const char* ClassDescription | ( | ) | [inline, static, inherited] |
- Returns:
- A list of descriptions of command-line options for DoTransformations()
Reimplemented in OBMol, and OBReaction.
T* CastAndClear | ( | bool | clear = true |
) | [inline, inherited] |
By default clears the object. Called from ReadMolecule of most format classes.
virtual const char* GetTitle | ( | bool | replaceNewlines = true |
) | const [inline, virtual, inherited] |
Base type does nothing Made virtual around r3535 to simplify code which passes around OBBase*.
Reimplemented in OBMol.
Referenced by OBMoleculeFormat::DoOutputOptions().
virtual void SetTitle | ( | const char * | ) | [inline, virtual, inherited] |
Reimplemented in OBMol.
Referenced by OBMoleculeFormat::DoOutputOptions().
bool HasData | ( | const std::string & | s | ) | [inherited] |
- Returns:
- whether the generic attribute/value pair exists
Referenced by OBMol::AddAtom(), OBDepict::DrawMolecule(), OBMol::FindAngles(), OBMol::FindLSSR(), OBMol::FindSSSR(), OBMol::FindTorsions(), OBForceField::GetAtomTypes(), OBForceField::GetConformers(), OBForceField::GetCoordinates(), OBMol::GetEnergies(), OBMol::GetEnergy(), OBMol::GetLSSR(), OBForceField::GetPartialCharges(), OBMol::GetSSSR(), OBBase::HasData(), OBDescriptor::MatchPairData(), OBMol::NewAtom(), OBMol::operator=(), OBMoleculeFormat::ReadChemObjectImpl(), and OBMol::SetEnergies().
bool HasData | ( | const char * | s | ) | [inherited] |
- Returns:
- whether the generic attribute/value pair exists
bool HasData | ( | const unsigned int | type | ) | [inherited] |
- Returns:
- whether the generic attribute/value pair exists, for a given OBGenericDataType
void DeleteData | ( | unsigned int | type | ) | [inherited] |
Delete any data matching the given OBGenericDataType.
Referenced by OBMol::AddAtom(), OBMol::BeginModify(), OpenBabel::CanonicalLabels(), OBDescriptor::DeleteProperties(), OBMol::EndModify(), OBMol::FindLSSR(), OBMol::FindSSSR(), OBMol::NewAtom(), OBMol::RenumberAtoms(), and OBForceField::Setup().
void DeleteData | ( | OBGenericData * | gd | ) | [inherited] |
Delete the given generic data from this object.
void DeleteData | ( | std::vector< OBGenericData * > & | vg | ) | [inherited] |
Delete all of the given generic data from this object.
bool DeleteData | ( | const std::string & | s | ) | [inherited] |
Deletes the generic data with the specified attribute, returning false if not found.
void SetData | ( | OBGenericData * | d | ) | [inline, inherited] |
Adds a data object; does nothing if d==NULL.
Referenced by OBMol::AddBond(), OBGastChrg::AssignPartialCharges(), OpenBabel::CalcSignedVolume(), OBMol::DoTransformations(), OBAtom::Duplicate(), AliasData::Expand(), OBMol::FindAngles(), OBMol::FindLSSR(), OBMol::FindSSSR(), OBMol::FindTorsions(), OBForceField::GetAtomTypes(), OBForceField::GetConformers(), OBForceField::GetCoordinates(), OBMol::GetEnergies(), OBMol::GetEnergy(), OBMol::GetFormula(), OBMol::GetLSSR(), OBMol::GetNextFragment(), OBForceField::GetPartialCharges(), OBMol::GetSSSR(), OBMoleculeFormat::MakeCombinedMolecule(), OBMol::operator=(), OBDescriptor::PredictAndSave(), OBMol::SetEnergies(), and OBMol::SetFormula().
void CloneData | ( | OBGenericData * | d | ) | [inherited] |
Adds a copy of a data object; does nothing if d == NULL
- Since:
- version 2.2
Referenced by OBMol::AddBond().
size_t DataSize | ( | ) | const [inline, inherited] |
- Returns:
- the number of OBGenericData items attached to this molecule.
OBGenericData * GetData | ( | const unsigned int | type | ) | [inherited] |
- Returns:
- the first matching data for a given type from OBGenericDataType or NULL if nothing matches
Referenced by OpenBabel::CalcSignedVolume(), OpenBabel::CorrectChirality(), OBDepict::DrawMolecule(), AliasData::Expand(), OBDescriptor::FilterCompare(), OpenBabel::GetAtomSymClass(), OBForceField::GetAtomTypes(), OBForceField::GetConformers(), OBForceField::GetCoordinates(), OBMol::GetNextFragment(), OBForceField::GetPartialCharges(), OBDescriptor::GetValues(), OBMoleculeFormat::MakeCombinedMolecule(), OBMolAngleIter::OBMolAngleIter(), OBMolRingIter::OBMolRingIter(), OBMolTorsionIter::OBMolTorsionIter(), OBMol::operator=(), and OBDescriptor::PredictAndSave().
OBGenericData * GetData | ( | const std::string & | s | ) | [inherited] |
- Returns:
- any data matching the given attribute name or NULL if nothing matches
- the value given an attribute name
OBGenericData * GetData | ( | const char * | s | ) | [inherited] |
- Returns:
- any data matching the given attribute name or NULL if nothing matches
- the value given an attribute name
std::vector<OBGenericData*>& GetData | ( | ) | [inline, inherited] |
- Returns:
- all data, suitable for iterating
Referenced by OBMol::BeginModify(), OBMol::DoTransformations(), OBBase::GetData(), OBMol::GetEnergies(), OBMol::GetEnergy(), OBMol::GetFormula(), OBMol::GetLSSR(), OBMol::GetSSSR(), OBMol::SetEnergies(), and OBMol::SetFormula().
std::vector< OBGenericData * > GetData | ( | DataOrigin | source | ) | [inherited] |
- Returns:
- all data with a specific origin, suitable for iterating
std::vector< OBGenericData * > GetAllData | ( | const unsigned int | type | ) | [inherited] |
- Returns:
- the all matching data for a given type from OBGenericDataType or an empty vector if nothing matches
- Since:
- version 2.2
Referenced by OpenBabel::CanonicalLabels(), OBBuilder::CorrectStereoAtoms(), and OBBuilder::CorrectStereoBonds().
OBDataIterator BeginData | ( | ) | [inline, inherited] |
- Returns:
- An iterator pointing to the beginning of the data
Referenced by OBMol::AddAtom(), OBMol::AddBond(), OBAtom::Duplicate(), OBMoleculeFormat::MakeCombinedMolecule(), OBMol::NewAtom(), and OBMol::operator=().
OBDataIterator EndData | ( | ) | [inline, inherited] |
- Returns:
- An iterator pointing to the end of the data
Referenced by OBMol::AddAtom(), OBMol::AddBond(), OBAtom::Duplicate(), OBMoleculeFormat::MakeCombinedMolecule(), OBMol::NewAtom(), and OBMol::operator=().
Friends And Related Function Documentation
std::ostream& operator<< | ( | std::ostream & | os, | |
const OBFloatGrid & | fg | |||
) | [friend] |
std::istream& operator>> | ( | std::istream & | is, | |
OBFloatGrid & | fg | |||
) | [friend] |
Member Data Documentation
std::vector<double> _values [protected] |
int* _ival [protected] |
for integer values (deprecated)
Referenced by OBFloatGrid::Init().
double _midz [protected] |
Referenced by OBFloatGrid::Init(), OpenBabel::operator<<(), and OpenBabel::operator>>().
double _midx [protected] |
Referenced by OBFloatGrid::Init(), OpenBabel::operator<<(), and OpenBabel::operator>>().
double _midy [protected] |
center of grid in world coordinates
Referenced by OBFloatGrid::Init(), OpenBabel::operator<<(), and OpenBabel::operator>>().
int _ydim [protected] |
int _xdim [protected] |
int _zdim [protected] |
grid dimensions
Referenced by OBFloatGrid::CoordsToIndex(), OBFloatGrid::IndexToCoords(), OBFloatGrid::Init(), OBFloatGrid::Interpolate(), OBFloatGrid::InterpolateDerivatives(), OpenBabel::operator<<(), OpenBabel::operator>>(), OBFloatGrid::SetLimits(), OBFloatGrid::SetNumberOfPoints(), and OBFloatGrid::SetVals().
double _spacing [protected] |
double _inv_spa [protected] |
spacing between grid points and its inverse
Referenced by OBFloatGrid::CoordsToIndex(), OBFloatGrid::Init(), OBFloatGrid::Interpolate(), OBFloatGrid::InterpolateDerivatives(), OpenBabel::operator<<(), OpenBabel::operator>>(), and OBFloatGrid::SetLimits().
double _halfSpace [protected] |
half of the grid spacing
Referenced by OBFloatGrid::IndexToCoords(), OBFloatGrid::Init(), OBFloatGrid::Interpolate(), OBFloatGrid::InterpolateDerivatives(), OpenBabel::operator>>(), and OBFloatGrid::SetLimits().
Three axes (i.e., translation vectors like a unit cell).
Referenced by OBFloatGrid::SetXAxis().
Referenced by OBFloatGrid::SetYAxis().
Referenced by OBFloatGrid::SetZAxis().
double _xmin [protected, inherited] |
Referenced by OBFloatGrid::CoordsToIndex(), OBProxGrid::GetProxVector(), OBFloatGrid::IndexToCoords(), OBFloatGrid::Init(), OBGrid::Init(), OBFloatGrid::Interpolate(), OBFloatGrid::InterpolateDerivatives(), OpenBabel::operator<<(), OpenBabel::operator>>(), OBFloatGrid::SetLimits(), and OBProxGrid::Setup().
double _xmax [protected, inherited] |
double _ymin [protected, inherited] |
Referenced by OBFloatGrid::CoordsToIndex(), OBProxGrid::GetProxVector(), OBFloatGrid::IndexToCoords(), OBFloatGrid::Init(), OBGrid::Init(), OBFloatGrid::Interpolate(), OBFloatGrid::InterpolateDerivatives(), OpenBabel::operator<<(), OpenBabel::operator>>(), OBFloatGrid::SetLimits(), and OBProxGrid::Setup().
double _ymax [protected, inherited] |
double _zmin [protected, inherited] |
Referenced by OBFloatGrid::CoordsToIndex(), OBProxGrid::GetProxVector(), OBFloatGrid::IndexToCoords(), OBFloatGrid::Init(), OBGrid::Init(), OBFloatGrid::Interpolate(), OBFloatGrid::InterpolateDerivatives(), OpenBabel::operator<<(), OpenBabel::operator>>(), OBFloatGrid::SetLimits(), and OBProxGrid::Setup().
double _zmax [protected, inherited] |
the min/max axes in XYZ axes (i.e., the box)
Referenced by OBProxGrid::GetProxVector(), OBFloatGrid::Init(), OBGrid::Init(), OBFloatGrid::Inject(), OBFloatGrid::Interpolate(), OBFloatGrid::InterpolateDerivatives(), OpenBabel::operator<<(), OpenBabel::operator>>(), OBFloatGrid::SetLimits(), and OBProxGrid::Setup().
std::vector<OBGenericData*> _vdata [protected, inherited] |
Custom data.
Referenced by OBBase::Clear(), OBBase::CloneData(), OBBase::DeleteData(), OBAtom::Duplicate(), OBBase::GetAllData(), OBBase::GetData(), OBBase::HasData(), OBBond::OBBond(), OBMol::OBMol(), and OBResidue::OBResidue().
The documentation for this class was generated from the following files: