| 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). |
| 39 |
< |
* [4] Vardeman & Gezelter, in progress (2009). |
| 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 |
|
#include "parallel/ForceDecomposition.hpp" |
| 43 |
|
#include "math/Vector3.hpp" |
| 48 |
|
using namespace std; |
| 49 |
|
namespace OpenMD { |
| 50 |
|
|
| 51 |
< |
ForceDecomposition::ForceDecomposition(SimInfo* info, InteractionManager* iMan) : info_(info), interactionMan_(iMan) { |
| 51 |
> |
ForceDecomposition::ForceDecomposition(SimInfo* info, InteractionManager* iMan) : info_(info), interactionMan_(iMan), needVelocities_(false) { |
| 52 |
> |
|
| 53 |
|
sman_ = info_->getSnapshotManager(); |
| 54 |
|
storageLayout_ = sman_->getStorageLayout(); |
| 55 |
|
ff_ = info_->getForceField(); |
| 56 |
|
userChoseCutoff_ = false; |
| 57 |
|
|
| 58 |
+ |
usePeriodicBoundaryConditions_ = info->getSimParams()->getUsePeriodicBoundaryConditions(); |
| 59 |
+ |
|
| 60 |
|
Globals* simParams_ = info_->getSimParams(); |
| 61 |
< |
|
| 61 |
> |
if (simParams_->havePrintHeatFlux()) { |
| 62 |
> |
if (simParams_->getPrintHeatFlux()) { |
| 63 |
> |
needVelocities_ = true; |
| 64 |
> |
} |
| 65 |
> |
} |
| 66 |
> |
|
| 67 |
|
if (simParams_->haveSkinThickness()) { |
| 68 |
|
skinThickness_ = simParams_->getSkinThickness(); |
| 69 |
|
} else { |
| 99 |
|
void ForceDecomposition::fillSelfData(SelfData &sdat, int atom1) { |
| 100 |
|
|
| 101 |
|
sdat.atype = atypesLocal[atom1]; |
| 102 |
< |
|
| 103 |
< |
// Still Missing skippedCharge |
| 104 |
< |
if (storageLayout_ & DataStorage::dslElectroFrame) { |
| 105 |
< |
sdat.eFrame = &(snap_->atomData.electroFrame[atom1]); |
| 102 |
> |
|
| 103 |
> |
sdat.pot = &embeddingPot; |
| 104 |
> |
sdat.excludedPot = &excludedSelfPot; |
| 105 |
> |
|
| 106 |
> |
if (storageLayout_ & DataStorage::dslDipole) { |
| 107 |
> |
sdat.dipole = &(snap_->atomData.dipole[atom1]); |
| 108 |
|
} |
| 109 |
< |
|
| 109 |
> |
|
| 110 |
> |
if (storageLayout_ & DataStorage::dslQuadrupole) { |
| 111 |
> |
sdat.quadrupole = &(snap_->atomData.quadrupole[atom1]); |
| 112 |
> |
} |
| 113 |
> |
|
| 114 |
|
if (storageLayout_ & DataStorage::dslTorque) { |
| 115 |
|
sdat.t = &(snap_->atomData.torque[atom1]); |
| 116 |
|
} |
| 134 |
|
if (storageLayout_ & DataStorage::dslParticlePot) { |
| 135 |
|
sdat.particlePot = &(snap_->atomData.particlePot[atom1]); |
| 136 |
|
} |
| 137 |
+ |
|
| 138 |
+ |
if (storageLayout_ & DataStorage::dslFlucQPosition) { |
| 139 |
+ |
sdat.flucQ = &(snap_->atomData.flucQPos[atom1]); |
| 140 |
+ |
} |
| 141 |
+ |
|
| 142 |
+ |
if (storageLayout_ & DataStorage::dslFlucQForce) { |
| 143 |
+ |
sdat.dVdFQ = &(snap_->atomData.flucQFrc[atom1]); |
| 144 |
+ |
} |
| 145 |
|
} |
| 146 |
|
|
| 147 |
|
bool ForceDecomposition::checkNeighborList() { |
| 148 |
|
|
| 149 |
|
int nGroups = snap_->cgData.position.size(); |
| 150 |
< |
|
| 150 |
> |
if (needVelocities_) |
| 151 |
> |
snap_->cgData.setStorageLayout(DataStorage::dslPosition | DataStorage::dslVelocity); |
| 152 |
> |
|
| 153 |
|
// if we have changed the group identities or haven't set up the |
| 154 |
|
// saved positions we automatically will need a neighbor list update: |
| 155 |
|
|
| 177 |
|
|
| 178 |
|
return false; |
| 179 |
|
} |
| 180 |
+ |
|
| 181 |
+ |
void ForceDecomposition::addToHeatFlux(Vector3d hf) { |
| 182 |
+ |
Vector3d chf = snap_->getConductiveHeatFlux(); |
| 183 |
+ |
chf += hf; |
| 184 |
+ |
snap_->setConductiveHeatFlux(chf); |
| 185 |
+ |
} |
| 186 |
+ |
void ForceDecomposition::setHeatFlux(Vector3d hf) { |
| 187 |
+ |
snap_->setConductiveHeatFlux(hf); |
| 188 |
+ |
} |
| 189 |
+ |
|
| 190 |
|
} |