45#include "applications/dynamicProps/CollectiveDipoleDisplacement.hpp"
47#include "types/FixedChargeAdapter.hpp"
48#include "types/FluctuatingChargeAdapter.hpp"
49#include "utils/Revision.hpp"
53 CollectiveDipoleDisplacement::CollectiveDipoleDisplacement(
54 SimInfo* info,
const string& filename,
const string& sele1,
55 const std::string& sele2) :
57 setCorrFuncType(
"Collective Dipole Displacement Function");
58 setOutputName(
getPrefix(dumpFilename_) +
".ddisp");
60 std::stringstream label;
61 label <<
"<|Mtrans(t)-Mtrans(0)|^2>\t"
62 <<
"<|Mtot(t)-Mtot(0)|^2>\t"
63 <<
"<|Mrot(t)-Mrot(0)|^2>";
64 const std::string labelString = label.str();
65 setLabelString(labelString);
67 CRcm_.resize(nFrames_, V3Zero);
68 CRtot_.resize(nFrames_, V3Zero);
69 CRrot_.resize(nFrames_, V3Zero);
72 thermo_ =
new Thermo(info_);
75 void CollectiveDipoleDisplacement::computeProperty1(
int frame) {
76 SimInfo::MoleculeIterator mi;
78 Molecule::AtomIterator ai;
93 for (atom = mol->beginAtom(ai); atom != NULL; atom = mol->nextAtom(ai)) {
97 if (fca.isFixedCharge()) q = fca.getCharge();
99 if (fqa.isFluctuatingCharge()) q += atom->
getFlucQPos();
113 if (qtot <= std::numeric_limits<RealType>::min()) {
119 CRcm_[frame] += qtot * rcm;
120 CRtot_[frame] += qtot * rcq;
121 CRrot_[frame] += qtot * (rcq - rcm);
125 RealType vol = thermo_->getVolume();
127 CRcm_[frame] /= (vol * Constants::chargeDensityConvert);
128 CRtot_[frame] /= (vol * Constants::chargeDensityConvert);
129 CRrot_[frame] /= (vol * Constants::chargeDensityConvert);
132 Vector3d CollectiveDipoleDisplacement::calcCorrVal(
int frame1,
int frame2) {
134 RealType dcm, dtot, drot;
135 diff = CRcm_[frame2] - CRcm_[frame1];
137 diff = CRtot_[frame2] - CRtot_[frame1];
139 diff = CRrot_[frame2] - CRrot_[frame1];
AtomType * getAtomType()
Returns the AtomType of this Atom.
AtomType is what OpenMD looks to for unchanging data about an atom.
One of the heavy-weight classes of OpenMD, SimInfo maintains objects and variables relating to the cu...
Molecule * beginMolecule(MoleculeIterator &i)
Returns the first molecule in this SimInfo and intialize the iterator.
Molecule * nextMolecule(MoleculeIterator &i)
Returns the next avaliable Molecule based on the iterator.
RealType getMass()
Returns the mass of this stuntDouble.
Vector3d getPos()
Returns the current position of this stuntDouble.
RealType getFlucQPos()
Returns the current fluctuating charge of this stuntDouble.
Real lengthSquare()
Returns the squared length of this vector.
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.
std::string getPrefix(const std::string &str)