ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
core/observables/CylindricalLBProfileObservable.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010-2022 The ESPResSo project
3 *
4 * This file is part of ESPResSo.
5 *
6 * ESPResSo is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * ESPResSo is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
23
24#include "SanityChecksLB.hpp"
25
26#include <utils/Vector.hpp>
29#include <utils/sampling.hpp>
30
31#include <limits>
32#include <memory>
33#include <utility>
34#include <vector>
35
36namespace Observables {
37
39public:
41 std::shared_ptr<Utils::CylindricalTransformationParameters>
43 int n_r_bins, int n_phi_bins, int n_z_bins, double min_r, double max_r,
44 double min_phi, double max_phi, double min_z, double max_z,
45 double sampling_density)
47 n_phi_bins, n_z_bins, min_r, max_r,
50
52
53protected:
55 mutable std::vector<Utils::Vector3d> sampling_positions;
56 mutable std::vector<Utils::Vector3d> sampling_positions_cyl;
57 mutable std::vector<Utils::Vector3d> sampling_positions_cart;
58
59public:
60 void calculate_sampling_positions(auto const &box_geo, auto const &lb) const {
61 lb_sanity_checks = SanityChecksLB(box_geo, lb);
62 sampling_positions.clear();
65
66 auto const lb_position_checker = lb.make_lattice_position_checker(false);
67 auto const lim = limits();
68 auto const b = n_bins();
70 lim[0], lim[1], lim[2], b[0], b[1], b[2], sampling_density);
71 for (auto const &p : global_positions) {
73 // We have to rotate the coordinates since the utils function assumes
74 // z-axis symmetry.
75 auto const z_axis = Utils::Vector3d{{0.0, 0.0, 1.0}};
77 auto const rot_axis =
78 Utils::vector_product(z_axis, transform_params->axis()).normalize();
79 if (theta > std::numeric_limits<double>::epsilon())
81 auto const pos = p_cart + transform_params->center();
82 if (lb_position_checker(pos)) {
83 sampling_positions.emplace_back(pos);
84 sampling_positions_cart.emplace_back(p_cart);
86 p_cart, transform_params->axis(), transform_params->orientation());
87 sampling_positions_cyl.emplace_back(pos_cyl);
88 }
89 }
90 }
91};
92
93} // Namespace Observables
Vector implementation and trait types for boost qvm interoperability.
void calculate_sampling_positions(auto const &box_geo, auto const &lb) const
CylindricalLBProfileObservable(std::shared_ptr< Utils::CylindricalTransformationParameters > transform_params, int n_r_bins, int n_phi_bins, int n_z_bins, double min_r, double max_r, double min_phi, double max_phi, double min_z, double max_z, double sampling_density)
std::shared_ptr< Utils::CylindricalTransformationParameters > transform_params
Bookkeeping of the box gometry and LB object memory address.
cudaStream_t stream[1]
CUDA streams for parallel computing on CPU and GPU.
Convert coordinates from the Cartesian system to the cylindrical system.
std::vector< Vector3d > get_cylindrical_sampling_positions(std::pair< double, double > const &r_limits, std::pair< double, double > const &phi_limits, std::pair< double, double > const &z_limits, std::size_t n_r_bins, std::size_t n_phi_bins, std::size_t n_z_bins, double sampling_density)
Generate sampling positions for a cylindrical histogram.
Definition sampling.hpp:46
Vector< T, 3 > vector_product(Vector< T, 3 > const &a, Vector< T, 3 > const &b)
Definition Vector.hpp:367
Vector3d vec_rotate(const Vector3d &axis, double angle, const Vector3d &vector)
Rotate a vector around an axis.
double angle_between(Vector3d const &v1, Vector3d const &v2)
Determine the angle between two vectors.
Vector3d transform_coordinate_cylinder_to_cartesian(Vector3d const &pos)
Coordinate transformation from cylindrical to Cartesian coordinates.
Vector3d transform_coordinate_cartesian_to_cylinder(Vector3d const &pos)
Coordinate transformation from Cartesian to cylindrical coordinates.
STL namespace.