Changes in src/molecule_geometry.cpp [3930eb:a67d19]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/molecule_geometry.cpp
r3930eb ra67d19 15 15 #include "memoryallocator.hpp" 16 16 #include "molecule.hpp" 17 #include "World.hpp" 17 18 18 19 /************************************* Functions for class molecule *********************************/ … … 26 27 bool status = true; 27 28 const Vector *Center = DetermineCenterOfAll(); 29 double * const cell_size = World::get()->cell_size; 28 30 double *M = ReturnFullMatrixforSymmetric(cell_size); 29 31 double *Minv = InverseMatrix(M); … … 46 48 { 47 49 bool status = true; 50 double * const cell_size = World::get()->cell_size; 48 51 double *M = ReturnFullMatrixforSymmetric(cell_size); 49 52 double *Minv = InverseMatrix(M); … … 226 229 void molecule::TranslatePeriodically(const Vector *trans) 227 230 { 231 double * const cell_size = World::get()->cell_size; 228 232 double *M = ReturnFullMatrixforSymmetric(cell_size); 229 233 double *Minv = InverseMatrix(M); … … 252 256 { 253 257 atom *Walker = start; 258 double * const cell_size = World::get()->cell_size; 254 259 double *matrix = ReturnFullMatrixforSymmetric(cell_size); 255 260 double *inversematrix = InverseMatrix(cell_size); … … 275 280 if ((fabs(tmp)) > BondDistance) { 276 281 flag = false; 277 Log() << Verbose(0) << "Hit: atom " << Walker->Name << " in bond " << *(*Runner) << " has to be shifted due to " << tmp << "." << endl;282 DoLog(0) && (Log() << Verbose(0) << "Hit: atom " << Walker->Name << " in bond " << *(*Runner) << " has to be shifted due to " << tmp << "." << endl); 278 283 if (tmp > 0) 279 284 Translationvector.x[j] -= 1.; … … 286 291 Testvector.MatrixMultiplication(matrix); 287 292 Center.AddVector(&Testvector); 288 Log() << Verbose(1) << "vector is: ";293 DoLog(1) && (Log() << Verbose(1) << "vector is: "); 289 294 Testvector.Output(); 290 Log() << Verbose(0) << endl;295 DoLog(0) && (Log() << Verbose(0) << endl); 291 296 #ifdef ADDHYDROGEN 292 297 // now also change all hydrogens … … 298 303 Testvector.MatrixMultiplication(matrix); 299 304 Center.AddVector(&Testvector); 300 Log() << Verbose(1) << "Hydrogen vector is: ";305 DoLog(1) && (Log() << Verbose(1) << "Hydrogen vector is: "); 301 306 Testvector.Output(); 302 Log() << Verbose(0) << endl;307 DoLog(0) && (Log() << Verbose(0) << endl); 303 308 } 304 309 } … … 347 352 } 348 353 // print InertiaTensor for debugging 349 Log() << Verbose(0) << "The inertia tensor is:" << endl;354 DoLog(0) && (Log() << Verbose(0) << "The inertia tensor is:" << endl); 350 355 for(int i=0;i<NDIM;i++) { 351 356 for(int j=0;j<NDIM;j++) 352 Log() << Verbose(0) << InertiaTensor[i*NDIM+j] << " ";353 Log() << Verbose(0) << endl;354 } 355 Log() << Verbose(0) << endl;357 DoLog(0) && (Log() << Verbose(0) << InertiaTensor[i*NDIM+j] << " "); 358 DoLog(0) && (Log() << Verbose(0) << endl); 359 } 360 DoLog(0) && (Log() << Verbose(0) << endl); 356 361 357 362 // diagonalize to determine principal axis system … … 365 370 366 371 for(int i=0;i<NDIM;i++) { 367 Log() << Verbose(1) << "eigenvalue = " << gsl_vector_get(eval, i);368 Log() << Verbose(0) << ", eigenvector = (" << evec->data[i * evec->tda + 0] << "," << evec->data[i * evec->tda + 1] << "," << evec->data[i * evec->tda + 2] << ")" << endl;372 DoLog(1) && (Log() << Verbose(1) << "eigenvalue = " << gsl_vector_get(eval, i)); 373 DoLog(0) && (Log() << Verbose(0) << ", eigenvector = (" << evec->data[i * evec->tda + 0] << "," << evec->data[i * evec->tda + 1] << "," << evec->data[i * evec->tda + 2] << ")" << endl); 369 374 } 370 375 371 376 // check whether we rotate or not 372 377 if (DoRotate) { 373 Log() << Verbose(1) << "Transforming molecule into PAS ... ";378 DoLog(1) && (Log() << Verbose(1) << "Transforming molecule into PAS ... "); 374 379 // the eigenvectors specify the transformation matrix 375 380 ActOnAllVectors( &Vector::MatrixMultiplication, (const double *) evec->data ); 376 Log() << Verbose(0) << "done." << endl;381 DoLog(0) && (Log() << Verbose(0) << "done." << endl); 377 382 378 383 // summing anew for debugging (resulting matrix has to be diagonal!) … … 399 404 } 400 405 // print InertiaTensor for debugging 401 Log() << Verbose(0) << "The inertia tensor is:" << endl;406 DoLog(0) && (Log() << Verbose(0) << "The inertia tensor is:" << endl); 402 407 for(int i=0;i<NDIM;i++) { 403 408 for(int j=0;j<NDIM;j++) 404 Log() << Verbose(0) << InertiaTensor[i*NDIM+j] << " ";405 Log() << Verbose(0) << endl;406 } 407 Log() << Verbose(0) << endl;409 DoLog(0) && (Log() << Verbose(0) << InertiaTensor[i*NDIM+j] << " "); 410 DoLog(0) && (Log() << Verbose(0) << endl); 411 } 412 DoLog(0) && (Log() << Verbose(0) << endl); 408 413 } 409 414 … … 428 433 429 434 // rotate on z-x plane 430 Log() << Verbose(0) << "Begin of Aligning all atoms." << endl;435 DoLog(0) && (Log() << Verbose(0) << "Begin of Aligning all atoms." << endl); 431 436 alpha = atan(-n->x[0]/n->x[2]); 432 Log() << Verbose(1) << "Z-X-angle: " << alpha << " ... ";437 DoLog(1) && (Log() << Verbose(1) << "Z-X-angle: " << alpha << " ... "); 433 438 while (ptr->next != end) { 434 439 ptr = ptr->next; … … 446 451 n->x[0] = cos(alpha) * tmp + sin(alpha) * n->x[2]; 447 452 n->x[2] = -sin(alpha) * tmp + cos(alpha) * n->x[2]; 448 Log() << Verbose(1) << "alignment vector after first rotation: ";453 DoLog(1) && (Log() << Verbose(1) << "alignment vector after first rotation: "); 449 454 n->Output(); 450 Log() << Verbose(0) << endl;455 DoLog(0) && (Log() << Verbose(0) << endl); 451 456 452 457 // rotate on z-y plane 453 458 ptr = start; 454 459 alpha = atan(-n->x[1]/n->x[2]); 455 Log() << Verbose(1) << "Z-Y-angle: " << alpha << " ... ";460 DoLog(1) && (Log() << Verbose(1) << "Z-Y-angle: " << alpha << " ... "); 456 461 while (ptr->next != end) { 457 462 ptr = ptr->next; … … 470 475 n->x[2] = -sin(alpha) * tmp + cos(alpha) * n->x[2]; 471 476 472 Log() << Verbose(1) << "alignment vector after second rotation: ";477 DoLog(1) && (Log() << Verbose(1) << "alignment vector after second rotation: "); 473 478 n->Output(); 474 Log() << Verbose(1) << endl;475 Log() << Verbose(0) << "End of Aligning all atoms." << endl;479 DoLog(1) && (Log() << Verbose(1) << endl); 480 DoLog(0) && (Log() << Verbose(0) << "End of Aligning all atoms." << endl); 476 481 }; 477 482
Note:
See TracChangeset
for help on using the changeset viewer.