45#include "applications/dynamicProps/ForceAutoCorrFunc.hpp"
48#include "utils/Revision.hpp"
51 ForceAutoCorrFunc::ForceAutoCorrFunc(SimInfo* info,
52 const std::string& filename,
53 const std::string& sele1,
54 const std::string& sele2) :
55 ObjectACF<Mat3x3d>(info, filename, sele1, sele2) {
56 setCorrFuncType(
"Force - Force Auto Correlation Function");
57 setOutputName(
getPrefix(dumpFilename_) +
".facorr");
59 forces_.resize(nFrames_);
64 int ForceAutoCorrFunc::computeProperty1(
int frame, StuntDouble* sd) {
65 if (sd->isDirectional()) {
66 Mat3x3d A = sd->getA();
67 Vector3d f = sd->getFrc();
70 Vector3d f = sd->getFrc();
73 forces_[frame].push_back(propertyTemp);
74 sumForces_ += propertyTemp;
76 return forces_[frame].size() - 1;
79 Mat3x3d ForceAutoCorrFunc::calcCorrVal(
int frame1,
int frame2,
int id1,
81 return outProduct(forces_[frame1][id1], forces_[frame2][id2]);
84 void ForceAutoCorrFunc::postCorrelate() {
86 sumForces_ /= RealType(forcesCount_);
88 Mat3x3d correlationOfAverages_ = outProduct(sumForces_, sumForces_);
89 for (
unsigned int i = 0; i < nTimeBins_; ++i) {
91 histogram_[i] /= RealType(count_[i]);
95 histogram_[i] -= correlationOfAverages_;
97 histogram_[i] = M3Zero;
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.
std::string getPrefix(const std::string &str)