| 35 |  | * | 
| 36 |  | * [1]  Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). | 
| 37 |  | * [2]  Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). | 
| 38 | < | * [3]  Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). | 
| 38 | > | * [3]  Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008). | 
| 39 |  | * [4]  Kuang & Gezelter,  J. Chem. Phys. 133, 164101 (2010). | 
| 40 |  | * [5]  Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). | 
| 41 |  | */ | 
| 42 |  |  | 
| 43 | – | /** | 
| 44 | – | * @file Stats.cpp | 
| 45 | – | * @author tlin | 
| 46 | – | * @date 11/04/2004 | 
| 47 | – | * @time 14:26am | 
| 48 | – | * @version 1.0 | 
| 49 | – | */ | 
| 50 | – |  | 
| 43 |  | #include "brains/Stats.hpp" | 
| 44 |  | #include "brains/Thermo.hpp" | 
| 45 |  |  | 
| 187 |  |  | 
| 188 |  | StatsData hydrogenbonding_potential; | 
| 189 |  | hydrogenbonding_potential.units =  "kcal/mol"; | 
| 190 | < | hydrogenbonding_potential.title =  "Metallic Potential"; | 
| 190 | > | hydrogenbonding_potential.title =  "Hydrogen Bonding Potential"; | 
| 191 |  | hydrogenbonding_potential.dataType = "RealType"; | 
| 192 |  | hydrogenbonding_potential.accumulator = new Accumulator(); | 
| 193 |  | data_[HYDROGENBONDING_POTENTIAL] = hydrogenbonding_potential; | 
| 194 |  | statsMap_["HYDROGENBONDING_POTENTIAL"] =  HYDROGENBONDING_POTENTIAL; | 
| 195 |  |  | 
| 196 | + | StatsData reciprocal_potential; | 
| 197 | + | reciprocal_potential.units =  "kcal/mol"; | 
| 198 | + | reciprocal_potential.title =  "Reciprocal Space Potential"; | 
| 199 | + | reciprocal_potential.dataType = "RealType"; | 
| 200 | + | reciprocal_potential.accumulator = new Accumulator(); | 
| 201 | + | data_[RECIPROCAL_POTENTIAL] = reciprocal_potential; | 
| 202 | + | statsMap_["RECIPROCAL_POTENTIAL"] =  RECIPROCAL_POTENTIAL; | 
| 203 | + |  | 
| 204 |  | StatsData short_range_potential; | 
| 205 |  | short_range_potential.units =  "kcal/mol"; | 
| 206 |  | short_range_potential.title =  "Short Range Potential"; | 
| 273 |  | data_[SYSTEM_DIPOLE] = system_dipole; | 
| 274 |  | statsMap_["SYSTEM_DIPOLE"] =  SYSTEM_DIPOLE; | 
| 275 |  |  | 
| 276 | + | StatsData system_quadrupole; | 
| 277 | + | system_quadrupole.units =  "C*m*m"; | 
| 278 | + | system_quadrupole.title =  "System Quadrupole"; | 
| 279 | + | system_quadrupole.dataType = "Mat3x3d"; | 
| 280 | + | system_quadrupole.accumulator = new MatrixAccumulator(); | 
| 281 | + | data_[SYSTEM_QUADRUPOLE] = system_quadrupole; | 
| 282 | + | statsMap_["SYSTEM_QUADRUPOLE"] =  SYSTEM_QUADRUPOLE; | 
| 283 | + |  | 
| 284 |  | StatsData tagged_pair_distance; | 
| 285 |  | tagged_pair_distance.units =  "Ang"; | 
| 286 |  | tagged_pair_distance.title =  "Tagged_Pair_Distance"; | 
| 320 |  | electronic_temperature.accumulator = new Accumulator(); | 
| 321 |  | data_[ELECTRONIC_TEMPERATURE] = electronic_temperature; | 
| 322 |  | statsMap_["ELECTRONIC_TEMPERATURE"] = ELECTRONIC_TEMPERATURE; | 
| 323 | + |  | 
| 324 | + | StatsData com; | 
| 325 | + | com.units =  "A"; | 
| 326 | + | com.title =  "Center of Mass"; | 
| 327 | + | com.dataType = "Vector3d"; | 
| 328 | + | com.accumulator = new VectorAccumulator(); | 
| 329 | + | data_[COM] = com; | 
| 330 | + | statsMap_["COM"] =  COM; | 
| 331 | + |  | 
| 332 | + | StatsData comVel; | 
| 333 | + | comVel.units =  "A/fs"; | 
| 334 | + | comVel.title =  "Center of Mass Velocity"; | 
| 335 | + | comVel.dataType = "Vector3d"; | 
| 336 | + | comVel.accumulator = new VectorAccumulator(); | 
| 337 | + | data_[COM_VELOCITY] = comVel; | 
| 338 | + | statsMap_["COM_VELOCITY"] =  COM_VELOCITY; | 
| 339 | + |  | 
| 340 | + | StatsData angMom; | 
| 341 | + | angMom.units =  "amu A^2/fs"; | 
| 342 | + | angMom.title =  "Angular Momentum"; | 
| 343 | + | angMom.dataType = "Vector3d"; | 
| 344 | + | angMom.accumulator = new VectorAccumulator(); | 
| 345 | + | data_[ANGULAR_MOMENTUM] = angMom; | 
| 346 | + | statsMap_["ANGULAR_MOMENTUM"] =  ANGULAR_MOMENTUM; | 
| 347 |  |  | 
| 348 |  | // Now, set some defaults in the mask: | 
| 349 |  |  | 
| 376 |  | statsMask_.set(SYSTEM_DIPOLE); | 
| 377 |  | } | 
| 378 |  |  | 
| 379 | + | // Why do we have both of these? | 
| 380 | + | if (simParams->getAccumulateBoxQuadrupole()) { | 
| 381 | + | statsMask_.set(SYSTEM_QUADRUPOLE); | 
| 382 | + | } | 
| 383 | + | if (info_->getCalcBoxQuadrupole()){ | 
| 384 | + | statsMask_.set(SYSTEM_QUADRUPOLE); | 
| 385 | + | } | 
| 386 | + |  | 
| 387 |  | if (simParams->havePrintHeatFlux()) { | 
| 388 |  | if (simParams->getPrintHeatFlux()){ | 
| 389 |  | statsMask_.set(HEATFLUX); | 
| 419 |  | } | 
| 420 |  | } | 
| 421 |  |  | 
| 422 | + | Stats::~Stats() { | 
| 423 | + | data_.clear(); | 
| 424 | + | statsMap_.clear(); | 
| 425 | + | } | 
| 426 |  |  | 
| 427 |  | std::string Stats::getTitle(int index) { | 
| 428 |  | assert(index >=0 && index < ENDINDEX); | 
| 440 |  | } | 
| 441 |  |  | 
| 442 |  | void Stats::collectStats(){ | 
| 399 | – | Globals* simParams = info_->getSimParams(); | 
| 443 |  | Snapshot* snap = info_->getSnapshotManager()->getCurrentSnapshot(); | 
| 444 |  | Thermo thermo(info_); | 
| 445 |  |  | 
| 447 |  | if (statsMask_[i]) { | 
| 448 |  | switch (i) { | 
| 449 |  | case TIME: | 
| 450 | < | data_[i].accumulator->add(snap->getTime()); | 
| 450 | > | dynamic_cast<Accumulator *>(data_[i].accumulator)->add(snap->getTime()); | 
| 451 |  | break; | 
| 452 |  | case KINETIC_ENERGY: | 
| 453 | < | data_[i].accumulator->add(thermo.getKinetic()); | 
| 453 | > | dynamic_cast<Accumulator *>(data_[i].accumulator)->add(thermo.getKinetic()); | 
| 454 |  | break; | 
| 455 |  | case POTENTIAL_ENERGY: | 
| 456 | < | data_[i].accumulator->add(thermo.getPotential()); | 
| 456 | > | dynamic_cast<Accumulator *>(data_[i].accumulator)->add(thermo.getPotential()); | 
| 457 |  | break; | 
| 458 |  | case TOTAL_ENERGY: | 
| 459 | < | data_[i].accumulator->add(thermo.getTotalEnergy()); | 
| 459 | > | dynamic_cast<Accumulator *>(data_[i].accumulator)->add(thermo.getTotalEnergy()); | 
| 460 |  | break; | 
| 461 |  | case TEMPERATURE: | 
| 462 | < | data_[i].accumulator->add(thermo.getTemperature()); | 
| 462 | > | dynamic_cast<Accumulator *>(data_[i].accumulator)->add(thermo.getTemperature()); | 
| 463 |  | break; | 
| 464 |  | case PRESSURE: | 
| 465 | < | data_[i].accumulator->add(thermo.getPressure()); | 
| 465 | > | dynamic_cast<Accumulator *>(data_[i].accumulator)->add(thermo.getPressure()); | 
| 466 |  | break; | 
| 467 |  | case VOLUME: | 
| 468 | < | data_[i].accumulator->add(thermo.getVolume()); | 
| 468 | > | dynamic_cast<Accumulator *>(data_[i].accumulator)->add(thermo.getVolume()); | 
| 469 |  | break; | 
| 470 |  | case CONSERVED_QUANTITY: | 
| 471 | < | data_[i].accumulator->add(snap->getConservedQuantity()); | 
| 471 | > | dynamic_cast<Accumulator *>(data_[i].accumulator)->add(snap->getConservedQuantity()); | 
| 472 |  | break; | 
| 473 |  | case PRESSURE_TENSOR: | 
| 474 |  | dynamic_cast<MatrixAccumulator *>(data_[i].accumulator)->add(thermo.getPressureTensor()); | 
| 476 |  | case SYSTEM_DIPOLE: | 
| 477 |  | dynamic_cast<VectorAccumulator *>(data_[i].accumulator)->add(thermo.getSystemDipole()); | 
| 478 |  | break; | 
| 479 | + | case SYSTEM_QUADRUPOLE: | 
| 480 | + | dynamic_cast<MatrixAccumulator *>(data_[i].accumulator)->add(thermo.getSystemQuadrupole()); | 
| 481 | + | break; | 
| 482 |  | case HEATFLUX: | 
| 483 |  | dynamic_cast<VectorAccumulator *>(data_[i].accumulator)->add(thermo.getHeatFlux()); | 
| 484 |  | break; | 
| 485 |  | case HULLVOLUME: | 
| 486 | < | data_[i].accumulator->add(thermo.getHullVolume()); | 
| 486 | > | dynamic_cast<Accumulator *>(data_[i].accumulator)->add(thermo.getHullVolume()); | 
| 487 |  | break; | 
| 488 |  | case GYRVOLUME: | 
| 489 | < | data_[i].accumulator->add(thermo.getGyrationalVolume()); | 
| 489 | > | dynamic_cast<Accumulator *>(data_[i].accumulator)->add(thermo.getGyrationalVolume()); | 
| 490 |  | break; | 
| 491 |  | case TRANSLATIONAL_KINETIC: | 
| 492 | < | data_[i].accumulator->add(thermo.getTranslationalKinetic()); | 
| 492 | > | dynamic_cast<Accumulator *>(data_[i].accumulator)->add(thermo.getTranslationalKinetic()); | 
| 493 |  | break; | 
| 494 |  | case ROTATIONAL_KINETIC: | 
| 495 | < | data_[i].accumulator->add(thermo.getRotationalKinetic()); | 
| 495 | > | dynamic_cast<Accumulator *>(data_[i].accumulator)->add(thermo.getRotationalKinetic()); | 
| 496 |  | break; | 
| 497 |  | case LONG_RANGE_POTENTIAL: | 
| 498 | < | data_[i].accumulator->add(snap->getLongRangePotential()); | 
| 498 | > | dynamic_cast<Accumulator *>(data_[i].accumulator)->add(snap->getLongRangePotential()); | 
| 499 |  | break; | 
| 500 |  | case VANDERWAALS_POTENTIAL: | 
| 501 | < | data_[i].accumulator->add(snap->getLongRangePotentials()[VANDERWAALS_FAMILY]); | 
| 501 | > | dynamic_cast<Accumulator *>(data_[i].accumulator)->add(snap->getLongRangePotentials()[VANDERWAALS_FAMILY]); | 
| 502 |  | break; | 
| 503 |  | case ELECTROSTATIC_POTENTIAL: | 
| 504 | < | data_[i].accumulator->add(snap->getLongRangePotentials()[ELECTROSTATIC_FAMILY]); | 
| 504 | > | dynamic_cast<Accumulator *>(data_[i].accumulator)->add(snap->getLongRangePotentials()[ELECTROSTATIC_FAMILY]); | 
| 505 |  | break; | 
| 506 |  | case METALLIC_POTENTIAL: | 
| 507 | < | data_[i].accumulator->add(snap->getLongRangePotentials()[METALLIC_FAMILY]); | 
| 507 | > | dynamic_cast<Accumulator *>(data_[i].accumulator)->add(snap->getLongRangePotentials()[METALLIC_FAMILY]); | 
| 508 |  | break; | 
| 509 |  | case HYDROGENBONDING_POTENTIAL: | 
| 510 | < | data_[i].accumulator->add(snap->getLongRangePotentials()[HYDROGENBONDING_FAMILY]); | 
| 510 | > | dynamic_cast<Accumulator *>(data_[i].accumulator)->add(snap->getLongRangePotentials()[HYDROGENBONDING_FAMILY]); | 
| 511 |  | break; | 
| 512 | + | case RECIPROCAL_POTENTIAL: | 
| 513 | + | dynamic_cast<Accumulator *>(data_[i].accumulator)->add(snap->getReciprocalPotential()); | 
| 514 | + | break; | 
| 515 |  | case SHORT_RANGE_POTENTIAL: | 
| 516 | < | data_[i].accumulator->add(snap->getShortRangePotential()); | 
| 516 | > | dynamic_cast<Accumulator *>(data_[i].accumulator)->add(snap->getShortRangePotential()); | 
| 517 |  | break; | 
| 518 |  | case BOND_POTENTIAL: | 
| 519 | < | data_[i].accumulator->add(snap->getBondPotential()); | 
| 519 | > | dynamic_cast<Accumulator *>(data_[i].accumulator)->add(snap->getBondPotential()); | 
| 520 |  | break; | 
| 521 |  | case BEND_POTENTIAL: | 
| 522 | < | data_[i].accumulator->add(snap->getBendPotential()); | 
| 522 | > | dynamic_cast<Accumulator *>(data_[i].accumulator)->add(snap->getBendPotential()); | 
| 523 |  | break; | 
| 524 |  | case DIHEDRAL_POTENTIAL: | 
| 525 | < | data_[i].accumulator->add(snap->getTorsionPotential()); | 
| 525 | > | dynamic_cast<Accumulator *>(data_[i].accumulator)->add(snap->getTorsionPotential()); | 
| 526 |  | break; | 
| 527 |  | case INVERSION_POTENTIAL: | 
| 528 | < | data_[i].accumulator->add(snap->getInversionPotential()); | 
| 528 | > | dynamic_cast<Accumulator *>(data_[i].accumulator)->add(snap->getInversionPotential()); | 
| 529 |  | break; | 
| 530 |  | case RAW_POTENTIAL: | 
| 531 | < | data_[i].accumulator->add(snap->getRawPotential()); | 
| 531 | > | dynamic_cast<Accumulator *>(data_[i].accumulator)->add(snap->getRawPotential()); | 
| 532 |  | break; | 
| 533 |  | case RESTRAINT_POTENTIAL: | 
| 534 | < | data_[i].accumulator->add(snap->getRestraintPotential()); | 
| 534 | > | dynamic_cast<Accumulator *>(data_[i].accumulator)->add(snap->getRestraintPotential()); | 
| 535 |  | break; | 
| 536 |  | case TAGGED_PAIR_DISTANCE: | 
| 537 | < | data_[i].accumulator->add(thermo.getTaggedAtomPairDistance()); | 
| 537 | > | dynamic_cast<Accumulator *>(data_[i].accumulator)->add(thermo.getTaggedAtomPairDistance()); | 
| 538 |  | break; | 
| 539 | + | case ELECTRONIC_TEMPERATURE: | 
| 540 | + | dynamic_cast<Accumulator *>(data_[i].accumulator)->add(thermo.getElectronicTemperature()); | 
| 541 | + | break; | 
| 542 | + | case COM: | 
| 543 | + | dynamic_cast<VectorAccumulator *>(data_[i].accumulator)->add(thermo.getCom()); | 
| 544 | + | break; | 
| 545 | + | case COM_VELOCITY: | 
| 546 | + | dynamic_cast<VectorAccumulator *>(data_[i].accumulator)->add(thermo.getComVel()); | 
| 547 | + | break; | 
| 548 | + | case ANGULAR_MOMENTUM: | 
| 549 | + | dynamic_cast<VectorAccumulator *>(data_[i].accumulator)->add(thermo.getAngularMomentum()); | 
| 550 | + | break; | 
| 551 |  | /* | 
| 552 |  | case SHADOWH: | 
| 553 | < | data_[i].accumulator->add(thermo.getShadowHamiltionian()); | 
| 553 | > | dynamic_cast<Accumulator *>(data_[i].accumulator)->add(thermo.getShadowHamiltionian()); | 
| 554 |  | break; | 
| 555 |  | case HELFANDMOMENT: | 
| 556 | < | data_[i].accumulator->add(thermo.getHelfandMoment()); | 
| 556 | > | dynamic_cast<Accumulator *>(data_[i].accumulator)->add(thermo.getHelfandMoment()); | 
| 557 |  | break; | 
| 558 |  | */ | 
| 498 | – | case ELECTRONIC_TEMPERATURE: | 
| 499 | – | data_[i].accumulator->add(thermo.getElectronicTemperature()); | 
| 500 | – | break; | 
| 559 |  | } | 
| 560 |  | } | 
| 561 |  | } | 
| 564 |  | int Stats::getIntData(int index) { | 
| 565 |  | assert(index >=0 && index < ENDINDEX); | 
| 566 |  | RealType value; | 
| 567 | < | data_[index].accumulator->getLastValue(value); | 
| 567 | > | dynamic_cast<Accumulator *>(data_[index].accumulator)->getLastValue(value); | 
| 568 |  | return (int) value; | 
| 569 |  | } | 
| 570 |  | RealType Stats::getRealData(int index) { | 
| 571 |  | assert(index >=0 && index < ENDINDEX); | 
| 572 |  | RealType value(0.0); | 
| 573 | < | data_[index].accumulator->getLastValue(value); | 
| 573 | > | dynamic_cast<Accumulator *>(data_[index].accumulator)->getLastValue(value); | 
| 574 |  | return value; | 
| 575 |  | } | 
| 576 |  | Vector3d Stats::getVectorData(int index) { |