10 #include "../utils/runtime_error.h" 29 elem->check_required_keys({
"xu",
"yu",
"zu",
"id"});
31 elem->make_2darray_from_data(positions, {
"xu",
"yu",
"zu"});
35 elem->check_required_keys(
"mass");
38 elem->make_1darray_from_data(ms,
"mass");
40 auto com = (positions.colwise()*ms).colwise().sum() / ms.sum();
42 positions.rowwise() -= com;
54 auto displacement2_xyz = (rs -
initial_rs).square();
56 ArrayXd displacement2 = ArrayXd::Zero(displacement2_xyz.rows());
58 for (
int i = 0; i != 3; ++i)
62 displacement2 += displacement2_xyz.col(i);
88 if (n_points != sd.size())
114 dimension = {include_x, include_y, include_z};
120 bool without_drift_correction_)
virtual void run_impl(const int index) override
Implementation of analysis using an element of generators.
void without_drift_correction(bool without_drift_correction_=true)
Disable to correct a drift of center of mass of the simulation system.
Vec< ShPtr< Generator > > generators
ArrayXd mean_square_displacement
void extract_positions(ArrayXXd &positions, const ElPtr &elem)
Extract position vectors from an Element object.
ShPtr< Element > ElPtr
An alias for a shared pointer of Element class.
virtual void use_generator_at(const int i)
Call Generator::generate_data of i th Generator object in generators.
ProMeanSquareDisplacement(const Vec< ElPtr > &elems)
Constructor of ProMeanSquareDisplacement class.
Eigen::Array< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > ArrayXXd
ArrayXXd is an alias for a two-dimensional array of float numbers.
ArrayXXd displacement2_array
const ArrayXd & get_mean_square_displacement()
Get time series of the mean square displacement as a one-dimensional array. Each element of the array...
virtual void finish() override
Fill displacement2_array with values of displacement2_traj, and calculate mean_square_displacement by...
This file has a definition of ProMeanSquareDisplacement class, which is a subclass of Processor class...
std::vector< T > Vec
Vec is an alias for vector (same as list in Python).
void runtime_error(const Str &msg)
Raise (for Python) and throw (for C++) a runtime error.
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 di...
Namespace for utility functions.
Eigen::Array< double, Eigen::Dynamic, 1 > ArrayXd
ArrayXd is an alias for a column array of float numbers.
const ArrayXXd & get_displacement2_array()
Get computed time series of squared displacements from initial position for each target as a two-dime...
Vec< RowArrayXd > displacement2_traj
void register_generators(const Vec< ShPtr< GEN >> &gens)
virtual void prepare() override
Set initial positions and resize displacement2_traj.