10 #include "../utils/map_to_index.h" 11 #include "../utils/runtime_error.h" 18 const Vec<std::pair<ElPtr,ElPtr>> &pairs)
22 for (
const auto &pair : pairs)
25 new GenDict({{
"Mols", pair.first}, {
"Atoms", pair.second}})));
36 const ElPtr &el_atoms)
39 el_mols->check_required_keys({
"id",
"atom-ids"});
41 auto &mols = el_mols->get_data();
43 el_atoms->check_required_keys({
"id",
"xu",
"yu",
"zu"});
45 auto &atoms = el_atoms->get_data();
49 for (
const auto &mol : mols)
53 auto &atom_ids = mol[
"atom-ids"];
55 auto &atom1 = atoms[id2index_atom[atom_ids.at(
index1_in_mol)]];
56 auto &atom2 = atoms[id2index_atom[atom_ids.at(
index2_in_mol)]];
59 vector_tmp << atom2[
"xu"].get<
double>() - atom1[
"xu"].get<double>(),
60 atom2[
"yu"].get<
double>() - atom1[
"yu"].get<double>(),
61 atom2[
"zu"].get<
double>() - atom1[
"zu"].get<double>();
77 auto index = coefficients_tmp.size();
78 coefficients_tmp.push_back(
88 "Number of molecules and molecular types must be unchanged");
92 coefficients_tmp.data(), coefficients_tmp.size());
Eigen::RowVector3d RowVector3d
RowVector3d is an alias for a 3-elements row vector of Eigen float numbers.
Vec< ShPtr< Generator > > generators
void set_indices(int index1_in_mol_, int index2_in_mol_)
Specify two atoms in a molecule by zero-based index. Time correlation function of a vector between th...
ShPtr< Element > ElPtr
An alias for a shared pointer of Element class.
void compute_temporary_vectors(std::function< void(const RowVector3d &)> callback, const ElPtr &el_mols, const ElPtr &el_atoms)
Compute intramolecular vectors and conduct customized manipulation using them.
virtual void use_generator_at(const int i)
Call Generator::generate_data of i th Generator object in generators.
virtual void prepare() override
Set initial vectors and resize coefficients_traj.
Eigen::Array< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > ArrayXXd
ArrayXXd is an alias for a two-dimensional array of float numbers.
const ArrayXXd & get_coefficients_array()
Get a two-dimensional array containing computed time correlation coefficients of vectors connecting t...
ArrayXd time_correlation_function
const ArrayXd & get_time_correlation()
Get an averaged time correlation function of atom-to-atom vector; each pair of atoms is in the same m...
This file has a definition of ProTimeCorrelationInMolecule class, which is a subclass of Processor cl...
virtual void finish() override
Fill coefficients_array with values of coefficients_traj, and calculate time_correlation_function by ...
void set_moltype(int target_moltype_)
Specify a molecular type. Only molecules whose type property is the specified type are analyzed...
Vec< RowArrayXd > coefficients_traj
ProTimeCorrelationInMolecule(const Vec< std::pair< ElPtr, ElPtr >> &pairs)
Constructor of ProTimeCorrelationInMolecule 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.
virtual void run_impl(const int index) override
Implementation of analysis using an element of generators.
GenDict is a dictionary (or map) of Generator objects.
Namespace for utility functions.
Eigen::Array< double, Eigen::Dynamic, 1 > ArrayXd
ArrayXd is an alias for a column array of float numbers.
ArrayXXd coefficients_array
Vec< double > initial_reciprocal_norm2
std::shared_ptr< T > ShPtr
ShPtr is an alias for shared pointer.
std::unordered_map< T, U > Map
Map is an alias for unordered map (same as dict in Python).
Vec< RowVector3d > initial_vectors
Map< Json, int > map_to_index(const Json &data, const Str &key)
Create a Map object from values of selected property in an array Json object to corresponding index i...
void register_generators(const Vec< ShPtr< GEN >> &gens)