45#include "applications/dynamicProps/MomAngMomCorrFunc.hpp"
48 MomAngMomCorrFunc::MomAngMomCorrFunc(SimInfo* info,
49 const std::string& filename,
50 const std::string& sele1,
51 const std::string& sele2) :
52 ObjectCCF<RealType>(info, filename, sele1, sele2) {
53 setCorrFuncType(
"Momentum - Angular Momentum Correlation Function");
54 setOutputName(
getPrefix(dumpFilename_) +
".pjcorr");
56 momenta_.resize(nFrames_);
60 int MomAngMomCorrFunc::computeProperty1(
int frame, StuntDouble* sd) {
61 momenta_[frame].push_back(sd->getMass() * sd->getVel());
62 return momenta_[frame].size() - 1;
65 int MomAngMomCorrFunc::computeProperty2(
int frame, StuntDouble* sd) {
69 Vector3d u = sd->getA().getRow(2);
70 Vector3d j = sd->getJ();
72 js_[frame].push_back(
cross(j, u));
73 return js_[frame].size() - 1;
76 RealType MomAngMomCorrFunc::calcCorrVal(
int frame1,
int frame2,
int id1,
78 RealType pj =
dot(momenta_[frame1][id1], js_[frame2][id2]);
82 void MomAngMomCorrFunc::validateSelection(SelectionManager& seleMan) {
86 for (sd = seleMan.beginSelected(i); sd != NULL;
87 sd = seleMan.nextSelected(i)) {
88 if (!sd->isDirectional()) {
89 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
90 "MomAngMomCorrFunc::validateSelection Error: selection "
92 "\t is not a Directional object\n",
93 sd->getGlobalIndex(), sd->getType().c_str());
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.
Vector3< Real > cross(const Vector3< Real > &v1, const Vector3< Real > &v2)
Returns the cross product of two Vectors.
Real dot(const DynamicVector< Real > &v1, const DynamicVector< Real > &v2)
Returns the dot product of two DynamicVectors.
std::string getPrefix(const std::string &str)