| 57 |
|
using namespace QuantLib; |
| 58 |
|
namespace OpenMD { |
| 59 |
|
|
| 60 |
< |
FluctuatingChargePropagator::FluctuatingChargePropagator(SimInfo* info, |
| 61 |
< |
ForceManager* fm) : |
| 62 |
< |
info_(info), forceMan_(fm), hasFlucQ_(false) { |
| 60 |
> |
FluctuatingChargePropagator::FluctuatingChargePropagator(SimInfo* info) : |
| 61 |
> |
info_(info), hasFlucQ_(false), forceMan_(NULL) { |
| 62 |
|
|
| 63 |
+ |
Globals* simParams = info_->getSimParams(); |
| 64 |
+ |
fqParams_ = simParams->getFluctuatingChargeParameters(); |
| 65 |
+ |
|
| 66 |
+ |
} |
| 67 |
+ |
|
| 68 |
+ |
void FluctuatingChargePropagator::setForceManager(ForceManager* forceMan) { |
| 69 |
+ |
forceMan_ = forceMan; |
| 70 |
+ |
} |
| 71 |
+ |
|
| 72 |
+ |
void FluctuatingChargePropagator::initialize() { |
| 73 |
+ |
|
| 74 |
|
if (info_->usesFluctuatingCharges()) { |
| 75 |
|
if (info_->getNFluctuatingCharges() > 0) { |
| 66 |
– |
|
| 76 |
|
hasFlucQ_ = true; |
| 77 |
< |
Globals* simParams = info_->getSimParams(); |
| 69 |
< |
fqParams_ = simParams->getFluctuatingChargeParameters(); |
| 70 |
< |
fqConstraints_ = new FluctuatingChargeConstraints(info_); |
| 71 |
< |
|
| 77 |
> |
fqConstraints_ = new FluctuatingChargeConstraints(info_); |
| 78 |
|
} |
| 79 |
|
} |
| 74 |
– |
} |
| 80 |
|
|
| 76 |
– |
void FluctuatingChargePropagator::initialize() { |
| 77 |
– |
|
| 81 |
|
if (!hasFlucQ_) return; |
| 82 |
|
|
| 83 |
|
SimInfo::MoleculeIterator i; |
| 103 |
|
EndCriteria endCriteria(1000, 100, 1e-5, 1e-5, 1e-5); |
| 104 |
|
OptimizationMethod* minim = OptimizationFactory::getInstance()->createOptimization("SD", info_); |
| 105 |
|
|
| 106 |
< |
DumpStatusFunction dsf(info_); // we want a dump file written every iteration |
| 106 |
> |
DumpStatusFunction dsf(info_); // we want a dump file written every iteration |
| 107 |
|
|
| 108 |
|
minim->minimize(problem, endCriteria); |
| 109 |
|
cerr << "Finished minimization\n"; |
| 114 |
|
cerr << atom->getType() << "\tQ Pos: " << atom->getFlucQPos() << "\n"; |
| 115 |
|
} |
| 116 |
|
} |
| 114 |
– |
// std::cerr << "after minim\n"; |
| 115 |
– |
// for (mol = info_->beginMolecule(i); mol != NULL; |
| 116 |
– |
// mol = info_->nextMolecule(i)) { |
| 117 |
– |
// for (atom = mol->beginFluctuatingCharge(j); atom != NULL; |
| 118 |
– |
// atom = mol->nextFluctuatingCharge(j)) { |
| 119 |
– |
// cerr << "q = " << atom->getFlucQPos(0.0) << "\n"; |
| 120 |
– |
// } |
| 121 |
– |
// } |
| 122 |
– |
|
| 123 |
– |
|
| 117 |
|
} |
| 118 |
|
|
| 119 |
|
|