54 auto const box_geo_handle = get_box_geo();
55 auto const &box_geo = *box_geo_handle;
62 auto const reference_position =
64 double total_mass = 0.;
65 for (
int pid : particle_ids) {
66 auto const folded_pos =
68 auto const dist_to_reference =
69 box_geo.get_mi_vector(folded_pos, reference_position);
78 com += reference_position;
81 return box_geo.folded_position(com);
129 std::vector<std::size_t> idx(v.size());
130 std::iota(idx.begin(), idx.end(), 0);
133 std::sort(idx.begin(), idx.end(),
134 [&v](std::size_t i1, std::size_t i2) { return v[i1] < v[i2]; });
141 auto const box_geo_handle = get_box_geo();
142 auto const &box_geo = *box_geo_handle;
149 std::vector<double> distances;
162 std::vector<int> subcluster_ids;
164 std::vector<double> log_pcounts;
165 std::vector<double> log_diameters;
166 double last_dist = 0;
167 for (
auto const idx : particle_indices) {
168 subcluster_ids.push_back(
particles[idx]);
169 if (distances[idx] < last_dist + dr)
172 last_dist = distances[idx];
173 if (subcluster_ids.size() == 1)
176 log_pcounts.push_back(log(
static_cast<double>(subcluster_ids.size())));
177 log_diameters.push_back(log(current_rg * 2.0));
179 double c0, c1, cov00, cov01, cov11, sumsq;
180 gsl_fit_linear(log_diameters.data(), 1, log_pcounts.data(), 1,
181 log_pcounts.size(), &c0, &c1, &cov00, &cov01, &cov11, &sumsq);
182 double mean_sq_residual = sumsq /
static_cast<double>(log_diameters.size());
183 return {c1, mean_sq_residual};
185 runtimeErrorMsg() <<
"GSL (gnu scientific library) is required for fractal "
186 "dimension calculation.";