EnergyMapNeighbor

class EnergyMapNeighbor : public feasst::EnergyMap

Map only between particles that interact (e.g., non zero energy). This data structure is intended to better scale with more particles than EnergyMapAll. Although for small system sizes or large cutoffs, EnergyMapAll may be faster because it does not require sorting.

This implementation also stores two versions of the map. The first version is the current map. The second version is an empty new map. Upon perturbation, the empty new map is populated with interactions. When a perturbation is accepted, finalize replaces interactions in current map with those in the new map. The new map is then emptied. When a perturbation is rejected, revert empties the new map.

Subclassed by feasst::EnergyMapNeighborCriteria

Public Functions

double energy(const int part1_index, const int site1_index) const

Return the interaction energy of given site.

double update(const double energy, const int part1_index, const int site1_index, const int site1_type, const int part2_index, const int site2_index, const int site2_type, const double squared_distance, const Position *pbc, const Configuration &config)

Update the interaction.

void revert(const Select &select)

Revert any changes from perturbation of selection.

void finalize(const Select &select)

Finalize any changes from perturbation of selection.

double total_energy() const

Return the total energy.

void select_cluster(const NeighborCriteria &cluster_criteria, const Configuration &config, const int particle_node, Select *cluster, const Position &frame_of_reference) const

Add neighboring particles to selection which interact with node based on an energy less than or equal to the tolerance. The cluster also has positions taking into account periodic boundary conditions, which is why frame of reference is used recurisvely.

bool is_cluster_changed(const NeighborCriteria &cluster_criteria, const Select &select, const Configuration &config) const

Compare old and new maps to see if cluster has changed. This is useful for detailed balance with rigid cluster moves.

void neighbors(const NeighborCriteria &neighbor_criteria, const Configuration &config, const int target_particle, const int target_site, const int given_site_index, Select *neighbors, const int new_map = 0) const

Return the neighbors of target particle and site that are of given site index.

param neighbors:

Return of the neighbors

param new_map:

If 1, use newly computed map.

void clear(const int part1_index, const int site1_index, const int part2_index, const int site2_index)

Clear interaction does nothing, because new map begins empty.