Avogadro
1.1.0
|
A list container for finding spatial neighbors of atoms. More...
#include <avogadro/neighborlist.h>
Public Member Functions | |
NeighborList (Molecule *mol, double rcut, bool periodic=false, int boxSize=1) | |
NeighborList (const QList< Atom * > &atoms, double rcut, bool periodic=false, int boxSize=1) | |
void | update () |
QList< Atom * > | nbrs (Atom *atom, bool uniqueOnly=true) |
QList< Atom * > | nbrs (const Eigen::Vector3f *pos) |
double | r2 (unsigned int index) const |
A list container for finding spatial neighbors of atoms.
NeighborList can be used for finding non-bonded interactions between pairs of atoms. Based on: Near-neighbor calculations using a modified cell-linked list method Mattson, W.; B. M. Rice (1999). "Near-neighbor calculations using a modified cell-linked list method". Computer Physics Communications 119: 135.
Avogadro::NeighborList::NeighborList | ( | Molecule * | mol, |
double | rcut, | ||
bool | periodic = false , |
||
int | boxSize = 1 |
||
) |
Constructor to include all atoms.
mol | The molecule containing the atoms |
rcut | The cut-off distance. |
boxSize | The number of cells per rcut distance. |
References Avogadro::Molecule::atoms().
Avogadro::NeighborList::NeighborList | ( | const QList< Atom * > & | atoms, |
double | rcut, | ||
bool | periodic = false , |
||
int | boxSize = 1 |
||
) |
Construcor.
atoms | The atoms |
rcut | The cut-off distance. |
periodic | Use periodic boundary conditions. |
The | number of cells per rcut distance. |
QList< Atom * > Avogadro::NeighborList::nbrs | ( | Atom * | atom, |
bool | uniqueOnly = true |
||
) |
Get the near-neighbor atoms for atom
. The squared distance is checked and is cached for later use (see r2() function).
Note: Atoms in relative 1-2 and 1-3 positions are not returned. The atom
itself isn't added to the list.
atom | The atom for which to return the near-neighbors |
atom
References QList::append(), QList::clear(), Avogadro::Primitive::index(), and Avogadro::Atom::pos().
QList< Atom * > Avogadro::NeighborList::nbrs | ( | const Eigen::Vector3f * | pos | ) |
Get the near-neighbor atoms around pos
. The squared distance is checked and is cached for later use (see r2() function).
pos | The position for which to return the near-neighbors |
atom
References QList::append(), and QList::clear().
double Avogadro::NeighborList::r2 | ( | unsigned int | index | ) | const [inline] |
Get the cached squared distance from the atom last used to call nbrs to the atom with index
in the returned vector.
index | The index for the atom in the vector of atoms returned by nbrs(). |
void Avogadro::NeighborList::update | ( | ) |
Update the cells. While minimizing or running MD simulations, atoms move and can go from on cell into the next. This function should be called every 10-20 iterations to make sure the cells stay accurate.