Class MoleculeGrid
- java.lang.Object
-
- com.actelion.research.chem.io.pdb.converter.MoleculeGrid
-
public class MoleculeGrid extends java.lang.ObjectClass 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>[][][]gridprotected int[]gridSizeprotected doublegridWidthprotected Coordinatesmaxprotected Coordinatesminprotected StereoMoleculemol
-
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 CoordinatesgetCartCoordinates(int[] gridCoords)intgetClosestNeighbour(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)booleanhasNeighbours(Coordinates c, double maxDist)voidupdateGrid(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()
-
-