Verlet list

struct mdk::vl::Spec

A specification (spec for short) for the non-local force. Technically one could generate a Verlet list for every non-local force, however this would be wasteful - thus we generate a most restrictive possible Verlet list which contains the “sub-Verlet lists” of the particular non-local forces and let them filter the general list on their own accord into a local list.

Public Members

double cutoffSq = 0.0

A square of the cutoff distance.

int minBondSep = 3

Minimum bond separation between the residues of one pair in the Verlet list. Technically this is just an optimization.

class mdk::vl::List : public mdk::SimulVar

A Verlet list.

Public Functions

void registerNF(NonlocalForce &force, Spec const &spec)

Register a nonlocal force, in particular adjust the current specs so as to accomodate the newly added force (for example increase the cutoff distance), and add it to the internal list of the forces whose hooks to call when a list is reconstructed.

Parameters
  • force – Nonlocal force to register.

  • specSpec with which to register the force.

virtual void bind(Simulation &simulation) override

Bind an object to a simulation.

Parameters

simulationSimulation to bind the object to.

void check()

Check whether the list needs updating, and if it does update it and invoke the relevant update hooks for the non-local forces.

Public Members

Pairs pairs

The list of pairs. The pairs are ordered (if a pair [i, j] is in this list, then i < j).

Private Functions

bool needToReset() const
void update()

Updates the Verlet list in the “legacy fashion”, i.e. going through a list of pairs and checking the distances.

int indexOf(Eigen::Vector3i const &loc)

Computes the flattened index of a cell in the grid.

Parameters

loc – Unflattened index.

Returns

Flattened index.

void perPair(int c1, int c2)
void perCell(int c1)
void updateGrid()

Updates the Verlet list, but instead of going through each pair we first place the residues into cells of (rough) size effCutoff and then only take the pairs from the neighboring cells, which reduces the computational cost from O(N^2) to O(N) (although the constant behind O(N) may be significant). In practice this version is much faster, especially for large numbers of residues.

Private Members

State const *state = nullptr
Chains const *chains = nullptr
double t0 = 0.0

Time from when the list was last reconstructed.

Vectors r0

Positions of the residues from when the list was last reconstructed.

Topology top0

Box shape from when the list was last reconstructed.

std::vector<NonlocalForce*> forces

A list of nonlocal forces, saved in order to invoke their update hooks when the list is reconstructed.

bool initial = false
double cutoff = 0.0 * angstrom

A maximal cutoff among registered nonlocal forces.

double pad = 10.0 * angstrom

An extra “buffer”. The list by default contains elements that may be outside the maximal cutoff, which allows us to not have to reconstruct the verlet list at every time step, at the cost of spurious distance comparisons.

int minBondSep = 0

Minimal bond-distance between the residues among registered nonlocal forces.

Eigen::Vector3i grid

Dimensions of the grid of cells used in the cell version of the computation.

std::vector<int> first

A list of size equal to the number of cells in the grid, where a nonnegative number indicates an index of the residue which is first in the linked list of residues in a given cell. If the cell is empty, the value is -1.

std::vector<int> last

A list of size equal to the number of cells in the grid, where a nonnegative number indicates an index of the residue which is last in the linked list of residues in a given cell. If the cell is empty, the value is -1.

std::vector<int> next

A list of size equal to the number of residues, where a nonnegative number indicates an index of a residue which is next in the linked list associated with the cell in which the residue is placed.

double effCutoff
double effCutoffSq