Changeset 1f591b for molecuilder/src/molecule_geometry.cpp
- Timestamp:
- Apr 13, 2010, 1:22:42 PM (16 years ago)
- Children:
- e7ea64
- Parents:
- 0f55b2
- File:
-
- 1 edited
-
molecuilder/src/molecule_geometry.cpp (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/molecule_geometry.cpp
r0f55b2 r1f591b 30 30 31 31 // go through all atoms 32 ActOnAllVectors( &Vector::SubtractVector, Center);32 ActOnAllVectors( &Vector::SubtractVector, *Center); 33 33 ActOnAllVectors( &Vector::WrapPeriodically, (const double *)M, (const double *)Minv); 34 34 … … 86 86 // Log() << Verbose(0) << endl; 87 87 min->Scale(-1.); 88 max->AddVector(min);88 (*max) += (*min); 89 89 Translate(min); 90 90 Center.Zero(); … … 109 109 ptr = ptr->next; 110 110 Num++; 111 Center .AddVector(&ptr->x);111 Center += ptr->x; 112 112 } 113 113 Center.Scale(-1./Num); // divide through total number (and sign for direction) … … 133 133 ptr = ptr->next; 134 134 Num += 1.; 135 tmp .CopyVector(&ptr->x);136 a->AddVector(&tmp);135 tmp = ptr->x; 136 (*a) += tmp; 137 137 } 138 138 a->Scale(1./Num); // divide through total mass (and sign for direction) … … 158 158 ptr = ptr->next; 159 159 Num += ptr->type->mass; 160 tmp.CopyVector(&ptr->x); 161 tmp.Scale(ptr->type->mass); // scale by mass 162 a->AddVector(&tmp); 160 tmp = ptr->type->mass * ptr->x; 161 (*a) += tmp; 163 162 } 164 163 a->Scale(-1./Num); // divide through total mass (and sign for direction) … … 186 185 void molecule::CenterAtVector(Vector *newcenter) 187 186 { 188 Center .CopyVector(newcenter);187 Center = *newcenter; 189 188 }; 190 189 … … 215 214 ptr = ptr->next; 216 215 for (int j=0;j<MDSteps;j++) 217 ptr->Trajectory.R.at(j).Translate( trans);218 ptr->x.Translate( trans);216 ptr->Trajectory.R.at(j).Translate(*trans); 217 ptr->x.Translate(*trans); 219 218 } 220 219 }; … … 230 229 231 230 // go through all atoms 232 ActOnAllVectors( &Vector::SubtractVector, trans);231 ActOnAllVectors( &Vector::SubtractVector, *trans); 233 232 ActOnAllVectors( &Vector::WrapPeriodically, (const double *)M, (const double *)Minv); 234 233 … … 243 242 void molecule::Mirror(const Vector *n) 244 243 { 245 ActOnAllVectors( &Vector::Mirror, n );244 ActOnAllVectors( &Vector::Mirror, *n ); 246 245 }; 247 246 … … 266 265 if (Walker->type->Z != 1) { 267 266 #endif 268 Testvector .CopyVector(&Walker->x);267 Testvector = Walker->x; 269 268 Testvector.MatrixMultiplication(inversematrix); 270 269 Translationvector.Zero(); … … 283 282 } 284 283 } 285 Testvector .AddVector(&Translationvector);284 Testvector += Translationvector; 286 285 Testvector.MatrixMultiplication(matrix); 287 Center .AddVector(&Testvector);286 Center += Testvector; 288 287 Log() << Verbose(1) << "vector is: " << Testvector << endl; 289 288 #ifdef ADDHYDROGEN … … 291 290 for (BondList::const_iterator Runner = Walker->ListOfBonds.begin(); Runner != Walker->ListOfBonds.end(); (++Runner)) { 292 291 if ((*Runner)->GetOtherAtom(Walker)->type->Z == 1) { 293 Testvector .CopyVector(&(*Runner)->GetOtherAtom(Walker)->x);292 Testvector = (*Runner)->GetOtherAtom(Walker)->x; 294 293 Testvector.MatrixMultiplication(inversematrix); 295 Testvector .AddVector(&Translationvector);294 Testvector += Translationvector; 296 295 Testvector.MatrixMultiplication(matrix); 297 Center .AddVector(&Testvector);296 Center += Testvector; 298 297 Log() << Verbose(1) << "Hydrogen vector is: " << Testvector << endl; 299 298 } … … 329 328 while (ptr->next != end) { 330 329 ptr = ptr->next; 331 Vector x; 332 x.CopyVector(&ptr->x); 330 Vector x = ptr->x; 333 331 //x.SubtractVector(CenterOfGravity); 334 332 InertiaTensor[0] += ptr->type->mass*(x[1]*x[1] + x[2]*x[2]); … … 381 379 while (ptr->next != end) { 382 380 ptr = ptr->next; 383 Vector x; 384 x.CopyVector(&ptr->x); 381 Vector x = ptr->x; 385 382 //x.SubtractVector(CenterOfGravity); 386 383 InertiaTensor[0] += ptr->type->mass*(x[1]*x[1] + x[2]*x[2]); … … 492 489 ptr = ptr->next; 493 490 if (ptr->type == ((struct lsq_params *)params)->type) { // for specific type 494 c.CopyVector(&ptr->x); // copy vector to temporary one 495 c.SubtractVector(&a); // subtract offset vector 496 t = c.ScalarProduct(&b); // get direction parameter 497 d.CopyVector(&b); // and create vector 498 d.Scale(&t); 499 c.SubtractVector(&d); // ... yielding distance vector 500 res += d.ScalarProduct((const Vector *)&d); // add squared distance 491 c = ptr->x - a; 492 t = c.ScalarProduct(b); // get direction parameter 493 d = t*b; // and create vector 494 c -= d; // ... yielding distance vector 495 res += d.ScalarProduct(d); // add squared distance 501 496 } 502 497 }
Note:
See TracChangeset
for help on using the changeset viewer.
