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.
-
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 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.
Group
Group information.
-
bool is_group_empty() const
Return true if group is defined.
Set the group.
Positions
Positions and properties.
-
Select(const Select &select, const ParticleFactory &particles)
Construct with positions.
-
bool has_positions() const
Return true if select has 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.
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 reset_excluded_and_bond()
Reset excluded and bonded sites.
Euler
Orientation
-
Select random_particle(Random *random)