TrialSelect

class TrialSelect

Select the mobile particles and sites that are to be perturbed via trials. Store the original position in mobile_original for reverting. Also store the ‘anchor’ particles and sites which are not mobile but may be required to complete the perturbation (e.g., bonds).

Subclassed by feasst::SelectCluster, feasst::SelectNothing, feasst::SelectParticleAVB, feasst::SelectParticleAVBDivalent, feasst::SelectPerturbed, feasst::SelectSiteOfType, feasst::TrialSelectBond, feasst::TrialSelectParticle

Public Functions

TrialSelect(const argtype &args = argtype())

args:

  • group_index: index of group definied within system (default: 0).

  • particle_type: type of particle in configuration (default: -1)

int group_index() const

Return the index of group for selection.

int particle_type() const

Return the particle type.

void before_select()

Perform upkeep before select.

virtual bool select(const Select &perturbed, System *system, Random *random)

Parameters
  • perturbed: Perturbed is included to allow chaining of selection based on previous.

Perform the selection as implemented in the derived class. Return false if the selection cannot be made. Otherwise, return true.

bool sel(System *system, Random *random)

Same as above but with an empty perturbed.

virtual void precompute(System *system)

Precompute quantities before simulation for optimization.

const Select &mobile() const

Return the mobile selection. These can change during the trial.

void set_mobile(const Select &mobile)

Set the mobile selection.

const Select &mobile_original() const

Return originally-seleted mobile. These do not change during trial.

const Select &anchor() const

Return the anchor selection.

const Position &anchor_position(const int particle_index, const int site_index, const System &system)

Return anchor position.

Parameters
  • particle_index: anchor index, not configuration index

  • site_index: anchor index

void set_trial_state(const int state)

Set the state of the trial for the mobile select (e.g., old, move, add). See Select::trial_state

void reset_mobile()

Reset the mobile selection to the original.

double probability() const

Return the probability of the selection. For example, if a random particle type is selected, then the probability is the inverse of the number of particles of that type.

void set_probability(const double prob = 1)

Set the probability of selection.

virtual void mid_stage()

Call after old configuration but before new.

void set_ghost(const bool ghost = true)

Select from ghost particles.

bool is_ghost() const

Return true if selecting from ghost particles.

const std::map<std::string, Accumulator> &printable() const

Return printable properties.

virtual bool are_constraints_satisfied(const System &system) const

Return true if constraints are satisfied.

bool is_particle_type_set() const

Return true if particle type is set.

void remove_unphysical_sites(const Configuration &config)

Remove unphysical sites from mobile.

void replace_mobile(const Select &replacement, const int sel_part_index, const Configuration &config)

Fast replace of a single particle in mobile.

double property(const std::string name) const

Return the property value by name.

bool has_property(const std::string name) const

Return true if entity has property of name.

void add_or_set_property(const std::string name, const double value)

Add a property, or set its value if name already exists.