ppap4lmp  0.7.2
ProDistanceInMolecule Class Reference

ProDistanceInMolecule computes atom-to-atom distance in each molecule (also computes square of the distance). More...

#include <pro_distance_in_molecule.h>

Inheritance diagram for ProDistanceInMolecule:
Collaboration diagram for ProDistanceInMolecule:

Public Member Functions

 ProDistanceInMolecule (const ElPtr &mols, const ElPtr &atoms)
 Constructor of ProDistanceInMolecule class for a snapshot of simulation. More...
 
 ProDistanceInMolecule (const Vec< std::pair< ElPtr, ElPtr >> &pairs)
 Constructor of ProDistanceInMolecule class for multiple snapshots of simulation. More...
 
virtual void prepare () override
 Resize distance2_traj. More...
 
virtual void finish () override
 Fill distance2_array with values of distance2_traj. More...
 
void set_indices (int index1_in_mol_, int index2_in_mol_)
 Specify two atoms in a molecule by zero-based index. Distance between the two atoms is computed for each molecule. More...
 
void set_moltype (int target_moltype_)
 Specify a molecular type. Only molecules whose type property is the specified type are analyzed. If molecules have no type property, you do not need to use this method. More...
 
ArrayXXd get_distance_array ()
 Get computed distances between two atoms in each molecule as a two-dimensional array: each row corresponds to each snapshot of a simulation and each column corresponds to each molecule. More...
 
const ArrayXXdget_distance2_array ()
 Get computed squared distances between two atoms in each molecule as a two-dimensional array: each row corresponds to each snapshot of a simulation and each column corresponds to each molecule. 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 Attributes

int index1_in_mol = 0
 
int index2_in_mol = 0
 
int target_moltype = 1
 
Vec< RowArrayXddistance2_traj
 
ArrayXXd distance2_array
 

Additional Inherited Members

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

Detailed Description

ProDistanceInMolecule computes atom-to-atom distance in each molecule (also computes square of the distance).

An object of this class makes a two-dimensional array of distances between two atoms belonging to the same molecule. Each row of the array corresponds to each snapshot of a simulation, and each column of the array corresponds to each molecule.

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

Definition at line 26 of file pro_distance_in_molecule.h.

Constructor & Destructor Documentation

◆ ProDistanceInMolecule() [1/2]

ProDistanceInMolecule::ProDistanceInMolecule ( const ElPtr mols,
const ElPtr atoms 
)

Constructor of ProDistanceInMolecule class for a snapshot of simulation.

Parameters
mols

An Element object for molecules.

Required property
  • id : integer
  • atom-ids : array of integers

atomsAn Element object for atoms.
Required property
  • id : integer
  • xu : float
  • yu : float
  • zu : float

A GenDict object is constructed taking the mols and atoms, and then put into generators by register_generator.

Definition at line 17 of file pro_distance_in_molecule.cpp.

Here is the call graph for this function:

◆ ProDistanceInMolecule() [2/2]

ProDistanceInMolecule::ProDistanceInMolecule ( const Vec< std::pair< ElPtr, ElPtr >> &  pairs)

Constructor of ProDistanceInMolecule class for multiple snapshots of simulation.

Parameters
pairsList of pairs of two Element objects: the first object is for molecules and the second object is for atoms. If each Element object has an array data, all the array should have the same length.
Required property (first)
  • atom-ids : array of integers
Required property (second)
  • id : integer
  • xu : float
  • yu : float
  • zu : float

GenDict objects are constructed taking each element of the pairs, and then put into generators by register_generators.

Definition at line 27 of file pro_distance_in_molecule.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ finish()

void ProDistanceInMolecule::finish ( )
overridevirtual

Fill distance2_array with values of distance2_traj.

Returns
None.

Each row of distance2_array corresponds to each element of distance2_traj.

Reimplemented from Processor.

Definition at line 92 of file pro_distance_in_molecule.cpp.

Here is the call graph for this function:

◆ get_distance2_array()

const ArrayXXd & ProDistanceInMolecule::get_distance2_array ( )

Get computed squared distances between two atoms in each molecule as a two-dimensional array: each row corresponds to each snapshot of a simulation and each column corresponds to each molecule.

Returns
distance2_array.

Definition at line 142 of file pro_distance_in_molecule.cpp.

Here is the caller graph for this function:

◆ get_distance_array()

ArrayXXd ProDistanceInMolecule::get_distance_array ( )

Get computed distances between two atoms in each molecule as a two-dimensional array: each row corresponds to each snapshot of a simulation and each column corresponds to each molecule.

Returns
Square rooted distance2_array.

Definition at line 135 of file pro_distance_in_molecule.cpp.

Here is the caller graph for this function:

◆ prepare()

void ProDistanceInMolecule::prepare ( )
overridevirtual

Resize distance2_traj.

Returns
None.

Reimplemented from Processor.

Definition at line 85 of file pro_distance_in_molecule.cpp.

◆ run_impl()

void ProDistanceInMolecule::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 43 of file pro_distance_in_molecule.cpp.

Here is the call graph for this function:

◆ set_indices()

void ProDistanceInMolecule::set_indices ( int  index1_in_mol_,
int  index2_in_mol_ 
)

Specify two atoms in a molecule by zero-based index. Distance between the two atoms is computed for each molecule.

Parameters
index1_in_mol_A zero-based index in a molecule specifying a target atom. This parameter is assigned to index1_in_mol.
index2_in_mol_A zero-based index in a molecule specifying the other target atom. This parameter is assigned to index2_in_mol.
Returns
None.

Definition at line 117 of file pro_distance_in_molecule.cpp.

Here is the caller graph for this function:

◆ set_moltype()

void ProDistanceInMolecule::set_moltype ( int  target_moltype_)

Specify a molecular type. Only molecules whose type property is the specified type are analyzed. If molecules have no type property, you do not need to use this method.

Parameters
target_moltype_An integer for molecular type. This parameter is assigned to target_moltype.
Returns
None.

Definition at line 127 of file pro_distance_in_molecule.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ distance2_array

ArrayXXd ProDistanceInMolecule::distance2_array
private

A two-dimensional array of computed distances. Each column corresponds to a sequence of the distance for each molecule, and each row corresponds to each element of generators.

Definition at line 57 of file pro_distance_in_molecule.h.

◆ distance2_traj

Vec<RowArrayXd> ProDistanceInMolecule::distance2_traj
private

List in which RowArrayXd objects of computed distances of each molecule are stored. Indices in this list corresponds those in generators.

Definition at line 51 of file pro_distance_in_molecule.h.

◆ index1_in_mol

int ProDistanceInMolecule::index1_in_mol = 0
private

Zero-based index for an atom in a molecule. Distance between two atoms specified by index1_in_mol and index2_in_mol is calculated for each molecule.

Definition at line 32 of file pro_distance_in_molecule.h.

◆ index2_in_mol

int ProDistanceInMolecule::index2_in_mol = 0
private

Zero-based index for an atom in a molecule. Distance between two atoms specified by index1_in_mol and index2_in_mol is calculated for each molecule.

Definition at line 38 of file pro_distance_in_molecule.h.

◆ target_moltype

int ProDistanceInMolecule::target_moltype = 1
private

Specify a type of molecules to be analyzed (default is 1). Only molecules whose type is target_moltype are analyzed. Note that if molecules do not have type property, 1 is used as their types.

Definition at line 45 of file pro_distance_in_molecule.h.


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