![]() |
ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
|
Describes a cell structure / cell system. More...
#include <CellStructure.hpp>
Inheritance diagram for CellStructure:
Collaboration diagram for CellStructure:Classes | |
| struct | AoSoA_pack |
Public Types | |
| using | memory_space = Kokkos::HostSpace |
| using | execution_space = Kokkos::DefaultHostExecutionSpace |
| using | ForceType = Kokkos::View< double *[3], Kokkos::LayoutRight, memory_space > |
| using | VirialType = Kokkos::View< double[3], Kokkos::LayoutRight, memory_space > |
| using | ScatterForce = Kokkos::Experimental::ScatterView< double *[3], Kokkos::LayoutRight, memory_space > |
| using | ScatterVirial = Kokkos::Experimental::ScatterView< double[3], Kokkos::LayoutRight, memory_space > |
| using | ListAlgorithm = Cabana::HalfNeighborTag |
| using | ListType = CustomVerletList< memory_space, ListAlgorithm, Cabana::VerletLayout2D, Cabana::TeamVectorOpTag > |
Public Attributes | |
| bool | use_verlet_list = true |
Static Public Attributes | |
| static constexpr auto | vector_length = 1 |
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 156 of file CellStructure.hpp.
| using CellStructure::execution_space = Kokkos::DefaultHostExecutionSpace |
Definition at line 160 of file CellStructure.hpp.
| using CellStructure::ForceType = Kokkos::View<double *[3], Kokkos::LayoutRight, memory_space> |
Definition at line 162 of file CellStructure.hpp.
| using CellStructure::ListAlgorithm = Cabana::HalfNeighborTag |
Definition at line 171 of file CellStructure.hpp.
| using CellStructure::ListType = CustomVerletList<memory_space, ListAlgorithm, Cabana::VerletLayout2D, Cabana::TeamVectorOpTag> |
Definition at line 172 of file CellStructure.hpp.
| using CellStructure::memory_space = Kokkos::HostSpace |
Definition at line 159 of file CellStructure.hpp.
| using CellStructure::ScatterForce = Kokkos::Experimental::ScatterView<double *[3], Kokkos::LayoutRight, memory_space> |
Definition at line 165 of file CellStructure.hpp.
| using CellStructure::ScatterVirial = Kokkos::Experimental::ScatterView<double[3], Kokkos::LayoutRight, memory_space> |
Definition at line 168 of file CellStructure.hpp.
| using CellStructure::VirialType = Kokkos::View<double[3], Kokkos::LayoutRight, memory_space> |
Definition at line 164 of file CellStructure.hpp.
| CellStructure::CellStructure | ( | BoxGeometry const & | box | ) |
Definition at line 326 of file CellStructure.cpp.
|
virtual |
Definition at line 74 of file CellStructure.cpp.
References clear_local_properties().
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 399 of file CellStructure.cpp.
References stream.
Definition at line 445 of file CellStructure.cpp.
References get_id_to_index(), and stream.
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 409 of file CellStructure.cpp.
References decomposition(), ParticleDecomposition::local_cells(), Cells::RESORT_GLOBAL, Cells::RESORT_LOCAL, set_resort_particles(), and stream.
Referenced by Mpiio::mpi_mpiio_common_read(), and CollisionDetection::place_vs_and_relate_to_particle().
|
inline |
Bonded pair loop.
| bond_kernel | Kernel to apply |
Definition at line 847 of file CellStructure.hpp.
References local_particles(), and stream.
Referenced by add_oif_global_forces(), calc_oif_mesh(), and compute_correction_vector().
|
inline |
Definition at line 748 of file CellStructure.hpp.
Definition at line 749 of file CellStructure.hpp.
Definition at line 797 of file CellStructure.hpp.
Referenced by cabana_short_range().
| 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 329 of file CellStructure.cpp.
References get_local_particle(), get_max_local_particle_id(), Particle::id(), local_particles(), and stream.
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 362 of file CellStructure.cpp.
References decomposition(), and ParticleDecomposition::local_cells().
Referenced by resort_particles().
| bool CellStructure::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.
| 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 625 of file CellStructure.cpp.
References Utils::sqr(), and stream.
Referenced by correct_position_shake(), and vs_relative_update_particles().
| void CellStructure::clear_bond_properties | ( | ) |
Definition at line 97 of file CellStructure.cpp.
Referenced by remove_all_particles().
| void CellStructure::clear_local_properties | ( | ) |
Definition at line 80 of file CellStructure.cpp.
Referenced by ~CellStructure().
| void CellStructure::clear_new_bonds | ( | ) |
Definition at line 444 of file CellStructure.cpp.
|
inline |
Clear the particles index.
Definition at line 268 of file CellStructure.hpp.
|
inline |
Set the resort level to sorted.
Definition at line 503 of file CellStructure.hpp.
References Cells::RESORT_NONE.
Referenced by update_ghosts_and_resort_particle().
|
inline |
Definition at line 342 of file CellStructure.hpp.
Referenced by anonymous_namespace{p3m_heffte.impl.hpp}::AssignForces< cao >::operator()(), and set_index_map().
|
inline |
Get the underlying particle decomposition.
Should be used solely for informative purposes.
Definition at line 477 of file CellStructure.hpp.
References stream.
Referenced by add_particle(), check_particle_sorting(), enumerate_local_particles(), for_each_local_particle(), ghost_particles(), ghosts_count(), ghosts_reduce_forces(), ghosts_reduce_rattle_correction(), ghosts_update(), local_particles(), max_cutoff(), max_range(), reduce_over_local_particles(), remove_all_particles(), remove_particle(), and run_on_particle_short_range_neighbors().
|
inline |
Definition at line 326 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 905 of file CellStructure.hpp.
References get_resort_particles(), Particle::is_ghost(), and stream.
Referenced by run_on_particle_short_range_neighbors().
Run a kernel on all ghost particles.
The kernel is assumed to be thread-safe.
Definition at line 373 of file CellStructure.hpp.
References ghost_particles().
Referenced by force_calc_icc(), and ghosts_reset_forces().
Run a kernel on all local particles.
The kernel is assumed to be thread-safe.
Definition at line 358 of file CellStructure.hpp.
References decomposition(), local_particles(), stream, and use_parallel_for_each_local_particle().
Referenced by force_calc_icc(), force_capping(), get_pid_for_vs_com(), integrator_step_1(), integrator_step_2(), reinit_dip_fld(), vs_com_back_transfer_forces_and_torques(), vs_com_update_particles(), vs_relative_back_transfer_forces_and_torques(), and vs_relative_update_particles().
|
inline |
Definition at line 744 of file CellStructure.hpp.
Referenced by anonymous_namespace{p3m_heffte.impl.hpp}::AssignForces< cao >::operator()(), reset_local_properties(), update_aosoa_charges(), and update_cabana_state().
Definition at line 745 of file CellStructure.hpp.
|
inline |
Definition at line 445 of file CellStructure.hpp.
Referenced by cabana_short_range(), rebuild_local_properties(), and update_cabana_state().
|
inline |
Definition at line 732 of file CellStructure.hpp.
Referenced by add_new_bond(), cabana_short_range(), rebuild_local_properties(), and update_cabana_state().
|
inline |
Definition at line 516 of file CellStructure.hpp.
| int CellStructure::get_local_angle_bond_numbers | ( | ) | const |
Definition at line 433 of file CellStructure.cpp.
Referenced by cabana_short_range().
| int CellStructure::get_local_dihedral_bond_numbers | ( | ) | const |
Definition at line 436 of file CellStructure.cpp.
Referenced by cabana_short_range().
|
inline |
Definition at line 733 of file CellStructure.hpp.
Referenced by rebuild_local_properties(), reset_local_force_and_torque(), and reset_local_properties().
| int CellStructure::get_local_pair_bond_numbers | ( | ) | const |
Definition at line 430 of file CellStructure.cpp.
Referenced by cabana_short_range().
Get a local particle by id.
| id | Particle to get. |
Definition at line 301 of file CellStructure.hpp.
References stream.
Referenced by BondBreakage::actions_for_breakage(), check_particle_index(), ScriptInterface::Analysis::check_topology(), GatherParticleTraits< T >::fetch(), get_ibm_particle_position(), get_local_particles(), CollisionDetection::get_part(), ScriptInterface::Particles::get_particles_properties(), ScriptInterface::Particles::get_real_particle(), get_reference_particle(), ScriptInterface::Particles::local_add_exclusion(), ScriptInterface::Particles::local_remove_exclusion(), BondBreakage::execute::operator()(), BondBreakage::execute::operator()(), BondBreakage::execute::operator()(), set_index_map(), ScriptInterface::Particles::set_particles_bonds(), ScriptInterface::Particles::set_particles_charges(), ScriptInterface::Particles::set_particles_exclusions(), ScriptInterface::Particles::set_particles_types(), update_ghosts_and_resort_particle(), vs_com_update_particles(), and vs_relative_pressure_tensor().
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 311 of file CellStructure.hpp.
References stream.
|
inline |
Definition at line 321 of file CellStructure.hpp.
References get_local_particle(), and stream.
Referenced by resolve_bond_partners().
|
inline |
Definition at line 736 of file CellStructure.hpp.
Referenced by rebuild_local_properties(), reset_local_force_and_torque(), and reset_local_properties().
|
inline |
Definition at line 740 of file CellStructure.hpp.
Referenced by reset_local_properties().
|
inline |
Definition at line 725 of file CellStructure.hpp.
| 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 423 of file CellStructure.cpp.
References stream.
Referenced by check_particle_index().
|
inline |
Definition at line 448 of file CellStructure.hpp.
Referenced by rebuild_local_properties().
|
inline |
Get the currently scheduled resort level.
Definition at line 498 of file CellStructure.hpp.
Referenced by cabana_short_range(), and find_current_cell().
|
inline |
Definition at line 734 of file CellStructure.hpp.
Referenced by anonymous_namespace{dp3m_heffte.impl.hpp}::AssignForcesDip< cao >::operator()(), and anonymous_namespace{p3m_heffte.impl.hpp}::AssignForces< cao >::operator()().
|
inline |
Definition at line 737 of file CellStructure.hpp.
Referenced by anonymous_namespace{dp3m_heffte.impl.hpp}::AssignTorques< cao >::operator()().
|
inline |
Definition at line 741 of file CellStructure.hpp.
Definition at line 746 of file CellStructure.hpp.
Referenced by cabana_short_range(), anonymous_namespace{dp3m_heffte.impl.hpp}::AssignTorques< cao >::operator()(), anonymous_namespace{dp3m_heffte.impl.hpp}::AssignForcesDip< cao >::operator()(), rebuild_local_properties(), update_aosoa_charges(), and update_cabana_state().
Definition at line 747 of file CellStructure.hpp.
Referenced by cabana_short_range().
|
inline |
Average number of integration steps the Verlet list was re-used.
Definition at line 589 of file CellStructure.hpp.
|
inline |
Get the Verlet skin.
Definition at line 572 of file CellStructure.hpp.
Referenced by lb_tracers_propagate().
|
inline |
Definition at line 338 of file CellStructure.hpp.
References decomposition(), and Cells::particles().
Referenced by correct_position_shake(), correct_velocity_shake(), for_each_ghost_particle(), lb_tracers_add_particle_force_to_fluid(), set_index_map(), and update_ghosts_and_resort_particle().
| void CellStructure::ghosts_count | ( | ) |
Synchronize number of ghosts.
Definition at line 479 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 and torques from ghost particles to real particles.
Definition at line 487 of file CellStructure.cpp.
References decomposition(), System::Leaf< CellStructure >::get_system(), ghost_communicator(), and GHOSTTRANS_FORCE.
Referenced by vs_com_back_transfer_forces_and_torques(), 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 492 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().
|
inline |
Set forces and torques on all ghosts to zero.
Definition at line 552 of file CellStructure.hpp.
References for_each_ghost_particle(), and Particle::force_and_torque().
Referenced by lb_tracers_add_particle_force_to_fluid(), vs_com_back_transfer_forces_and_torques(), and vs_relative_back_transfer_forces_and_torques().
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 483 of file CellStructure.cpp.
References decomposition(), System::Leaf< CellStructure >::get_system(), ghost_communicator(), map_data_parts(), and stream.
Referenced by correct_position_shake(), correct_velocity_shake(), update_ghosts_and_resort_particle(), vs_com_update_particles(), and vs_relative_update_particles().
|
inline |
Definition at line 753 of file CellStructure.hpp.
Referenced by prepare_verlet_list_cabana(), and rebuild_verlet_list_cabana().
|
inline |
Whether the Verlet skin is set.
Definition at line 569 of file CellStructure.hpp.
Referenced by set_verlet_skin_heuristic().
|
inline |
Definition at line 334 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(), enumerate_local_particles(), for_each_local_particle(), integrator_step_1(), integrator_step_2(), lb_tracers_add_particle_force_to_fluid(), lb_tracers_propagate(), SteepestDescent::propagate(), ScriptInterface::System::rescale_particles(), ScriptInterface::System::rotate_system(), and vs_relative_pressure_tensor().
|
inline |
Maximal cutoff supported by current cell system.
Definition at line 329 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 332 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 856 of file CellStructure.hpp.
References stream.
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 866 of file CellStructure.hpp.
References stream, and use_verlet_list.
Reset local properties of the Verlet list.
| cutoff | Pair interaction cutoff. |
Definition at line 772 of file CellStructure.hpp.
References is_verlet_list_cabana_rebuild_needed(), rebuild_local_properties(), reset_local_properties(), and set_index_map().
Referenced by update_cabana_state().
| void CellStructure::rebuild_bond_list | ( | ) |
Definition at line 449 of file CellStructure.cpp.
Definition at line 134 of file CellStructure.cpp.
References estimate_max_counts(), get_cached_max_local_particle_id(), get_id_to_index(), get_local_force(), get_local_torque(), get_num_local_particles_cached(), System::Leaf< CellStructure >::get_system(), get_unique_particles(), and stream.
Referenced by prepare_verlet_list_cabana().
Definition at line 786 of file CellStructure.hpp.
References is_verlet_list_cabana_rebuild_needed(), and stream.
| 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 452 of file CellStructure.cpp.
References clear_bond_properties(), decomposition(), and ParticleDecomposition::local_cells().
Referenced by Mpiio::mpi_mpiio_common_read().
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 373 of file CellStructure.cpp.
References Utils::contains(), decomposition(), ParticleDecomposition::local_cells(), stream, and update_particle_index().
| void CellStructure::reset_local_force_and_torque | ( | ) |
Definition at line 196 of file CellStructure.cpp.
References get_local_force(), get_local_torque(), and stream.
Referenced by force_calc_icc().
| void CellStructure::reset_local_properties | ( | ) |
Definition at line 208 of file CellStructure.cpp.
References get_aosoa(), get_local_force(), get_local_torque(), get_local_virial(), and stream.
Referenced by prepare_verlet_list_cabana().
Resolve ids to particles.
| BondResolutionError | if one of the ids was not found. |
| partner_ids | Ids to resolve. |
Definition at line 600 of file CellStructure.hpp.
References get_local_particles(), and stream.
Referenced by update_bond_storage().
Resort particles.
Definition at line 512 of file CellStructure.cpp.
References check_particle_index(), check_particle_sorting(), System::Leaf< CellStructure >::get_system(), and stream.
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 924 of file CellStructure.hpp.
References ParticleDecomposition::box(), decomposition(), find_current_cell(), ParticleDecomposition::minimum_image_distance(), and stream.
| void CellStructure::set_atom_decomposition | ( | ) |
Set the particle decomposition to AtomDecomposition.
Definition at line 534 of file CellStructure.cpp.
References comm_cart, System::Leaf< CellStructure >::get_system(), NSQUARE, and stream.
| 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 557 of file CellStructure.cpp.
References comm_cart, System::Leaf< CellStructure >::get_system(), HYBRID, and stream.
| void CellStructure::set_index_map | ( | ) |
Definition at line 260 of file CellStructure.cpp.
References Particle::bonds(), count_local_particles(), enumerate_local_particles(), get_local_particle(), ghost_particles(), Particle::id(), set_local_bond_numbers(), and stream.
Referenced by prepare_verlet_list_cabana().
| void CellStructure::set_kokkos_handle | ( | std::shared_ptr< KokkosHandle > | handle | ) |
Definition at line 99 of file CellStructure.cpp.
References stream.
| void CellStructure::set_regular_decomposition | ( | double | range, |
| std::optional< std::pair< int, int > > | fully_connected_boundary | ||
| ) |
Set the particle decomposition to RegularDecomposition.
| range | Interaction range. |
| fully_connected_boundary | neighbor cell directions for Lees-Edwards. |
Definition at line 545 of file CellStructure.cpp.
References comm_cart, System::Leaf< CellStructure >::get_system(), REGULAR, and stream.
|
inline |
Increase the local resort level at least to level.
Definition at line 490 of file CellStructure.hpp.
References stream.
Referenced by add_particle(), correct_position_shake(), lb_tracers_propagate(), SteepestDescent::propagate(), ScriptInterface::System::rotate_system(), and vs_relative_update_particles().
Set the Verlet skin.
Definition at line 571 of file CellStructure.cpp.
References System::Leaf< CellStructure >::get_system(), and stream.
Referenced by set_verlet_skin_heuristic().
| void CellStructure::set_verlet_skin_heuristic | ( | ) |
Set the Verlet skin using a heuristic.
Definition at line 579 of file CellStructure.cpp.
References System::Leaf< CellStructure >::get_system(), is_verlet_skin_set(), max_cutoff(), max_range(), set_verlet_skin(), and stream.
| void CellStructure::update_bond_storage | ( | int & | pair_count, |
| int & | angle_count, | ||
| int & | dihedral_count, | ||
| Particle const & | p | ||
| ) |
Update bond storage(m_*_bond_list_kokkos and m_*_bond_id_kokkos).
| pair_count | Index for pair bond storage. |
| angle_count | Index for angle bond storage. |
| dihedral_count | Index for dihedral bond storage. |
| p | Particle pointer. |
Definition at line 222 of file CellStructure.cpp.
References bond_resolution_error(), Particle::bonds(), Particle::id(), resolve_bond_partners(), and stream.
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 593 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(), stream, and update_particle_index().
Referenced by correct_position_shake(), lb_tracers_add_particle_force_to_fluid(), and ScriptInterface::System::rotate_system().
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 231 of file CellStructure.hpp.
References Particle::id(), and stream.
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().
Update local particle index.
Update the entry for a particle in the local particle index.
| p | Pointer to the particle. |
Definition at line 250 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 259 of file CellStructure.hpp.
References update_particle_index().
Definition at line 580 of file CellStructure.hpp.
References stream.
|
inline |
whether to use parallel version of for_each_local_particle
Definition at line 351 of file CellStructure.hpp.
Referenced by enumerate_local_particles(), and for_each_local_particle().
Definition at line 220 of file CellStructure.hpp.
Referenced by cabana_short_range(), and non_bonded_loop().
Definition at line 158 of file CellStructure.hpp.