45#include "applications/dynamicProps/VCorrFunc.hpp"
48 VCorrFunc::VCorrFunc(SimInfo* info,
const std::string& filename,
49 const std::string& sele1,
const std::string& sele2) :
50 ObjectACF<RealType>(info, filename, sele1, sele2) {
51 setCorrFuncType(
"Velocity Correlation Function");
52 setOutputName(
getPrefix(dumpFilename_) +
".vcorr");
53 setLabelString(
"<v(0).v(t)>");
54 velocities_.resize(nFrames_);
57 VCorrFuncZ::VCorrFuncZ(SimInfo* info,
const std::string& filename,
58 const std::string& sele1,
const std::string& sele2) :
59 ObjectACF<RealType>(info, filename, sele1, sele2) {
60 setCorrFuncType(
"Velocity Correlation Function projected along z axis");
61 setOutputName(
getPrefix(dumpFilename_) +
".vcorrz");
62 setLabelString(
"<vz(0).vz(t)>");
63 velocities_.resize(nFrames_);
66 VCorrFuncR::VCorrFuncR(SimInfo* info,
const std::string& filename,
67 const std::string& sele1,
const std::string& sele2) :
68 ObjectACF<RealType>(info, filename, sele1, sele2) {
71 reader_->setNeedCOMprops(ncp);
72 setCorrFuncType(
"Velocity Correlation Function (radial projection)");
73 setOutputName(
getPrefix(dumpFilename_) +
".vcorrr");
74 setLabelString(
"<vr(0).vr(t)>");
75 velocities_.resize(nFrames_);
78 int VCorrFunc::computeProperty1(
int frame, StuntDouble* sd) {
79 velocities_[frame].push_back(sd->getVel());
80 return velocities_[frame].size() - 1;
83 RealType VCorrFunc::calcCorrVal(
int frame1,
int frame2,
int id1,
int id2) {
84 RealType v2 =
dot(velocities_[frame1][id1], velocities_[frame2][id2]);
88 int VCorrFuncZ::computeProperty1(
int frame, StuntDouble* sd) {
89 velocities_[frame].push_back(sd->getVel().z());
90 return velocities_[frame].size() - 1;
93 RealType VCorrFuncZ::calcCorrVal(
int frame1,
int frame2,
int id1,
int id2) {
94 RealType v2 = velocities_[frame1][id1] * velocities_[frame2][id2];
98 int VCorrFuncR::computeProperty1(
int frame, StuntDouble* sd) {
100 Vector3d coord_t = sd->getPos() - sd->getCOM();
104 RealType vel =
dot(sd->getVel(), coord_t);
105 velocities_[frame].push_back(vel);
106 return velocities_[frame].size() - 1;
109 RealType VCorrFuncR::calcCorrVal(
int frame1,
int frame2,
int id1,
int id2) {
111 v2 = velocities_[frame1][id1] * velocities_[frame2][id2];
void normalize()
Normalizes this vector in place.
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.
Real dot(const DynamicVector< Real > &v1, const DynamicVector< Real > &v2)
Returns the dot product of two DynamicVectors.
std::string getPrefix(const std::string &str)