Changeset 0d111b for molecuilder/src/atom_trajectoryparticle.cpp
- Timestamp:
- Apr 29, 2010, 1:55:21 PM (15 years ago)
- Children:
- 070651, 5d1a94
- Parents:
- 90c4460 (diff), 32842d8 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/atom_trajectoryparticle.cpp
r90c4460 r0d111b 34 34 { 35 35 for (int i=NDIM;i--;) 36 *temperature += type->mass * Trajectory.U.at(step) .x[i]* Trajectory.U.at(step).x[i];36 *temperature += type->mass * Trajectory.U.at(step)[i]* Trajectory.U.at(step)[i]; 37 37 }; 38 38 … … 49 49 // set forces 50 50 for (int i=NDIM;i++;) 51 Force->Matrix[0][nr][5+i] += 2.*constant*sqrt(Trajectory.R.at(startstep).Distance( &Sprinter->Trajectory.R.at(endstep)));51 Force->Matrix[0][nr][5+i] += 2.*constant*sqrt(Trajectory.R.at(startstep).Distance(Sprinter->Trajectory.R.at(endstep))); 52 52 }; 53 53 … … 60 60 { 61 61 for(int d=0;d<NDIM;d++) { 62 Trajectory.U.at(Step) .x[d] -= CoGVelocity->x[d];63 *ActualTemp += 0.5 * type->mass * Trajectory.U.at(Step) .x[d] * Trajectory.U.at(Step).x[d];62 Trajectory.U.at(Step)[d] -= CoGVelocity->at(d); 63 *ActualTemp += 0.5 * type->mass * Trajectory.U.at(Step)[d] * Trajectory.U.at(Step)[d]; 64 64 } 65 65 }; … … 89 89 90 90 for (int n=NDIM;n--;) { 91 Trajectory.R.at(dest) .x[n] = Trajectory.R.at(src).x[n];92 Trajectory.U.at(dest) .x[n] = Trajectory.U.at(src).x[n];93 Trajectory.F.at(dest) .x[n] = Trajectory.F.at(src).x[n];91 Trajectory.R.at(dest)[n] = Trajectory.R.at(src)[n]; 92 Trajectory.U.at(dest)[n] = Trajectory.U.at(src)[n]; 93 Trajectory.F.at(dest)[n] = Trajectory.F.at(src)[n]; 94 94 } 95 95 }; … … 105 105 //a = configuration.Deltat*0.5/walker->type->mass; // (F+F_old)/2m = a and thus: v = (F+F_old)/2m * t = (F + F_old) * a 106 106 for (int d=0; d<NDIM; d++) { 107 Trajectory.F.at(NextStep) .x[d] = -Force->Matrix[0][nr][d+5]*(configuration->GetIsAngstroem() ? AtomicLengthToAngstroem : 1.);108 Trajectory.R.at(NextStep) .x[d] = Trajectory.R.at(NextStep-1).x[d];109 Trajectory.R.at(NextStep) .x[d] += configuration->Deltat*(Trajectory.U.at(NextStep-1).x[d]); // s(t) = s(0) + v * deltat + 1/2 a * deltat^2110 Trajectory.R.at(NextStep) .x[d] += 0.5*configuration->Deltat*configuration->Deltat*(Trajectory.F.at(NextStep).x[d]/type->mass); // F = m * a and s =107 Trajectory.F.at(NextStep)[d] = -Force->Matrix[0][nr][d+5]*(configuration->GetIsAngstroem() ? AtomicLengthToAngstroem : 1.); 108 Trajectory.R.at(NextStep)[d] = Trajectory.R.at(NextStep-1)[d]; 109 Trajectory.R.at(NextStep)[d] += configuration->Deltat*(Trajectory.U.at(NextStep-1)[d]); // s(t) = s(0) + v * deltat + 1/2 a * deltat^2 110 Trajectory.R.at(NextStep)[d] += 0.5*configuration->Deltat*configuration->Deltat*(Trajectory.F.at(NextStep)[d]/type->mass); // F = m * a and s = 111 111 } 112 112 // Update U 113 113 for (int d=0; d<NDIM; d++) { 114 Trajectory.U.at(NextStep) .x[d] = Trajectory.U.at(NextStep-1).x[d];115 Trajectory.U.at(NextStep) .x[d] += configuration->Deltat * (Trajectory.F.at(NextStep).x[d]+Trajectory.F.at(NextStep-1).x[d]/type->mass); // v = F/m * t114 Trajectory.U.at(NextStep)[d] = Trajectory.U.at(NextStep-1)[d]; 115 Trajectory.U.at(NextStep)[d] += configuration->Deltat * (Trajectory.F.at(NextStep)[d]+Trajectory.F.at(NextStep-1)[d]/type->mass); // v = F/m * t 116 116 } 117 117 // Update R (and F) … … 134 134 *TotalMass += type->mass; // sum up total mass 135 135 for(int d=0;d<NDIM;d++) { 136 TotalVelocity-> x[d] += Trajectory.U.at(Step).x[d]*type->mass;136 TotalVelocity->at(d) += Trajectory.U.at(Step)[d]*type->mass; 137 137 } 138 138 }; … … 145 145 void TrajectoryParticle::Thermostat_Woodcock(double ScaleTempFactor, int Step, double *ekin) 146 146 { 147 double *U = Trajectory.U.at(Step).x;147 Vector &U = Trajectory.U.at(Step); 148 148 if (FixedIon == 0) // even FixedIon moves, only not by other's forces 149 149 for (int d=0; d<NDIM; d++) { … … 160 160 void TrajectoryParticle::Thermostat_Gaussian_init(int Step, double *G, double *E) 161 161 { 162 double *U = Trajectory.U.at(Step).x;163 double *F = Trajectory.F.at(Step).x;162 Vector &U = Trajectory.U.at(Step); 163 Vector &F = Trajectory.F.at(Step); 164 164 if (FixedIon == 0) // even FixedIon moves, only not by other's forces 165 165 for (int d=0; d<NDIM; d++) { … … 177 177 void TrajectoryParticle::Thermostat_Gaussian_least_constraint(int Step, double G_over_E, double *ekin, config *configuration) 178 178 { 179 double *U = Trajectory.U.at(Step).x;179 Vector &U = Trajectory.U.at(Step); 180 180 if (FixedIon == 0) // even FixedIon moves, only not by other's forces 181 181 for (int d=0; d<NDIM; d++) { … … 194 194 { 195 195 double sigma = sqrt(configuration->TargetTemp/type->mass); // sigma = (k_b T)/m (Hartree/atomicmass = atomiclength/atomictime) 196 double *U = Trajectory.U.at(Step).x;196 Vector &U = Trajectory.U.at(Step); 197 197 if (FixedIon == 0) { // even FixedIon moves, only not by other's forces 198 198 // throw a dice to determine whether it gets hit by a heat bath particle … … 218 218 void TrajectoryParticle::Thermostat_Berendsen(int Step, double ScaleTempFactor, double *ekin, config *configuration) 219 219 { 220 double *U = Trajectory.U.at(Step).x;220 Vector &U = Trajectory.U.at(Step); 221 221 if (FixedIon == 0) { // even FixedIon moves, only not by other's forces 222 222 for (int d=0; d<NDIM; d++) { … … 233 233 void TrajectoryParticle::Thermostat_NoseHoover_init(int Step, double *delta_alpha) 234 234 { 235 double *U = Trajectory.U.at(Step).x;235 Vector &U = Trajectory.U.at(Step); 236 236 if (FixedIon == 0) { // even FixedIon moves, only not by other's forces 237 237 for (int d=0; d<NDIM; d++) { … … 248 248 void TrajectoryParticle::Thermostat_NoseHoover_scale(int Step, double *ekin, config *configuration) 249 249 { 250 double *U = Trajectory.U.at(Step).x;250 Vector &U = Trajectory.U.at(Step); 251 251 if (FixedIon == 0) { // even FixedIon moves, only not by other's forces 252 252 for (int d=0; d<NDIM; d++) {
Note:
See TracChangeset
for help on using the changeset viewer.