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#ifndef OBSERVABLES_CYLINDRICALLBPROFILEOBSERVABLE_HPP
20#define OBSERVABLES_CYLINDRICALLBPROFILEOBSERVABLE_HPP
21
23
24#include <utils/Vector.hpp>
27#include <utils/sampling.hpp>
28
29#include <limits>
30#include <memory>
31#include <utility>
32#include <vector>
33
34namespace Observables {
35
37public:
39 std::shared_ptr<Utils::CylindricalTransformationParameters>
41 int n_r_bins, int n_phi_bins, int n_z_bins, double min_r, double max_r,
42 double min_phi, double max_phi, double min_z, double max_z,
43 double sampling_density)
45 n_phi_bins, n_z_bins, min_r, max_r,
46 min_phi, max_phi, min_z, max_z),
49 }
51 auto const lim = limits();
52 auto const b = n_bins();
54 lim[0], lim[1], lim[2], b[0], b[1], b[2], sampling_density);
55 for (auto &p : sampling_positions) {
57 // We have to rotate the coordinates since the utils function assumes
58 // z-axis symmetry.
59 auto const z_axis = Utils::Vector3d{{0.0, 0.0, 1.0}};
60 auto const theta = Utils::angle_between(z_axis, transform_params->axis());
61 auto const rot_axis =
62 Utils::vector_product(z_axis, transform_params->axis()).normalize();
63 if (theta > std::numeric_limits<double>::epsilon())
64 p_cart = Utils::vec_rotate(rot_axis, theta, p_cart);
65 p = p_cart + transform_params->center();
66 }
67 }
68 std::vector<Utils::Vector3d> sampling_positions;
70};
71} // Namespace Observables
72#endif
Vector implementation and trait types for boost qvm interoperability.
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
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:368
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.