49#include "applications/dynamicProps/TimeCorrFunc.hpp"
54#include "types/MultipoleAdapter.hpp"
56#include "utils/simError.h"
60 FreqFlucCorrFunc::FreqFlucCorrFunc(SimInfo* info,
const std::string& filename,
61 const std::string& sele1,
62 const std::string& sele2) :
63 ObjectACF<RealType>(info, filename, sele1, sele2) {
64 setCorrFuncType(
"FreqFluc Correlation Function");
65 setOutputName(
getPrefix(dumpFilename_) +
".ffcorr");
68 int FreqFlucCorrFunc::computeProperty1(
int frame, StuntDouble* sd) {
69 Vector3d e = sd->getElectricField();
71 if (sd->isRigidBody()) {
72 u = sd->getA().getRow(2);
74 AtomType* at =
static_cast<Atom*
>(sd)->getAtomType();
75 MultipoleAdapter ma = MultipoleAdapter(at);
77 if (ma.isDipole()) { u = sd->getDipole(); }
80 RealType uedot =
dot(u, e);
83 ue_[frame].push_back(uedot);
84 return ue_[frame].size() - 1;
87 RealType FreqFlucCorrFunc::calcCorrVal(
int frame1,
int frame2,
int id1,
89 RealType mean = ueStats_.getAverage();
91 return (ue_[frame1][id1] - mean) * (ue_[frame2][id2] - mean);
94 void FreqFlucCorrFunc::validateSelection(SelectionManager&) {
97 for (sd = seleMan1_.beginSelected(i); sd != NULL;
98 sd = seleMan1_.nextSelected(i)) {
99 if (!sd->isRigidBody()) {
100 AtomType* at =
static_cast<Atom*
>(sd)->getAtomType();
101 MultipoleAdapter ma = MultipoleAdapter(at);
103 if (!ma.isDipole()) {
105 painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
106 "FreqFlucCorrFunc::validateSelection Error: selection is not a "
109 "\tnot have a dipole\n");
110 painCave.isFatal = 1;
Frequency Fluctuation Correlation Function.
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)