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