45#include "applications/dynamicProps/LegendreCorrFunc.hpp"
50#include "utils/Revision.hpp"
51#include "utils/simError.h"
54 LegendreCorrFunc::LegendreCorrFunc(
SimInfo* info,
const std::string& filename,
55 const std::string& sele1,
56 const std::string& sele2,
int order) :
59 setCorrFuncType(
"Legendre Correlation Function");
60 setOutputName(
getPrefix(dumpFilename_) +
".lcorr");
62 std::stringstream params;
63 params <<
" order = " << order_;
64 const std::string paramString = params.str();
65 setParameterString(paramString);
67 setLabelString(
"Pn(costheta_x)\tPn(costheta_y)\tPn(costheta_z)");
70 legendre_ = polynomial.getLegendrePolynomial(order);
72 rotMats_.resize(nFrames_);
75 int LegendreCorrFunc::computeProperty1(
int frame,
StuntDouble* sd) {
76 rotMats_[frame].push_back(sd->
getA());
77 return rotMats_[frame].size() - 1;
80 Vector3d LegendreCorrFunc::calcCorrVal(
int frame1,
int frame2,
int id1,
88 Vector3d v1x = rotMats_[frame1][id1].getRow(0);
89 Vector3d v1y = rotMats_[frame1][id1].getRow(1);
90 Vector3d v1z = rotMats_[frame1][id1].getRow(2);
92 Vector3d v2x = rotMats_[frame2][id2].getRow(0);
93 Vector3d v2y = rotMats_[frame2][id2].getRow(1);
94 Vector3d v2z = rotMats_[frame2][id2].getRow(2);
112 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
113 "LegendreCorrFunc::validateSelection Error: "
114 "at least one of the selected objects is not Directional\n");
115 painCave.isFatal = 1;
A collection of Legendre Polynomials.
Real evaluate(const Real &x)
Calculates the value of this Polynomial evaluated at the given x value.
StuntDouble * nextSelected(int &i)
Finds the next selected StuntDouble in the selection.
StuntDouble * beginSelected(int &i)
Finds the first selected StuntDouble in the selection.
One of the heavy-weight classes of OpenMD, SimInfo maintains objects and variables relating to the cu...
"Don't move, or you're dead! Stand up! Captain, we've got them!"
RotMat3x3d getA()
Returns the current rotation matrix of this stuntDouble.
bool isDirectional()
Tests if this stuntDouble is a directional one.
Real length()
Returns the length of this vector.
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)