public class Grid extends Object
The grid is composed of cells of size of the cutoff so that the distances that need to be calculated are reduced to those within each cell and to the neighbouring cells.
Usage, for generic 3D points:
Point3d[] points = ...; Grid grid = new Grid(8.0); grid.addCoords(points); List<Contact> contacts = getIndicesContacts();Usage, for atoms:
Atom[] atoms = ...; Grid grid = new Grid(8.0); grid.addCoords(atoms); AtomContactSet contacts = getAtomContacts();
Constructor and Description |
---|
Grid(double cutoff)
Creates a
Grid , the cutoff is in the same units as the coordinates
(Angstroms if they are atom coordinates) and can
be specified to a precision of 0.01. |
Modifier and Type | Method and Description |
---|---|
void |
addAtoms(Atom[] atoms)
Adds a set of atoms, subsequent call to
getIndicesContacts() or getAtomContacts() will produce the interatomic contacts. |
void |
addAtoms(Atom[] iAtoms,
Atom[] jAtoms)
Adds the i and j atoms and fills the grid.
|
void |
addAtoms(Atom[] atoms,
BoundingBox bounds)
Adds a set of atoms, subsequent call to
getIndicesContacts() or getAtomContacts() will produce the interatomic contacts. |
void |
addAtoms(Atom[] iAtoms,
BoundingBox icoordbounds,
Atom[] jAtoms,
BoundingBox jcoordbounds)
Adds the i and j atoms and fills the grid, passing their bounds (array of size 6 with x,y,z minima and x,y,z maxima)
This way the bounds don't need to be recomputed.
|
void |
addCoords(javax.vecmath.Point3d[] atoms)
Adds a set of coordinates, subsequent call to
getIndicesContacts() will produce the
contacts, i.e. the set of points within distance cutoff. |
void |
addCoords(javax.vecmath.Point3d[] atoms,
BoundingBox bounds)
Adds a set of coordinates, subsequent call to
getIndicesContacts() will produce the
contacts, i.e. the set of points within distance cutoff. |
void |
addCoords(javax.vecmath.Point3d[] iAtoms,
BoundingBox icoordbounds,
javax.vecmath.Point3d[] jAtoms,
BoundingBox jcoordbounds)
Adds the i and j coordinates and fills the grid, passing their bounds (array of size 6 with x,y,z minima and x,y,z maxima)
This way the bounds don't need to be recomputed.
|
void |
addCoords(javax.vecmath.Point3d[] iAtoms,
javax.vecmath.Point3d[] jAtoms)
Adds the i and j coordinates and fills the grid.
|
AtomContactSet |
getAtomContacts()
Returns all contacts, i.e. all atoms that are within the cutoff distance.
|
AtomContactSet |
getContacts()
Deprecated.
use
getAtomContacts() instead |
double |
getCutoff() |
protected javax.vecmath.Point3d[] |
getIAtoms() |
List<Contact> |
getIndicesContacts()
Returns all contacts, i.e. all atoms that are within the cutoff distance, as simple Contact objects containing the atom indices pairs and the distance.
|
protected javax.vecmath.Point3d[] |
getJAtoms() |
boolean |
hasAnyContact(Collection<javax.vecmath.Point3d> atoms) |
boolean |
hasAnyContact(javax.vecmath.Point3d[] atoms)
Fast determination of whether any atoms from a given set fall within
the cutoff of iAtoms.
|
boolean |
isNoOverlap()
Tells whether (after having added atoms to grid) the i and j grids are not overlapping.
|
public Grid(double cutoff)
Grid
, the cutoff is in the same units as the coordinates
(Angstroms if they are atom coordinates) and can
be specified to a precision of 0.01.cutoff
- public void addAtoms(Atom[] iAtoms, Atom[] jAtoms)
getIndicesContacts()
or getAtomContacts()
will produce the interatomic contacts.iAtoms
- jAtoms
- public void addAtoms(Atom[] iAtoms, BoundingBox icoordbounds, Atom[] jAtoms, BoundingBox jcoordbounds)
getIndicesContacts()
or getAtomContacts()
will produce the interatomic contacts.iAtoms
- icoordbounds
- jAtoms
- jcoordbounds
- public void addAtoms(Atom[] atoms)
getIndicesContacts()
or getAtomContacts()
will produce the interatomic contacts.
The bounding box of the atoms will be computed based on input arrayatoms
- public void addAtoms(Atom[] atoms, BoundingBox bounds)
getIndicesContacts()
or getAtomContacts()
will produce the interatomic contacts.
The bounds calculated elsewhere can be passed, or if null they are computed.atoms
- bounds
- public void addCoords(javax.vecmath.Point3d[] iAtoms, javax.vecmath.Point3d[] jAtoms)
getIndicesContacts()
will produce the
contacts, i.e. the set of points within distance cutoff.
Subsequent calls to method getAtomContacts()
will produce a NullPointerException
since this only adds coordinates and no atom information.iAtoms
- jAtoms
- public void addCoords(javax.vecmath.Point3d[] iAtoms, BoundingBox icoordbounds, javax.vecmath.Point3d[] jAtoms, BoundingBox jcoordbounds)
getIndicesContacts()
will produce the
contacts, i.e. the set of points within distance cutoff.
Subsequent calls to method getAtomContacts()
will produce a NullPointerException
since this only adds coordinates and no atom information.iAtoms
- icoordbounds
- jAtoms
- jcoordbounds
- public void addCoords(javax.vecmath.Point3d[] atoms)
getIndicesContacts()
will produce the
contacts, i.e. the set of points within distance cutoff.
The bounding box of the atoms will be computed based on input array.
Subsequent calls to method getAtomContacts()
will produce a NullPointerException
since this only adds coordinates and no atom information.atoms
- public void addCoords(javax.vecmath.Point3d[] atoms, BoundingBox bounds)
getIndicesContacts()
will produce the
contacts, i.e. the set of points within distance cutoff.
The bounds calculated elsewhere can be passed, or if null they are computed.
Subsequent calls to method getAtomContacts()
will produce a NullPointerException
since this only adds coordinates and no atom information.atoms
- bounds
- public AtomContactSet getAtomContacts()
@Deprecated public AtomContactSet getContacts()
getAtomContacts()
insteadpublic List<Contact> getIndicesContacts()
public boolean hasAnyContact(javax.vecmath.Point3d[] atoms)
addAtoms(Atom[], Atom[])
was called
with two sets of atoms, contacts to either set are considered.atoms
- public boolean hasAnyContact(Collection<javax.vecmath.Point3d> atoms)
public double getCutoff()
public boolean isNoOverlap()
protected javax.vecmath.Point3d[] getIAtoms()
protected javax.vecmath.Point3d[] getJAtoms()
Copyright © 2000–2019 BioJava. All rights reserved.