48#include "applications/dynamicProps/MomAngMomCorrFunc.hpp"
51 MomAngMomCorrFunc::MomAngMomCorrFunc(
SimInfo* info,
52 const std::string& filename,
53 const std::string& sele1,
54 const std::string& sele2) :
55 ObjectCCF<RealType>(info, filename, sele1, sele2) {
56 setCorrFuncType(
"Momentum - Angular Momentum Correlation Function");
57 setOutputName(
getPrefix(dumpFilename_) +
".pjcorr");
59 momenta_.resize(nFrames_);
63 int MomAngMomCorrFunc::computeProperty1(
int frame, StuntDouble* sd) {
64 momenta_[frame].push_back(sd->getMass() * sd->getVel());
65 return momenta_[frame].size() - 1;
68 int MomAngMomCorrFunc::computeProperty2(
int frame, StuntDouble* sd) {
72 Vector3d u = sd->getA().getRow(2);
73 Vector3d j = sd->getJ();
75 js_[frame].push_back(
cross(j, u));
76 return js_[frame].size() - 1;
79 RealType MomAngMomCorrFunc::calcCorrVal(
int frame1,
int frame2,
int id1,
81 RealType pj =
dot(momenta_[frame1][id1], js_[frame2][id2]);
85 void MomAngMomCorrFunc::validateSelection(SelectionManager& seleMan) {
89 for (sd = seleMan.beginSelected(i); sd != NULL;
90 sd = seleMan.nextSelected(i)) {
91 if (!sd->isDirectional()) {
92 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
93 "MomAngMomCorrFunc::validateSelection Error: selection "
95 "\t is not a Directional object\n",
96 sd->getGlobalIndex(), sd->getType().c_str());
One of the heavy-weight classes of OpenMD, SimInfo maintains objects and variables relating to the cu...
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)