116 if (
name ==
"linear_momentum") {
118 get_system(), get_value_or<bool>(parameters,
"include_particles",
true),
119 get_value_or<bool>(parameters,
"include_lbfluid",
true));
122 if (
name ==
"particle_energy") {
124 auto const pid = get_value<int>(parameters,
"pid");
125 auto const local = system.particle_short_range_energy_contribution(pid);
128#ifdef DIPOLE_FIELD_TRACKING
129 if (
name ==
"calc_long_range_fields") {
134 if (
name ==
"particle_neighbor_pids") {
136 system.on_observable_calc();
137 std::unordered_map<int, std::vector<int>> dict;
141 std::for_each(neighbor_pids.begin(), neighbor_pids.end(),
143 dict[neighbor_pid.pid] = neighbor_pid.neighbor_pids;
149 if (
name ==
"dpd_stress") {
151 return result.as_vector();
154 if (
name ==
"min_dist") {
155 auto const p_types1 = get_value<std::vector<int>>(parameters,
"p_types1");
156 auto const p_types2 = get_value<std::vector<int>>(parameters,
"p_types2");
157 for (
auto const p_type : p_types1) {
160 for (
auto const p_type : p_types2) {
165 if (
name ==
"center_of_mass") {
166 auto const p_type = get_value<int>(parameters,
"p_type");
171 if (
name ==
"angular_momentum") {
172 auto const p_type = get_value<int>(parameters,
"p_type");
177 if (
name ==
"nbhood") {
178 auto const pos = get_value<Utils::Vector3d>(parameters,
"pos");
179 auto const radius = get_value<double>(parameters,
"r_catch");
183 if (
name ==
"calc_re") {
185 auto const chain_start = get_value<int>(parameters,
"chain_start");
186 auto const chain_length = get_value<int>(parameters,
"chain_length");
187 auto const n_chains = get_value<int>(parameters,
"number_of_chains");
188 check_topology(*system.cell_structure, chain_start, chain_length, n_chains);
189 auto const result =
calc_re(system, chain_start, chain_length, n_chains);
190 return std::vector<double>(result.begin(), result.end());
192 if (
name ==
"calc_rg") {
194 auto const chain_start = get_value<int>(parameters,
"chain_start");
195 auto const chain_length = get_value<int>(parameters,
"chain_length");
196 auto const n_chains = get_value<int>(parameters,
"number_of_chains");
197 check_topology(*system.cell_structure, chain_start, chain_length, n_chains);
200 auto const result =
calc_rg(system, chain_start, chain_length, n_chains);
201 output =
Variant{std::vector<double>(result.begin(), result.end())};
205 if (
name ==
"calc_rh") {
207 auto const chain_start = get_value<int>(parameters,
"chain_start");
208 auto const chain_length = get_value<int>(parameters,
"chain_length");
209 auto const n_chains = get_value<int>(parameters,
"number_of_chains");
210 check_topology(*system.cell_structure, chain_start, chain_length, n_chains);
211 auto const result =
calc_rh(system, chain_start, chain_length, n_chains);
212 return std::vector<double>(result.begin(), result.end());
214 if (
name ==
"gyration_tensor") {
215 auto const p_types = get_value<std::vector<int>>(parameters,
"p_types");
216 for (
auto const p_type : p_types) {
220 return std::vector<double>(mat.begin(), mat.end());
222 if (
name ==
"moment_of_inertia_matrix") {
223 auto const p_type = get_value<int>(parameters,
"p_type");
228 if (
name ==
"structure_factor") {
229 auto const order = get_value<int>(parameters,
"sf_order");
230 auto const p_types = get_value<std::vector<int>>(parameters,
"sf_types");
233 throw std::domain_error(
"order has to be a strictly positive number");
235 for (
auto const p_type : p_types) {
241 if (
name ==
"distribution") {
242 auto const &box_l =
get_system().box_geo->length();
243 auto const r_max_limit =
244 0.5 * std::min(std::min(box_l[0], box_l[1]), box_l[2]);
245 auto const r_min = get_value_or<double>(parameters,
"r_min", 0.);
246 auto const r_max = get_value_or<double>(parameters,
"r_max", r_max_limit);
247 auto const r_bins = get_value_or<int>(parameters,
"r_bins", 100);
248 auto const log_flag = get_value_or<bool>(parameters,
"log_flag",
false);
249 auto const int_flag = get_value_or<bool>(parameters,
"int_flag",
false);
251 if (log_flag and r_min <= 0.) {
252 throw std::domain_error(
"Parameter 'r_min' must be > 0");
255 throw std::domain_error(
"Parameter 'r_min' must be >= 0");
257 if (r_min >= r_max) {
258 throw std::domain_error(
"Parameter 'r_max' must be > 'r_min'");
260 if (r_max > r_max_limit) {
261 throw std::domain_error(
"Parameter 'r_max' must be <= box_l / 2");
264 throw std::domain_error(
"Parameter 'r_bins' must be >= 1");
267 auto const p_types1 =
268 get_value<std::vector<int>>(parameters,
"type_list_a");
269 auto const p_types2 =
270 get_value<std::vector<int>>(parameters,
"type_list_b");
271 for (
auto const p_type : p_types1) {
274 for (
auto const p_type : p_types2) {
279 r_bins, log_flag, int_flag));
281 if (
name ==
"calculate_energy") {
282 return m_obs_stat->do_call_method(
"calculate_energy", {});
284 if (
name ==
"calculate_scalar_pressure") {
285 return m_obs_stat->do_call_method(
"calculate_scalar_pressure", {});
287 if (
name ==
"calculate_pressure_tensor") {
288 return m_obs_stat->do_call_method(
"calculate_pressure_tensor", {});