| 51 |
|
#include "primitives/Molecule.hpp" |
| 52 |
|
#include "utils/simError.h" |
| 53 |
|
#include "utils/PhysicalConstants.hpp" |
| 54 |
+ |
#include "types/MultipoleAdapter.hpp" |
| 55 |
|
|
| 56 |
|
namespace OpenMD { |
| 57 |
|
|
| 143 |
|
|
| 144 |
|
RealType temperature = ( 2.0 * this->getKinetic() ) / (info_->getNdf()* PhysicalConstants::kb ); |
| 145 |
|
return temperature; |
| 146 |
+ |
} |
| 147 |
+ |
|
| 148 |
+ |
RealType Thermo::getElectronicTemperature() { |
| 149 |
+ |
SimInfo::MoleculeIterator miter; |
| 150 |
+ |
std::vector<Atom*>::iterator iiter; |
| 151 |
+ |
Molecule* mol; |
| 152 |
+ |
Atom* atom; |
| 153 |
+ |
RealType cvel; |
| 154 |
+ |
RealType cmass; |
| 155 |
+ |
RealType kinetic = 0.0; |
| 156 |
+ |
RealType kinetic_global = 0.0; |
| 157 |
+ |
|
| 158 |
+ |
for (mol = info_->beginMolecule(miter); mol != NULL; mol = info_->nextMolecule(miter)) { |
| 159 |
+ |
for (atom = mol->beginFluctuatingCharge(iiter); atom != NULL; |
| 160 |
+ |
atom = mol->nextFluctuatingCharge(iiter)) { |
| 161 |
+ |
cmass = atom->getChargeMass(); |
| 162 |
+ |
cvel = atom->getFlucQVel(); |
| 163 |
+ |
|
| 164 |
+ |
kinetic += cmass * cvel * cvel; |
| 165 |
+ |
|
| 166 |
+ |
} |
| 167 |
+ |
} |
| 168 |
+ |
|
| 169 |
+ |
#ifdef IS_MPI |
| 170 |
+ |
|
| 171 |
+ |
MPI_Allreduce(&kinetic, &kinetic_global, 1, MPI_REALTYPE, MPI_SUM, |
| 172 |
+ |
MPI_COMM_WORLD); |
| 173 |
+ |
kinetic = kinetic_global; |
| 174 |
+ |
|
| 175 |
+ |
#endif //is_mpi |
| 176 |
+ |
|
| 177 |
+ |
kinetic = kinetic * 0.5 / PhysicalConstants::energyConvert; |
| 178 |
+ |
return ( 2.0 * kinetic) / (info_->getNFluctuatingCharges()* PhysicalConstants::kb ); |
| 179 |
|
} |
| 180 |
|
|
| 181 |
+ |
|
| 182 |
+ |
|
| 183 |
+ |
|
| 184 |
|
RealType Thermo::getVolume() { |
| 185 |
|
Snapshot* curSnapshot = info_->getSnapshotManager()->getCurrentSnapshot(); |
| 186 |
|
return curSnapshot->getVolume(); |
| 246 |
|
|
| 247 |
|
RealType volume = this->getVolume(); |
| 248 |
|
Snapshot* curSnapshot = info_->getSnapshotManager()->getCurrentSnapshot(); |
| 249 |
< |
Mat3x3d tau = curSnapshot->statData.getTau(); |
| 249 |
> |
Mat3x3d tau = curSnapshot->getTau(); |
| 250 |
|
|
| 251 |
|
pressureTensor = (p_global + PhysicalConstants::energyConvert* tau)/volume; |
| 252 |
|
|
| 401 |
|
} |
| 402 |
|
} |
| 403 |
|
|
| 404 |
< |
if (atom->isDipole() ) { |
| 404 |
> |
MultipoleAdapter ma = MultipoleAdapter(atom->getAtomType()); |
| 405 |
> |
if (ma.isDipole() ) { |
| 406 |
|
Vector3d u_i = atom->getElectroFrame().getColumn(2); |
| 407 |
< |
GenericData* data = dynamic_cast<DirectionalAtomType*>(atom->getAtomType())->getPropertyByName("Dipole"); |
| 408 |
< |
if (data != NULL) { |
| 409 |
< |
moment = (dynamic_cast<DoubleGenericData*>(data))->getData(); |
| 372 |
< |
|
| 373 |
< |
moment *= debyeToCm; |
| 374 |
< |
dipoleVector += u_i * moment; |
| 375 |
< |
} |
| 407 |
> |
moment = ma.getDipoleMoment(); |
| 408 |
> |
moment *= debyeToCm; |
| 409 |
> |
dipoleVector += u_i * moment; |
| 410 |
|
} |
| 411 |
|
} |
| 412 |
|
} |