45#include "applications/dynamicProps/TorqueAutoCorrFunc.hpp"
48#include "utils/Revision.hpp"
51 TorqueAutoCorrFunc::TorqueAutoCorrFunc(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(
"Torque Auto Correlation Function");
57 setOutputName(
getPrefix(dumpFilename_) +
".tacorr");
59 torques_.resize(nFrames_);
64 void TorqueAutoCorrFunc::validateSelection(SelectionManager& seleMan) {
68 for (sd = seleMan.beginSelected(i); sd != NULL;
69 sd = seleMan.nextSelected(i)) {
70 if (!sd->isDirectional()) {
71 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
72 "TorqueAutoCorrFunc::validateSelection Error: selection "
74 "\t is not a Directional object\n",
75 sd->getGlobalIndex(), sd->getType().c_str());
82 int TorqueAutoCorrFunc::computeProperty1(
int frame, StuntDouble* sd) {
83 Mat3x3d A = sd->getA();
84 Vector3d t = sd->getTrq();
86 torques_[frame].push_back(propertyTemp);
87 sumTorques_ += propertyTemp;
89 return torques_[frame].size() - 1;
92 Mat3x3d TorqueAutoCorrFunc::calcCorrVal(
int frame1,
int frame2,
int id1,
94 return outProduct(torques_[frame1][id1], torques_[frame2][id2]);
97 void TorqueAutoCorrFunc::postCorrelate() {
99 sumTorques_ /= RealType(torquesCount_);
101 Mat3x3d correlationOfAverages_ = outProduct(sumTorques_, sumTorques_);
102 for (
unsigned int i = 0; i < nTimeBins_; ++i) {
104 histogram_[i] /= RealType(count_[i]);
108 histogram_[i] -= correlationOfAverages_;
110 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)