ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
Accumulators::Correlator Class Reference

The main correlator class. More...

#include <Correlator.hpp>

+ Inheritance diagram for Accumulators::Correlator:
+ Collaboration diagram for Accumulators::Correlator:

Public Member Functions

 Correlator (::System::System const *system, int delta_N, int tau_lin, double tau_max, std::string compress1_, std::string compress2_, std::string corr_operation, obs_ptr obs1, obs_ptr obs2, Utils::Vector3d correlation_args_={})
 The initialization procedure for the correlation object.
 
void update (boost::mpi::communicator const &comm) override
 The function to process a new datapoint of A and B.
 
int finalize (boost::mpi::communicator const &comm)
 At the end of data collection, go through the whole hierarchy and correlate data left there.
 
std::vector< double > get_correlation ()
 Return correlation result.
 
std::size_t n_values () const
 
std::vector< std::size_t > shape () const override
 
std::vector< int > get_samples_sizes () const
 
std::vector< double > get_lag_times () const
 
int tau_lin () const
 
double tau_max () const
 
double dt () const
 
Utils::Vector3d const & correlation_args () const
 
void set_correlation_args (Utils::Vector3d const &args)
 
std::string const & compress1 () const
 
std::string const & compress2 () const
 
std::string const & correlation_operation () const
 
std::string get_internal_state () const final
 
void set_internal_state (std::string const &) final
 
- Public Member Functions inherited from Accumulators::AccumulatorBase
 AccumulatorBase (::System::System const *system, int delta_N)
 
virtual ~AccumulatorBase ()=default
 
int & delta_N ()
 
bool has_same_system_handle (::System::System const *system) const
 
void override_system_handle (::System::System const *system)
 

Additional Inherited Members

- Protected Attributes inherited from Accumulators::AccumulatorBase
void const * m_system
 for bookkeeping purposes
 

Detailed Description

The main correlator class.

Data organization: We use a ring-like way to manage the data: at the beginning we have a linear array, which we fill from index 0 to tau_lin. The index newest[i] always indicates the latest entry of the hierarchic "past" For every new entry in is incremented and if tau_lin is reached, it starts again from the beginning.

Definition at line 130 of file core/accumulators/Correlator.hpp.

Constructor & Destructor Documentation

◆ Correlator()

Accumulators::Correlator::Correlator ( ::System::System const *  system,
int  delta_N,
int  tau_lin,
double  tau_max,
std::string  compress1_,
std::string  compress2_,
std::string  corr_operation,
obs_ptr  obs1,
obs_ptr  obs2,
Utils::Vector3d  correlation_args_ = {} 
)
inline

The initialization procedure for the correlation object.

All important parameters have to be specified at the same time. They cannot be changed later, so every instance of the correlation class has to be fed with correct data from the very beginning.

Parameters
systemThe system attached to this correlator
delta_NThe number of time steps between subsequent updates
tau_linThe linear part of the correlation function.
tau_maxmaximal time delay tau to sample
obs1First observable to correlate
obs2Second observable to correlate
corr_operationhow to correlate the two observables A and B (this has no default)
compress1_how the A values should be compressed (usually the linear compression method)
compress2_how the B values should be compressed (usually the linear compression method)
correlation_args_optional arguments for the correlation function (currently only used when corr_operation is "fcs_acf")

Definition at line 161 of file core/accumulators/Correlator.hpp.

Member Function Documentation

◆ compress1()

std::string const & Accumulators::Correlator::compress1 ( ) const
inline

Definition at line 218 of file core/accumulators/Correlator.hpp.

◆ compress2()

std::string const & Accumulators::Correlator::compress2 ( ) const
inline

Definition at line 219 of file core/accumulators/Correlator.hpp.

◆ correlation_args()

Utils::Vector3d const & Accumulators::Correlator::correlation_args ( ) const
inline

Definition at line 213 of file core/accumulators/Correlator.hpp.

◆ correlation_operation()

std::string const & Accumulators::Correlator::correlation_operation ( ) const
inline

Definition at line 220 of file core/accumulators/Correlator.hpp.

◆ dt()

double Accumulators::Correlator::dt ( ) const
inline

Definition at line 211 of file core/accumulators/Correlator.hpp.

Referenced by get_lag_times().

◆ finalize()

int Accumulators::Correlator::finalize ( boost::mpi::communicator const &  comm)

At the end of data collection, go through the whole hierarchy and correlate data left there.

Definition at line 426 of file Correlator.cpp.

◆ get_correlation()

std::vector< double > Accumulators::Correlator::get_correlation ( )

Return correlation result.

Definition at line 511 of file Correlator.cpp.

References n_values().

◆ get_internal_state()

std::string Accumulators::Correlator::get_internal_state ( ) const
finalvirtual

Implements Accumulators::AccumulatorBase.

Definition at line 535 of file Correlator.cpp.

◆ get_lag_times()

std::vector< double > Accumulators::Correlator::get_lag_times ( ) const

Definition at line 528 of file Correlator.cpp.

References dt(), and n_values().

◆ get_samples_sizes()

std::vector< int > Accumulators::Correlator::get_samples_sizes ( ) const
inline

Definition at line 204 of file core/accumulators/Correlator.hpp.

◆ n_values()

std::size_t Accumulators::Correlator::n_values ( ) const
inline

Definition at line 196 of file core/accumulators/Correlator.hpp.

Referenced by get_correlation(), get_lag_times(), and shape().

◆ set_correlation_args()

void Accumulators::Correlator::set_correlation_args ( Utils::Vector3d const &  args)
inline

Definition at line 214 of file core/accumulators/Correlator.hpp.

◆ set_internal_state()

void Accumulators::Correlator::set_internal_state ( std::string const &  state)
finalvirtual

Implements Accumulators::AccumulatorBase.

Definition at line 556 of file Correlator.cpp.

References Accumulators::AccumulatorBase::m_system.

◆ shape()

std::vector< std::size_t > Accumulators::Correlator::shape ( ) const
inlineoverridevirtual

Implements Accumulators::AccumulatorBase.

Definition at line 199 of file core/accumulators/Correlator.hpp.

References n_values(), and shape().

Referenced by shape().

◆ tau_lin()

int Accumulators::Correlator::tau_lin ( ) const
inline

Definition at line 209 of file core/accumulators/Correlator.hpp.

◆ tau_max()

double Accumulators::Correlator::tau_max ( ) const
inline

Definition at line 210 of file core/accumulators/Correlator.hpp.

◆ update()

void Accumulators::Correlator::update ( boost::mpi::communicator const &  comm)
overridevirtual

The function to process a new datapoint of A and B.

First the function finds out if it is necessary to make some space for the new entries of A and B. Then, if necessary, it compresses old values of A and B to make room for the new value. Finally, the new values of A and B are stored in A[newest[0]] and B[newest[0]], where the newest indices have been increased before. Finally, the correlation estimate is updated. TODO: Not all correlation estimates have to be updated.

Implements Accumulators::AccumulatorBase.

Definition at line 314 of file Correlator.cpp.


The documentation for this class was generated from the following files: