Template Class CellListPotential#

Inheritance Relationships#

Base Type#

Class Documentation#

template<typename pairwise_interaction, typename distance_policy>
class CellListPotential : public pele::PairwisePotentialInterface#

Potential to loop over the list of atom pairs generated with the cell list implementation in cell_lists.h.

This should also do the cell list construction and refresh, such that the interface is the same for the user as with SimplePairwise.

Public Functions

inline ~CellListPotential()#
inline CellListPotential(
std::shared_ptr<pairwise_interaction> interaction,
std::shared_ptr<distance_policy> dist,
pele::Array<double> const &boxvec,
double ncellx_scale,
const pele::Array<double> radii,
NonAdditiveCutoffCalculator cutoff_calculator,
const double radii_sca = 0.0,
const bool balance_omp = true,
const bool exact_sum = false
)#
inline CellListPotential(
std::shared_ptr<pairwise_interaction> interaction,
std::shared_ptr<distance_policy> dist,
pele::Array<double> const &boxvec,
double rcut,
double ncellx_scale,
const pele::Array<double> radii,
const double radii_sca = 0.0,
const bool balance_omp = true,
const bool exact_sum = false,
const double non_additivity = 0.0
)#
inline CellListPotential(
std::shared_ptr<pairwise_interaction> interaction,
std::shared_ptr<distance_policy> dist,
pele::Array<double> const &boxvec,
double rcut,
double ncellx_scale,
const bool balance_omp = true,
const bool exact_sum = false
)#
inline virtual size_t get_ndim()#
inline virtual double get_energy(Array<double> const &coords)#

Return the energy of configuration x.

This is the only function which must be overloaded

inline virtual double get_energy_change(
Array<double> const &old_coords,
Array<double> const &new_coords,
std::vector<size_t> const &changed_atoms
)#

Return the change in energy when configuration A is changed to configuration B.

It also takes in the vector of indices of atoms changed to recalculate energies changed by those atoms.

inline virtual double get_energy_gradient(
Array<double> const &coords,
Array<double> &grad
)#

compute the energy and gradient.

If not overloaded it will compute the numerical gradient

inline virtual double add_energy_gradient_hessian(
Array<double> const &coords,
Array<double> &grad,
Array<double> &hess
)#

Adds the gradient and hessian of the potential to the arrays.

Parameters:
  • coords –

  • grad –

  • hess –

Returns:

double

inline virtual double add_energy_gradient(
Array<double> const &coords,
Array<double> &grad
)#

Adds the gradient of the potential to the array.

Parameters:
  • coords –

  • grad –

Returns:

double

inline double add_energy_hessian(Array<double> const &coords, Array<double> &hess)#
inline virtual void add_hessian(Array<double> const &coords, Array<double> &hess)#
inline double get_energy_hessian(Array<double> const &coords, Array<double> &hess)#
inline virtual double get_energy_gradient_hessian(
Array<double> const &coords,
Array<double> &grad,
Array<double> &hess
)#

compute the energy and gradient and Hessian.

If not overloaded it will compute the Hessian numerically and use get_energy_gradient to get the energy and gradient.

inline virtual void get_neighbors(
pele::Array<double> const &coords,
pele::Array<std::vector<size_t>> &neighbor_indexes,
pele::Array<std::vector<std::vector<double>>> &neighbor_displacements,
const double cutoff_factor = 1.0
)#

Return lists of neighbors.

inline virtual void get_neighbors_picky(
pele::Array<double> const &coords,
pele::Array<std::vector<size_t>> &neighbor_indexes,
pele::Array<std::vector<std::vector<double>>> &neighbor_displacements,
pele::Array<short> const &include_atoms,
const double cutoff_factor = 1.0
)#

Return lists of neighbors considering only certain atoms.

inline virtual std::vector<size_t> get_overlaps(Array<double> const &coords)#

Return linearized vector of overlapping atoms.

Every two entries in the resulting vector correspond to a pair of overlapping atoms.

inline virtual pele::Array<size_t> get_atom_order(Array<double> &coords)#

Return a computationally sensible order for sorting the atoms.

This is primarily used for better caching when using cell lists. If sorting atoms is not useful, it returns an empty Pele-Array.

inline virtual size_t get_ndim() const#

Return the number of dimensions (box dimensions).

Ideally this should be overloaded.

inline virtual void get_rij(
double *const r_ij,
double const *const r1,
double const *const r2
) const#

Return the distance as measured by the distance policy.

inline virtual double get_interaction_energy_gradient(
double r2,
double *gij,
size_t atom_i,
size_t atom_j
) const#

Return energy_gradient of interaction.

inline virtual double get_interaction_energy_gradient_hessian(
double r2,
double *gij,
double *hij,
size_t atom_i,
size_t atom_j
) const#

Return gradient and Hessian of interaction.

inline virtual double compute_norm(pele::Array<double> const &x)#

compute a meaningful norm of all coordinates

Protected Functions

inline void update_iterator(Array<double> const &coords)#

Protected Static Attributes

static const size_t m_ndim = distance_policy::_ndim#