40 m_cluster_identities.clear();
54 this->add_pair(
p1,
p2);
66 for (
auto const bond : p.bonds()) {
67 if (
bond.partner_ids().size() == 1) {
85 if (!m_pair_criterion) {
90 if (m_pair_criterion->decide(
p1,
p2)) {
95 const int cid = get_next_free_cluster_id();
129void ClusterStructure::merge_clusters() {
163 std::ranges::sort(
cluster->particles);
167int ClusterStructure::find_id_for(
int x)
const {
169 while (m_cluster_identities.contains(
cid)) {
170 cid = m_cluster_identities.at(
cid);
175int ClusterStructure::get_next_free_cluster_id() {
183void ClusterStructure::sanity_checks()
const {
185 throw std::runtime_error(
186 "Cluster analysis is not compatible with non-cuboid box types");
std::map< int, int > cluster_id
Map between particle ids and corresponding cluster ids.
void clear()
Clear data structures.
void run_for_bonded_particles()
Run cluster analysis, consider pairs of particles connected by a bonded interaction.
void run_for_all_pairs()
Run cluster analysis, consider all particle pairs.
bool part_of_cluster(Particle const &p) const
Is particle p part of a cluster.
std::map< int, std::shared_ptr< Cluster > > clusters
Map holding the individual clusters.
Particle cache on the head node.
cudaStream_t stream[1]
CUDA streams for parallel computing on CPU and GPU.
This file contains the errorhandling code for severe errors, like a broken bond or illegal parameter ...
#define runtimeErrorMsg()
void for_each_pair(ForwardIterator first, ForwardIterator last, BinaryOp op)
Execute op for each pair of elements in [first, last) once.
const Particle & get_particle_data(int p_id)
Get particle data.
Particles creation and deletion.
Struct holding all information for one particle.