48#include "applications/dynamicProps/VCorrFunc.hpp"
51 VCorrFunc::VCorrFunc(
SimInfo* info,
const std::string& filename,
52 const std::string& sele1,
const std::string& sele2) :
53 ObjectACF<RealType>(info, filename, sele1, sele2) {
54 setCorrFuncType(
"Velocity Correlation Function");
55 setOutputName(
getPrefix(dumpFilename_) +
".vcorr");
56 setLabelString(
"<v(0).v(t)>");
57 velocities_.resize(nFrames_);
60 VCorrFuncZ::VCorrFuncZ(SimInfo* info,
const std::string& filename,
61 const std::string& sele1,
const std::string& sele2) :
62 ObjectACF<RealType>(info, filename, sele1, sele2) {
63 setCorrFuncType(
"Velocity Correlation Function projected along z axis");
64 setOutputName(
getPrefix(dumpFilename_) +
".vcorrz");
65 setLabelString(
"<vz(0).vz(t)>");
66 velocities_.resize(nFrames_);
69 VCorrFuncR::VCorrFuncR(SimInfo* info,
const std::string& filename,
70 const std::string& sele1,
const std::string& sele2) :
71 ObjectACF<RealType>(info, filename, sele1, sele2) {
74 reader_->setNeedCOMprops(ncp);
75 setCorrFuncType(
"Velocity Correlation Function (radial projection)");
76 setOutputName(
getPrefix(dumpFilename_) +
".vcorrr");
77 setLabelString(
"<vr(0).vr(t)>");
78 velocities_.resize(nFrames_);
81 int VCorrFunc::computeProperty1(
int frame, StuntDouble* sd) {
82 velocities_[frame].push_back(sd->getVel());
83 return velocities_[frame].size() - 1;
86 RealType VCorrFunc::calcCorrVal(
int frame1,
int frame2,
int id1,
int id2) {
87 RealType v2 =
dot(velocities_[frame1][id1], velocities_[frame2][id2]);
91 int VCorrFuncZ::computeProperty1(
int frame, StuntDouble* sd) {
92 velocities_[frame].push_back(sd->getVel().z());
93 return velocities_[frame].size() - 1;
96 RealType VCorrFuncZ::calcCorrVal(
int frame1,
int frame2,
int id1,
int id2) {
97 RealType v2 = velocities_[frame1][id1] * velocities_[frame2][id2];
101 int VCorrFuncR::computeProperty1(
int frame, StuntDouble* sd) {
103 Vector3d coord_t = sd->getPos() - sd->getCOM();
107 RealType vel =
dot(sd->getVel(), coord_t);
108 velocities_[frame].push_back(vel);
109 return velocities_[frame].size() - 1;
112 RealType VCorrFuncR::calcCorrVal(
int frame1,
int frame2,
int id1,
int id2) {
114 v2 = velocities_[frame1][id1] * velocities_[frame2][id2];
One of the heavy-weight classes of OpenMD, SimInfo maintains objects and variables relating to the cu...
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)