Select

class Select

Select a subset of particles and sites by storing their respective indices. For optimization, all input lists of indices are assumed to be sorted.

Checks

Consistency checks and tests.

void check() const

Check the size of member vectors.

bool is_equal(const Select &select) const

Return true if the selections are equivalent.

Select random_particle(Random *random)

Return the selection of a particle chosen randomly from current selection.

std::string str(const bool pos = false) const

Print the selection.

Indices

Add, remove or access the indices of sites and particles.

bool is_empty() const

Return true if nothing is selected.

void clear()

Clear the selection.

virtual void add_site(const int particle_index, const int site_index)

Add site by index.

void set_site(const int particle_index, const int site_index, const int index)

Set site by index.

void set_particle(const int particle_index, const int index)

Set particle by index.

void add_sites(const int particle_index, const std::vector<int> site_indices)

Add sites by index.

void remove_sites(const int particle_index, const std::vector<int> site_indices)

Remove sites by configuration-based particle and site index.

void add_particle(const int particle_index, std::vector<int> site_indices, const bool prevent_duplicate = false)

Add particle index and site indices of that particle.

param prevent_duplicate:

optionally prevent duplicates (slower)

void add_particle(const Particle &particle, const int particle_index, const bool prevent_duplicate = false)

Same as above, but use Particle to get site_indices.

int num_particles() const

Return number of selected particles.

int num_sites(const int particle_index = -1) const

Return number of selected sites.

param particle_index:

Return numbers of sites in particle. If -1 (default), in all particles.

void add(const Select &select)

Add input selection to current.

void remove(const Select &select)

Remove input selection from current.

void remove_last_particle()

Remove the last particle.

virtual void remove_last_site()

Remove the last site.

void remove_last_sites(const int num)

Remove the last num sites.

virtual void remove_first_site()

Remove the first site.

void remove_first_sites(const int num)

Remove the first num sites.

void remove_particle(const int particle_index)

Remove particle by index.

const std::vector<int> &particle_indices() const

Return the particle indices.

const std::vector<std::vector<int>> &site_indices() const

Return the site indices.

const std::vector<int> &site_indices(const int particle_index) const

Return the site indices of particle Note that particle_index is the index of selection, not particle index from configuration.

bool replace_indices(const int particle_index, const std::vector<int> &site_indices)

Replace current indices with those given. Return true if replace is done quickly due to match in existing size.

bool is_overlap(const Select &select) const

Return true if the selection contains a particle in self.

Group

Group information.

bool is_group_empty() const

Return true if group is defined.

void set_group(std::shared_ptr<Group> group)

Set the group.

const Group &group() const

Return the group.

Positions

Positions and properties.

Select(const Select &select, const ParticleFactory &particles)

Construct with positions.

Select(const int particle_index, const Particle &particle)

Construct with positions.

bool has_positions() const

Return true if select has positions.

const std::vector<std::vector<Position>> &site_positions() const

Return the site positions.

const std::vector<std::vector<Properties>> &site_properties() const

Return the site positions.

void set_site_position(const int particle_index, const int site_index, const Position &position)

Set the position of a site by particle and site index. Note that these indices are based on selection, not configuration.

void set_site_position(const int particle_index, const int site_index, const std::vector<double> coord)

Same as above except vector position is accepted.

void add_to_site_position(const int particle_index, const int site_index, const Position &position)

Add to the position of a site by particle and site index. Note that these indices are based on selection, not configuration.

void set_site_properties(const int particle_index, const int site_index, const Properties &properties)

Set the property of a site by particle and site index. Note that these indices are based on selection, not configuration.

void load_position(const int pindex, const Particle &particle)

Load the positions of a particle with existing selection indices.

void load_positions(const ParticleFactory &particles)

Load the positions from the existing selection indices.

void load_positions_of_last(const Particle &particle, const Position &frame_of_reference)

Load the positions and properties of the last particle added.

param frame_of_reference:

shift the positions by the frame of reference

Position geometric_center(const int particle_index = -1) const

Return the geometric center of the selection.

param particle_index:

Consider only one particle, or all particles (-1).

Trials

Advanced trial information: state, exclude, include.

int trial_state() const

Possible states: 0 -> old -> configuration unchanged from previously accepted state 1 -> move -> moved selected particles but total numbers unchanged 2 -> remove -> remove existing particles/sites listed in selection 3 -> add -> added new particles/sites listed in selection 4 -> volume -> change volume and scale all particles. New only.

void set_trial_state(const int state = -1)

Set the trial state.

void exclude(const Select &select)

Excluded site list.

const std::shared_ptr<Select> excluded() const

Return excluded list.

void set_new_bond(const Select &select)

Sites to become bonded.

const Select *new_bond() const

Return sites to become bonded.

void set_old_bond(const Select &select)

Sites which are bonded.

const Select *old_bond() const

Return sites which are bonded.

void reset_excluded_and_bond()

Reset excluded and bonded sites.

Euler

Orientation