Loading [MathJax]/extensions/TeX/AMSmath.js
ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages Concepts
statistics.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010-2022 The ESPResSo project
3 * Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010
4 * Max-Planck-Institute for Polymer Research, Theory Group
5 *
6 * This file is part of ESPResSo.
7 *
8 * ESPResSo is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * ESPResSo is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#pragma once
23
24/** \file
25 * Statistical tools to analyze simulations.
26 *
27 * Implementation in statistics.cpp.
28 */
29
30#include "system/System.hpp"
31
32#include <utils/Vector.hpp>
33
34#include <vector>
35
36/** Calculate the minimal distance of two particles with types in @p set1 and
37 * @p set2, respectively.
38 * @param system particle system
39 * @param set1 types of particles
40 * @param set2 types of particles
41 * @return the minimal distance of two particles
42 */
43double mindist(System::System const &system, std::vector<int> const &set1,
44 std::vector<int> const &set2);
45
46/** Find all particles within a given radius @p dist around a position @p pos.
47 * @param system particle system
48 * @param pos position of sphere center
49 * @param dist the sphere radius
50 *
51 * @return List of ids close to @p pos.
52 */
53std::vector<int> nbhood(System::System const &system,
54 Utils::Vector3d const &pos, double dist);
55
56/** Calculate the distribution of particles around others.
57 *
58 * Calculates the distance distribution of particles with types given
59 * in the @p p1_types list around particles with types given in the
60 * @p p2_types list. The distances range from @p r_min to @p r_max, binned
61 * into @p r_bins bins which are either equidistant (@p log_flag==false) or
62 * logarithmically equidistant (@p log_flag==true). The result is stored
63 * in the @p array dist.
64 * @param system particle system
65 * @param p1_types list with types of particles to find the distribution for.
66 * @param p2_types list with types of particles the others are distributed
67 * around.
68 * @param r_min Minimal distance for the distribution.
69 * @param r_max Maximal distance for the distribution.
70 * @param r_bins Number of bins.
71 * @param log_flag Whether the bins are (logarithmically) equidistant.
72 * @param int_flag Whether the distribution should be cumulative.
73 * @return Radii and distance distribution.
74 */
75std::vector<std::vector<double>>
77 std::vector<int> const &p1_types,
78 std::vector<int> const &p2_types, double r_min,
79 double r_max, int r_bins, bool log_flag, bool int_flag);
80
81/** Calculate the spherically averaged structure factor.
82 *
83 * Calculates the spherically averaged structure factor of particles of a
84 * given type. The possible wave vectors are given by q = 2PI/L sqrt(nx^2 +
85 * ny^2 + nz^2).
86 * The S(q) is calculated up to a given length measured in 2PI/L (the
87 * recommended order of the wave vector is less than 20).
88 * The data is stored starting with q=1, and contains alternatingly S(q-1) and
89 * the number of wave vectors l with l^2=q. Only if the second number is
90 * nonzero, the first is meaningful. This means the q=1 entries are sf[0]=S(1)
91 * and sf[1]=1. For q=7, there are no possible wave vectors, so
92 * sf[2*(7-1)]=sf[2*(7-1)+1]=0.
93 *
94 * @param system particle system
95 * @param p_types list with types of particles to be analyzed
96 * @param order the maximum wave vector length in units of 2PI/L
97 * @return The scattering vectors q and structure factors S(q).
98 */
99std::vector<std::vector<double>>
100structure_factor(System::System const &system, std::vector<int> const &p_types,
101 int order);
102
103/** @brief Calculate the center of mass of particles of a certain type.
104 * @param system particle system
105 * @param p_type type of the particle
106 */
107Utils::Vector3d center_of_mass(System::System const &system, int p_type);
108
109/** @brief Calculate the angular momentum of particles of a certain type.
110 * @param system particle system
111 * @param p_type type of the particle
112 */
113Utils::Vector3d angular_momentum(System::System const &system, int p_type);
114
115/** @brief Calculate the gyration tensor of particles of certain types.
116 * @param system particle system
117 * @param p_types types of the particle
118 */
120 std::vector<int> const &p_types);
121
122/** @brief Calculate the moment of inertia of particles of a certain type.
123 * @param system particle system
124 * @param p_type type of the particle
125 */
127 int p_type);
128
129/** Calculate total momentum of the system (particles & LB fluid).
130 * @param system particle system
131 * @param include_particles Add particles momentum
132 * @param include_lbfluid Add LB fluid momentum
133 */
135 bool include_particles,
136 bool include_lbfluid);
Vector implementation and trait types for boost qvm interoperability.
Main system class.
Utils::Vector3d center_of_mass(System::System const &system, int p_type)
Calculate the center of mass of particles of a certain type.
Utils::Vector3d angular_momentum(System::System const &system, int p_type)
Calculate the angular momentum of particles of a certain type.
std::vector< int > nbhood(System::System const &system, Utils::Vector3d const &pos, double dist)
Find all particles within a given radius dist around a position pos.
Utils::Vector9d moment_of_inertia_matrix(System::System const &system, int p_type)
Calculate the moment of inertia of particles of a certain type.
Utils::Vector9d gyration_tensor(System::System const &system, std::vector< int > const &p_types)
Calculate the gyration tensor of particles of certain types.
Utils::Vector3d calc_linear_momentum(System::System const &system, bool include_particles, bool include_lbfluid)
Calculate total momentum of the system (particles & LB fluid).
std::vector< std::vector< double > > structure_factor(System::System const &system, std::vector< int > const &p_types, int order)
Calculate the spherically averaged structure factor.
double mindist(System::System const &system, std::vector< int > const &set1, std::vector< int > const &set2)
Calculate the minimal distance of two particles with types in set1 and set2, respectively.
std::vector< std::vector< double > > calc_part_distribution(System::System const &system, std::vector< int > const &p1_types, std::vector< int > const &p2_types, double r_min, double r_max, int r_bins, bool log_flag, bool int_flag)
Calculate the distribution of particles around others.