![]() |
ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
|
Statistical tools to analyze simulations. More...
#include "analysis/statistics.hpp"#include "BoxGeometry.hpp"#include "Particle.hpp"#include "cell_system/CellStructure.hpp"#include "communication.hpp"#include "errorhandling.hpp"#include "npt.hpp"#include "particle_reduction.hpp"#include "system/System.hpp"#include <utils/Vector.hpp>#include <utils/contains.hpp>#include <utils/math/sqr.hpp>#include <utils/mpi/gather_buffer.hpp>#include <boost/mpi/collectives/broadcast.hpp>#include <boost/mpi/collectives/reduce.hpp>#include <cassert>#include <cmath>#include <cstdlib>#include <functional>#include <limits>#include <numbers>#include <stdexcept>#include <tuple>#include <utility>#include <vector>
Include dependency graph for statistics.cpp:Go to the source code of this file.
Classes | |
| struct | DecayTupleResult< F > |
| Decay a tuple of only 1 type to that type. More... | |
| struct | DecayTupleResult< F > |
Namespaces | |
| namespace | boost |
| namespace | boost::serialization |
Functions | |
| template<typename Archive , typename... T> | |
| void | boost::serialization::serialize (Archive &ar, std::tuple< T... > &pack, unsigned int const) |
Serialize std::tuple. | |
| template<class... Trait> | |
| static auto | gather_traits_for_types (System::System const &system, std::vector< int > const &p_types, Trait &&...trait) |
| Gather particle traits to MPI rank 0. | |
| 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. | |
| Utils::Vector3d | calc_linear_momentum (System::System const &system, bool include_particles, bool include_lbfluid) |
| Calculate total momentum of the system (particles & LB fluid). | |
| 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. | |
| Utils::Vector9d | gyration_tensor (System::System const &system, std::vector< int > const &p_types) |
| Calculate the gyration tensor of particles of certain types. | |
| Utils::Vector9d | moment_of_inertia_matrix (System::System const &system, int p_type) |
| Calculate the moment of inertia 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. | |
| 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. | |
| 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. | |
Statistical tools to analyze simulations.
The corresponding header file is statistics.hpp.
Definition in file statistics.cpp.
| Utils::Vector3d angular_momentum | ( | System::System const & | system, |
| int | p_type | ||
| ) |
Calculate the angular momentum of particles of a certain type.
| system | particle system |
| p_type | type of the particle |
Definition at line 182 of file statistics.cpp.
References System::System::box_geo, System::System::cell_structure, and vector_product().
Referenced by ScriptInterface::Analysis::Analysis::do_call_method().
| Utils::Vector3d calc_linear_momentum | ( | System::System const & | system, |
| bool | include_particles, | ||
| bool | include_lbfluid | ||
| ) |
Calculate total momentum of the system (particles & LB fluid).
| system | particle system |
| include_particles | Add particles momentum |
| include_lbfluid | Add LB fluid momentum |
Definition at line 145 of file statistics.cpp.
References System::System::cell_structure, LB::Solver::get_lattice_speed(), LB::Solver::get_momentum(), LB::Solver::is_solver_set(), and System::System::lb.
Referenced by ScriptInterface::Analysis::Analysis::do_call_method().
| 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.
Calculates the distance distribution of particles with types given in the p1_types list around particles with types given in the p2_types list. The distances range from r_min to r_max, binned into r_bins bins which are either equidistant (log_flag==false) or logarithmically equidistant (log_flag==true). The result is stored in the array dist.
| system | particle system |
| p1_types | list with types of particles to find the distribution for. |
| p2_types | list with types of particles the others are distributed around. |
| r_min | Minimal distance for the distribution. |
| r_max | Maximal distance for the distribution. |
| r_bins | Number of bins. |
| log_flag | Whether the bins are (logarithmically) equidistant. |
| int_flag | Whether the distribution should be cumulative. |
Definition at line 277 of file statistics.cpp.
References System::System::box_geo, gather_traits_for_types(), and Utils::sqr().
Referenced by ScriptInterface::Analysis::Analysis::do_call_method().
| Utils::Vector3d center_of_mass | ( | System::System const & | system, |
| int | p_type | ||
| ) |
Calculate the center of mass of particles of a certain type.
| system | particle system |
| p_type | type of the particle |
Definition at line 163 of file statistics.cpp.
References System::System::box_geo, System::System::cell_structure, and comm_cart.
Referenced by ScriptInterface::Analysis::Analysis::do_call_method(), and moment_of_inertia_matrix().
|
static |
Gather particle traits to MPI rank 0.
When only one trait is requested, return a vector of type T. When multiple traits are requested, return a vector of tuples.
Definition at line 80 of file statistics.cpp.
References System::System::cell_structure, comm_cart, Utils::contains(), and Utils::Mpi::gather_buffer().
Referenced by calc_part_distribution(), gyration_tensor(), and structure_factor().
| Utils::Vector9d gyration_tensor | ( | System::System const & | system, |
| std::vector< int > const & | p_types | ||
| ) |
Calculate the gyration tensor of particles of certain types.
| system | particle system |
| p_types | types of the particle |
Definition at line 196 of file statistics.cpp.
References System::System::box_geo, comm_cart, and gather_traits_for_types().
Referenced by ScriptInterface::Analysis::Analysis::do_call_method().
| 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.
| system | particle system |
| set1 | types of particles |
| set2 | types of particles |
Definition at line 98 of file statistics.cpp.
References System::System::box_geo, System::System::cell_structure, comm_cart, Utils::contains(), and Utils::Mpi::gather_buffer().
Referenced by ScriptInterface::Analysis::Analysis::do_call_method().
| Utils::Vector9d moment_of_inertia_matrix | ( | System::System const & | system, |
| int | p_type | ||
| ) |
Calculate the moment of inertia of particles of a certain type.
| system | particle system |
| p_type | type of the particle |
Definition at line 228 of file statistics.cpp.
References System::System::box_geo, System::System::cell_structure, center_of_mass(), and comm_cart.
Referenced by ScriptInterface::Analysis::Analysis::do_call_method().
| 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.
| system | particle system |
| pos | position of sphere center |
| dist | the sphere radius |
pos. Definition at line 255 of file statistics.cpp.
References System::System::box_geo, System::System::cell_structure, comm_cart, and Utils::Mpi::gather_buffer().
Referenced by ScriptInterface::Analysis::Analysis::do_call_method().
| 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.
Calculates the spherically averaged structure factor of particles of a given type. The possible wave vectors are given by q = 2PI/L sqrt(nx^2 + ny^2 + nz^2). The S(q) is calculated up to a given length measured in 2PI/L (the recommended order of the wave vector is less than 20). The data is stored starting with q=1, and contains alternatingly S(q-1) and the number of wave vectors l with l^2=q. Only if the second number is nonzero, the first is meaningful. This means the q=1 entries are sf[0]=S(1) and sf[1]=1. For q=7, there are no possible wave vectors, so sf[2*(7-1)]=sf[2*(7-1)+1]=0.
| system | particle system |
| p_types | list with types of particles to be analyzed |
| order | the maximum wave vector length in units of 2PI/L |
Definition at line 363 of file statistics.cpp.
References System::System::box_geo, comm_cart, gather_traits_for_types(), and Utils::sqr().
Referenced by ScriptInterface::Analysis::Analysis::do_call_method().