32 |
|
*/ |
33 |
|
|
34 |
|
#include "integrators/VelocityVerletIntegrator.hpp" |
35 |
+ |
#include "integrators/DLM.hpp" |
36 |
|
|
37 |
|
namespace oopse { |
38 |
< |
VelocityVerletIntegrator::VelocityVerletIntegrator(SimInfo *info) : Integrator(info) { |
38 |
> |
VelocityVerletIntegrator::VelocityVerletIntegrator(SimInfo *info) : Integrator(info), rotAlgo(NULL) { |
39 |
> |
rotAlgo = new DLM(); |
40 |
|
dt2 = 0.5 * dt; |
41 |
|
} |
42 |
|
|
43 |
< |
VelocityVerletIntegrator::~VelocityVerletIntegrator() { } |
43 |
> |
VelocityVerletIntegrator::~VelocityVerletIntegrator() { |
44 |
> |
delete rotAlgo; |
45 |
> |
} |
46 |
|
|
47 |
|
void VelocityVerletIntegrator::initialize(){ |
48 |
|
|
73 |
|
dumpWriter = createDumpWriter(); |
74 |
|
statWriter = createStatWriter(); |
75 |
|
|
76 |
< |
dumpWriter->writeFrame(); |
77 |
< |
statWriter->writeStat(currentSnapshot_.statData); |
78 |
< |
|
75 |
< |
|
76 |
> |
dumpWriter->writeDump(); |
77 |
> |
statWriter->writeStat(currentSnapshot_->statData); |
78 |
> |
|
79 |
|
} |
80 |
|
|
81 |
|
void VelocityVerletIntegrator::doIntegrate() { |
88 |
|
preStep(); |
89 |
|
|
90 |
|
integrateStep(); |
88 |
– |
|
89 |
– |
info_->incrTime(dt); |
91 |
|
|
92 |
|
postStep(); |
93 |
|
|
109 |
|
} |
110 |
|
|
111 |
|
void VelocityVerletIntegrator::postStep() { |
112 |
+ |
|
113 |
+ |
//save snapshot |
114 |
+ |
info_->getSnapshotManager()->advance(); |
115 |
+ |
|
116 |
+ |
//increase time |
117 |
+ |
currentSnapshot_->increaseTime(dt); |
118 |
+ |
|
119 |
+ |
//save statistics |
120 |
+ |
thermo.saveStat(); |
121 |
|
|
112 |
– |
|
122 |
|
if (needVelocityScaling) { |
123 |
|
if (currentSnapshot_->getTime() >= currThermal) { |
124 |
|
velocitizer_->velocitize(targetScalingTemp); |
127 |
|
} |
128 |
|
|
129 |
|
if (currentSnapshot_->getTime() >= currSample) { |
130 |
< |
dumpWriter->writeFrame(currentSnapshot_->getTime()); |
130 |
> |
dumpWriter->writeDump(); |
131 |
|
currSample += sampleTime; |
132 |
|
} |
133 |
|
|
134 |
|
if (currentSnapshot_->getTime() >= currStatus) { |
135 |
< |
statWriter->writeStat(currentSnapshot_.statData); |
135 |
> |
statWriter->writeStat(currentSnapshot_->statData); |
136 |
|
needPotential = false; |
137 |
|
needStress = false; |
138 |
|
currStatus += statusTime; |
139 |
|
} |
140 |
+ |
|
141 |
+ |
|
142 |
|
} |
143 |
|
|
144 |
|
|
145 |
|
void VelocityVerletIntegrator::finalize() { |
146 |
|
|
147 |
< |
dumpWriter->writeFrame(); |
147 |
> |
dumpWriter->writeDump(); |
148 |
|
|
149 |
|
delete dumpWriter; |
150 |
|
delete statWriter; |
164 |
|
|
165 |
|
void VelocityVerletIntegrator::calcForce(bool needPotential, |
166 |
|
bool needStress) { |
167 |
< |
forceMan_->calcForces(needPotential, needStress) |
167 |
> |
forceMan_->calcForces(needPotential, needStress); |
168 |
|
} |
169 |
|
|
170 |
+ |
DumpWriter* VelocityVerletIntegrator::createDumpWriter() { |
171 |
+ |
return new DumpWriter(info_, info_->getDumpFileName()); |
172 |
+ |
} |
173 |
|
|
174 |
+ |
StatWriter* VelocityVerletIntegrator::createStatWriter() { |
175 |
+ |
return new StatWriter(info_->getStatFileName()); |
176 |
+ |
} |
177 |
+ |
|
178 |
+ |
|
179 |
|
} //end namespace oopse |