ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
statistics.hpp File Reference

Statistical tools to analyze simulations. More...

#include "system/System.hpp"
#include <utils/Vector.hpp>
#include <vector>
+ Include dependency graph for statistics.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

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< 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.
 
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.
 
Utils::Vector3d calc_linear_momentum (System::System const &system, bool include_particles, bool include_lbfluid)
 Calculate total momentum of the system (particles & LB fluid).
 

Detailed Description

Statistical tools to analyze simulations.

Implementation in statistics.cpp.

Definition in file statistics.hpp.

Function Documentation

◆ angular_momentum()

Utils::Vector3d angular_momentum ( System::System const &  system,
int  p_type 
)

Calculate the angular momentum of particles of a certain type.

Parameters
systemparticle system
p_typetype of the particle

Definition at line 180 of file statistics.cpp.

References System::System::box_geo, System::System::cell_structure, pos, and vector_product().

Referenced by ScriptInterface::Analysis::Analysis::do_call_method().

◆ calc_linear_momentum()

Utils::Vector3d calc_linear_momentum ( System::System const &  system,
bool  include_particles,
bool  include_lbfluid 
)

Calculate total momentum of the system (particles & LB fluid).

Parameters
systemparticle system
include_particlesAdd particles momentum
include_lbfluidAdd LB fluid momentum

Definition at line 143 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().

◆ calc_part_distribution()

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.

Parameters
systemparticle system
p1_typeslist with types of particles to find the distribution for.
p2_typeslist with types of particles the others are distributed around.
r_minMinimal distance for the distribution.
r_maxMaximal distance for the distribution.
r_binsNumber of bins.
log_flagWhether the bins are (logarithmically) equidistant.
int_flagWhether the distribution should be cumulative.
Returns
Radii and distance distribution.

Definition at line 275 of file statistics.cpp.

References System::System::box_geo, gather_traits_for_types(), and Utils::sqr().

Referenced by ScriptInterface::Analysis::Analysis::do_call_method().

◆ center_of_mass()

Utils::Vector3d center_of_mass ( System::System const &  system,
int  p_type 
)

Calculate the center of mass of particles of a certain type.

Parameters
systemparticle system
p_typetype of the particle

Definition at line 161 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().

◆ gyration_tensor()

Utils::Vector9d gyration_tensor ( System::System const &  system,
std::vector< int > const &  p_types 
)

Calculate the gyration tensor of particles of certain types.

Parameters
systemparticle system
p_typestypes of the particle

Definition at line 194 of file statistics.cpp.

References System::System::box_geo, comm_cart, gather_traits_for_types(), pos, and u.

Referenced by ScriptInterface::Analysis::Analysis::do_call_method().

◆ mindist()

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.

Parameters
systemparticle system
set1types of particles
set2types of particles
Returns
the minimal distance of two particles

Definition at line 96 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().

◆ moment_of_inertia_matrix()

Utils::Vector9d moment_of_inertia_matrix ( System::System const &  system,
int  p_type 
)

Calculate the moment of inertia of particles of a certain type.

Parameters
systemparticle system
p_typetype of the particle

Definition at line 226 of file statistics.cpp.

References System::System::box_geo, System::System::cell_structure, center_of_mass(), comm_cart, and pos.

Referenced by ScriptInterface::Analysis::Analysis::do_call_method().

◆ nbhood()

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.

Parameters
systemparticle system
posposition of sphere center
distthe sphere radius
Returns
List of ids close to pos.

Definition at line 253 of file statistics.cpp.

References System::System::box_geo, System::System::cell_structure, comm_cart, Utils::Mpi::gather_buffer(), and pos.

Referenced by ScriptInterface::Analysis::Analysis::do_call_method().

◆ structure_factor()

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.

Parameters
systemparticle system
p_typeslist with types of particles to be analyzed
orderthe maximum wave vector length in units of 2PI/L
Returns
The scattering vectors q and structure factors S(q).

Definition at line 361 of file statistics.cpp.

References System::System::box_geo, comm_cart, gather_traits_for_types(), Utils::pi(), pos, and Utils::sqr().

Referenced by ScriptInterface::Analysis::Analysis::do_call_method().