Class MoleculeGrid
- java.lang.Object
-
- com.actelion.research.chem.io.pdb.converter.MoleculeGrid
-
- Direct Known Subclasses:
NegativeReceptorImage
public class MoleculeGrid extends java.lang.Object
Class used to speed up the calculation of neighbours by creating a grid. Each atom is indexed according to its 3D coordinates.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Set<java.lang.Integer>[][][]
grid
protected int[]
gridSize
protected double
gridWidth
protected Coordinates
max
protected Coordinates
min
protected StereoMolecule
mol
-
Constructor Summary
Constructors Constructor Description MoleculeGrid(StereoMolecule mol)
MoleculeGrid(StereoMolecule mol, double gridWidth, Coordinates extension)
Creates the Grid: Complexity O(nAtoms)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Coordinates
getCartCoordinates(int[] gridCoords)
int
getClosestNeighbour(Coordinates c, double maxDist)
Returns the closest neighbour.int[]
getGridCoordinates(Coordinates c)
int[]
getGridSize()
java.util.Set<java.lang.Integer>
getNeighbours(Coordinates[] bounds, double maxDist)
Gets a Set of all neigbouring atoms.java.util.Set<java.lang.Integer>
getNeighbours(Coordinates c, double maxDist)
Gets a Set of all neigbouring atoms.java.util.Set<java.lang.Integer>
getNeighbours(Coordinates c, double maxDist, boolean enforceDist)
java.util.Set<java.lang.Integer>
getNeighbours(Coordinates c, double maxDist, boolean enforceDist, int requiredFlags)
Gets a Set of all neigbouring atoms.java.util.Set<java.lang.Integer>
getNeighbours(Molecule mol, int atom, double maxDist)
java.util.Set<java.lang.Integer>
getNeighbours(Molecule mol, int atom, double maxDist, boolean enforceDist)
boolean
hasNeighbours(Coordinates c, double maxDist)
void
updateGrid(StereoMolecule mol)
-
-
-
Field Detail
-
mol
protected final StereoMolecule mol
-
gridWidth
protected final double gridWidth
-
min
protected final Coordinates min
-
max
protected final Coordinates max
-
gridSize
protected final int[] gridSize
-
grid
protected final java.util.Set<java.lang.Integer>[][][] grid
-
-
Constructor Detail
-
MoleculeGrid
public MoleculeGrid(StereoMolecule mol)
-
MoleculeGrid
public MoleculeGrid(StereoMolecule mol, double gridWidth, Coordinates extension)
Creates the Grid: Complexity O(nAtoms)- Parameters:
mol
-
-
-
Method Detail
-
getNeighbours
public java.util.Set<java.lang.Integer> getNeighbours(Coordinates c, double maxDist)
Gets a Set of all neigbouring atoms. This class ensures that at least all atoms within maxDist are returned (+more)- Parameters:
c
-maxDist
-- Returns:
-
getNeighbours
public java.util.Set<java.lang.Integer> getNeighbours(Coordinates c, double maxDist, boolean enforceDist)
-
getNeighbours
public java.util.Set<java.lang.Integer> getNeighbours(Coordinates c, double maxDist, boolean enforceDist, int requiredFlags)
Gets a Set of all neigbouring atoms. This class ensures that at least all atoms within maxDist are returned (+more)- Parameters:
c
-maxDist
-- Returns:
-
hasNeighbours
public boolean hasNeighbours(Coordinates c, double maxDist)
-
getNeighbours
public java.util.Set<java.lang.Integer> getNeighbours(Coordinates[] bounds, double maxDist)
Gets a Set of all neigbouring atoms. This class ensures that at least all atoms within maxDist are returned (+more)- Parameters:
bounds
-maxDist
-- Returns:
-
getClosestNeighbour
public int getClosestNeighbour(Coordinates c, double maxDist)
Returns the closest neighbour. maxDist has to be given to take advantage of the speed- Parameters:
c
-maxDist
-- Returns:
-
updateGrid
public void updateGrid(StereoMolecule mol)
-
getNeighbours
public java.util.Set<java.lang.Integer> getNeighbours(Molecule mol, int atom, double maxDist)
-
getNeighbours
public java.util.Set<java.lang.Integer> getNeighbours(Molecule mol, int atom, double maxDist, boolean enforceDist)
-
getGridCoordinates
public int[] getGridCoordinates(Coordinates c)
-
getCartCoordinates
public Coordinates getCartCoordinates(int[] gridCoords)
-
getGridSize
public int[] getGridSize()
-
-