43 |
|
#include "utils/simError.h" |
44 |
|
|
45 |
|
namespace oopse { |
46 |
< |
DipoleCorrFunc::DipoleCorrFunc(SimInfo* info, const std::string& filename, const std::string& sele1, const std::string& sele2) |
46 |
> |
DipoleCorrFunc::DipoleCorrFunc(SimInfo* info, const std::string& filename, const std::string& sele1, const std::string& sele2) |
47 |
|
: ParticleTimeCorrFunc(info, filename, sele1, sele2, DataStorage::dslElectroFrame){ |
48 |
|
|
49 |
< |
setCorrFuncType("Dipole Correlation Function"); |
50 |
< |
setOutputName(getPrefix(dumpFilename_) + ".dcorr"); |
49 |
> |
setCorrFuncType("Dipole Correlation Function"); |
50 |
> |
setOutputName(getPrefix(dumpFilename_) + ".dcorr"); |
51 |
|
|
52 |
< |
} |
52 |
> |
} |
53 |
|
|
54 |
< |
double DipoleCorrFunc::calcCorrVal(int frame1, int frame2, StuntDouble* sd1, StuntDouble* sd2) { |
55 |
< |
Vector3d v1 =sd1->getVel(frame1); |
56 |
< |
Vector3d v2 = sd2->getVel(frame2); |
54 |
> |
double DipoleCorrFunc::calcCorrVal(int frame1, int frame2, StuntDouble* sd1, StuntDouble* sd2) { |
55 |
> |
Vector3d v1 =sd1->getElectroFrame(frame1).getColumn(2); |
56 |
> |
Vector3d v2 = sd2->getElectroFrame(frame2).getColumn(2); |
57 |
|
|
58 |
< |
return dot(v1, v2); |
59 |
< |
} |
58 |
> |
return dot(v1, v2)/(v1.length()*v2.length()); |
59 |
> |
} |
60 |
|
|
61 |
|
|
62 |
< |
void DipoleCorrFunc::validateSelection(const SelectionManager& seleMan) { |
62 |
> |
void DipoleCorrFunc::validateSelection(const SelectionManager& seleMan) { |
63 |
|
StuntDouble* sd; |
64 |
|
int i; |
65 |
|
for (sd = seleMan1_.beginSelected(i); sd != NULL; sd = seleMan1_.nextSelected(i)) { |
66 |
< |
if (!sd->isDirectionalAtom()) { |
67 |
< |
sprintf(painCave.errMsg, |
66 |
> |
if (!sd->isDirectionalAtom()) { |
67 |
> |
sprintf(painCave.errMsg, |
68 |
|
"DipoleCorrFunc::validateSelection Error: selected atoms do not have dipole moment\n"); |
69 |
< |
painCave.isFatal = 1; |
70 |
< |
simError(); |
71 |
< |
} |
69 |
> |
painCave.isFatal = 1; |
70 |
> |
simError(); |
71 |
> |
} |
72 |
|
} |
73 |
|
|
74 |
< |
} |
74 |
> |
} |
75 |
|
|
76 |
|
} |
77 |
|
|