MoleculeGrid

This class provides discrete representation of the molecule. The molecule is represented by a grid. Each voxel of the grid is marked as follows: In addition the distance function can be calculated for each voxel. The distances are zero at the surface voxels and change as the distance from the surface increases/decreases. The distance function is negative for inside molecule voxels and positive for outside voxels.

[ GAMB | Source | Keywords | Summary | Ancestors | All Members | Descendants ]

Quick Index

AUTHORS
CHANGES LOG
GOALS
USAGE

Class Summary

class MoleculeGrid

{
public:
// Constructors
MoleculeGrid(const Surface& surface, const float inDelta, const float maxRadius);
// Functions
float getDist(const Vector3& point) const ;
Vector3 calcVolumeNormal(const Vector3& center, const float radius ) const;
float calcVolumeFunc(const Vector3& center, const float radius ) const;
void calcVolumeFuncAndNormal(const Vector3& center, const float radius, float& volFunc, Vector3& volNormal) const;
void computeDistFromSurface(const Surface& surface, bool precise );
template< class MoleculeT> void markTheInside(const MoleculeT& M);
float volume() const;
void printGrid(ofstream& file) const;
protected:
int getIndexForPoint( const Vector3& point) const ;
Vector3 getPointForIndex(int index) const ;
bool isValidIndex(int index) const ;
int getIntGridRadius( float radius ) const ;
float delta ;
vector < int > neigbor;
vector < float > neigborDist;
vector < float > grid;
}; // MoleculeGrid

Back to the top of MoleculeGrid


AUTHORS

Yuval Inbar Dina Duhovny ,

Copyright: SAMBA group, Tel-Aviv Univ. Israel, 2001.

Back to the top of MoleculeGrid


CHANGES LOG

Back to the top of MoleculeGrid


GOALS

The class is designed to represent a molecule as accurate as possible using small amount of space and fast algorithms for grid calculations.

Distance function calculation: initialization: The grid voxels are initialized to MAX_VALUE. Then the surface voxels are marked with zero. The algorithm used for distance function computation is grass-fire algorithm. The analogy is that a fire spreads out from some voxels (surface voxels in this case), igniting each voxel in the fire's path. The distance function is computed for each layer starting from surface voxels. The radius for distance function computation is specified by the user. There is also a possibility to compute exact distance function: each voxel will have the exact distance to the closest surface point. Since the algorithm is iterative, the time complexity is linear to the number of voxels.

Marking the inside of the molecule: The same algorithm of grass-fire is used here. The signs of the voxel distance function is changed layer by layer, starting from the centers of molecule atoms. The procedure stops when it reaches surface voxels (distance function is zero or very small).

Space Complexity of the Grid: The density of the grid: delta, is specified by the user. Assume that the width of the molecule along each of the axis is: x_width, y_width, z_width. The space used by the grid will be: x_width*y_width*z_width/(delta^3).

Volume function and Volume normal: The class also supports volume function and normal calculation for a point on molecule surface. The volume function is the ratio of voxels outside the molecule in the sphere of radius R (in most articles it is suggested to use radius of 5A~), and the total number of voxels in the sphere. The volume normal is the average of the points outside the sphere of radius R. This normal is more accurate than the one given by MS or Shuo program.

Back to the top of MoleculeGrid


USAGE

The MoleculeGrid class uses Surface representation of the molecule generated by Connolly MS program. The density of the points needed for dense grid is 5A or more. The density of the grid (delta) should be 0.5-1.0. As the density of Connolly points increases, you can decrease the delta value of the grid.


  Surface msSurface;
  Molecule<Atom> mol;
  // ... read msSurface
  // ... read mol
  // initialization of grid
  MoleculeGrid* grid = new MoleculeGrid(msSurface, delta, maxDist) ;
  // distance function calculation
  grid->computeDistFromSurface(msSurface);
  // marking the molecule
  grid->markTheInside(mol);

  Vector3 point(1.2, 2.3, 3.4);
  float vf = grid->calcVolumeFunc(point,vfRadius) ;
  Vector3 normal = grid->calcVolumeNormal(point,vfRadius) ;
   

Back to the top of MoleculeGrid


MoleculeGrid(const Surface& surface, const float inDelta, const float maxRadius);

The MoleculeGrid constructor receives Connoly MS Surface, delta - grid density and maxRadius - maximum radius for distance function calculation.

  MoleculeGrid(const Surface& surface, const float inDelta, const float maxRadius);

Back to the top of MoleculeGrid


float getDist(const Vector3& point) const ;

Returns distance from surface for a given point.

  float getDist(const Vector3& point) const                                                                                                                             
;

Function is currently defined inline.


Back to the top of MoleculeGrid


Vector3 calcVolumeNormal(const Vector3& center, const float radius ) const;

Calculates volume normal for Vector3 center in a given radius.

  Vector3 calcVolumeNormal(const Vector3& center, const float radius = 5.0) const;

Back to the top of MoleculeGrid


float calcVolumeFunc(const Vector3& center, const float radius ) const;

Calculates volume function for Vector3 center in a given radius.

  float calcVolumeFunc(const Vector3& center, const float radius = 5.0) const;

Back to the top of MoleculeGrid


void calcVolumeFuncAndNormal(const Vector3& center, const float radius, float& volFunc, Vector3& volNormal) const;

Calculates volume function and normal at one pass. Usefull when both of them need to be calculated.

  void calcVolumeFuncAndNormal(const Vector3& center, const float radius,
			       float& volFunc, Vector3& volNormal) const;

Back to the top of MoleculeGrid


void computeDistFromSurface(const Surface& surface, bool precise );

Computes distance function for the molecule. The voxels corresponding to surface points are given zero distance function value and serve as a first layer. If precise value is true, than the exact dist. function is calculated.

  void computeDistFromSurface(const Surface& surface, bool precise = false);

Back to the top of MoleculeGrid


template< class MoleculeT> void markTheInside(const MoleculeT& M);

Marks the inside of the molecule by changing the sign of the distance function for inner voxels to negative. the molecule M shouls contain the coordinates of the centers of all atoms of the molecule.

  template< class MoleculeT>
  void markTheInside(const MoleculeT& M);

Back to the top of MoleculeGrid


float volume() const;

Computes the volume of the molecule based on grid

  float volume() const;

Back to the top of MoleculeGrid


void printGrid(ofstream& file) const;

Prints each surface voxel as a coordinate in PDB format. Usefull for grid visualization.

  void printGrid(ofstream& file) const;

Back to the top of MoleculeGrid


int getIndexForPoint( const Vector3& point) const ;

computes index in grid for a point.

  int getIndexForPoint( const Vector3& point) const                                                                                                                                                                                                                                                                                                                                          
;

Function is currently defined inline.


Back to the top of MoleculeGrid


Vector3 getPointForIndex(int index) const ;

computes a point corresponding to an index.

  Vector3 getPointForIndex(int index) const                                                                                                                                                                                                 
;

Function is currently defined inline.


Back to the top of MoleculeGrid


bool isValidIndex(int index) const ;

checks if the index is valid for the grid

  bool isValidIndex(int index) const                                             
;

Function is currently defined inline.


Back to the top of MoleculeGrid


int getIntGridRadius( float radius ) const ;

convert radius to grid valid radius (number of voxels)

  int getIntGridRadius( float radius ) const                                          
;

Function is currently defined inline.


Back to the top of MoleculeGrid


float delta ;

grid resolution

  float delta ;

Back to the top of MoleculeGrid


vector < int > neigbor;

cube neighbors there are 26 neighbors for each voxel

  vector < int > neigbor;

Back to the top of MoleculeGrid


vector < float > neigborDist;

cube neighbors' distances

  vector < float > neigborDist;

Back to the top of MoleculeGrid


vector < float > grid;

distances grid

  vector < float > grid;

Back to the top of MoleculeGrid


All Members

public:
// Functions
float getDist(const Vector3& point) const ;
Vector3 calcVolumeNormal(const Vector3& center, const float radius ) const;
float calcVolumeFunc(const Vector3& center, const float radius ) const;
void calcVolumeFuncAndNormal(const Vector3& center, const float radius, float& volFunc, Vector3& volNormal) const;
void computeDistFromSurface(const Surface& surface, bool precise );
template< class MoleculeT> void markTheInside(const MoleculeT& M);
float volume() const;
void printGrid(ofstream& file) const;
protected:
int getIndexForPoint( const Vector3& point) const ;
Vector3 getPointForIndex(int index) const ;
bool isValidIndex(int index) const ;
int getIntGridRadius( float radius ) const ;
float delta ;
vector < int > neigbor;
vector < float > neigborDist;
vector < float > grid;

Back to the top of MoleculeGrid


Ancestors

Class does not inherit from any other class.

Back to the top of MoleculeGrid


Descendants

Class is not inherited by any others.

Back to the top of MoleculeGrid


Generated from source by the Cocoon utilities on Sun Nov 15 13:35:26 2009 .

Report problems to jkotula@unimax.com