# | Line 1 | Line 1 | |
---|---|---|
1 | #include <iostream> | |
2 | < | #include <cstdlib> |
2 | > | #include <stdlib.h> |
3 | > | #include <math.h> |
4 | ||
5 | #ifdef IS_MPI | |
6 | #include "mpiSimulation.hpp" | |
# | Line 10 | Line 11 | |
11 | #include "simError.h" | |
12 | ||
13 | ||
14 | < | Integrator::Integrator( SimInfo* theInfo, ForceFields* the_ff ){ |
15 | < | |
14 | > | template<typename T> Integrator<T>::Integrator(SimInfo* theInfo, |
15 | > | ForceFields* the_ff){ |
16 | info = theInfo; | |
17 | myFF = the_ff; | |
18 | isFirst = 1; | |
# | Line 20 | Line 21 | Integrator::Integrator( SimInfo* theInfo, ForceFields* | |
21 | nMols = info->n_mol; | |
22 | ||
23 | // give a little love back to the SimInfo object | |
23 | – | |
24 | – | if( info->the_integrator != NULL ) delete info->the_integrator; |
25 | – | info->the_integrator = this; |
24 | ||
25 | + | if (info->the_integrator != NULL){ |
26 | + | delete info->the_integrator; |
27 | + | } |
28 | + | |
29 | nAtoms = info->n_atoms; | |
30 | ||
31 | // check for constraints | |
32 | < | |
33 | < | constrainedA = NULL; |
34 | < | constrainedB = NULL; |
32 | > | |
33 | > | constrainedA = NULL; |
34 | > | constrainedB = NULL; |
35 | constrainedDsqr = NULL; | |
36 | < | moving = NULL; |
37 | < | moved = NULL; |
38 | < | prePos = NULL; |
39 | < | |
36 | > | moving = NULL; |
37 | > | moved = NULL; |
38 | > | oldPos = NULL; |
39 | > | |
40 | nConstrained = 0; | |
41 | ||
42 | checkConstraints(); | |
43 | } | |
44 | ||
45 | < | Integrator::~Integrator() { |
46 | < | |
45 | < | if( nConstrained ){ |
45 | > | template<typename T> Integrator<T>::~Integrator(){ |
46 | > | if (nConstrained){ |
47 | delete[] constrainedA; | |
48 | delete[] constrainedB; | |
49 | delete[] constrainedDsqr; | |
50 | delete[] moving; | |
51 | delete[] moved; | |
52 | < | delete[] prePos; |
52 | < | k |
52 | > | delete[] oldPos; |
53 | } | |
54 | – | |
54 | } | |
55 | ||
56 | < | void Integrator::checkConstraints( void ){ |
58 | < | |
59 | < | |
56 | > | template<typename T> void Integrator<T>::checkConstraints(void){ |
57 | isConstrained = 0; | |
58 | ||
59 | < | Constraint *temp_con; |
60 | < | Constraint *dummy_plug; |
59 | > | Constraint* temp_con; |
60 | > | Constraint* dummy_plug; |
61 | temp_con = new Constraint[info->n_SRI]; | |
62 | nConstrained = 0; | |
63 | int constrained = 0; | |
64 | < | |
64 | > | |
65 | SRI** theArray; | |
66 | < | for(int i = 0; i < nMols; i++){ |
67 | < | |
68 | < | theArray = (SRI**) molecules[i].getMyBonds(); |
72 | < | for(int j=0; j<molecules[i].getNBonds(); j++){ |
73 | < | |
66 | > | for (int i = 0; i < nMols; i++){ |
67 | > | theArray = (SRI * *) molecules[i].getMyBonds(); |
68 | > | for (int j = 0; j < molecules[i].getNBonds(); j++){ |
69 | constrained = theArray[j]->is_constrained(); | |
70 | < | |
71 | < | if(constrained){ |
72 | < | |
73 | < | dummy_plug = theArray[j]->get_constraint(); |
74 | < | temp_con[nConstrained].set_a( dummy_plug->get_a() ); |
75 | < | temp_con[nConstrained].set_b( dummy_plug->get_b() ); |
76 | < | temp_con[nConstrained].set_dsqr( dummy_plug->get_dsqr() ); |
77 | < | |
78 | < | nConstrained++; |
84 | < | constrained = 0; |
70 | > | |
71 | > | if (constrained){ |
72 | > | dummy_plug = theArray[j]->get_constraint(); |
73 | > | temp_con[nConstrained].set_a(dummy_plug->get_a()); |
74 | > | temp_con[nConstrained].set_b(dummy_plug->get_b()); |
75 | > | temp_con[nConstrained].set_dsqr(dummy_plug->get_dsqr()); |
76 | > | |
77 | > | nConstrained++; |
78 | > | constrained = 0; |
79 | } | |
80 | } | |
81 | ||
82 | < | theArray = (SRI**) molecules[i].getMyBends(); |
83 | < | for(int j=0; j<molecules[i].getNBends(); j++){ |
90 | < | |
82 | > | theArray = (SRI * *) molecules[i].getMyBends(); |
83 | > | for (int j = 0; j < molecules[i].getNBends(); j++){ |
84 | constrained = theArray[j]->is_constrained(); | |
85 | < | |
86 | < | if(constrained){ |
87 | < | |
88 | < | dummy_plug = theArray[j]->get_constraint(); |
89 | < | temp_con[nConstrained].set_a( dummy_plug->get_a() ); |
90 | < | temp_con[nConstrained].set_b( dummy_plug->get_b() ); |
91 | < | temp_con[nConstrained].set_dsqr( dummy_plug->get_dsqr() ); |
92 | < | |
93 | < | nConstrained++; |
101 | < | constrained = 0; |
85 | > | |
86 | > | if (constrained){ |
87 | > | dummy_plug = theArray[j]->get_constraint(); |
88 | > | temp_con[nConstrained].set_a(dummy_plug->get_a()); |
89 | > | temp_con[nConstrained].set_b(dummy_plug->get_b()); |
90 | > | temp_con[nConstrained].set_dsqr(dummy_plug->get_dsqr()); |
91 | > | |
92 | > | nConstrained++; |
93 | > | constrained = 0; |
94 | } | |
95 | } | |
96 | ||
97 | < | theArray = (SRI**) molecules[i].getMyTorsions(); |
98 | < | for(int j=0; j<molecules[i].getNTorsions(); j++){ |
107 | < | |
97 | > | theArray = (SRI * *) molecules[i].getMyTorsions(); |
98 | > | for (int j = 0; j < molecules[i].getNTorsions(); j++){ |
99 | constrained = theArray[j]->is_constrained(); | |
100 | < | |
101 | < | if(constrained){ |
102 | < | |
103 | < | dummy_plug = theArray[j]->get_constraint(); |
104 | < | temp_con[nConstrained].set_a( dummy_plug->get_a() ); |
105 | < | temp_con[nConstrained].set_b( dummy_plug->get_b() ); |
106 | < | temp_con[nConstrained].set_dsqr( dummy_plug->get_dsqr() ); |
107 | < | |
108 | < | nConstrained++; |
118 | < | constrained = 0; |
100 | > | |
101 | > | if (constrained){ |
102 | > | dummy_plug = theArray[j]->get_constraint(); |
103 | > | temp_con[nConstrained].set_a(dummy_plug->get_a()); |
104 | > | temp_con[nConstrained].set_b(dummy_plug->get_b()); |
105 | > | temp_con[nConstrained].set_dsqr(dummy_plug->get_dsqr()); |
106 | > | |
107 | > | nConstrained++; |
108 | > | constrained = 0; |
109 | } | |
110 | } | |
111 | } | |
112 | ||
113 | < | if(nConstrained > 0){ |
124 | < | |
113 | > | if (nConstrained > 0){ |
114 | isConstrained = 1; | |
115 | ||
116 | < | if(constrainedA != NULL ) delete[] constrainedA; |
117 | < | if(constrainedB != NULL ) delete[] constrainedB; |
118 | < | if(constrainedDsqr != NULL ) delete[] constrainedDsqr; |
116 | > | if (constrainedA != NULL) |
117 | > | delete[] constrainedA; |
118 | > | if (constrainedB != NULL) |
119 | > | delete[] constrainedB; |
120 | > | if (constrainedDsqr != NULL) |
121 | > | delete[] constrainedDsqr; |
122 | ||
123 | < | constrainedA = new int[nConstrained]; |
124 | < | constrainedB = new int[nConstrained]; |
123 | > | constrainedA = new int[nConstrained]; |
124 | > | constrainedB = new int[nConstrained]; |
125 | constrainedDsqr = new double[nConstrained]; | |
126 | < | |
127 | < | for( int i = 0; i < nConstrained; i++){ |
136 | < | |
126 | > | |
127 | > | for (int i = 0; i < nConstrained; i++){ |
128 | constrainedA[i] = temp_con[i].get_a(); | |
129 | constrainedB[i] = temp_con[i].get_b(); | |
130 | constrainedDsqr[i] = temp_con[i].get_dsqr(); | |
131 | } | |
132 | ||
133 | < | |
133 | > | |
134 | // save oldAtoms to check for lode balanceing later on. | |
135 | < | |
135 | > | |
136 | oldAtoms = nAtoms; | |
137 | < | |
137 | > | |
138 | moving = new int[nAtoms]; | |
139 | < | moved = new int[nAtoms]; |
139 | > | moved = new int[nAtoms]; |
140 | ||
141 | < | prePos = new double[nAtoms*3]; |
141 | > | oldPos = new double[nAtoms * 3]; |
142 | } | |
143 | < | |
143 | > | |
144 | delete[] temp_con; | |
145 | } | |
146 | ||
147 | ||
148 | < | void Integrator::integrate( void ){ |
148 | > | template<typename T> void Integrator<T>::integrate(void){ |
149 | ||
150 | < | int i, j; // loop counters |
151 | < | double kE = 0.0; // the kinetic energy |
152 | < | double rot_kE; |
162 | < | double trans_kE; |
163 | < | int tl; // the time loop conter |
164 | < | double dt2; // half the dt |
165 | < | |
166 | < | double vx, vy, vz; // the velocities |
167 | < | double vx2, vy2, vz2; // the square of the velocities |
168 | < | double rx, ry, rz; // the postitions |
169 | < | |
170 | < | double ji[3]; // the body frame angular momentum |
171 | < | double jx2, jy2, jz2; // the square of the angular momentums |
172 | < | double Tb[3]; // torque in the body frame |
173 | < | double angle; // the angle through which to rotate the rotation matrix |
174 | < | double A[3][3]; // the rotation matrix |
175 | < | double press[9]; |
176 | < | |
177 | < | double dt = info->dt; |
178 | < | double runTime = info->run_time; |
179 | < | double sampleTime = info->sampleTime; |
180 | < | double statusTime = info->statusTime; |
150 | > | double runTime = info->run_time; |
151 | > | double sampleTime = info->sampleTime; |
152 | > | double statusTime = info->statusTime; |
153 | double thermalTime = info->thermalTime; | |
154 | + | double resetTime = info->resetTime; |
155 | ||
156 | + | |
157 | double currSample; | |
158 | double currThermal; | |
159 | double currStatus; | |
160 | < | double currTime; |
160 | > | double currReset; |
161 | ||
162 | int calcPot, calcStress; | |
189 | – | int isError; |
163 | ||
164 | < | tStats = new Thermo( info ); |
165 | < | e_out = new StatWriter( info ); |
166 | < | dump_out = new DumpWriter( info ); |
164 | > | tStats = new Thermo(info); |
165 | > | statOut = new StatWriter(info); |
166 | > | dumpOut = new DumpWriter(info); |
167 | ||
168 | < | Atom** atoms = info->atoms; |
169 | < | DirectionalAtom* dAtom; |
168 | > | atoms = info->atoms; |
169 | > | |
170 | > | dt = info->dt; |
171 | dt2 = 0.5 * dt; | |
172 | ||
173 | + | readyCheck(); |
174 | + | |
175 | // initialize the forces before the first step | |
176 | ||
177 | < | myFF->doForces(1,1); |
178 | < | |
179 | < | if( info->setTemp ){ |
180 | < | |
181 | < | tStats->velocitize(); |
177 | > | std::cerr << "Before initial Force calc\n"; |
178 | > | |
179 | > | calcForce(1, 1); |
180 | > | |
181 | > | if (nConstrained){ |
182 | > | preMove(); |
183 | > | constrainA(); |
184 | > | calcForce(1, 1); |
185 | > | constrainB(); |
186 | > | std::cerr << "premove done\n"; |
187 | } | |
188 | < | |
189 | < | dump_out->writeDump( 0.0 ); |
190 | < | e_out->writeStat( 0.0 ); |
191 | < | |
188 | > | |
189 | > | |
190 | > | |
191 | > | if (info->setTemp){ |
192 | > | thermalize(); |
193 | > | } |
194 | > | |
195 | calcPot = 0; | |
196 | calcStress = 0; | |
197 | < | currSample = sampleTime; |
198 | < | currThermal = thermalTime; |
199 | < | currStatus = statusTime; |
200 | < | currTime = 0.0;; |
197 | > | currSample = sampleTime + info->getTime(); |
198 | > | currThermal = thermalTime+ info->getTime(); |
199 | > | currStatus = statusTime + info->getTime(); |
200 | > | currReset = resetTime + info->getTime(); |
201 | ||
202 | < | while( currTime < runTime ){ |
202 | > | dumpOut->writeDump(info->getTime()); |
203 | > | statOut->writeStat(info->getTime()); |
204 | ||
205 | < | if( (currTime+dt) >= currStatus ){ |
205 | > | |
206 | > | |
207 | > | #ifdef IS_MPI |
208 | > | strcpy(checkPointMsg, "The integrator is ready to go."); |
209 | > | MPIcheckPoint(); |
210 | > | #endif // is_mpi |
211 | > | |
212 | > | while (info->getTime() < runTime){ |
213 | > | if ((info->getTime() + dt) >= currStatus){ |
214 | calcPot = 1; | |
215 | calcStress = 1; | |
216 | } | |
224 | – | |
225 | – | integrateStep( calcPot, calcStress ); |
226 | – | |
227 | – | currTime += dt; |
217 | ||
218 | < | if( info->setTemp ){ |
219 | < | if( currTime >= currThermal ){ |
220 | < | tStats->velocitize(); |
221 | < | currThermal += thermalTime; |
218 | > | integrateStep(calcPot, calcStress); |
219 | > | |
220 | > | info->incrTime(dt); |
221 | > | |
222 | > | if (info->setTemp){ |
223 | > | if (info->getTime() >= currThermal){ |
224 | > | thermalize(); |
225 | > | currThermal += thermalTime; |
226 | } | |
227 | } | |
228 | ||
229 | < | if( currTime >= currSample ){ |
230 | < | dump_out->writeDump( currTime ); |
229 | > | if (info->getTime() >= currSample){ |
230 | > | dumpOut->writeDump(info->getTime()); |
231 | currSample += sampleTime; | |
232 | } | |
233 | ||
234 | < | if( currTime >= currStatus ){ |
235 | < | e_out->writeStat( time * dt ); |
236 | < | calcPot = 0; |
234 | > | if (info->getTime() >= currStatus){ |
235 | > | statOut->writeStat(info->getTime()); |
236 | > | calcPot = 0; |
237 | calcStress = 0; | |
238 | currStatus += statusTime; | |
239 | < | } |
239 | > | } |
240 | > | |
241 | > | if (info->resetIntegrator){ |
242 | > | if (info->getTime() >= currReset){ |
243 | > | this->resetIntegrator(); |
244 | > | currReset += resetTime; |
245 | > | } |
246 | > | } |
247 | > | |
248 | > | std::cerr << "done with time = " << info->getTime() << "\n"; |
249 | > | |
250 | > | #ifdef IS_MPI |
251 | > | strcpy(checkPointMsg, "successfully took a time step."); |
252 | > | MPIcheckPoint(); |
253 | > | #endif // is_mpi |
254 | } | |
255 | ||
249 | – | dump_out->writeFinal(); |
256 | ||
257 | < | delete dump_out; |
258 | < | delete e_out; |
257 | > | // write the last frame |
258 | > | dumpOut->writeDump(info->getTime()); |
259 | > | |
260 | > | delete dumpOut; |
261 | > | delete statOut; |
262 | } | |
263 | ||
264 | < | void Integrator::integrateStep( int calcPot, int calcStress ){ |
265 | < | |
264 | > | template<typename T> void Integrator<T>::integrateStep(int calcPot, |
265 | > | int calcStress){ |
266 | // Position full step, and velocity half step | |
267 | + | preMove(); |
268 | ||
259 | – | //preMove(); |
269 | moveA(); | |
261 | – | if( nConstrained ) constrainA(); |
270 | ||
271 | + | |
272 | + | |
273 | + | |
274 | + | #ifdef IS_MPI |
275 | + | strcpy(checkPointMsg, "Succesful moveA\n"); |
276 | + | MPIcheckPoint(); |
277 | + | #endif // is_mpi |
278 | + | |
279 | + | |
280 | // calc forces | |
281 | ||
282 | < | myFF->doForces(calcPot,calcStress); |
282 | > | calcForce(calcPot, calcStress); |
283 | ||
284 | + | #ifdef IS_MPI |
285 | + | strcpy(checkPointMsg, "Succesful doForces\n"); |
286 | + | MPIcheckPoint(); |
287 | + | #endif // is_mpi |
288 | + | |
289 | + | |
290 | // finish the velocity half step | |
291 | < | |
291 | > | |
292 | moveB(); | |
293 | < | if( nConstrained ) constrainB(); |
294 | < | |
293 | > | |
294 | > | |
295 | > | |
296 | > | #ifdef IS_MPI |
297 | > | strcpy(checkPointMsg, "Succesful moveB\n"); |
298 | > | MPIcheckPoint(); |
299 | > | #endif // is_mpi |
300 | } | |
301 | ||
302 | ||
303 | < | void Integrator::moveA( void ){ |
304 | < | |
277 | < | int i,j,k; |
278 | < | int atomIndex, aMatIndex; |
303 | > | template<typename T> void Integrator<T>::moveA(void){ |
304 | > | int i, j; |
305 | DirectionalAtom* dAtom; | |
306 | < | double Tb[3]; |
307 | < | double ji[3]; |
306 | > | double Tb[3], ji[3]; |
307 | > | double vel[3], pos[3], frc[3]; |
308 | > | double mass; |
309 | ||
310 | < | for( i=0; i<nAtoms; i++ ){ |
311 | < | atomIndex = i * 3; |
312 | < | aMatIndex = i * 9; |
313 | < | |
287 | < | // velocity half step |
288 | < | for( j=atomIndex; j<(atomIndex+3); j++ ) |
289 | < | vel[j] += ( dt2 * frc[j] / atoms[i]->getMass() ) * eConvert; |
310 | > | for (i = 0; i < nAtoms; i++){ |
311 | > | atoms[i]->getVel(vel); |
312 | > | atoms[i]->getPos(pos); |
313 | > | atoms[i]->getFrc(frc); |
314 | ||
315 | < | // position whole step |
316 | < | for( j=atomIndex; j<(atomIndex+3); j++ ) |
315 | > | mass = atoms[i]->getMass(); |
316 | > | |
317 | > | for (j = 0; j < 3; j++){ |
318 | > | // velocity half step |
319 | > | vel[j] += (dt2 * frc[j] / mass) * eConvert; |
320 | > | // position whole step |
321 | pos[j] += dt * vel[j]; | |
322 | + | } |
323 | ||
324 | < | |
325 | < | if( atoms[i]->isDirectional() ){ |
324 | > | atoms[i]->setVel(vel); |
325 | > | atoms[i]->setPos(pos); |
326 | ||
327 | < | dAtom = (DirectionalAtom *)atoms[i]; |
328 | < | |
327 | > | if (atoms[i]->isDirectional()){ |
328 | > | dAtom = (DirectionalAtom *) atoms[i]; |
329 | > | |
330 | // get and convert the torque to body frame | |
331 | < | |
332 | < | Tb[0] = dAtom->getTx(); |
333 | < | Tb[1] = dAtom->getTy(); |
334 | < | Tb[2] = dAtom->getTz(); |
305 | < | |
306 | < | dAtom->lab2Body( Tb ); |
307 | < | |
331 | > | |
332 | > | dAtom->getTrq(Tb); |
333 | > | dAtom->lab2Body(Tb); |
334 | > | |
335 | // get the angular momentum, and propagate a half step | |
336 | < | |
337 | < | ji[0] = dAtom->getJx() + ( dt2 * Tb[0] ) * eConvert; |
338 | < | ji[1] = dAtom->getJy() + ( dt2 * Tb[1] ) * eConvert; |
339 | < | ji[2] = dAtom->getJz() + ( dt2 * Tb[2] ) * eConvert; |
340 | < | |
341 | < | // use the angular velocities to propagate the rotation matrix a |
342 | < | // full time step |
343 | < | |
344 | < | // rotate about the x-axis |
318 | < | angle = dt2 * ji[0] / dAtom->getIxx(); |
319 | < | this->rotate( 1, 2, angle, ji, &aMat[aMatIndex] ); |
320 | < | |
321 | < | // rotate about the y-axis |
322 | < | angle = dt2 * ji[1] / dAtom->getIyy(); |
323 | < | this->rotate( 2, 0, angle, ji, &aMat[aMatIndex] ); |
324 | < | |
325 | < | // rotate about the z-axis |
326 | < | angle = dt * ji[2] / dAtom->getIzz(); |
327 | < | this->rotate( 0, 1, angle, ji, &aMat[aMatIndex] ); |
328 | < | |
329 | < | // rotate about the y-axis |
330 | < | angle = dt2 * ji[1] / dAtom->getIyy(); |
331 | < | this->rotate( 2, 0, angle, ji, &aMat[aMatIndex] ); |
332 | < | |
333 | < | // rotate about the x-axis |
334 | < | angle = dt2 * ji[0] / dAtom->getIxx(); |
335 | < | this->rotate( 1, 2, angle, ji, &aMat[aMatIndex] ); |
336 | < | |
337 | < | dAtom->setJx( ji[0] ); |
338 | < | dAtom->setJy( ji[1] ); |
339 | < | dAtom->setJz( ji[2] ); |
336 | > | |
337 | > | dAtom->getJ(ji); |
338 | > | |
339 | > | for (j = 0; j < 3; j++) |
340 | > | ji[j] += (dt2 * Tb[j]) * eConvert; |
341 | > | |
342 | > | this->rotationPropagation( dAtom, ji ); |
343 | > | |
344 | > | dAtom->setJ(ji); |
345 | } | |
341 | – | |
346 | } | |
347 | + | |
348 | + | if (nConstrained){ |
349 | + | constrainA(); |
350 | + | } |
351 | } | |
352 | ||
353 | ||
354 | < | void Integrator::moveB( void ){ |
355 | < | int i,j,k; |
348 | < | int atomIndex; |
354 | > | template<typename T> void Integrator<T>::moveB(void){ |
355 | > | int i, j; |
356 | DirectionalAtom* dAtom; | |
357 | < | double Tb[3]; |
358 | < | double ji[3]; |
357 | > | double Tb[3], ji[3]; |
358 | > | double vel[3], frc[3]; |
359 | > | double mass; |
360 | ||
361 | < | for( i=0; i<nAtoms; i++ ){ |
362 | < | atomIndex = i * 3; |
361 | > | for (i = 0; i < nAtoms; i++){ |
362 | > | atoms[i]->getVel(vel); |
363 | > | atoms[i]->getFrc(frc); |
364 | ||
365 | + | mass = atoms[i]->getMass(); |
366 | + | |
367 | // velocity half step | |
368 | < | for( j=atomIndex; j<(atomIndex+3); j++ ) |
369 | < | vel[j] += ( dt2 * frc[j] / atoms[i]->getMass() ) * eConvert; |
368 | > | for (j = 0; j < 3; j++) |
369 | > | vel[j] += (dt2 * frc[j] / mass) * eConvert; |
370 | ||
371 | < | if( atoms[i]->isDirectional() ){ |
372 | < | |
373 | < | dAtom = (DirectionalAtom *)atoms[i]; |
374 | < | |
371 | > | atoms[i]->setVel(vel); |
372 | > | |
373 | > | if (atoms[i]->isDirectional()){ |
374 | > | dAtom = (DirectionalAtom *) atoms[i]; |
375 | > | |
376 | // get and convert the torque to body frame | |
377 | < | |
378 | < | Tb[0] = dAtom->getTx(); |
379 | < | Tb[1] = dAtom->getTy(); |
380 | < | Tb[2] = dAtom->getTz(); |
381 | < | |
382 | < | dAtom->lab2Body( Tb ); |
383 | < | |
384 | < | // get the angular momentum, and complete the angular momentum |
385 | < | // half step |
386 | < | |
387 | < | ji[0] = dAtom->getJx() + ( dt2 * Tb[0] ) * eConvert; |
388 | < | ji[1] = dAtom->getJy() + ( dt2 * Tb[1] ) * eConvert; |
389 | < | ji[2] = dAtom->getJz() + ( dt2 * Tb[2] ) * eConvert; |
378 | < | |
379 | < | jx2 = ji[0] * ji[0]; |
380 | < | jy2 = ji[1] * ji[1]; |
381 | < | jz2 = ji[2] * ji[2]; |
382 | < | |
383 | < | dAtom->setJx( ji[0] ); |
384 | < | dAtom->setJy( ji[1] ); |
385 | < | dAtom->setJz( ji[2] ); |
377 | > | |
378 | > | dAtom->getTrq(Tb); |
379 | > | dAtom->lab2Body(Tb); |
380 | > | |
381 | > | // get the angular momentum, and propagate a half step |
382 | > | |
383 | > | dAtom->getJ(ji); |
384 | > | |
385 | > | for (j = 0; j < 3; j++) |
386 | > | ji[j] += (dt2 * Tb[j]) * eConvert; |
387 | > | |
388 | > | |
389 | > | dAtom->setJ(ji); |
390 | } | |
391 | } | |
392 | ||
393 | + | if (nConstrained){ |
394 | + | constrainB(); |
395 | + | } |
396 | } | |
397 | ||
398 | < | void Integrator::preMove( void ){ |
399 | < | int i; |
398 | > | template<typename T> void Integrator<T>::preMove(void){ |
399 | > | int i, j; |
400 | > | double pos[3]; |
401 | ||
402 | < | if( nConstrained ){ |
403 | < | if( oldAtoms != nAtoms ){ |
404 | < | |
405 | < | // save oldAtoms to check for lode balanceing later on. |
406 | < | |
407 | < | oldAtoms = nAtoms; |
408 | < | |
401 | < | delete[] moving; |
402 | < | delete[] moved; |
403 | < | delete[] oldPos; |
404 | < | |
405 | < | moving = new int[nAtoms]; |
406 | < | moved = new int[nAtoms]; |
407 | < | |
408 | < | oldPos = new double[nAtoms*3]; |
402 | > | if (nConstrained){ |
403 | > | for (i = 0; i < nAtoms; i++){ |
404 | > | atoms[i]->getPos(pos); |
405 | > | |
406 | > | for (j = 0; j < 3; j++){ |
407 | > | oldPos[3 * i + j] = pos[j]; |
408 | > | } |
409 | } | |
410 | – | |
411 | – | for(i=0; i<(nAtoms*3); i++) oldPos[i] = pos[i]; |
410 | } | |
411 | < | } |
411 | > | } |
412 | ||
413 | < | void Integrator::constrainA(){ |
414 | < | |
417 | < | int i,j,k; |
413 | > | template<typename T> void Integrator<T>::constrainA(){ |
414 | > | int i, j; |
415 | int done; | |
416 | < | double pxab, pyab, pzab; |
417 | < | double rxab, ryab, rzab; |
418 | < | int a, b; |
416 | > | double posA[3], posB[3]; |
417 | > | double velA[3], velB[3]; |
418 | > | double pab[3]; |
419 | > | double rab[3]; |
420 | > | int a, b, ax, ay, az, bx, by, bz; |
421 | double rma, rmb; | |
422 | double dx, dy, dz; | |
423 | + | double rpab; |
424 | double rabsq, pabsq, rpabsq; | |
425 | double diffsq; | |
426 | double gab; | |
427 | int iteration; | |
428 | ||
429 | < | |
430 | < | |
431 | < | for( i=0; i<nAtoms; i++){ |
432 | < | |
429 | > | for (i = 0; i < nAtoms; i++){ |
430 | moving[i] = 0; | |
431 | < | moved[i] = 1; |
431 | > | moved[i] = 1; |
432 | } | |
433 | < | |
437 | < | |
433 | > | |
434 | iteration = 0; | |
435 | done = 0; | |
436 | < | while( !done && (iteration < maxIteration )){ |
441 | < | |
436 | > | while (!done && (iteration < maxIteration)){ |
437 | done = 1; | |
438 | < | for(i=0; i<nConstrained; i++){ |
444 | < | |
438 | > | for (i = 0; i < nConstrained; i++){ |
439 | a = constrainedA[i]; | |
440 | b = constrainedB[i]; | |
447 | – | |
448 | – | if( moved[a] || moved[b] ){ |
449 | – | |
450 | – | pxab = pos[3*a+0] - pos[3*b+0]; |
451 | – | pyab = pos[3*a+1] - pos[3*b+1]; |
452 | – | pzab = pos[3*a+2] - pos[3*b+2]; |
441 | ||
442 | < | //periodic boundary condition |
443 | < | pxab = pxab - info->box_x * copysign(1, pxab) |
444 | < | * int(pxab / info->box_x + 0.5); |
457 | < | pyab = pyab - info->box_y * copysign(1, pyab) |
458 | < | * int(pyab / info->box_y + 0.5); |
459 | < | pzab = pzab - info->box_z * copysign(1, pzab) |
460 | < | * int(pzab / info->box_z + 0.5); |
461 | < | |
462 | < | pabsq = pxab * pxab + pyab * pyab + pzab * pzab; |
463 | < | rabsq = constraintedDsqr[i]; |
464 | < | diffsq = pabsq - rabsq; |
442 | > | ax = (a * 3) + 0; |
443 | > | ay = (a * 3) + 1; |
444 | > | az = (a * 3) + 2; |
445 | ||
446 | < | // the original rattle code from alan tidesley |
447 | < | if (fabs(diffsq) > tol*rabsq*2) { |
448 | < | rxab = oldPos[3*a+0] - oldPos[3*b+0]; |
469 | < | ryab = oldPos[3*a+1] - oldPos[3*b+1]; |
470 | < | rzab = oldPos[3*a+2] - oldPos[3*b+2]; |
471 | < | |
472 | < | rxab = rxab - info->box_x * copysign(1, rxab) |
473 | < | * int(rxab / info->box_x + 0.5); |
474 | < | ryab = ryab - info->box_y * copysign(1, ryab) |
475 | < | * int(ryab / info->box_y + 0.5); |
476 | < | rzab = rzab - info->box_z * copysign(1, rzab) |
477 | < | * int(rzab / info->box_z + 0.5); |
446 | > | bx = (b * 3) + 0; |
447 | > | by = (b * 3) + 1; |
448 | > | bz = (b * 3) + 2; |
449 | ||
450 | < | rpab = rxab * pxab + ryab * pyab + rzab * pzab; |
451 | < | rpabsq = rpab * rpab; |
450 | > | if (moved[a] || moved[b]){ |
451 | > | atoms[a]->getPos(posA); |
452 | > | atoms[b]->getPos(posB); |
453 | ||
454 | + | for (j = 0; j < 3; j++) |
455 | + | pab[j] = posA[j] - posB[j]; |
456 | ||
457 | < | if (rpabsq < (rabsq * -diffsq)){ |
457 | > | //periodic boundary condition |
458 | > | |
459 | > | info->wrapVector(pab); |
460 | > | |
461 | > | pabsq = pab[0] * pab[0] + pab[1] * pab[1] + pab[2] * pab[2]; |
462 | > | |
463 | > | rabsq = constrainedDsqr[i]; |
464 | > | diffsq = rabsq - pabsq; |
465 | > | |
466 | > | // the original rattle code from alan tidesley |
467 | > | if (fabs(diffsq) > (tol * rabsq * 2)){ |
468 | > | rab[0] = oldPos[ax] - oldPos[bx]; |
469 | > | rab[1] = oldPos[ay] - oldPos[by]; |
470 | > | rab[2] = oldPos[az] - oldPos[bz]; |
471 | > | |
472 | > | info->wrapVector(rab); |
473 | > | |
474 | > | rpab = rab[0] * pab[0] + rab[1] * pab[1] + rab[2] * pab[2]; |
475 | > | |
476 | > | rpabsq = rpab * rpab; |
477 | > | |
478 | > | |
479 | > | if (rpabsq < (rabsq * -diffsq)){ |
480 | #ifdef IS_MPI | |
481 | < | a = atoms[a]->getGlobalIndex(); |
482 | < | b = atoms[b]->getGlobalIndex(); |
481 | > | a = atoms[a]->getGlobalIndex(); |
482 | > | b = atoms[b]->getGlobalIndex(); |
483 | #endif //is_mpi | |
484 | < | sprintf( painCave.errMsg, |
485 | < | "Constraint failure in constrainA at atom %d and %d\n.", |
486 | < | a, b ); |
487 | < | painCave.isFatal = 1; |
488 | < | simError(); |
489 | < | } |
484 | > | sprintf(painCave.errMsg, |
485 | > | "Constraint failure in constrainA at atom %d and %d.\n", a, |
486 | > | b); |
487 | > | painCave.isFatal = 1; |
488 | > | simError(); |
489 | > | } |
490 | ||
491 | < | rma = 1.0 / atoms[a]->getMass(); |
492 | < | rmb = 1.0 / atoms[b]->getMass(); |
497 | < | |
498 | < | gab = diffsq / ( 2.0 * ( rma + rmb ) * rpab ); |
499 | < | dx = rxab * gab; |
500 | < | dy = ryab * gab; |
501 | < | dz = rzab * gab; |
491 | > | rma = 1.0 / atoms[a]->getMass(); |
492 | > | rmb = 1.0 / atoms[b]->getMass(); |
493 | ||
494 | < | pos[3*a+0] += rma * dx; |
504 | < | pos[3*a+1] += rma * dy; |
505 | < | pos[3*a+2] += rma * dz; |
494 | > | gab = diffsq / (2.0 * (rma + rmb) * rpab); |
495 | ||
496 | < | pos[3*b+0] -= rmb * dx; |
497 | < | pos[3*b+1] -= rmb * dy; |
498 | < | pos[3*b+2] -= rmb * dz; |
496 | > | dx = rab[0] * gab; |
497 | > | dy = rab[1] * gab; |
498 | > | dz = rab[2] * gab; |
499 | ||
500 | + | posA[0] += rma * dx; |
501 | + | posA[1] += rma * dy; |
502 | + | posA[2] += rma * dz; |
503 | + | |
504 | + | atoms[a]->setPos(posA); |
505 | + | |
506 | + | posB[0] -= rmb * dx; |
507 | + | posB[1] -= rmb * dy; |
508 | + | posB[2] -= rmb * dz; |
509 | + | |
510 | + | atoms[b]->setPos(posB); |
511 | + | |
512 | dx = dx / dt; | |
513 | dy = dy / dt; | |
514 | dz = dz / dt; | |
515 | ||
516 | < | vel[3*a+0] += rma * dx; |
516 | < | vel[3*a+1] += rma * dy; |
517 | < | vel[3*a+2] += rma * dz; |
516 | > | atoms[a]->getVel(velA); |
517 | ||
518 | < | vel[3*b+0] -= rmb * dx; |
519 | < | vel[3*b+1] -= rmb * dy; |
520 | < | vel[3*b+2] -= rmb * dz; |
518 | > | velA[0] += rma * dx; |
519 | > | velA[1] += rma * dy; |
520 | > | velA[2] += rma * dz; |
521 | ||
522 | < | moving[a] = 1; |
523 | < | moving[b] = 1; |
524 | < | done = 0; |
525 | < | } |
522 | > | atoms[a]->setVel(velA); |
523 | > | |
524 | > | atoms[b]->getVel(velB); |
525 | > | |
526 | > | velB[0] -= rmb * dx; |
527 | > | velB[1] -= rmb * dy; |
528 | > | velB[2] -= rmb * dz; |
529 | > | |
530 | > | atoms[b]->setVel(velB); |
531 | > | |
532 | > | moving[a] = 1; |
533 | > | moving[b] = 1; |
534 | > | done = 0; |
535 | > | } |
536 | } | |
537 | } | |
538 | < | |
539 | < | for(i=0; i<nAtoms; i++){ |
531 | < | |
538 | > | |
539 | > | for (i = 0; i < nAtoms; i++){ |
540 | moved[i] = moving[i]; | |
541 | moving[i] = 0; | |
542 | } | |
# | Line 536 | Line 544 | void Integrator::constrainA(){ | |
544 | iteration++; | |
545 | } | |
546 | ||
547 | < | if( !done ){ |
548 | < | |
549 | < | sprintf( painCae.errMsg, |
550 | < | "Constraint failure in constrainA, too many iterations: %d\n", |
543 | < | iterations ); |
547 | > | if (!done){ |
548 | > | sprintf(painCave.errMsg, |
549 | > | "Constraint failure in constrainA, too many iterations: %d\n", |
550 | > | iteration); |
551 | painCave.isFatal = 1; | |
552 | simError(); | |
553 | } | |
554 | ||
555 | } | |
556 | ||
557 | < | void Integrator::constrainB( void ){ |
558 | < | |
552 | < | int i,j,k; |
557 | > | template<typename T> void Integrator<T>::constrainB(void){ |
558 | > | int i, j; |
559 | int done; | |
560 | + | double posA[3], posB[3]; |
561 | + | double velA[3], velB[3]; |
562 | double vxab, vyab, vzab; | |
563 | < | double rxab, ryab, rzab; |
564 | < | int a, b; |
563 | > | double rab[3]; |
564 | > | int a, b, ax, ay, az, bx, by, bz; |
565 | double rma, rmb; | |
566 | double dx, dy, dz; | |
567 | < | double rabsq, pabsq, rvab; |
560 | < | double diffsq; |
567 | > | double rvab; |
568 | double gab; | |
569 | int iteration; | |
570 | ||
571 | < | for(i=0; i<nAtom; i++){ |
571 | > | for (i = 0; i < nAtoms; i++){ |
572 | moving[i] = 0; | |
573 | moved[i] = 1; | |
574 | } | |
575 | ||
576 | done = 0; | |
577 | < | while( !done && (iteration < maxIteration ) ){ |
577 | > | iteration = 0; |
578 | > | while (!done && (iteration < maxIteration)){ |
579 | > | done = 1; |
580 | ||
581 | < | for(i=0; i<nConstrained; i++){ |
573 | < | |
581 | > | for (i = 0; i < nConstrained; i++){ |
582 | a = constrainedA[i]; | |
583 | b = constrainedB[i]; | |
584 | ||
585 | < | if( moved[a] || moved[b] ){ |
586 | < | |
587 | < | vxab = vel[3*a+0] - vel[3*b+0]; |
580 | < | vyab = vel[3*a+1] - vel[3*b+1]; |
581 | < | vzab = vel[3*a+2] - vel[3*b+2]; |
585 | > | ax = (a * 3) + 0; |
586 | > | ay = (a * 3) + 1; |
587 | > | az = (a * 3) + 2; |
588 | ||
589 | < | rxab = pos[3*a+0] - pos[3*b+0];q |
590 | < | ryab = pos[3*a+1] - pos[3*b+1]; |
591 | < | rzab = pos[3*a+2] - pos[3*b+2]; |
586 | < | |
587 | < | rxab = rxab - info->box_x * copysign(1, rxab) |
588 | < | * int(rxab / info->box_x + 0.5); |
589 | < | ryab = ryab - info->box_y * copysign(1, ryab) |
590 | < | * int(ryab / info->box_y + 0.5); |
591 | < | rzab = rzab - info->box_z * copysign(1, rzab) |
592 | < | * int(rzab / info->box_z + 0.5); |
589 | > | bx = (b * 3) + 0; |
590 | > | by = (b * 3) + 1; |
591 | > | bz = (b * 3) + 2; |
592 | ||
593 | < | rma = 1.0 / atoms[a]->getMass(); |
594 | < | rmb = 1.0 / atoms[b]->getMass(); |
593 | > | if (moved[a] || moved[b]){ |
594 | > | atoms[a]->getVel(velA); |
595 | > | atoms[b]->getVel(velB); |
596 | ||
597 | < | rvab = rxab * vxab + ryab * vyab + rzab * vzab; |
598 | < | |
599 | < | gab = -rvab / ( ( rma + rmb ) * constraintsDsqr[i] ); |
597 | > | vxab = velA[0] - velB[0]; |
598 | > | vyab = velA[1] - velB[1]; |
599 | > | vzab = velA[2] - velB[2]; |
600 | ||
601 | < | if (fabs(gab) > tol) { |
602 | < | |
603 | < | dx = rxab * gab; |
604 | < | dy = ryab * gab; |
605 | < | dz = rzab * gab; |
606 | < | |
607 | < | vel[3*a+0] += rma * dx; |
608 | < | vel[3*a+1] += rma * dy; |
609 | < | vel[3*a+2] += rma * dz; |
601 | > | atoms[a]->getPos(posA); |
602 | > | atoms[b]->getPos(posB); |
603 | ||
604 | < | vel[3*b+0] -= rmb * dx; |
605 | < | vel[3*b+1] -= rmb * dy; |
606 | < | vel[3*b+2] -= rmb * dz; |
607 | < | |
608 | < | moving[a] = 1; |
609 | < | moving[b] = 1; |
610 | < | done = 0; |
611 | < | } |
604 | > | for (j = 0; j < 3; j++) |
605 | > | rab[j] = posA[j] - posB[j]; |
606 | > | |
607 | > | info->wrapVector(rab); |
608 | > | |
609 | > | rma = 1.0 / atoms[a]->getMass(); |
610 | > | rmb = 1.0 / atoms[b]->getMass(); |
611 | > | |
612 | > | rvab = rab[0] * vxab + rab[1] * vyab + rab[2] * vzab; |
613 | > | |
614 | > | gab = -rvab / ((rma + rmb) * constrainedDsqr[i]); |
615 | > | |
616 | > | if (fabs(gab) > tol){ |
617 | > | dx = rab[0] * gab; |
618 | > | dy = rab[1] * gab; |
619 | > | dz = rab[2] * gab; |
620 | > | |
621 | > | velA[0] += rma * dx; |
622 | > | velA[1] += rma * dy; |
623 | > | velA[2] += rma * dz; |
624 | > | |
625 | > | atoms[a]->setVel(velA); |
626 | > | |
627 | > | velB[0] -= rmb * dx; |
628 | > | velB[1] -= rmb * dy; |
629 | > | velB[2] -= rmb * dz; |
630 | > | |
631 | > | atoms[b]->setVel(velB); |
632 | > | |
633 | > | moving[a] = 1; |
634 | > | moving[b] = 1; |
635 | > | done = 0; |
636 | > | } |
637 | } | |
638 | } | |
639 | ||
640 | < | for(i=0; i<nAtoms; i++){ |
640 | > | for (i = 0; i < nAtoms; i++){ |
641 | moved[i] = moving[i]; | |
642 | moving[i] = 0; | |
643 | } | |
644 | < | |
644 | > | |
645 | iteration++; | |
646 | } | |
647 | ||
648 | < | if( !done ){ |
649 | < | |
650 | < | |
651 | < | sprintf( painCae.errMsg, |
634 | < | "Constraint failure in constrainB, too many iterations: %d\n", |
635 | < | iterations ); |
648 | > | if (!done){ |
649 | > | sprintf(painCave.errMsg, |
650 | > | "Constraint failure in constrainB, too many iterations: %d\n", |
651 | > | iteration); |
652 | painCave.isFatal = 1; | |
653 | simError(); | |
654 | < | } |
639 | < | |
654 | > | } |
655 | } | |
656 | ||
657 | + | template<typename T> void Integrator<T>::rotationPropagation |
658 | + | ( DirectionalAtom* dAtom, double ji[3] ){ |
659 | ||
660 | + | double angle; |
661 | + | double A[3][3], I[3][3]; |
662 | ||
663 | + | // use the angular velocities to propagate the rotation matrix a |
664 | + | // full time step |
665 | ||
666 | + | dAtom->getA(A); |
667 | + | dAtom->getI(I); |
668 | ||
669 | + | // rotate about the x-axis |
670 | + | angle = dt2 * ji[0] / I[0][0]; |
671 | + | this->rotate( 1, 2, angle, ji, A ); |
672 | ||
673 | + | // rotate about the y-axis |
674 | + | angle = dt2 * ji[1] / I[1][1]; |
675 | + | this->rotate( 2, 0, angle, ji, A ); |
676 | ||
677 | < | void Integrator::rotate( int axes1, int axes2, double angle, double ji[3], |
678 | < | double A[3][3] ){ |
677 | > | // rotate about the z-axis |
678 | > | angle = dt * ji[2] / I[2][2]; |
679 | > | this->rotate( 0, 1, angle, ji, A); |
680 | ||
681 | < | int i,j,k; |
681 | > | // rotate about the y-axis |
682 | > | angle = dt2 * ji[1] / I[1][1]; |
683 | > | this->rotate( 2, 0, angle, ji, A ); |
684 | > | |
685 | > | // rotate about the x-axis |
686 | > | angle = dt2 * ji[0] / I[0][0]; |
687 | > | this->rotate( 1, 2, angle, ji, A ); |
688 | > | |
689 | > | dAtom->setA( A ); |
690 | > | } |
691 | > | |
692 | > | template<typename T> void Integrator<T>::rotate(int axes1, int axes2, |
693 | > | double angle, double ji[3], |
694 | > | double A[3][3]){ |
695 | > | int i, j, k; |
696 | double sinAngle; | |
697 | double cosAngle; | |
698 | double angleSqr; | |
# | Line 660 | Line 704 | void Integrator::rotate( int axes1, int axes2, double | |
704 | ||
705 | // initialize the tempA | |
706 | ||
707 | < | for(i=0; i<3; i++){ |
708 | < | for(j=0; j<3; j++){ |
707 | > | for (i = 0; i < 3; i++){ |
708 | > | for (j = 0; j < 3; j++){ |
709 | tempA[j][i] = A[i][j]; | |
710 | } | |
711 | } | |
712 | ||
713 | // initialize the tempJ | |
714 | ||
715 | < | for( i=0; i<3; i++) tempJ[i] = ji[i]; |
716 | < | |
715 | > | for (i = 0; i < 3; i++) |
716 | > | tempJ[i] = ji[i]; |
717 | > | |
718 | // initalize rot as a unit matrix | |
719 | ||
720 | rot[0][0] = 1.0; | |
# | Line 679 | Line 724 | void Integrator::rotate( int axes1, int axes2, double | |
724 | rot[1][0] = 0.0; | |
725 | rot[1][1] = 1.0; | |
726 | rot[1][2] = 0.0; | |
727 | < | |
727 | > | |
728 | rot[2][0] = 0.0; | |
729 | rot[2][1] = 0.0; | |
730 | rot[2][2] = 1.0; | |
731 | < | |
731 | > | |
732 | // use a small angle aproximation for sin and cosine | |
733 | ||
734 | < | angleSqr = angle * angle; |
734 | > | angleSqr = angle * angle; |
735 | angleSqrOver4 = angleSqr / 4.0; | |
736 | top = 1.0 - angleSqrOver4; | |
737 | bottom = 1.0 + angleSqrOver4; | |
# | Line 699 | Line 744 | void Integrator::rotate( int axes1, int axes2, double | |
744 | ||
745 | rot[axes1][axes2] = sinAngle; | |
746 | rot[axes2][axes1] = -sinAngle; | |
747 | < | |
747 | > | |
748 | // rotate the momentum acoording to: ji[] = rot[][] * ji[] | |
749 | < | |
750 | < | for(i=0; i<3; i++){ |
749 | > | |
750 | > | for (i = 0; i < 3; i++){ |
751 | ji[i] = 0.0; | |
752 | < | for(k=0; k<3; k++){ |
752 | > | for (k = 0; k < 3; k++){ |
753 | ji[i] += rot[i][k] * tempJ[k]; | |
754 | } | |
755 | } | |
756 | ||
757 | < | // rotate the Rotation matrix acording to: |
757 | > | // rotate the Rotation matrix acording to: |
758 | // A[][] = A[][] * transpose(rot[][]) | |
759 | ||
760 | ||
761 | < | // NOte for as yet unknown reason, we are setting the performing the |
761 | > | // NOte for as yet unknown reason, we are performing the |
762 | // calculation as: | |
763 | // transpose(A[][]) = transpose(A[][]) * transpose(rot[][]) | |
764 | ||
765 | < | for(i=0; i<3; i++){ |
766 | < | for(j=0; j<3; j++){ |
765 | > | for (i = 0; i < 3; i++){ |
766 | > | for (j = 0; j < 3; j++){ |
767 | A[j][i] = 0.0; | |
768 | < | for(k=0; k<3; k++){ |
769 | < | A[j][i] += tempA[i][k] * rot[j][k]; |
768 | > | for (k = 0; k < 3; k++){ |
769 | > | A[j][i] += tempA[i][k] * rot[j][k]; |
770 | } | |
771 | } | |
772 | } | |
773 | } | |
774 | + | |
775 | + | template<typename T> void Integrator<T>::calcForce(int calcPot, int calcStress){ |
776 | + | myFF->doForces(calcPot, calcStress); |
777 | + | } |
778 | + | |
779 | + | template<typename T> void Integrator<T>::thermalize(){ |
780 | + | tStats->velocitize(); |
781 | + | } |
782 | + | |
783 | + | template<typename T> double Integrator<T>::getConservedQuantity(void){ |
784 | + | return tStats->getTotalE(); |
785 | + | } |
786 | + | template<typename T> string Integrator<T>::getAdditionalParameters(void){ |
787 | + | //By default, return a null string |
788 | + | //The reason we use string instead of char* is that if we use char*, we will |
789 | + | //return a pointer point to local variable which might cause problem |
790 | + | return string(); |
791 | + | } |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |