Changeset 543ce4 for molecuilder/src/molecule_geometry.cpp
- Timestamp:
- Nov 4, 2009, 7:56:04 PM (16 years ago)
- Children:
- 4ef101, aa8542
- Parents:
- ec70ec
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/molecule_geometry.cpp
rec70ec r543ce4 12 12 #include "helpers.hpp" 13 13 #include "leastsquaremin.hpp" 14 #include "log.hpp" 14 15 #include "memoryallocator.hpp" 15 16 #include "molecule.hpp" … … 21 22 * \param *out output stream for debugging 22 23 */ 23 bool molecule::CenterInBox( ofstream *out)24 bool molecule::CenterInBox() 24 25 { 25 26 bool status = true; 26 const Vector *Center = DetermineCenterOfAll( out);27 const Vector *Center = DetermineCenterOfAll(); 27 28 double *M = ReturnFullMatrixforSymmetric(cell_size); 28 29 double *Minv = InverseMatrix(M); … … 42 43 * \param *out output stream for debugging 43 44 */ 44 bool molecule::BoundInBox( ofstream *out)45 bool molecule::BoundInBox() 45 46 { 46 47 bool status = true; … … 60 61 * \param *max coordinates of other edge, specifying box dimensions. 61 62 */ 62 void molecule::CenterEdge( ofstream *out,Vector *max)63 void molecule::CenterEdge(Vector *max) 63 64 { 64 65 Vector *min = new Vector; 65 66 66 // *out<< Verbose(3) << "Begin of CenterEdge." << endl;67 // Log() << Verbose(3) << "Begin of CenterEdge." << endl; 67 68 atom *ptr = start->next; // start at first in list 68 69 if (ptr != end) { //list not empty? … … 79 80 } 80 81 } 81 // *out<< Verbose(4) << "Maximum is ";82 // Log() << Verbose(4) << "Maximum is "; 82 83 // max->Output(out); 83 // *out<< ", Minimum is ";84 // Log() << Verbose(0) << ", Minimum is "; 84 85 // min->Output(out); 85 // *out<< endl;86 // Log() << Verbose(0) << endl; 86 87 min->Scale(-1.); 87 88 max->AddVector(min); … … 90 91 } 91 92 delete(min); 92 // *out<< Verbose(3) << "End of CenterEdge." << endl;93 // Log() << Verbose(3) << "End of CenterEdge." << endl; 93 94 }; 94 95 … … 97 98 * \param *center return vector for translation vector 98 99 */ 99 void molecule::CenterOrigin( ofstream *out)100 void molecule::CenterOrigin() 100 101 { 101 102 int Num = 0; … … 117 118 118 119 /** Returns vector pointing to center of all atoms. 119 * \param *out output stream for debugging120 120 * \return pointer to center of all vector 121 121 */ 122 Vector * molecule::DetermineCenterOfAll( ofstream *out) const122 Vector * molecule::DetermineCenterOfAll() const 123 123 { 124 124 atom *ptr = start->next; // start at first in list … … 138 138 a->Scale(1./Num); // divide through total mass (and sign for direction) 139 139 } 140 //cout << Verbose(1) << "Resulting center of gravity: ";141 //a->Output(out);142 //cout << endl;143 140 return a; 144 141 }; … … 148 145 * \return pointer to center of gravity vector 149 146 */ 150 Vector * molecule::DetermineCenterOfGravity( ofstream *out)147 Vector * molecule::DetermineCenterOfGravity() 151 148 { 152 149 atom *ptr = start->next; // start at first in list … … 167 164 a->Scale(-1./Num); // divide through total mass (and sign for direction) 168 165 } 169 // *out<< Verbose(1) << "Resulting center of gravity: ";166 // Log() << Verbose(1) << "Resulting center of gravity: "; 170 167 // a->Output(out); 171 // *out<< endl;168 // Log() << Verbose(0) << endl; 172 169 return a; 173 170 }; … … 177 174 * \param *center return vector for translation vector 178 175 */ 179 void molecule::CenterPeriodic( ofstream *out)176 void molecule::CenterPeriodic() 180 177 { 181 178 DeterminePeriodicCenter(Center); … … 187 184 * \param *center return vector for translation vector 188 185 */ 189 void molecule::CenterAtVector( ofstream *out,Vector *newcenter)186 void molecule::CenterAtVector(Vector *newcenter) 190 187 { 191 188 Center.CopyVector(newcenter); … … 277 274 if ((fabs(tmp)) > BondDistance) { 278 275 flag = false; 279 cout<< Verbose(0) << "Hit: atom " << Walker->Name << " in bond " << *(*Runner) << " has to be shifted due to " << tmp << "." << endl;276 Log() << Verbose(0) << "Hit: atom " << Walker->Name << " in bond " << *(*Runner) << " has to be shifted due to " << tmp << "." << endl; 280 277 if (tmp > 0) 281 278 Translationvector.x[j] -= 1.; … … 288 285 Testvector.MatrixMultiplication(matrix); 289 286 Center.AddVector(&Testvector); 290 cout<< Verbose(1) << "vector is: ";291 Testvector.Output( (ofstream *)&cout);292 cout<< endl;287 Log() << Verbose(1) << "vector is: "; 288 Testvector.Output(); 289 Log() << Verbose(0) << endl; 293 290 #ifdef ADDHYDROGEN 294 291 // now also change all hydrogens … … 300 297 Testvector.MatrixMultiplication(matrix); 301 298 Center.AddVector(&Testvector); 302 cout<< Verbose(1) << "Hydrogen vector is: ";303 Testvector.Output( (ofstream *)&cout);304 cout<< endl;299 Log() << Verbose(1) << "Hydrogen vector is: "; 300 Testvector.Output(); 301 Log() << Verbose(0) << endl; 305 302 } 306 303 } … … 318 315 * TODO treatment of trajetories missing 319 316 */ 320 void molecule::PrincipalAxisSystem( ofstream *out,bool DoRotate)317 void molecule::PrincipalAxisSystem(bool DoRotate) 321 318 { 322 319 atom *ptr = start; // start at first in list 323 320 double InertiaTensor[NDIM*NDIM]; 324 Vector *CenterOfGravity = DetermineCenterOfGravity( out);325 326 CenterPeriodic( out);321 Vector *CenterOfGravity = DetermineCenterOfGravity(); 322 323 CenterPeriodic(); 327 324 328 325 // reset inertia tensor … … 347 344 } 348 345 // print InertiaTensor for debugging 349 *out<< "The inertia tensor is:" << endl;346 Log() << Verbose(0) << "The inertia tensor is:" << endl; 350 347 for(int i=0;i<NDIM;i++) { 351 348 for(int j=0;j<NDIM;j++) 352 *out<< InertiaTensor[i*NDIM+j] << " ";353 *out<< endl;354 } 355 *out<< endl;349 Log() << Verbose(0) << InertiaTensor[i*NDIM+j] << " "; 350 Log() << Verbose(0) << endl; 351 } 352 Log() << Verbose(0) << endl; 356 353 357 354 // diagonalize to determine principal axis system … … 365 362 366 363 for(int i=0;i<NDIM;i++) { 367 *out<< Verbose(1) << "eigenvalue = " << gsl_vector_get(eval, i);368 *out<< ", eigenvector = (" << evec->data[i * evec->tda + 0] << "," << evec->data[i * evec->tda + 1] << "," << evec->data[i * evec->tda + 2] << ")" << endl;364 Log() << Verbose(1) << "eigenvalue = " << gsl_vector_get(eval, i); 365 Log() << Verbose(0) << ", eigenvector = (" << evec->data[i * evec->tda + 0] << "," << evec->data[i * evec->tda + 1] << "," << evec->data[i * evec->tda + 2] << ")" << endl; 369 366 } 370 367 371 368 // check whether we rotate or not 372 369 if (DoRotate) { 373 *out<< Verbose(1) << "Transforming molecule into PAS ... ";370 Log() << Verbose(1) << "Transforming molecule into PAS ... "; 374 371 // the eigenvectors specify the transformation matrix 375 372 ActOnAllVectors( &Vector::MatrixMultiplication, (const double *) evec->data ); 376 *out<< "done." << endl;373 Log() << Verbose(0) << "done." << endl; 377 374 378 375 // summing anew for debugging (resulting matrix has to be diagonal!) … … 399 396 } 400 397 // print InertiaTensor for debugging 401 *out<< "The inertia tensor is:" << endl;398 Log() << Verbose(0) << "The inertia tensor is:" << endl; 402 399 for(int i=0;i<NDIM;i++) { 403 400 for(int j=0;j<NDIM;j++) 404 *out<< InertiaTensor[i*NDIM+j] << " ";405 *out<< endl;406 } 407 *out<< endl;401 Log() << Verbose(0) << InertiaTensor[i*NDIM+j] << " "; 402 Log() << Verbose(0) << endl; 403 } 404 Log() << Verbose(0) << endl; 408 405 } 409 406 … … 428 425 429 426 // rotate on z-x plane 430 cout<< Verbose(0) << "Begin of Aligning all atoms." << endl;427 Log() << Verbose(0) << "Begin of Aligning all atoms." << endl; 431 428 alpha = atan(-n->x[0]/n->x[2]); 432 cout<< Verbose(1) << "Z-X-angle: " << alpha << " ... ";429 Log() << Verbose(1) << "Z-X-angle: " << alpha << " ... "; 433 430 while (ptr->next != end) { 434 431 ptr = ptr->next; … … 446 443 n->x[0] = cos(alpha) * tmp + sin(alpha) * n->x[2]; 447 444 n->x[2] = -sin(alpha) * tmp + cos(alpha) * n->x[2]; 448 cout<< Verbose(1) << "alignment vector after first rotation: ";449 n->Output( (ofstream *)&cout);450 cout<< endl;445 Log() << Verbose(1) << "alignment vector after first rotation: "; 446 n->Output(); 447 Log() << Verbose(0) << endl; 451 448 452 449 // rotate on z-y plane 453 450 ptr = start; 454 451 alpha = atan(-n->x[1]/n->x[2]); 455 cout<< Verbose(1) << "Z-Y-angle: " << alpha << " ... ";452 Log() << Verbose(1) << "Z-Y-angle: " << alpha << " ... "; 456 453 while (ptr->next != end) { 457 454 ptr = ptr->next; … … 470 467 n->x[2] = -sin(alpha) * tmp + cos(alpha) * n->x[2]; 471 468 472 cout<< Verbose(1) << "alignment vector after second rotation: ";473 n->Output( (ofstream *)&cout);474 cout<< Verbose(1) << endl;475 cout<< Verbose(0) << "End of Aligning all atoms." << endl;469 Log() << Verbose(1) << "alignment vector after second rotation: "; 470 n->Output(); 471 Log() << Verbose(1) << endl; 472 Log() << Verbose(0) << "End of Aligning all atoms." << endl; 476 473 }; 477 474
Note:
See TracChangeset
for help on using the changeset viewer.