ppap4lmp  0.7.2
ProMeanSquareDisplacement Class Reference

ProMeanSquareDisplacement computes mean square displacement (MSD). More...

#include <pro_mean_square_displacement.h>

Inheritance diagram for ProMeanSquareDisplacement:
Collaboration diagram for ProMeanSquareDisplacement:

Public Member Functions

 ProMeanSquareDisplacement (const Vec< ElPtr > &elems)
 Constructor of ProMeanSquareDisplacement class. More...
 
virtual void prepare () override
 Set initial positions and resize displacement2_traj. More...
 
virtual void finish () override
 Fill displacement2_array with values of displacement2_traj, and calculate mean_square_displacement by averaging over columns of displacement2_array. More...
 
void set_dimension (bool include_x, bool include_y, bool include_z)
 Specify dimensions to be considered. By default, the mean square displacement is computed in three dimensions. To compute the mean square displacement in xy place, for example, the third parameter of this method must be set to false. More...
 
void without_drift_correction (bool without_drift_correction_=true)
 Disable to correct a drift of center of mass of the simulation system. More...
 
const ArrayXXdget_displacement2_array ()
 Get computed time series of squared displacements from initial position for each target as a two-dimensional array: each row corresponds to each snapshot of the simulation and each column corresponds to each target. More...
 
const ArrayXdget_mean_square_displacement ()
 Get time series of the mean square displacement as a one-dimensional array. Each element of the array corresponds to each snapshot of the simulation. More...
 
- Public Member Functions inherited from Processor
 Processor ()=default
 Constructor of Processor class (default).
 
virtual bool run ()
 Run analysis using i th Generator object in generators, where i = i_generator. More...
 
void startup ()
 Startup this Processor object. More...
 

Protected Member Functions

virtual void run_impl (const int index) override
 Implementation of analysis using an element of generators. More...
 
- Protected Member Functions inherited from Processor
template<class GEN >
void register_generator (const ShPtr< GEN > &gen)
 
template<class GEN >
void register_generators (const Vec< ShPtr< GEN >> &gens)
 
virtual void use_generator_at (const int i)
 Call Generator::generate_data of i th Generator object in generators. More...
 
virtual void finish_using_generator_at (const int i)
 Call Generator::finish_using_generated_data of i* th Generator object in generators. More...
 

Private Member Functions

void extract_positions (ArrayXXd &positions, const ElPtr &elem)
 Extract position vectors from an Element object. More...
 

Private Attributes

bool drift_correction = true
 
Vec< bool > dimension = {true, true, true}
 
ArrayXXd initial_rs
 
Vec< RowArrayXddisplacement2_traj
 
ArrayXXd displacement2_array
 
ArrayXd mean_square_displacement
 

Additional Inherited Members

- Protected Attributes inherited from Processor
int n_generators
 
Vec< ShPtr< Generator > > generators
 

Detailed Description

ProMeanSquareDisplacement computes mean square displacement (MSD).

An object of this class makes a two-dimensional array of squared displacements from initial position for each target (can be an atom, bead, molecule...) over a simulation trajectory. Each row of the array corresponds to each snapshot of a simulation, and each column of the array corresponds to each target. By averaging over columns of the array, the object of this class also makes a one-dimensional array for the mean square displacement.

About usage in Python, please see pybind::py_pro_mean_square_displacement.

Definition at line 29 of file pro_mean_square_displacement.h.

Constructor & Destructor Documentation

◆ ProMeanSquareDisplacement()

ProMeanSquareDisplacement::ProMeanSquareDisplacement ( const Vec< ElPtr > &  elems)

Constructor of ProMeanSquareDisplacement class.

Parameters
elemsList of Element objects for atoms, beads, molecules... If each Element object has an array data, all the array should have the same length.
Required property
  • id : integer
  • xu : float
  • yu : float
  • zu : float
  • mass : float (for drift correction)

Element objects in the elems are put into generators by register_generators.

Definition at line 16 of file pro_mean_square_displacement.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ extract_positions()

void ProMeanSquareDisplacement::extract_positions ( ArrayXXd positions,
const ElPtr elem 
)
private

Extract position vectors from an Element object.

Parameters
positionsMutable reference of a two-dimensional array whose rows are position vectors.
elemThis method extracts position vectors from this Element object.
Returns
None.

Definition at line 24 of file pro_mean_square_displacement.cpp.

Here is the caller graph for this function:

◆ finish()

void ProMeanSquareDisplacement::finish ( )
overridevirtual

Fill displacement2_array with values of displacement2_traj, and calculate mean_square_displacement by averaging over columns of displacement2_array.

Returns
None.

Each row of displacement2_array corresponds to each element of displacement2_traj.

Reimplemented from Processor.

Definition at line 82 of file pro_mean_square_displacement.cpp.

Here is the call graph for this function:

◆ get_displacement2_array()

const ArrayXXd & ProMeanSquareDisplacement::get_displacement2_array ( )

Get computed time series of squared displacements from initial position for each target as a two-dimensional array: each row corresponds to each snapshot of the simulation and each column corresponds to each target.

Returns
displacement2_array.

Definition at line 127 of file pro_mean_square_displacement.cpp.

Here is the caller graph for this function:

◆ get_mean_square_displacement()

const ArrayXd & ProMeanSquareDisplacement::get_mean_square_displacement ( )

Get time series of the mean square displacement as a one-dimensional array. Each element of the array corresponds to each snapshot of the simulation.

Returns
mean_square_displacement.

Definition at line 134 of file pro_mean_square_displacement.cpp.

Here is the caller graph for this function:

◆ prepare()

void ProMeanSquareDisplacement::prepare ( )
overridevirtual

Set initial positions and resize displacement2_traj.

Returns
None.

Reimplemented from Processor.

Definition at line 71 of file pro_mean_square_displacement.cpp.

Here is the call graph for this function:

◆ run_impl()

void ProMeanSquareDisplacement::run_impl ( const int  index)
overrideprotectedvirtual

Implementation of analysis using an element of generators.

Parameters
indexAn index in generators for a Generator object to be analyzed.
Returns
None.

To be compatible with multithreading computation, class members should not be modified in this method. If modification of some members is necessary, please consider defining them as Vec, and modifying only their i th element, where i = index.

I am sorry to say that the best documentation for this method is its source code...

Implements Processor.

Definition at line 48 of file pro_mean_square_displacement.cpp.

Here is the call graph for this function:

◆ set_dimension()

void ProMeanSquareDisplacement::set_dimension ( bool  include_x,
bool  include_y,
bool  include_z 
)

Specify dimensions to be considered. By default, the mean square displacement is computed in three dimensions. To compute the mean square displacement in xy place, for example, the third parameter of this method must be set to false.

Parameters
include_xA boolean, whether component in the x direction is included in squared displacement. This parameter is stored as the first element of dimension.
include_yA boolean, whether component in the y direction is included in squared displacement. This parameter is stored as the second element of dimension.
include_zA boolean, whether component in the z direction is included in squared displacement. This parameter is stored as the third element of dimension.
Returns
None.

Definition at line 109 of file pro_mean_square_displacement.cpp.

Here is the caller graph for this function:

◆ without_drift_correction()

void ProMeanSquareDisplacement::without_drift_correction ( bool  without_drift_correction_ = true)

Disable to correct a drift of center of mass of the simulation system.

Parameters
without_drift_correction_Whether disable the drift correction or not (default is true). Negation of this parameter is assigned to drift_correction.
Returns
None.

Definition at line 119 of file pro_mean_square_displacement.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ dimension

Vec<bool> ProMeanSquareDisplacement::dimension = {true, true, true}
private

Dimensions to be considered in computing squared displacements. Three elements of this member corresponds to x, y, and z direction, respectively. Only if an element of this member is true, displacement in the corresponding direction is added to resulted displacement. Default is true for all the direction.

Definition at line 46 of file pro_mean_square_displacement.h.

◆ displacement2_array

ArrayXXd ProMeanSquareDisplacement::displacement2_array
private

A two-dimensional array of squared displacements from initial position for each target over a simulation trajectory. Each column corresponds to time series of the squared displacement for each target, and each row corresponds to each element of generators (snapshot of simulation).

Definition at line 65 of file pro_mean_square_displacement.h.

◆ displacement2_traj

Vec<RowArrayXd> ProMeanSquareDisplacement::displacement2_traj
private

List in which RowArrayXd objects of computed squared displacements of each target are stored. Indices in this list corresponds those in generators.

Definition at line 57 of file pro_mean_square_displacement.h.

◆ drift_correction

bool ProMeanSquareDisplacement::drift_correction = true
private

Whether to correct a drift of center of mass of the simulation system (default is true). If the initial structure of the simulation has some biases of position or velocity, drift of the simulation system (translational displacement of center of mass of the system) can occur and, as the result, distort the mean square displacement.

Definition at line 38 of file pro_mean_square_displacement.h.

◆ initial_rs

ArrayXXd ProMeanSquareDisplacement::initial_rs
private

Initial positions of targets. The first element of generators is used for the initial positions.

Definition at line 51 of file pro_mean_square_displacement.h.

◆ mean_square_displacement

ArrayXd ProMeanSquareDisplacement::mean_square_displacement
private

The mean square displacement. Each element corresponds to each element of generators (snapshot of simulation).

Definition at line 71 of file pro_mean_square_displacement.h.


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