ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
|
Describes a cell structure / cell system. More...
#include <CellStructure.hpp>
Public Member Functions | |
CellStructure (BoxGeometry const &box) | |
void | update_particle_index (int id, Particle *p) |
Update local particle index. | |
void | update_particle_index (Particle &p) |
Update local particle index. | |
void | update_particle_index (ParticleList &pl) |
Update local particle index. | |
void | clear_particle_index () |
Clear the particles index. | |
Particle * | get_local_particle (int id) |
Get a local particle by id. | |
const Particle * | get_local_particle (int id) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
template<class InputRange , class OutputIterator > | |
void | get_local_particles (InputRange ids, OutputIterator out) |
CellStructureType | decomposition_type () const |
Utils::Vector3d | max_cutoff () const |
Maximal cutoff supported by current cell system. | |
Utils::Vector3d | max_range () const |
Maximal pair range supported by current cell system. | |
ParticleRange | local_particles () const |
ParticleRange | ghost_particles () const |
Particle * | add_particle (Particle &&p) |
Add a particle. | |
Particle * | add_local_particle (Particle &&p) |
Add a particle. | |
void | remove_particle (int id) |
Remove a particle. | |
int | get_max_local_particle_id () const |
Get the maximal particle id on this node. | |
void | remove_all_particles () |
Remove all particles from the cell system. | |
ParticleDecomposition const & | decomposition () const |
Get the underlying particle decomposition. | |
void | set_resort_particles (Cells::Resort level) |
Increase the local resort level at least to level . | |
unsigned | get_resort_particles () const |
Get the currently scheduled resort level. | |
void | clear_resort_particles () |
Set the resort level to sorted. | |
bool | check_resort_required (Utils::Vector3d const &additional_offset={}) const |
Check whether a particle has moved further than half the skin since the last Verlet list update, thus requiring a resort. | |
auto | get_le_pos_offset_at_last_resort () const |
void | ghosts_count () |
Synchronize number of ghosts. | |
void | ghosts_update (unsigned data_parts) |
Update ghost particles. | |
void | update_ghosts_and_resort_particle (unsigned data_parts) |
Update ghost particles, with particle resort if needed. | |
void | ghosts_reduce_forces () |
Add forces from ghost particles to real particles. | |
void | ghosts_reduce_rattle_correction () |
Add rattle corrections from ghost particles to real particles. | |
void | resort_particles (bool global_flag) |
Resort particles. | |
auto | is_verlet_skin_set () const |
Whether the Verlet skin is set. | |
auto | get_verlet_skin () const |
Get the Verlet skin. | |
void | set_verlet_skin (double value) |
Set the Verlet skin. | |
void | set_verlet_skin_heuristic () |
Set the Verlet skin using a heuristic. | |
void | update_verlet_stats (int n_steps, int n_verlet_updates) |
auto | get_verlet_reuse () const |
Average number of integration steps the Verlet list was re-used. | |
void | set_atom_decomposition () |
Set the particle decomposition to AtomDecomposition. | |
void | set_regular_decomposition (double range) |
Set the particle decomposition to RegularDecomposition. | |
void | set_hybrid_decomposition (double cutoff_regular, std::set< int > n_square_types) |
Set the particle decomposition to HybridDecomposition. | |
template<class BondKernel > | |
void | bond_loop (BondKernel const &bond_kernel) |
Bonded pair loop. | |
template<class PairKernel > | |
void | non_bonded_loop (PairKernel pair_kernel) |
Non-bonded pair loop. | |
template<class PairKernel , class VerletCriterion > | |
void | non_bonded_loop (PairKernel pair_kernel, const VerletCriterion &verlet_criterion) |
Non-bonded pair loop with potential use of verlet lists. | |
void | check_particle_index () const |
Check that particle index is commensurate with particles. | |
void | check_particle_sorting () const |
Check that particles are in the correct cell. | |
Cell * | find_current_cell (const Particle &p) |
Find cell a particle is stored in. | |
template<class Kernel > | |
bool | run_on_particle_short_range_neighbors (Particle const &p, Kernel &kernel) |
Run kernel on all particles inside local cell and its neighbors. | |
Public Member Functions inherited from System::Leaf< CellStructure > | |
void | bind_system (std::shared_ptr< System > const &system) |
void | detach_system (std::shared_ptr< System > const &system) |
Public Attributes | |
bool | use_verlet_list = true |
Additional Inherited Members | |
Protected Member Functions inherited from System::Leaf< CellStructure > | |
auto & | get_system () |
auto & | get_system () const |
Protected Attributes inherited from System::Leaf< CellStructure > | |
std::weak_ptr< System > | m_system |
Describes a cell structure / cell system.
Contains information about the communication of cell contents (particles, ghosts, ...) between different nodes and the relation between particle positions and the cell system. All other properties of the cell system which are not common between different cell systems have to be stored in separate structures.
Definition at line 133 of file CellStructure.hpp.
CellStructure::CellStructure | ( | BoxGeometry const & | box | ) |
Definition at line 54 of file CellStructure.cpp.
Add a particle.
Moves a particle into the cell system, if it belongs to this node. Otherwise this does not have an effect and the particle is discarded. This can be used to add a particle without knowledge where it should be placed by calling the function on all nodes, it will then add the particle in exactly one place.
p | Particle to add. |
Definition at line 128 of file CellStructure.cpp.
Add a particle.
Moves a particle into the cell system. This adds a particle to the local node, irrespective of where it belongs.
p | Particle to add. |
Definition at line 139 of file CellStructure.cpp.
References decomposition(), ParticleDecomposition::local_cells(), Cells::RESORT_GLOBAL, Cells::RESORT_LOCAL, and set_resort_particles().
Referenced by place_vs_and_relate_to_particle().
|
inline |
Bonded pair loop.
bond_kernel | Kernel to apply |
Definition at line 651 of file CellStructure.hpp.
References local_particles().
Referenced by add_oif_global_forces(), calc_oif_global(), and compute_correction_vector().
void CellStructure::check_particle_index | ( | ) | const |
Check that particle index is commensurate with particles.
For each local particles is checked that has a correct entry in the particles index, and that there are no excess (non-existing) particles in the index.
Definition at line 57 of file CellStructure.cpp.
References get_local_particle(), get_max_local_particle_id(), Particle::id(), local_particles(), and u.
Referenced by resort_particles().
void CellStructure::check_particle_sorting | ( | ) | const |
Check that particles are in the correct cell.
This checks for all local particles that the result of particles_to_cell is the cell the particles is actually in, e.g. that the particles are sorted according to particles_to_cell.
Definition at line 90 of file CellStructure.cpp.
References decomposition(), and ParticleDecomposition::local_cells().
Referenced by resort_particles().
|
inline |
Check whether a particle has moved further than half the skin since the last Verlet list update, thus requiring a resort.
additional_offset | Offset which is added to the distance the particle has travelled when comparing to half the Verlet skin (e.g., for Lees-Edwards BC). |
Definition at line 393 of file CellStructure.hpp.
Referenced by correct_position_shake(), and vs_relative_update_particles().
|
inline |
Clear the particles index.
Definition at line 203 of file CellStructure.hpp.
|
inline |
Set the resort level to sorted.
Definition at line 382 of file CellStructure.hpp.
References Cells::RESORT_NONE.
Referenced by update_ghosts_and_resort_particle().
|
inline |
Get the underlying particle decomposition.
Should be used solely for informative purposes.
Definition at line 356 of file CellStructure.hpp.
Referenced by add_particle(), check_particle_sorting(), ghost_particles(), ghosts_count(), ghosts_reduce_forces(), ghosts_reduce_rattle_correction(), ghosts_update(), local_particles(), max_cutoff(), max_range(), remove_all_particles(), remove_particle(), and run_on_particle_short_range_neighbors().
|
inline |
Definition at line 261 of file CellStructure.hpp.
Find cell a particle is stored in.
For local particles, this returns the cell they are stored in, otherwise nullptr is returned.
p | Particle to find cell for |
Definition at line 709 of file CellStructure.hpp.
References get_resort_particles(), and Particle::is_ghost().
Referenced by run_on_particle_short_range_neighbors(), and three_particle_binding_domain_decomposition().
|
inline |
Definition at line 402 of file CellStructure.hpp.
|
inline |
Get a local particle by id.
id | Particle to get. |
Definition at line 236 of file CellStructure.hpp.
Referenced by BondBreakage::actions_for_breakage(), bind_at_poc_create_bond_between_vs(), check_particle_index(), ScriptInterface::Analysis::check_topology(), GatherParticleTraits< T >::fetch(), get_local_particles(), anonymous_namespace{collision.cpp}::get_part(), get_reference_particle(), handle_collisions(), BondBreakage::execute::operator()(), BondBreakage::execute::operator()(), BondBreakage::execute::operator()(), three_particle_binding_domain_decomposition(), update_ghosts_and_resort_particle(), and vs_relative_pressure_tensor().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 246 of file CellStructure.hpp.
|
inline |
Definition at line 256 of file CellStructure.hpp.
References get_local_particle().
int CellStructure::get_max_local_particle_id | ( | ) | const |
Get the maximal particle id on this node.
This returns the highest particle id on this node, or -1 if there are no particles on this node.
Definition at line 153 of file CellStructure.cpp.
Referenced by check_particle_index(), and handle_collisions().
|
inline |
Get the currently scheduled resort level.
Definition at line 377 of file CellStructure.hpp.
Referenced by find_current_cell().
|
inline |
Average number of integration steps the Verlet list was re-used.
Definition at line 470 of file CellStructure.hpp.
|
inline |
Get the Verlet skin.
Definition at line 453 of file CellStructure.hpp.
Referenced by lb_tracers_propagate().
|
inline |
Definition at line 273 of file CellStructure.hpp.
References decomposition(), and Cells::particles().
Referenced by correct_position_shake(), correct_velocity_shake(), lb_tracers_add_particle_force_to_fluid(), update_ghosts_and_resort_particle(), and vs_relative_back_transfer_forces_and_torques().
void CellStructure::ghosts_count | ( | ) |
Synchronize number of ghosts.
Definition at line 186 of file CellStructure.cpp.
References decomposition(), System::Leaf< CellStructure >::get_system(), ghost_communicator(), and GHOSTTRANS_PARTNUM.
Referenced by update_ghosts_and_resort_particle().
void CellStructure::ghosts_reduce_forces | ( | ) |
Add forces from ghost particles to real particles.
Definition at line 194 of file CellStructure.cpp.
References decomposition(), System::Leaf< CellStructure >::get_system(), ghost_communicator(), and GHOSTTRANS_FORCE.
Referenced by ICCStar::iteration(), and vs_relative_back_transfer_forces_and_torques().
void CellStructure::ghosts_reduce_rattle_correction | ( | ) |
Add rattle corrections from ghost particles to real particles.
Definition at line 199 of file CellStructure.cpp.
References decomposition(), System::Leaf< CellStructure >::get_system(), ghost_communicator(), and GHOSTTRANS_RATTLE.
Referenced by correct_position_shake(), and correct_velocity_shake().
void CellStructure::ghosts_update | ( | unsigned | data_parts | ) |
Update ghost particles.
Update ghost particles with data from the real particles.
data_parts | Particle parts to update, combination of Cells::DataPart |
Definition at line 190 of file CellStructure.cpp.
References decomposition(), System::Leaf< CellStructure >::get_system(), ghost_communicator(), and map_data_parts().
Referenced by correct_position_shake(), correct_velocity_shake(), ICCStar::iteration(), update_ghosts_and_resort_particle(), and vs_relative_update_particles().
|
inline |
Whether the Verlet skin is set.
Definition at line 450 of file CellStructure.hpp.
Referenced by set_verlet_skin_heuristic().
|
inline |
Definition at line 269 of file CellStructure.hpp.
References decomposition(), and Cells::particles().
Referenced by bond_loop(), calc_total_charge(), check_particle_index(), correct_position_shake(), correct_velocity_shake(), is_valid_position(), lb_tracers_add_particle_force_to_fluid(), lb_tracers_propagate(), ScriptInterface::System::rescale_particles(), ScriptInterface::System::rotate_system(), vs_relative_back_transfer_forces_and_torques(), vs_relative_pressure_tensor(), and vs_relative_update_particles().
|
inline |
Maximal cutoff supported by current cell system.
Definition at line 264 of file CellStructure.hpp.
References decomposition(), and ParticleDecomposition::max_cutoff().
Referenced by set_verlet_skin_heuristic().
|
inline |
Maximal pair range supported by current cell system.
Definition at line 267 of file CellStructure.hpp.
References decomposition(), and ParticleDecomposition::max_range().
Referenced by set_verlet_skin_heuristic().
|
inline |
Non-bonded pair loop.
pair_kernel | Kernel to apply |
Definition at line 660 of file CellStructure.hpp.
Referenced by force_calc_icc().
|
inline |
Non-bonded pair loop with potential use of verlet lists.
pair_kernel | Kernel to apply |
verlet_criterion | Filter for verlet lists. |
Definition at line 670 of file CellStructure.hpp.
References use_verlet_list.
void CellStructure::remove_all_particles | ( | ) |
Remove all particles from the cell system.
This allows linear time removal of all particles from the system, removing each particle individually would be quadratic.
Definition at line 160 of file CellStructure.cpp.
References decomposition(), and ParticleDecomposition::local_cells().
void CellStructure::remove_particle | ( | int | id | ) |
Remove a particle.
Removes a particle and all bonds pointing to it. This is a collective call.
id | Id of particle to remove. |
Definition at line 101 of file CellStructure.cpp.
References Utils::contains(), decomposition(), ParticleDecomposition::local_cells(), and update_particle_index().
void CellStructure::resort_particles | ( | bool | global_flag | ) |
Resort particles.
Definition at line 219 of file CellStructure.cpp.
References check_particle_index(), check_particle_sorting(), and System::Leaf< CellStructure >::get_system().
Referenced by update_ghosts_and_resort_particle().
|
inline |
Run kernel on all particles inside local cell and its neighbors.
p | Particle to find cell for |
kernel | Function with signature double(Particle const&,
Particle const&, Utils::Vector3d const&) |
Definition at line 728 of file CellStructure.hpp.
References ParticleDecomposition::box(), decomposition(), find_current_cell(), and ParticleDecomposition::minimum_image_distance().
void CellStructure::set_atom_decomposition | ( | ) |
Set the particle decomposition to AtomDecomposition.
Definition at line 241 of file CellStructure.cpp.
References comm_cart, System::Leaf< CellStructure >::get_system(), and NSQUARE.
void CellStructure::set_hybrid_decomposition | ( | double | cutoff_regular, |
std::set< int > | n_square_types | ||
) |
Set the particle decomposition to HybridDecomposition.
cutoff_regular | Interaction cutoff_regular. |
n_square_types | Particle types to put into n_square decomposition. |
Definition at line 263 of file CellStructure.cpp.
References comm_cart, System::Leaf< CellStructure >::get_system(), and HYBRID.
void CellStructure::set_regular_decomposition | ( | double | range | ) |
Set the particle decomposition to RegularDecomposition.
range | Interaction range. |
Definition at line 252 of file CellStructure.cpp.
References comm_cart, System::Leaf< CellStructure >::get_system(), and REGULAR.
|
inline |
Increase the local resort level at least to level
.
Definition at line 369 of file CellStructure.hpp.
Referenced by add_particle(), correct_position_shake(), handle_collisions(), lb_tracers_propagate(), ScriptInterface::System::rotate_system(), and vs_relative_update_particles().
void CellStructure::set_verlet_skin | ( | double | value | ) |
Set the Verlet skin.
Definition at line 277 of file CellStructure.cpp.
References System::Leaf< CellStructure >::get_system().
Referenced by set_verlet_skin_heuristic().
void CellStructure::set_verlet_skin_heuristic | ( | ) |
Set the Verlet skin using a heuristic.
Definition at line 284 of file CellStructure.cpp.
References System::Leaf< CellStructure >::get_system(), is_verlet_skin_set(), max_cutoff(), max_range(), and set_verlet_skin().
void CellStructure::update_ghosts_and_resort_particle | ( | unsigned | data_parts | ) |
Update ghost particles, with particle resort if needed.
Update ghost particles with data from the real particles. Resort particles if a resort is due.
data_parts | Particle parts to update, combination of Cells::DataPart |
Definition at line 298 of file CellStructure.cpp.
References clear_resort_particles(), comm_cart, Cells::DATA_PART_BONDS, Cells::DATA_PART_PROPERTIES, get_local_particle(), ghost_particles(), ghosts_count(), ghosts_update(), Cells::RESORT_GLOBAL, Cells::RESORT_NONE, resort_particles(), and update_particle_index().
Referenced by correct_position_shake(), handle_collisions(), lb_tracers_add_particle_force_to_fluid(), and ScriptInterface::System::rotate_system().
|
inline |
Update local particle index.
Update the entry for a particle in the local particle index.
id | Entry to update. |
p | Pointer to the particle. |
Definition at line 166 of file CellStructure.hpp.
References Particle::id().
Referenced by anonymous_namespace{CellStructure.cpp}::UpdateParticleIndexVisitor::operator()(), anonymous_namespace{CellStructure.cpp}::UpdateParticleIndexVisitor::operator()(), remove_particle(), update_ghosts_and_resort_particle(), update_particle_index(), and update_particle_index().
|
inline |
Update local particle index.
Update the entry for a particle in the local particle index.
p | Pointer to the particle. |
Definition at line 185 of file CellStructure.hpp.
References Particle::id(), and update_particle_index().
|
inline |
Update local particle index.
pl | List of particles whose index entries should be updated. |
Definition at line 194 of file CellStructure.hpp.
References update_particle_index().
|
inline |
Definition at line 461 of file CellStructure.hpp.
bool CellStructure::use_verlet_list = true |
Definition at line 155 of file CellStructure.hpp.
Referenced by non_bonded_loop().