Changes in src/builder.cpp [b34306:a67d19]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/builder.cpp
rb34306 ra67d19 52 52 #include <cstring> 53 53 54 #include "analysis_bonds.hpp" 54 55 #include "analysis_correlation.hpp" 55 56 #include "atom.hpp" … … 85 86 bool valid; 86 87 87 Log()<< Verbose(0) << "===========ADD ATOM============================" << endl;88 Log()<< Verbose(0) << " a - state absolute coordinates of atom" << endl;89 Log()<< Verbose(0) << " b - state relative coordinates of atom wrt to reference point" << endl;90 Log()<< Verbose(0) << " c - state relative coordinates of atom wrt to already placed atom" << endl;91 Log()<< Verbose(0) << " d - state two atoms, two angles and a distance" << endl;92 Log()<< Verbose(0) << " e - least square distance position to a set of atoms" << endl;93 Log()<< Verbose(0) << "all else - go back" << endl;94 Log()<< Verbose(0) << "===============================================" << endl;95 Log()<< Verbose(0) << "Note: Specifiy angles in degrees not multiples of Pi!" << endl;96 Log()<< Verbose(0) << "INPUT: ";88 cout << Verbose(0) << "===========ADD ATOM============================" << endl; 89 cout << Verbose(0) << " a - state absolute coordinates of atom" << endl; 90 cout << Verbose(0) << " b - state relative coordinates of atom wrt to reference point" << endl; 91 cout << Verbose(0) << " c - state relative coordinates of atom wrt to already placed atom" << endl; 92 cout << Verbose(0) << " d - state two atoms, two angles and a distance" << endl; 93 cout << Verbose(0) << " e - least square distance position to a set of atoms" << endl; 94 cout << Verbose(0) << "all else - go back" << endl; 95 cout << Verbose(0) << "===============================================" << endl; 96 cout << Verbose(0) << "Note: Specifiy angles in degrees not multiples of Pi!" << endl; 97 cout << Verbose(0) << "INPUT: "; 97 98 cin >> choice; 98 99 99 100 switch (choice) { 100 101 default: 101 eLog() << Verbose(2) << "Not a valid choice." << endl;102 DoeLog(2) && (eLog()<< Verbose(2) << "Not a valid choice." << endl); 102 103 break; 103 104 case 'a': // absolute coordinates of atom 104 Log()<< Verbose(0) << "Enter absolute coordinates." << endl;105 cout << Verbose(0) << "Enter absolute coordinates." << endl; 105 106 first = new atom; 106 107 first->x.AskPosition(World::get()->cell_size, false); … … 113 114 valid = true; 114 115 do { 115 if (!valid) eLog() << Verbose(2) << "Resulting position out of cell." << endl;116 Log()<< Verbose(0) << "Enter reference coordinates." << endl;116 if (!valid) DoeLog(2) && (eLog()<< Verbose(2) << "Resulting position out of cell." << endl); 117 cout << Verbose(0) << "Enter reference coordinates." << endl; 117 118 x.AskPosition(World::get()->cell_size, true); 118 Log()<< Verbose(0) << "Enter relative coordinates." << endl;119 cout << Verbose(0) << "Enter relative coordinates." << endl; 119 120 first->x.AskPosition(World::get()->cell_size, false); 120 121 first->x.AddVector((const Vector *)&x); 121 Log()<< Verbose(0) << "\n";122 cout << Verbose(0) << "\n"; 122 123 } while (!(valid = mol->CheckBounds((const Vector *)&first->x))); 123 124 first->type = periode->AskElement(); // give type … … 129 130 valid = true; 130 131 do { 131 if (!valid) eLog() << Verbose(2) << "Resulting position out of cell." << endl;132 if (!valid) DoeLog(2) && (eLog()<< Verbose(2) << "Resulting position out of cell." << endl); 132 133 second = mol->AskAtom("Enter atom number: "); 133 Log() << Verbose(0) << "Enter relative coordinates." << endl;134 DoLog(0) && (Log() << Verbose(0) << "Enter relative coordinates." << endl); 134 135 first->x.AskPosition(World::get()->cell_size, false); 135 136 for (int i=NDIM;i--;) { … … 146 147 do { 147 148 if (!valid) { 148 eLog() << Verbose(2) << "Resulting coordinates out of cell - " << first->x << endl;149 DoeLog(2) && (eLog()<< Verbose(2) << "Resulting coordinates out of cell - " << first->x << endl); 149 150 } 150 Log()<< Verbose(0) << "First, we need two atoms, the first atom is the central, while the second is the outer one." << endl;151 cout << Verbose(0) << "First, we need two atoms, the first atom is the central, while the second is the outer one." << endl; 151 152 second = mol->AskAtom("Enter central atom: "); 152 153 third = mol->AskAtom("Enter second atom (specifying the axis for first angle): "); … … 159 160 c *= M_PI/180.; 160 161 bound(&c, -M_PI, M_PI); 161 Log()<< Verbose(0) << "radius: " << a << "\t phi: " << b*180./M_PI << "\t theta: " << c*180./M_PI << endl;162 cout << Verbose(0) << "radius: " << a << "\t phi: " << b*180./M_PI << "\t theta: " << c*180./M_PI << endl; 162 163 /* 163 164 second->Output(1,1,(ofstream *)&cout); … … 171 172 172 173 if (!z.SolveSystem(&x,&y,&n, b, c, a)) { 173 Log() << Verbose(0) << "Failure solving self-dependent linear system!" << endl;174 coutg() << Verbose(0) << "Failure solving self-dependent linear system!" << endl; 174 175 continue; 175 176 } 176 Log() << Verbose(0) << "resulting relative coordinates: ";177 DoLog(0) && (Log() << Verbose(0) << "resulting relative coordinates: "); 177 178 z.Output(); 178 Log() << Verbose(0) << endl;179 DoLog(0) && (Log() << Verbose(0) << endl); 179 180 */ 180 181 // calc axis vector … … 184 185 Log() << Verbose(0) << "x: ", 185 186 x.Output(); 186 Log() << Verbose(0) << endl;187 DoLog(0) && (Log() << Verbose(0) << endl); 187 188 z.MakeNormalVector(&second->x,&third->x,&fourth->x); 188 189 Log() << Verbose(0) << "z: ", 189 190 z.Output(); 190 Log() << Verbose(0) << endl;191 DoLog(0) && (Log() << Verbose(0) << endl); 191 192 y.MakeNormalVector(&x,&z); 192 193 Log() << Verbose(0) << "y: ", 193 194 y.Output(); 194 Log() << Verbose(0) << endl;195 DoLog(0) && (Log() << Verbose(0) << endl); 195 196 196 197 // rotate vector around first angle … … 199 200 Log() << Verbose(0) << "Rotated vector: ", 200 201 first->x.Output(); 201 Log() << Verbose(0) << endl;202 DoLog(0) && (Log() << Verbose(0) << endl); 202 203 // remove the projection onto the rotation plane of the second angle 203 204 n.CopyVector(&y); … … 205 206 Log() << Verbose(0) << "N1: ", 206 207 n.Output(); 207 Log() << Verbose(0) << endl;208 DoLog(0) && (Log() << Verbose(0) << endl); 208 209 first->x.SubtractVector(&n); 209 210 Log() << Verbose(0) << "Subtracted vector: ", 210 211 first->x.Output(); 211 Log() << Verbose(0) << endl;212 DoLog(0) && (Log() << Verbose(0) << endl); 212 213 n.CopyVector(&z); 213 214 n.Scale(first->x.ScalarProduct(&z)); 214 215 Log() << Verbose(0) << "N2: ", 215 216 n.Output(); 216 Log() << Verbose(0) << endl;217 DoLog(0) && (Log() << Verbose(0) << endl); 217 218 first->x.SubtractVector(&n); 218 219 Log() << Verbose(0) << "2nd subtracted vector: ", 219 220 first->x.Output(); 220 Log() << Verbose(0) << endl;221 DoLog(0) && (Log() << Verbose(0) << endl); 221 222 222 223 // rotate another vector around second angle … … 225 226 Log() << Verbose(0) << "2nd Rotated vector: ", 226 227 n.Output(); 227 Log() << Verbose(0) << endl;228 DoLog(0) && (Log() << Verbose(0) << endl); 228 229 229 230 // add the two linear independent vectors … … 233 234 first->x.AddVector(&second->x); 234 235 235 Log() << Verbose(0) << "resulting coordinates: ";236 DoLog(0) && (Log() << Verbose(0) << "resulting coordinates: "); 236 237 first->x.Output(); 237 Log() << Verbose(0) << endl;238 DoLog(0) && (Log() << Verbose(0) << endl); 238 239 } while (!(valid = mol->CheckBounds((const Vector *)&first->x))); 239 240 first->type = periode->AskElement(); // give type … … 248 249 atoms[i] = NULL; 249 250 int i=0, j=0; 250 Log()<< Verbose(0) << "Now we need at least three molecules.\n";251 cout << Verbose(0) << "Now we need at least three molecules.\n"; 251 252 do { 252 Log()<< Verbose(0) << "Enter " << i+1 << "th atom: ";253 cout << Verbose(0) << "Enter " << i+1 << "th atom: "; 253 254 cin >> j; 254 255 if (j != -1) { … … 265 266 } else { 266 267 delete first; 267 Log()<< Verbose(0) << "Please enter at least two vectors!\n";268 cout << Verbose(0) << "Please enter at least two vectors!\n"; 268 269 } 269 270 break; … … 279 280 char choice; // menu choice char 280 281 281 Log()<< Verbose(0) << "===========CENTER ATOMS=========================" << endl;282 Log()<< Verbose(0) << " a - on origin" << endl;283 Log()<< Verbose(0) << " b - on center of gravity" << endl;284 Log()<< Verbose(0) << " c - within box with additional boundary" << endl;285 Log()<< Verbose(0) << " d - within given simulation box" << endl;286 Log()<< Verbose(0) << "all else - go back" << endl;287 Log()<< Verbose(0) << "===============================================" << endl;288 Log()<< Verbose(0) << "INPUT: ";282 cout << Verbose(0) << "===========CENTER ATOMS=========================" << endl; 283 cout << Verbose(0) << " a - on origin" << endl; 284 cout << Verbose(0) << " b - on center of gravity" << endl; 285 cout << Verbose(0) << " c - within box with additional boundary" << endl; 286 cout << Verbose(0) << " d - within given simulation box" << endl; 287 cout << Verbose(0) << "all else - go back" << endl; 288 cout << Verbose(0) << "===============================================" << endl; 289 cout << Verbose(0) << "INPUT: "; 289 290 cin >> choice; 290 291 291 292 switch (choice) { 292 293 default: 293 Log()<< Verbose(0) << "Not a valid choice." << endl;294 cout << Verbose(0) << "Not a valid choice." << endl; 294 295 break; 295 296 case 'a': 296 Log()<< Verbose(0) << "Centering atoms in config file on origin." << endl;297 cout << Verbose(0) << "Centering atoms in config file on origin." << endl; 297 298 mol->CenterOrigin(); 298 299 break; 299 300 case 'b': 300 Log()<< Verbose(0) << "Centering atoms in config file on center of gravity." << endl;301 cout << Verbose(0) << "Centering atoms in config file on center of gravity." << endl; 301 302 mol->CenterPeriodic(); 302 303 break; 303 304 case 'c': 304 Log()<< Verbose(0) << "Centering atoms in config file within given additional boundary." << endl;305 cout << Verbose(0) << "Centering atoms in config file within given additional boundary." << endl; 305 306 for (int i=0;i<NDIM;i++) { 306 Log()<< Verbose(0) << "Enter axis " << i << " boundary: ";307 cout << Verbose(0) << "Enter axis " << i << " boundary: "; 307 308 cin >> y.x[i]; 308 309 } … … 315 316 break; 316 317 case 'd': 317 Log()<< Verbose(1) << "Centering atoms in config file within given simulation box." << endl;318 cout << Verbose(1) << "Centering atoms in config file within given simulation box." << endl; 318 319 for (int i=0;i<NDIM;i++) { 319 Log()<< Verbose(0) << "Enter axis " << i << " boundary: ";320 cout << Verbose(0) << "Enter axis " << i << " boundary: "; 320 321 cin >> x.x[i]; 321 322 } … … 338 339 char choice; // menu choice char 339 340 340 Log()<< Verbose(0) << "===========ALIGN ATOMS=========================" << endl;341 Log()<< Verbose(0) << " a - state three atoms defining align plane" << endl;342 Log()<< Verbose(0) << " b - state alignment vector" << endl;343 Log()<< Verbose(0) << " c - state two atoms in alignment direction" << endl;344 Log()<< Verbose(0) << " d - align automatically by least square fit" << endl;345 Log()<< Verbose(0) << "all else - go back" << endl;346 Log()<< Verbose(0) << "===============================================" << endl;347 Log()<< Verbose(0) << "INPUT: ";341 cout << Verbose(0) << "===========ALIGN ATOMS=========================" << endl; 342 cout << Verbose(0) << " a - state three atoms defining align plane" << endl; 343 cout << Verbose(0) << " b - state alignment vector" << endl; 344 cout << Verbose(0) << " c - state two atoms in alignment direction" << endl; 345 cout << Verbose(0) << " d - align automatically by least square fit" << endl; 346 cout << Verbose(0) << "all else - go back" << endl; 347 cout << Verbose(0) << "===============================================" << endl; 348 cout << Verbose(0) << "INPUT: "; 348 349 cin >> choice; 349 350 … … 358 359 break; 359 360 case 'b': // normal vector of mirror plane 360 Log()<< Verbose(0) << "Enter normal vector of mirror plane." << endl;361 cout << Verbose(0) << "Enter normal vector of mirror plane." << endl; 361 362 n.AskPosition(World::get()->cell_size,0); 362 363 n.Normalize(); … … 378 379 fscanf(stdin, "%3s", shorthand); 379 380 } while ((param.type = periode->FindElement(shorthand)) == NULL); 380 Log()<< Verbose(0) << "Element is " << param.type->name << endl;381 cout << Verbose(0) << "Element is " << param.type->name << endl; 381 382 mol->GetAlignvector(¶m); 382 383 for (int i=NDIM;i--;) { … … 385 386 } 386 387 gsl_vector_free(param.x); 387 Log()<< Verbose(0) << "Offset vector: ";388 cout << Verbose(0) << "Offset vector: "; 388 389 x.Output(); 389 Log() << Verbose(0) << endl;390 DoLog(0) && (Log() << Verbose(0) << endl); 390 391 n.Normalize(); 391 392 break; 392 393 }; 393 Log() << Verbose(0) << "Alignment vector: ";394 DoLog(0) && (Log() << Verbose(0) << "Alignment vector: "); 394 395 n.Output(); 395 Log() << Verbose(0) << endl;396 DoLog(0) && (Log() << Verbose(0) << endl); 396 397 mol->Align(&n); 397 398 }; … … 406 407 char choice; // menu choice char 407 408 408 Log() << Verbose(0) << "===========MIRROR ATOMS=========================" << endl;409 Log() << Verbose(0) << " a - state three atoms defining mirror plane" << endl;410 Log() << Verbose(0) << " b - state normal vector of mirror plane" << endl;411 Log() << Verbose(0) << " c - state two atoms in normal direction" << endl;412 Log() << Verbose(0) << "all else - go back" << endl;413 Log() << Verbose(0) << "===============================================" << endl;414 Log() << Verbose(0) << "INPUT: ";409 DoLog(0) && (Log() << Verbose(0) << "===========MIRROR ATOMS=========================" << endl); 410 DoLog(0) && (Log() << Verbose(0) << " a - state three atoms defining mirror plane" << endl); 411 DoLog(0) && (Log() << Verbose(0) << " b - state normal vector of mirror plane" << endl); 412 DoLog(0) && (Log() << Verbose(0) << " c - state two atoms in normal direction" << endl); 413 DoLog(0) && (Log() << Verbose(0) << "all else - go back" << endl); 414 DoLog(0) && (Log() << Verbose(0) << "===============================================" << endl); 415 DoLog(0) && (Log() << Verbose(0) << "INPUT: "); 415 416 cin >> choice; 416 417 … … 425 426 break; 426 427 case 'b': // normal vector of mirror plane 427 Log() << Verbose(0) << "Enter normal vector of mirror plane." << endl;428 DoLog(0) && (Log() << Verbose(0) << "Enter normal vector of mirror plane." << endl); 428 429 n.AskPosition(World::get()->cell_size,0); 429 430 n.Normalize(); … … 438 439 break; 439 440 }; 440 Log() << Verbose(0) << "Normal vector: ";441 DoLog(0) && (Log() << Verbose(0) << "Normal vector: "); 441 442 n.Output(); 442 Log() << Verbose(0) << endl;443 DoLog(0) && (Log() << Verbose(0) << endl); 443 444 mol->Mirror((const Vector *)&n); 444 445 }; … … 454 455 char choice; // menu choice char 455 456 456 Log() << Verbose(0) << "===========REMOVE ATOMS=========================" << endl;457 Log() << Verbose(0) << " a - state atom for removal by number" << endl;458 Log() << Verbose(0) << " b - keep only in radius around atom" << endl;459 Log() << Verbose(0) << " c - remove this with one axis greater value" << endl;460 Log() << Verbose(0) << "all else - go back" << endl;461 Log() << Verbose(0) << "===============================================" << endl;462 Log() << Verbose(0) << "INPUT: ";457 DoLog(0) && (Log() << Verbose(0) << "===========REMOVE ATOMS=========================" << endl); 458 DoLog(0) && (Log() << Verbose(0) << " a - state atom for removal by number" << endl); 459 DoLog(0) && (Log() << Verbose(0) << " b - keep only in radius around atom" << endl); 460 DoLog(0) && (Log() << Verbose(0) << " c - remove this with one axis greater value" << endl); 461 DoLog(0) && (Log() << Verbose(0) << "all else - go back" << endl); 462 DoLog(0) && (Log() << Verbose(0) << "===============================================" << endl); 463 DoLog(0) && (Log() << Verbose(0) << "INPUT: "); 463 464 cin >> choice; 464 465 … … 467 468 case 'a': 468 469 if (mol->RemoveAtom(mol->AskAtom("Enter number of atom within molecule: "))) 469 Log() << Verbose(1) << "Atom removed." << endl;470 DoLog(1) && (Log() << Verbose(1) << "Atom removed." << endl); 470 471 else 471 Log() << Verbose(1) << "Atom not found." << endl;472 DoLog(1) && (Log() << Verbose(1) << "Atom not found." << endl); 472 473 break; 473 474 case 'b': 474 475 second = mol->AskAtom("Enter number of atom as reference point: "); 475 Log() << Verbose(0) << "Enter radius: ";476 DoLog(0) && (Log() << Verbose(0) << "Enter radius: "); 476 477 cin >> tmp1; 477 478 first = mol->start; … … 485 486 break; 486 487 case 'c': 487 Log() << Verbose(0) << "Which axis is it: ";488 DoLog(0) && (Log() << Verbose(0) << "Which axis is it: "); 488 489 cin >> axis; 489 Log() << Verbose(0) << "Lower boundary: ";490 DoLog(0) && (Log() << Verbose(0) << "Lower boundary: "); 490 491 cin >> tmp1; 491 Log() << Verbose(0) << "Upper boundary: ";492 DoLog(0) && (Log() << Verbose(0) << "Upper boundary: "); 492 493 cin >> tmp2; 493 494 first = mol->start; … … 519 520 char choice; // menu choice char 520 521 521 Log() << Verbose(0) << "===========MEASURE ATOMS=========================" << endl;522 Log() << Verbose(0) << " a - calculate bond length between one atom and all others" << endl;523 Log() << Verbose(0) << " b - calculate bond length between two atoms" << endl;524 Log() << Verbose(0) << " c - calculate bond angle" << endl;525 Log() << Verbose(0) << " d - calculate principal axis of the system" << endl;526 Log() << Verbose(0) << " e - calculate volume of the convex envelope" << endl;527 Log() << Verbose(0) << " f - calculate temperature from current velocity" << endl;528 Log() << Verbose(0) << " g - output all temperatures per step from velocities" << endl;529 Log() << Verbose(0) << "all else - go back" << endl;530 Log() << Verbose(0) << "===============================================" << endl;531 Log() << Verbose(0) << "INPUT: ";522 DoLog(0) && (Log() << Verbose(0) << "===========MEASURE ATOMS=========================" << endl); 523 DoLog(0) && (Log() << Verbose(0) << " a - calculate bond length between one atom and all others" << endl); 524 DoLog(0) && (Log() << Verbose(0) << " b - calculate bond length between two atoms" << endl); 525 DoLog(0) && (Log() << Verbose(0) << " c - calculate bond angle" << endl); 526 DoLog(0) && (Log() << Verbose(0) << " d - calculate principal axis of the system" << endl); 527 DoLog(0) && (Log() << Verbose(0) << " e - calculate volume of the convex envelope" << endl); 528 DoLog(0) && (Log() << Verbose(0) << " f - calculate temperature from current velocity" << endl); 529 DoLog(0) && (Log() << Verbose(0) << " g - output all temperatures per step from velocities" << endl); 530 DoLog(0) && (Log() << Verbose(0) << "all else - go back" << endl); 531 DoLog(0) && (Log() << Verbose(0) << "===============================================" << endl); 532 DoLog(0) && (Log() << Verbose(0) << "INPUT: "); 532 533 cin >> choice; 533 534 534 535 switch(choice) { 535 536 default: 536 Log() << Verbose(1) << "Not a valid choice." << endl;537 DoLog(1) && (Log() << Verbose(1) << "Not a valid choice." << endl); 537 538 break; 538 539 case 'a': … … 566 567 x.SubtractVector((const Vector *)&second->x); 567 568 tmp1 = x.Norm(); 568 Log() << Verbose(1) << "Distance vector is ";569 DoLog(1) && (Log() << Verbose(1) << "Distance vector is "); 569 570 x.Output(); 570 Log() << Verbose(0) << "." << endl << "Norm of distance is " << tmp1 << "." << endl;571 DoLog(0) && (Log() << Verbose(0) << "." << endl << "Norm of distance is " << tmp1 << "." << endl); 571 572 break; 572 573 573 574 case 'c': 574 Log() << Verbose(0) << "Evaluating bond angle between three - first, central, last - atoms." << endl;575 DoLog(0) && (Log() << Verbose(0) << "Evaluating bond angle between three - first, central, last - atoms." << endl); 575 576 first = mol->AskAtom("Enter first atom: "); 576 577 second = mol->AskAtom("Enter central atom: "); … … 581 582 y.CopyVector((const Vector *)&third->x); 582 583 y.SubtractVector((const Vector *)&second->x); 583 Log() << Verbose(0) << "Bond angle between first atom Nr." << first->nr << ", central atom Nr." << second->nr << " and last atom Nr." << third->nr << ": ";584 Log() << Verbose(0) << (acos(x.ScalarProduct((const Vector *)&y)/(y.Norm()*x.Norm()))/M_PI*180.) << " degrees" << endl;584 DoLog(0) && (Log() << Verbose(0) << "Bond angle between first atom Nr." << first->nr << ", central atom Nr." << second->nr << " and last atom Nr." << third->nr << ": "); 585 DoLog(0) && (Log() << Verbose(0) << (acos(x.ScalarProduct((const Vector *)&y)/(y.Norm()*x.Norm()))/M_PI*180.) << " degrees" << endl); 585 586 break; 586 587 case 'd': 587 Log() << Verbose(0) << "Evaluating prinicipal axis." << endl;588 Log() << Verbose(0) << "Shall we rotate? [0/1]: ";588 DoLog(0) && (Log() << Verbose(0) << "Evaluating prinicipal axis." << endl); 589 DoLog(0) && (Log() << Verbose(0) << "Shall we rotate? [0/1]: "); 589 590 cin >> Z; 590 591 if ((Z >=0) && (Z <=1)) … … 595 596 case 'e': 596 597 { 597 Log() << Verbose(0) << "Evaluating volume of the convex envelope.";598 DoLog(0) && (Log() << Verbose(0) << "Evaluating volume of the convex envelope."); 598 599 class Tesselation *TesselStruct = NULL; 599 600 const LinkedCell *LCList = NULL; … … 601 602 FindConvexBorder(mol, TesselStruct, LCList, NULL); 602 603 double clustervolume = VolumeOfConvexEnvelope(TesselStruct, configuration); 603 Log() << Verbose(0) << "The tesselated surface area is " << clustervolume << "." << endl;\604 DoLog(0) && (Log() << Verbose(0) << "The tesselated surface area is " << clustervolume << "." << endl);\ 604 605 delete(LCList); 605 606 delete(TesselStruct); … … 612 613 { 613 614 char filename[255]; 614 Log() << Verbose(0) << "Please enter filename: " << endl;615 DoLog(0) && (Log() << Verbose(0) << "Please enter filename: " << endl); 615 616 cin >> filename; 616 Log() << Verbose(1) << "Storing temperatures in " << filename << "." << endl;617 DoLog(1) && (Log() << Verbose(1) << "Storing temperatures in " << filename << "." << endl); 617 618 ofstream *output = new ofstream(filename, ios::trunc); 618 619 if (!mol->OutputTemperatureFromTrajectories(output, 0, mol->MDSteps)) 619 Log() << Verbose(2) << "File could not be written." << endl;620 DoLog(2) && (Log() << Verbose(2) << "File could not be written." << endl); 620 621 else 621 Log() << Verbose(2) << "File stored." << endl;622 DoLog(2) && (Log() << Verbose(2) << "File stored." << endl); 622 623 output->close(); 623 624 delete(output); … … 636 637 clock_t start, end; 637 638 638 Log() << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl;639 Log() << Verbose(0) << "What's the desired bond order: ";639 DoLog(0) && (Log() << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl); 640 DoLog(0) && (Log() << Verbose(0) << "What's the desired bond order: "); 640 641 cin >> Order1; 641 642 if (mol->first->next != mol->last) { // there are bonds … … 643 644 mol->FragmentMolecule(Order1, configuration); 644 645 end = clock(); 645 Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl;646 DoLog(0) && (Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl); 646 647 } else 647 Log() << Verbose(0) << "Connection matrix has not yet been generated!" << endl;648 DoLog(0) && (Log() << Verbose(0) << "Connection matrix has not yet been generated!" << endl); 648 649 }; 649 650 … … 664 665 bool valid; 665 666 666 Log() << Verbose(0) << "=========MANIPULATE ATOMS======================" << endl;667 Log() << Verbose(0) << "a - add an atom" << endl;668 Log() << Verbose(0) << "r - remove an atom" << endl;669 Log() << Verbose(0) << "b - scale a bond between atoms" << endl;670 Log() << Verbose(0) << "t - turn an atom round another bond" << endl;671 Log() << Verbose(0) << "u - change an atoms element" << endl;672 Log() << Verbose(0) << "l - measure lengths, angles, ... for an atom" << endl;673 Log() << Verbose(0) << "all else - go back" << endl;674 Log() << Verbose(0) << "===============================================" << endl;667 DoLog(0) && (Log() << Verbose(0) << "=========MANIPULATE ATOMS======================" << endl); 668 DoLog(0) && (Log() << Verbose(0) << "a - add an atom" << endl); 669 DoLog(0) && (Log() << Verbose(0) << "r - remove an atom" << endl); 670 DoLog(0) && (Log() << Verbose(0) << "b - scale a bond between atoms" << endl); 671 DoLog(0) && (Log() << Verbose(0) << "t - turn an atom round another bond" << endl); 672 DoLog(0) && (Log() << Verbose(0) << "u - change an atoms element" << endl); 673 DoLog(0) && (Log() << Verbose(0) << "l - measure lengths, angles, ... for an atom" << endl); 674 DoLog(0) && (Log() << Verbose(0) << "all else - go back" << endl); 675 DoLog(0) && (Log() << Verbose(0) << "===============================================" << endl); 675 676 if (molecules->NumberOfActiveMolecules() > 1) 676 eLog() << Verbose(2) << "There is more than one molecule active! Atoms will be added to each." << endl;677 Log() << Verbose(0) << "INPUT: ";677 DoeLog(2) && (eLog()<< Verbose(2) << "There is more than one molecule active! Atoms will be added to each." << endl); 678 DoLog(0) && (Log() << Verbose(0) << "INPUT: "); 678 679 cin >> choice; 679 680 680 681 switch (choice) { 681 682 default: 682 Log() << Verbose(0) << "Not a valid choice." << endl;683 DoLog(0) && (Log() << Verbose(0) << "Not a valid choice." << endl); 683 684 break; 684 685 … … 687 688 if ((*ListRunner)->ActiveFlag) { 688 689 mol = *ListRunner; 689 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;690 DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl); 690 691 AddAtoms(periode, mol); 691 692 } … … 696 697 if ((*ListRunner)->ActiveFlag) { 697 698 mol = *ListRunner; 698 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;699 Log() << Verbose(0) << "Scaling bond length between two atoms." << endl;699 DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl); 700 DoLog(0) && (Log() << Verbose(0) << "Scaling bond length between two atoms." << endl); 700 701 first = mol->AskAtom("Enter first (fixed) atom: "); 701 702 second = mol->AskAtom("Enter second (shifting) atom: "); … … 704 705 minBond += (first->x.x[i]-second->x.x[i])*(first->x.x[i] - second->x.x[i]); 705 706 minBond = sqrt(minBond); 706 Log() << Verbose(0) << "Current Bond length between " << first->type->name << " Atom " << first->nr << " and " << second->type->name << " Atom " << second->nr << ": " << minBond << " a.u." << endl;707 Log() << Verbose(0) << "Enter new bond length [a.u.]: ";707 DoLog(0) && (Log() << Verbose(0) << "Current Bond length between " << first->type->name << " Atom " << first->nr << " and " << second->type->name << " Atom " << second->nr << ": " << minBond << " a.u." << endl); 708 DoLog(0) && (Log() << Verbose(0) << "Enter new bond length [a.u.]: "); 708 709 cin >> bond; 709 710 for (int i=NDIM;i--;) { … … 719 720 if ((*ListRunner)->ActiveFlag) { 720 721 mol = *ListRunner; 721 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;722 Log() << Verbose(0) << "Angstroem -> Bohrradius: 1.8897261\t\tBohrradius -> Angstroem: 0.52917721" << endl;723 Log() << Verbose(0) << "Enter three factors: ";722 DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl); 723 DoLog(0) && (Log() << Verbose(0) << "Angstroem -> Bohrradius: 1.8897261\t\tBohrradius -> Angstroem: 0.52917721" << endl); 724 DoLog(0) && (Log() << Verbose(0) << "Enter three factors: "); 724 725 factor = new double[NDIM]; 725 726 cin >> factor[0]; … … 736 737 if ((*ListRunner)->ActiveFlag) { 737 738 mol = *ListRunner; 738 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;739 DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl); 739 740 MeasureAtoms(periode, mol, configuration); 740 741 } … … 745 746 if ((*ListRunner)->ActiveFlag) { 746 747 mol = *ListRunner; 747 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;748 DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl); 748 749 RemoveAtoms(mol); 749 750 } … … 754 755 if ((*ListRunner)->ActiveFlag) { 755 756 mol = *ListRunner; 756 Log() << Verbose(0) << "Turning atom around another bond - first is atom to turn, second (central) and third specify bond" << endl;757 DoLog(0) && (Log() << Verbose(0) << "Turning atom around another bond - first is atom to turn, second (central) and third specify bond" << endl); 757 758 first = mol->AskAtom("Enter turning atom: "); 758 759 second = mol->AskAtom("Enter central atom: "); … … 788 789 int Z; 789 790 mol = *ListRunner; 790 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;791 DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl); 791 792 first = NULL; 792 793 do { 793 Log() << Verbose(0) << "Change the element of which atom: ";794 DoLog(0) && (Log() << Verbose(0) << "Change the element of which atom: "); 794 795 cin >> Z; 795 796 } while ((first = mol->FindAtom(Z)) == NULL); 796 Log() << Verbose(0) << "New element by atomic number Z: ";797 DoLog(0) && (Log() << Verbose(0) << "New element by atomic number Z: "); 797 798 cin >> Z; 798 799 first->type = periode->FindElement(Z); 799 Log() << Verbose(0) << "Atom " << first->nr << "'s element is " << first->type->name << "." << endl;800 DoLog(0) && (Log() << Verbose(0) << "Atom " << first->nr << "'s element is " << first->type->name << "." << endl); 800 801 } 801 802 break; … … 818 819 MoleculeLeafClass *Subgraphs = NULL; 819 820 820 Log() << Verbose(0) << "=========MANIPULATE GLOBALLY===================" << endl;821 Log() << Verbose(0) << "c - scale by unit transformation" << endl;822 Log() << Verbose(0) << "d - duplicate molecule/periodic cell" << endl;823 Log() << Verbose(0) << "f - fragment molecule many-body bond order style" << endl;824 Log() << Verbose(0) << "g - center atoms in box" << endl;825 Log() << Verbose(0) << "i - realign molecule" << endl;826 Log() << Verbose(0) << "m - mirror all molecules" << endl;827 Log() << Verbose(0) << "o - create connection matrix" << endl;828 Log() << Verbose(0) << "t - translate molecule by vector" << endl;829 Log() << Verbose(0) << "all else - go back" << endl;830 Log() << Verbose(0) << "===============================================" << endl;821 DoLog(0) && (Log() << Verbose(0) << "=========MANIPULATE GLOBALLY===================" << endl); 822 DoLog(0) && (Log() << Verbose(0) << "c - scale by unit transformation" << endl); 823 DoLog(0) && (Log() << Verbose(0) << "d - duplicate molecule/periodic cell" << endl); 824 DoLog(0) && (Log() << Verbose(0) << "f - fragment molecule many-body bond order style" << endl); 825 DoLog(0) && (Log() << Verbose(0) << "g - center atoms in box" << endl); 826 DoLog(0) && (Log() << Verbose(0) << "i - realign molecule" << endl); 827 DoLog(0) && (Log() << Verbose(0) << "m - mirror all molecules" << endl); 828 DoLog(0) && (Log() << Verbose(0) << "o - create connection matrix" << endl); 829 DoLog(0) && (Log() << Verbose(0) << "t - translate molecule by vector" << endl); 830 DoLog(0) && (Log() << Verbose(0) << "all else - go back" << endl); 831 DoLog(0) && (Log() << Verbose(0) << "===============================================" << endl); 831 832 if (molecules->NumberOfActiveMolecules() > 1) 832 eLog() << Verbose(2) << "There is more than one molecule active! Atoms will be added to each." << endl;833 Log() << Verbose(0) << "INPUT: ";833 DoeLog(2) && (eLog()<< Verbose(2) << "There is more than one molecule active! Atoms will be added to each." << endl); 834 DoLog(0) && (Log() << Verbose(0) << "INPUT: "); 834 835 cin >> choice; 835 836 836 837 switch (choice) { 837 838 default: 838 Log() << Verbose(0) << "Not a valid choice." << endl;839 DoLog(0) && (Log() << Verbose(0) << "Not a valid choice." << endl); 839 840 break; 840 841 … … 843 844 if ((*ListRunner)->ActiveFlag) { 844 845 mol = *ListRunner; 845 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;846 Log() << Verbose(0) << "State the axis [(+-)123]: ";846 DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl); 847 DoLog(0) && (Log() << Verbose(0) << "State the axis [(+-)123]: "); 847 848 cin >> axis; 848 Log() << Verbose(0) << "State the factor: ";849 DoLog(0) && (Log() << Verbose(0) << "State the factor: "); 849 850 cin >> faktor; 850 851 … … 863 864 } 864 865 if (count != j) 865 eLog() << Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl;866 DoeLog(1) && (eLog()<< Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl); 866 867 x.Zero(); 867 868 y.Zero(); … … 902 903 if ((*ListRunner)->ActiveFlag) { 903 904 mol = *ListRunner; 904 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;905 DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl); 905 906 CenterAtoms(mol); 906 907 } … … 911 912 if ((*ListRunner)->ActiveFlag) { 912 913 mol = *ListRunner; 913 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;914 DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl); 914 915 AlignAtoms(periode, mol); 915 916 } … … 920 921 if ((*ListRunner)->ActiveFlag) { 921 922 mol = *ListRunner; 922 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;923 DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl); 923 924 MirrorAtoms(mol); 924 925 } … … 931 932 double bonddistance; 932 933 clock_t start,end; 933 Log() << Verbose(0) << "What's the maximum bond distance: ";934 DoLog(0) && (Log() << Verbose(0) << "What's the maximum bond distance: "); 934 935 cin >> bonddistance; 935 936 start = clock(); 936 937 mol->CreateAdjacencyList(bonddistance, configuration->GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL); 937 938 end = clock(); 938 Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl;939 DoLog(0) && (Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl); 939 940 } 940 941 break; … … 944 945 if ((*ListRunner)->ActiveFlag) { 945 946 mol = *ListRunner; 946 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;947 Log() << Verbose(0) << "Enter translation vector." << endl;947 DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl); 948 DoLog(0) && (Log() << Verbose(0) << "Enter translation vector." << endl); 948 949 x.AskPosition(World::get()->cell_size,0); 949 950 mol->Center.AddVector((const Vector *)&x); … … 973 974 molecule *mol = NULL; 974 975 975 Log() << Verbose(0) << "==========EDIT MOLECULES=====================" << endl;976 Log() << Verbose(0) << "c - create new molecule" << endl;977 Log() << Verbose(0) << "l - load molecule from xyz file" << endl;978 Log() << Verbose(0) << "n - change molecule's name" << endl;979 Log() << Verbose(0) << "N - give molecules filename" << endl;980 Log() << Verbose(0) << "p - parse atoms in xyz file into molecule" << endl;981 Log() << Verbose(0) << "r - remove a molecule" << endl;982 Log() << Verbose(0) << "all else - go back" << endl;983 Log() << Verbose(0) << "===============================================" << endl;984 Log() << Verbose(0) << "INPUT: ";976 DoLog(0) && (Log() << Verbose(0) << "==========EDIT MOLECULES=====================" << endl); 977 DoLog(0) && (Log() << Verbose(0) << "c - create new molecule" << endl); 978 DoLog(0) && (Log() << Verbose(0) << "l - load molecule from xyz file" << endl); 979 DoLog(0) && (Log() << Verbose(0) << "n - change molecule's name" << endl); 980 DoLog(0) && (Log() << Verbose(0) << "N - give molecules filename" << endl); 981 DoLog(0) && (Log() << Verbose(0) << "p - parse atoms in xyz file into molecule" << endl); 982 DoLog(0) && (Log() << Verbose(0) << "r - remove a molecule" << endl); 983 DoLog(0) && (Log() << Verbose(0) << "all else - go back" << endl); 984 DoLog(0) && (Log() << Verbose(0) << "===============================================" << endl); 985 DoLog(0) && (Log() << Verbose(0) << "INPUT: "); 985 986 cin >> choice; 986 987 987 988 switch (choice) { 988 989 default: 989 Log() << Verbose(0) << "Not a valid choice." << endl;990 DoLog(0) && (Log() << Verbose(0) << "Not a valid choice." << endl); 990 991 break; 991 992 case 'c': … … 997 998 { 998 999 char filename[MAXSTRINGSIZE]; 999 Log() << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl;1000 DoLog(0) && (Log() << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl); 1000 1001 mol = new molecule(periode); 1001 1002 do { 1002 Log() << Verbose(0) << "Enter file name: ";1003 DoLog(0) && (Log() << Verbose(0) << "Enter file name: "); 1003 1004 cin >> filename; 1004 1005 } while (!mol->AddXYZFile(filename)); … … 1021 1022 char filename[MAXSTRINGSIZE]; 1022 1023 do { 1023 Log() << Verbose(0) << "Enter index of molecule: ";1024 DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule: "); 1024 1025 cin >> nr; 1025 1026 mol = molecules->ReturnIndex(nr); 1026 1027 } while (mol == NULL); 1027 Log() << Verbose(0) << "Enter name: ";1028 DoLog(0) && (Log() << Verbose(0) << "Enter name: "); 1028 1029 cin >> filename; 1029 1030 strcpy(mol->name, filename); … … 1035 1036 char filename[MAXSTRINGSIZE]; 1036 1037 do { 1037 Log() << Verbose(0) << "Enter index of molecule: ";1038 DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule: "); 1038 1039 cin >> nr; 1039 1040 mol = molecules->ReturnIndex(nr); 1040 1041 } while (mol == NULL); 1041 Log() << Verbose(0) << "Enter name: ";1042 DoLog(0) && (Log() << Verbose(0) << "Enter name: "); 1042 1043 cin >> filename; 1043 1044 mol->SetNameFromFilename(filename); … … 1050 1051 mol = NULL; 1051 1052 do { 1052 Log() << Verbose(0) << "Enter index of molecule: ";1053 DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule: "); 1053 1054 cin >> nr; 1054 1055 mol = molecules->ReturnIndex(nr); 1055 1056 } while (mol == NULL); 1056 Log() << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl;1057 DoLog(0) && (Log() << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl); 1057 1058 do { 1058 Log() << Verbose(0) << "Enter file name: ";1059 DoLog(0) && (Log() << Verbose(0) << "Enter file name: "); 1059 1060 cin >> filename; 1060 1061 } while (!mol->AddXYZFile(filename)); … … 1064 1065 1065 1066 case 'r': 1066 Log() << Verbose(0) << "Enter index of molecule: ";1067 DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule: "); 1067 1068 cin >> nr; 1068 1069 count = 1; … … 1087 1088 char choice; // menu choice char 1088 1089 1089 Log() << Verbose(0) << "===========MERGE MOLECULES=====================" << endl; 1090 Log() << Verbose(0) << "a - simple add of one molecule to another" << endl; 1091 Log() << Verbose(0) << "e - embedding merge of two molecules" << endl; 1092 Log() << Verbose(0) << "m - multi-merge of all molecules" << endl; 1093 Log() << Verbose(0) << "s - scatter merge of two molecules" << endl; 1094 Log() << Verbose(0) << "t - simple merge of two molecules" << endl; 1095 Log() << Verbose(0) << "all else - go back" << endl; 1096 Log() << Verbose(0) << "===============================================" << endl; 1097 Log() << Verbose(0) << "INPUT: "; 1090 DoLog(0) && (Log() << Verbose(0) << "===========MERGE MOLECULES=====================" << endl); 1091 DoLog(0) && (Log() << Verbose(0) << "a - simple add of one molecule to another" << endl); 1092 DoLog(0) && (Log() << Verbose(0) << "b - count the number of bonds of two elements" << endl); 1093 DoLog(0) && (Log() << Verbose(0) << "B - count the number of bonds of three elements " << endl); 1094 DoLog(0) && (Log() << Verbose(0) << "e - embedding merge of two molecules" << endl); 1095 DoLog(0) && (Log() << Verbose(0) << "h - count the number of hydrogen bonds" << endl); 1096 DoLog(0) && (Log() << Verbose(0) << "b - count the number of hydrogen bonds" << endl); 1097 DoLog(0) && (Log() << Verbose(0) << "m - multi-merge of all molecules" << endl); 1098 DoLog(0) && (Log() << Verbose(0) << "s - scatter merge of two molecules" << endl); 1099 DoLog(0) && (Log() << Verbose(0) << "t - simple merge of two molecules" << endl); 1100 DoLog(0) && (Log() << Verbose(0) << "all else - go back" << endl); 1101 DoLog(0) && (Log() << Verbose(0) << "===============================================" << endl); 1102 DoLog(0) && (Log() << Verbose(0) << "INPUT: "); 1098 1103 cin >> choice; 1099 1104 1100 1105 switch (choice) { 1101 1106 default: 1102 Log() << Verbose(0) << "Not a valid choice." << endl;1107 DoLog(0) && (Log() << Verbose(0) << "Not a valid choice." << endl); 1103 1108 break; 1104 1109 … … 1109 1114 { 1110 1115 do { 1111 Log() << Verbose(0) << "Enter index of destination molecule: ";1116 DoLog(0) && (Log() << Verbose(0) << "Enter index of destination molecule: "); 1112 1117 cin >> dest; 1113 1118 destmol = molecules->ReturnIndex(dest); 1114 1119 } while ((destmol == NULL) && (dest != -1)); 1115 1120 do { 1116 Log() << Verbose(0) << "Enter index of source molecule to add from: ";1121 DoLog(0) && (Log() << Verbose(0) << "Enter index of source molecule to add from: "); 1117 1122 cin >> src; 1118 1123 srcmol = molecules->ReturnIndex(src); … … 1124 1129 break; 1125 1130 1131 case 'b': 1132 { 1133 const int nr = 2; 1134 char *names[nr] = {"first", "second"}; 1135 int Z[nr]; 1136 element *elements[nr]; 1137 for (int i=0;i<nr;i++) { 1138 Z[i] = 0; 1139 do { 1140 cout << "Enter " << names[i] << " element: "; 1141 cin >> Z[i]; 1142 } while ((Z[i] <= 0) && (Z[i] > MAX_ELEMENTS)); 1143 elements[i] = periode->FindElement(Z[i]); 1144 } 1145 const int count = CountBondsOfTwo(molecules, elements[0], elements[1]); 1146 cout << endl << "There are " << count << " "; 1147 for (int i=0;i<nr;i++) { 1148 if (i==0) 1149 cout << elements[i]->symbol; 1150 else 1151 cout << "-" << elements[i]->symbol; 1152 } 1153 cout << " bonds." << endl; 1154 } 1155 break; 1156 1157 case 'B': 1158 { 1159 const int nr = 3; 1160 char *names[nr] = {"first", "second", "third"}; 1161 int Z[nr]; 1162 element *elements[nr]; 1163 for (int i=0;i<nr;i++) { 1164 Z[i] = 0; 1165 do { 1166 cout << "Enter " << names[i] << " element: "; 1167 cin >> Z[i]; 1168 } while ((Z[i] <= 0) && (Z[i] > MAX_ELEMENTS)); 1169 elements[i] = periode->FindElement(Z[i]); 1170 } 1171 const int count = CountBondsOfThree(molecules, elements[0], elements[1], elements[2]); 1172 cout << endl << "There are " << count << " "; 1173 for (int i=0;i<nr;i++) { 1174 if (i==0) 1175 cout << elements[i]->symbol; 1176 else 1177 cout << "-" << elements[i]->symbol; 1178 } 1179 cout << " bonds." << endl; 1180 } 1181 break; 1182 1126 1183 case 'e': 1127 1184 { … … 1129 1186 molecule *srcmol = NULL, *destmol = NULL; 1130 1187 do { 1131 Log() << Verbose(0) << "Enter index of matrix molecule (the variable one): ";1188 DoLog(0) && (Log() << Verbose(0) << "Enter index of matrix molecule (the variable one): "); 1132 1189 cin >> src; 1133 1190 srcmol = molecules->ReturnIndex(src); 1134 1191 } while ((srcmol == NULL) && (src != -1)); 1135 1192 do { 1136 Log() << Verbose(0) << "Enter index of molecule to merge into (the fixed one): ";1193 DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule to merge into (the fixed one): "); 1137 1194 cin >> dest; 1138 1195 destmol = molecules->ReturnIndex(dest); … … 1143 1200 break; 1144 1201 1202 case 'h': 1203 { 1204 int Z; 1205 cout << "Please enter interface element: "; 1206 cin >> Z; 1207 element * const InterfaceElement = periode->FindElement(Z); 1208 cout << endl << "There are " << CountHydrogenBridgeBonds(molecules, InterfaceElement) << " hydrogen bridges with connections to " << (InterfaceElement != 0 ? InterfaceElement->name : "None") << "." << endl; 1209 } 1210 break; 1211 1145 1212 case 'm': 1146 1213 { … … 1148 1215 molecule *mol = NULL; 1149 1216 do { 1150 Log() << Verbose(0) << "Enter index of molecule to merge into: ";1217 DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule to merge into: "); 1151 1218 cin >> nr; 1152 1219 mol = molecules->ReturnIndex(nr); … … 1165 1232 1166 1233 case 's': 1167 Log() << Verbose(0) << "Not implemented yet." << endl;1234 DoLog(0) && (Log() << Verbose(0) << "Not implemented yet." << endl); 1168 1235 break; 1169 1236 … … 1174 1241 { 1175 1242 do { 1176 Log() << Verbose(0) << "Enter index of destination molecule: ";1243 DoLog(0) && (Log() << Verbose(0) << "Enter index of destination molecule: "); 1177 1244 cin >> dest; 1178 1245 destmol = molecules->ReturnIndex(dest); 1179 1246 } while ((destmol == NULL) && (dest != -1)); 1180 1247 do { 1181 Log() << Verbose(0) << "Enter index of source molecule to merge into: ";1248 DoLog(0) && (Log() << Verbose(0) << "Enter index of source molecule to merge into: "); 1182 1249 cin >> src; 1183 1250 srcmol = molecules->ReturnIndex(src); … … 1208 1275 mol = (molecules->ListOfMolecules.front())->CopyMolecule(); 1209 1276 else { 1210 eLog() << Verbose(0) << "I don't have anything to test on ... ";1277 DoeLog(0) && (eLog()<< Verbose(0) << "I don't have anything to test on ... "); 1211 1278 performCriticalExit(); 1212 1279 return; … … 1215 1282 1216 1283 // generate some KeySets 1217 Log() << Verbose(0) << "Generating KeySets." << endl;1284 DoLog(0) && (Log() << Verbose(0) << "Generating KeySets." << endl); 1218 1285 KeySet TestSets[mol->AtomCount+1]; 1219 1286 i=1; … … 1225 1292 i++; 1226 1293 } 1227 Log() << Verbose(0) << "Testing insertion of already present item in KeySets." << endl;1294 DoLog(0) && (Log() << Verbose(0) << "Testing insertion of already present item in KeySets." << endl); 1228 1295 KeySetTestPair test; 1229 1296 test = TestSets[mol->AtomCount-1].insert(Walker->nr); 1230 1297 if (test.second) { 1231 Log() << Verbose(1) << "Insertion worked?!" << endl;1298 DoLog(1) && (Log() << Verbose(1) << "Insertion worked?!" << endl); 1232 1299 } else { 1233 Log() << Verbose(1) << "Insertion rejected: Present object is " << (*test.first) << "." << endl;1300 DoLog(1) && (Log() << Verbose(1) << "Insertion rejected: Present object is " << (*test.first) << "." << endl); 1234 1301 } 1235 1302 TestSets[mol->AtomCount].insert(mol->end->previous->nr); … … 1237 1304 1238 1305 // constructing Graph structure 1239 Log() << Verbose(0) << "Generating Subgraph class." << endl;1306 DoLog(0) && (Log() << Verbose(0) << "Generating Subgraph class." << endl); 1240 1307 Graph Subgraphs; 1241 1308 1242 1309 // insert KeySets into Subgraphs 1243 Log() << Verbose(0) << "Inserting KeySets into Subgraph class." << endl;1310 DoLog(0) && (Log() << Verbose(0) << "Inserting KeySets into Subgraph class." << endl); 1244 1311 for (int j=0;j<mol->AtomCount;j++) { 1245 1312 Subgraphs.insert(GraphPair (TestSets[j],pair<int, double>(counter++, 1.))); 1246 1313 } 1247 Log() << Verbose(0) << "Testing insertion of already present item in Subgraph." << endl;1314 DoLog(0) && (Log() << Verbose(0) << "Testing insertion of already present item in Subgraph." << endl); 1248 1315 GraphTestPair test2; 1249 1316 test2 = Subgraphs.insert(GraphPair (TestSets[mol->AtomCount],pair<int, double>(counter++, 1.))); 1250 1317 if (test2.second) { 1251 Log() << Verbose(1) << "Insertion worked?!" << endl;1318 DoLog(1) && (Log() << Verbose(1) << "Insertion worked?!" << endl); 1252 1319 } else { 1253 Log() << Verbose(1) << "Insertion rejected: Present object is " << (*(test2.first)).second.first << "." << endl;1320 DoLog(1) && (Log() << Verbose(1) << "Insertion rejected: Present object is " << (*(test2.first)).second.first << "." << endl); 1254 1321 } 1255 1322 1256 1323 // show graphs 1257 Log() << Verbose(0) << "Showing Subgraph's contents, checking that it's sorted." << endl;1324 DoLog(0) && (Log() << Verbose(0) << "Showing Subgraph's contents, checking that it's sorted." << endl); 1258 1325 Graph::iterator A = Subgraphs.begin(); 1259 1326 while (A != Subgraphs.end()) { 1260 Log() << Verbose(0) << (*A).second.first << ": ";1327 DoLog(0) && (Log() << Verbose(0) << (*A).second.first << ": "); 1261 1328 KeySet::iterator key = (*A).first.begin(); 1262 1329 comp = -1; 1263 1330 while (key != (*A).first.end()) { 1264 1331 if ((*key) > comp) 1265 Log() << Verbose(0) << (*key) << " ";1332 DoLog(0) && (Log() << Verbose(0) << (*key) << " "); 1266 1333 else 1267 Log() << Verbose(0) << (*key) << "! ";1334 DoLog(0) && (Log() << Verbose(0) << (*key) << "! "); 1268 1335 comp = (*key); 1269 1336 key++; 1270 1337 } 1271 Log() << Verbose(0) << endl;1338 DoLog(0) && (Log() << Verbose(0) << endl); 1272 1339 A++; 1273 1340 } … … 1289 1356 1290 1357 if (!strcmp(configuration->configpath, configuration->GetDefaultPath())) { 1291 eLog() << Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl;1358 DoeLog(2) && (eLog()<< Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl); 1292 1359 } 1293 1360 … … 1298 1365 if (output == NULL) 1299 1366 strcpy(filename,"main_pcp_linux"); 1300 Log() << Verbose(0) << "Saving as pdb input ";1367 DoLog(0) && (Log() << Verbose(0) << "Saving as pdb input "); 1301 1368 if (configuration->SavePDB(filename, molecules)) 1302 Log() << Verbose(0) << "done." << endl;1369 DoLog(0) && (Log() << Verbose(0) << "done." << endl); 1303 1370 else 1304 Log() << Verbose(0) << "failed." << endl;1371 DoLog(0) && (Log() << Verbose(0) << "failed." << endl); 1305 1372 1306 1373 // then save as tremolo data file … … 1309 1376 if (output == NULL) 1310 1377 strcpy(filename,"main_pcp_linux"); 1311 Log() << Verbose(0) << "Saving as tremolo data input ";1378 DoLog(0) && (Log() << Verbose(0) << "Saving as tremolo data input "); 1312 1379 if (configuration->SaveTREMOLO(filename, molecules)) 1313 Log() << Verbose(0) << "done." << endl;1380 DoLog(0) && (Log() << Verbose(0) << "done." << endl); 1314 1381 else 1315 Log() << Verbose(0) << "failed." << endl;1382 DoLog(0) && (Log() << Verbose(0) << "failed." << endl); 1316 1383 1317 1384 // translate each to its center and merge all molecules in MoleculeListClass into this molecule … … 1333 1400 } 1334 1401 1335 Log() << Verbose(0) << "Storing configuration ... " << endl;1402 DoLog(0) && (Log() << Verbose(0) << "Storing configuration ... " << endl); 1336 1403 // get correct valence orbitals 1337 1404 mol->CalculateOrbitals(*configuration); … … 1349 1416 output.close(); 1350 1417 output.clear(); 1351 Log() << Verbose(0) << "Saving of config file ";1418 DoLog(0) && (Log() << Verbose(0) << "Saving of config file "); 1352 1419 if (configuration->Save(filename, periode, mol)) 1353 Log() << Verbose(0) << "successful." << endl;1420 DoLog(0) && (Log() << Verbose(0) << "successful." << endl); 1354 1421 else 1355 Log() << Verbose(0) << "failed." << endl;1422 DoLog(0) && (Log() << Verbose(0) << "failed." << endl); 1356 1423 1357 1424 // and save to xyz file … … 1366 1433 output.open(filename, ios::trunc); 1367 1434 } 1368 Log() << Verbose(0) << "Saving of XYZ file ";1435 DoLog(0) && (Log() << Verbose(0) << "Saving of XYZ file "); 1369 1436 if (mol->MDSteps <= 1) { 1370 1437 if (mol->OutputXYZ(&output)) 1371 Log() << Verbose(0) << "successful." << endl;1438 DoLog(0) && (Log() << Verbose(0) << "successful." << endl); 1372 1439 else 1373 Log() << Verbose(0) << "failed." << endl;1440 DoLog(0) && (Log() << Verbose(0) << "failed." << endl); 1374 1441 } else { 1375 1442 if (mol->OutputTrajectoriesXYZ(&output)) 1376 Log() << Verbose(0) << "successful." << endl;1443 DoLog(0) && (Log() << Verbose(0) << "successful." << endl); 1377 1444 else 1378 Log() << Verbose(0) << "failed." << endl;1445 DoLog(0) && (Log() << Verbose(0) << "failed." << endl); 1379 1446 } 1380 1447 output.close(); … … 1386 1453 if (output == NULL) 1387 1454 strcpy(filename,"main_pcp_linux"); 1388 Log() << Verbose(0) << "Saving as mpqc input ";1455 DoLog(0) && (Log() << Verbose(0) << "Saving as mpqc input "); 1389 1456 if (configuration->SaveMPQC(filename, mol)) 1390 Log() << Verbose(0) << "done." << endl;1457 DoLog(0) && (Log() << Verbose(0) << "done." << endl); 1391 1458 else 1392 Log() << Verbose(0) << "failed." << endl;1459 DoLog(0) && (Log() << Verbose(0) << "failed." << endl); 1393 1460 1394 1461 if (!strcmp(configuration->configpath, configuration->GetDefaultPath())) { 1395 eLog() << Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl;1462 DoeLog(2) && (eLog()<< Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl); 1396 1463 } 1397 1464 … … 1435 1502 do { 1436 1503 if (argv[argptr][0] == '-') { 1437 Log() << Verbose(0) << "Recognized command line argument: " << argv[argptr][1] << ".\n";1504 DoLog(0) && (Log() << Verbose(0) << "Recognized command line argument: " << argv[argptr][1] << ".\n"); 1438 1505 argptr++; 1439 1506 switch(argv[argptr-1][1]) { … … 1441 1508 case 'H': 1442 1509 case '?': 1443 Log() << Verbose(0) << "MoleCuilder suite" << endl << "==================" << endl << endl; 1444 Log() << Verbose(0) << "Usage: " << argv[0] << "[config file] [-{acefpsthH?vfrp}] [further arguments]" << endl; 1445 Log() << Verbose(0) << "or simply " << argv[0] << " without arguments for interactive session." << endl; 1446 Log() << Verbose(0) << "\t-a Z x1 x2 x3\tAdd new atom of element Z at coordinates (x1,x2,x3)." << endl; 1447 Log() << Verbose(0) << "\t-A <source>\tCreate adjacency list from bonds parsed from 'dbond'-style file." <<endl; 1448 Log() << Verbose(0) << "\t-b xx xy xz yy yz zz\tCenter atoms in domain with given symmetric matrix of (xx,xy,xz,yy,yz,zz)." << endl; 1449 Log() << Verbose(0) << "\t-B xx xy xz yy yz zz\tBound atoms by domain with given symmetric matrix of (xx,xy,xz,yy,yz,zz)." << endl; 1450 Log() << Verbose(0) << "\t-c x1 x2 x3\tCenter atoms in domain with a minimum distance to boundary of (x1,x2,x3)." << endl; 1451 Log() << Verbose(0) << "\t-C <type> [params] <output> <bin output> <BinWidth> <BinStart> <BinEnd>\tPair Correlation analysis." << endl; 1452 Log() << Verbose(0) << "\t-d x1 x2 x3\tDuplicate cell along each axis by given factor." << endl; 1453 Log() << Verbose(0) << "\t-D <bond distance>\tDepth-First-Search Analysis of the molecule, giving cycles and tree/back edges." << endl; 1454 Log() << Verbose(0) << "\t-e <file>\tSets the databases path to be parsed (default: ./)." << endl; 1455 Log() << Verbose(0) << "\t-E <id> <Z>\tChange atom <id>'s element to <Z>, <id> begins at 0." << endl; 1456 Log() << Verbose(0) << "\t-f <dist> <order>\tFragments the molecule in BOSSANOVA manner (with/out rings compressed) and stores config files in same dir as config (return code 0 - fragmented, 2 - no fragmentation necessary)." << endl; 1457 Log() << Verbose(0) << "\t-F <xyz of filler> <dist_x> <dist_y> <dist_z> <epsilon> <randatom> <randmol> <DoRotate>\tFilling Box with water molecules." << endl; 1458 Log() << Verbose(0) << "\t-FF <MaxDistance> <xyz of filler> <dist_x> <dist_y> <dist_z> <epsilon> <randatom> <randmol> <DoRotate>\tFilling Box with water molecules." << endl; 1459 Log() << Verbose(0) << "\t-g <file>\tParses a bond length table from the given file." << endl; 1460 Log() << Verbose(0) << "\t-h/-H/-?\tGive this help screen." << endl; 1461 Log() << Verbose(0) << "\t-I\t Dissect current system of molecules into a set of disconnected (subgraphs of) molecules." << endl; 1462 Log() << Verbose(0) << "\t-j\t<path> Store all bonds to file." << endl; 1463 Log() << Verbose(0) << "\t-J\t<path> Store adjacency per atom to file." << endl; 1464 Log() << Verbose(0) << "\t-L <step0> <step1> <prefix>\tStore a linear interpolation between two configurations <step0> and <step1> into single config files with prefix <prefix> and as Trajectories into the current config file." << endl; 1465 Log() << Verbose(0) << "\t-m <0/1>\tCalculate (0)/ Align in(1) PAS with greatest EV along z axis." << endl; 1466 Log() << Verbose(0) << "\t-M <basis>\tSetting basis to store to MPQC config files." << endl; 1467 Log() << Verbose(0) << "\t-n\tFast parsing (i.e. no trajectories are looked for)." << endl; 1468 Log() << Verbose(0) << "\t-N <radius> <file>\tGet non-convex-envelope." << endl; 1469 Log() << Verbose(0) << "\t-o <out>\tGet volume of the convex envelope (and store to tecplot file)." << endl; 1470 Log() << Verbose(0) << "\t-O\tCenter atoms in origin." << endl; 1471 Log() << Verbose(0) << "\t-p <file>\tParse given xyz file and create raw config file from it." << endl; 1472 Log() << Verbose(0) << "\t-P <file>\tParse given forces file and append as an MD step to config file via Verlet." << endl; 1473 Log() << Verbose(0) << "\t-r <id>\t\tRemove an atom with given id." << endl; 1474 Log() << Verbose(0) << "\t-R <id> <radius>\t\tRemove all atoms out of sphere around a given one." << endl; 1475 Log() << Verbose(0) << "\t-s x1 x2 x3\tScale all atom coordinates by this vector (x1,x2,x3)." << endl; 1476 Log() << Verbose(0) << "\t-S <file> Store temperatures from the config file in <file>." << endl; 1477 Log() << Verbose(0) << "\t-t x1 x2 x3\tTranslate all atoms by this vector (x1,x2,x3)." << endl; 1478 Log() << Verbose(0) << "\t-T x1 x2 x3\tTranslate periodically all atoms by this vector (x1,x2,x3)." << endl; 1479 Log() << Verbose(0) << "\t-u rho\tsuspend in water solution and output necessary cell lengths, average density rho and repetition." << endl; 1480 Log() << Verbose(0) << "\t-v\t\tsets verbosity (more is more)." << endl; 1481 Log() << Verbose(0) << "\t-V\t\tGives version information." << endl; 1482 Log() << Verbose(0) << "Note: config files must not begin with '-' !" << endl; 1510 DoLog(0) && (Log() << Verbose(0) << "MoleCuilder suite" << endl << "==================" << endl << endl); 1511 DoLog(0) && (Log() << Verbose(0) << "Usage: " << argv[0] << "[config file] [-{acefpsthH?vfrp}] [further arguments]" << endl); 1512 DoLog(0) && (Log() << Verbose(0) << "or simply " << argv[0] << " without arguments for interactive session." << endl); 1513 DoLog(0) && (Log() << Verbose(0) << "\t-a Z x1 x2 x3\tAdd new atom of element Z at coordinates (x1,x2,x3)." << endl); 1514 DoLog(0) && (Log() << Verbose(0) << "\t-A <source>\tCreate adjacency list from bonds parsed from 'dbond'-style file." <<endl); 1515 DoLog(0) && (Log() << Verbose(0) << "\t-b xx xy xz yy yz zz\tCenter atoms in domain with given symmetric matrix of (xx,xy,xz,yy,yz,zz)." << endl); 1516 DoLog(0) && (Log() << Verbose(0) << "\t-B xx xy xz yy yz zz\tBound atoms by domain with given symmetric matrix of (xx,xy,xz,yy,yz,zz)." << endl); 1517 DoLog(0) && (Log() << Verbose(0) << "\t-c x1 x2 x3\tCenter atoms in domain with a minimum distance to boundary of (x1,x2,x3)." << endl); 1518 DoLog(0) && (Log() << Verbose(0) << "\t-C <type> [params] <output> <bin output> <BinWidth> <BinStart> <BinEnd>\tPair Correlation analysis." << endl); 1519 DoLog(0) && (Log() << Verbose(0) << "\t-d x1 x2 x3\tDuplicate cell along each axis by given factor." << endl); 1520 DoLog(0) && (Log() << Verbose(0) << "\t-D <bond distance>\tDepth-First-Search Analysis of the molecule, giving cycles and tree/back edges." << endl); 1521 DoLog(0) && (Log() << Verbose(0) << "\t-e <file>\tSets the databases path to be parsed (default: ./)." << endl); 1522 DoLog(0) && (Log() << Verbose(0) << "\t-E <id> <Z>\tChange atom <id>'s element to <Z>, <id> begins at 0." << endl); 1523 DoLog(0) && (Log() << Verbose(0) << "\t-f <dist> <order>\tFragments the molecule in BOSSANOVA manner (with/out rings compressed) and stores config files in same dir as config (return code 0 - fragmented, 2 - no fragmentation necessary)." << endl); 1524 DoLog(0) && (Log() << Verbose(0) << "\t-F <xyz of filler> <dist_x> <dist_y> <dist_z> <epsilon> <randatom> <randmol> <DoRotate>\tFilling Box with water molecules." << endl); 1525 DoLog(0) && (Log() << Verbose(0) << "\t-FF <MaxDistance> <xyz of filler> <dist_x> <dist_y> <dist_z> <epsilon> <randatom> <randmol> <DoRotate>\tFilling Box with water molecules." << endl); 1526 DoLog(0) && (Log() << Verbose(0) << "\t-g <file>\tParses a bond length table from the given file." << endl); 1527 DoLog(0) && (Log() << Verbose(0) << "\t-h/-H/-?\tGive this help screen." << endl); 1528 DoLog(0) && (Log() << Verbose(0) << "\t-I\t Dissect current system of molecules into a set of disconnected (subgraphs of) molecules." << endl); 1529 DoLog(0) && (Log() << Verbose(0) << "\t-j\t<path> Store all bonds to file." << endl); 1530 DoLog(0) && (Log() << Verbose(0) << "\t-J\t<path> Store adjacency per atom to file." << endl); 1531 DoLog(0) && (Log() << Verbose(0) << "\t-L <step0> <step1> <prefix>\tStore a linear interpolation between two configurations <step0> and <step1> into single config files with prefix <prefix> and as Trajectories into the current config file." << endl); 1532 DoLog(0) && (Log() << Verbose(0) << "\t-m <0/1>\tCalculate (0)/ Align in(1) PAS with greatest EV along z axis." << endl); 1533 DoLog(0) && (Log() << Verbose(0) << "\t-M <basis>\tSetting basis to store to MPQC config files." << endl); 1534 DoLog(0) && (Log() << Verbose(0) << "\t-n\tFast parsing (i.e. no trajectories are looked for)." << endl); 1535 DoLog(0) && (Log() << Verbose(0) << "\t-N <radius> <file>\tGet non-convex-envelope." << endl); 1536 DoLog(0) && (Log() << Verbose(0) << "\t-o <out>\tGet volume of the convex envelope (and store to tecplot file)." << endl); 1537 DoLog(0) && (Log() << Verbose(0) << "\t-O\tCenter atoms in origin." << endl); 1538 DoLog(0) && (Log() << Verbose(0) << "\t-p <file>\tParse given xyz file and create raw config file from it." << endl); 1539 DoLog(0) && (Log() << Verbose(0) << "\t-P <file>\tParse given forces file and append as an MD step to config file via Verlet." << endl); 1540 DoLog(0) && (Log() << Verbose(0) << "\t-r <id>\t\tRemove an atom with given id." << endl); 1541 DoLog(0) && (Log() << Verbose(0) << "\t-R <id> <radius>\t\tRemove all atoms out of sphere around a given one." << endl); 1542 DoLog(0) && (Log() << Verbose(0) << "\t-s x1 x2 x3\tScale all atom coordinates by this vector (x1,x2,x3)." << endl); 1543 DoLog(0) && (Log() << Verbose(0) << "\t-S <file> Store temperatures from the config file in <file>." << endl); 1544 DoLog(0) && (Log() << Verbose(0) << "\t-t x1 x2 x3\tTranslate all atoms by this vector (x1,x2,x3)." << endl); 1545 DoLog(0) && (Log() << Verbose(0) << "\t-T x1 x2 x3\tTranslate periodically all atoms by this vector (x1,x2,x3)." << endl); 1546 DoLog(0) && (Log() << Verbose(0) << "\t-u rho\tsuspend in water solution and output necessary cell lengths, average density rho and repetition." << endl); 1547 DoLog(0) && (Log() << Verbose(0) << "\t-v\t\tsets verbosity (more is more)." << endl); 1548 DoLog(0) && (Log() << Verbose(0) << "\t-V\t\tGives version information." << endl); 1549 DoLog(0) && (Log() << Verbose(0) << "\t-X\t\tset default name of a molecule." << endl); 1550 DoLog(0) && (Log() << Verbose(0) << "Note: config files must not begin with '-' !" << endl); 1483 1551 return (1); 1484 1552 break; … … 1488 1556 } 1489 1557 setVerbosity(verbosity); 1490 Log() << Verbose(0) << "Setting verbosity to " << verbosity << "." << endl;1558 DoLog(0) && (Log() << Verbose(0) << "Setting verbosity to " << verbosity << "." << endl); 1491 1559 break; 1492 1560 case 'V': 1493 Log() << Verbose(0) << argv[0] << " " << VERSIONSTRING << endl;1494 Log() << Verbose(0) << "Build your own molecule position set." << endl;1561 DoLog(0) && (Log() << Verbose(0) << argv[0] << " " << VERSIONSTRING << endl); 1562 DoLog(0) && (Log() << Verbose(0) << "Build your own molecule position set." << endl); 1495 1563 return (1); 1564 break; 1565 case 'B': 1566 if (ExitFlag == 0) ExitFlag = 1; 1567 if ((argptr+5 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) || (!IsValidNumber(argv[argptr+3])) || (!IsValidNumber(argv[argptr+4])) || (!IsValidNumber(argv[argptr+5])) ) { 1568 ExitFlag = 255; 1569 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for bounding in box: -B <xx> <xy> <xz> <yy> <yz> <zz>" << endl); 1570 performCriticalExit(); 1571 } else { 1572 SaveFlag = true; 1573 j = -1; 1574 DoLog(1) && (Log() << Verbose(1) << "Centering atoms in config file within given simulation box." << endl); 1575 double * const cell_size = World::get()->cell_size; 1576 for (int i=0;i<6;i++) { 1577 cell_size[i] = atof(argv[argptr+i]); 1578 } 1579 argptr+=6; 1580 } 1496 1581 break; 1497 1582 case 'e': 1498 1583 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 1499 eLog() << Verbose(0) << "Not enough or invalid arguments for specifying element db: -e <db file>" << endl;1584 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments for specifying element db: -e <db file>" << endl); 1500 1585 performCriticalExit(); 1501 1586 } else { 1502 Log() << Verbose(0) << "Using " << argv[argptr] << " as elements database." << endl;1587 DoLog(0) && (Log() << Verbose(0) << "Using " << argv[argptr] << " as elements database." << endl); 1503 1588 strncpy (configuration.databasepath, argv[argptr], MAXSTRINGSIZE-1); 1504 1589 argptr+=1; … … 1507 1592 case 'g': 1508 1593 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 1509 eLog() << Verbose(0) << "Not enough or invalid arguments for specifying bond length table: -g <table file>" << endl;1594 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments for specifying bond length table: -g <table file>" << endl); 1510 1595 performCriticalExit(); 1511 1596 } else { 1512 1597 BondGraphFileName = argv[argptr]; 1513 Log() << Verbose(0) << "Using " << BondGraphFileName << " as bond length table." << endl;1598 DoLog(0) && (Log() << Verbose(0) << "Using " << BondGraphFileName << " as bond length table." << endl); 1514 1599 argptr+=1; 1515 1600 } 1516 1601 break; 1517 1602 case 'n': 1518 Log() << Verbose(0) << "I won't parse trajectories." << endl;1603 DoLog(0) && (Log() << Verbose(0) << "I won't parse trajectories." << endl); 1519 1604 configuration.FastParsing = true; 1605 break; 1606 case 'X': 1607 { 1608 char **name = &(World::get()->DefaultName); 1609 delete[](*name); 1610 const int length = strlen(argv[argptr]); 1611 *name = new char[length+2]; 1612 strncpy(*name, argv[argptr], length); 1613 DoLog(0) && (Log() << Verbose(0) << "Default name of new molecules set to " << *name << "." << endl); 1614 } 1520 1615 break; 1521 1616 default: // no match? Step on … … 1529 1624 // 3a. Parse the element database 1530 1625 if (periode->LoadPeriodentafel(configuration.databasepath)) { 1531 Log() << Verbose(0) << "Element list loaded successfully." << endl;1626 DoLog(0) && (Log() << Verbose(0) << "Element list loaded successfully." << endl); 1532 1627 //periode->Output(); 1533 1628 } else { 1534 Log() << Verbose(0) << "Element list loading failed." << endl;1629 DoLog(0) && (Log() << Verbose(0) << "Element list loading failed." << endl); 1535 1630 return 1; 1536 1631 } … … 1538 1633 if (argv[1][0] != '-') { 1539 1634 // simply create a new molecule, wherein the config file is loaded and the manipulation takes place 1540 Log() << Verbose(0) << "Config file given." << endl;1635 DoLog(0) && (Log() << Verbose(0) << "Config file given." << endl); 1541 1636 test.open(argv[1], ios::in); 1542 1637 if (test == NULL) { … … 1544 1639 output.open(argv[1], ios::out); 1545 1640 if (output == NULL) { 1546 Log() << Verbose(1) << "Specified config file " << argv[1] << " not found." << endl;1641 DoLog(1) && (Log() << Verbose(1) << "Specified config file " << argv[1] << " not found." << endl); 1547 1642 configPresent = absent; 1548 1643 } else { 1549 Log() << Verbose(0) << "Empty configuration file." << endl;1644 DoLog(0) && (Log() << Verbose(0) << "Empty configuration file." << endl); 1550 1645 ConfigFileName = argv[1]; 1551 1646 configPresent = empty; … … 1555 1650 test.close(); 1556 1651 ConfigFileName = argv[1]; 1557 Log() << Verbose(1) << "Specified config file found, parsing ... ";1652 DoLog(1) && (Log() << Verbose(1) << "Specified config file found, parsing ... "); 1558 1653 switch (configuration.TestSyntax(ConfigFileName, periode)) { 1559 1654 case 1: 1560 Log() << Verbose(0) << "new syntax." << endl;1655 DoLog(0) && (Log() << Verbose(0) << "new syntax." << endl); 1561 1656 configuration.Load(ConfigFileName, BondGraphFileName, periode, molecules); 1562 1657 configPresent = present; 1563 1658 break; 1564 1659 case 0: 1565 Log() << Verbose(0) << "old syntax." << endl;1660 DoLog(0) && (Log() << Verbose(0) << "old syntax." << endl); 1566 1661 configuration.LoadOld(ConfigFileName, BondGraphFileName, periode, molecules); 1567 1662 configPresent = present; 1568 1663 break; 1569 1664 default: 1570 Log() << Verbose(0) << "Unknown syntax or empty, yet present file." << endl;1665 DoLog(0) && (Log() << Verbose(0) << "Unknown syntax or empty, yet present file." << endl); 1571 1666 configPresent = empty; 1572 1667 } … … 1592 1687 configuration.BG = new BondGraph(configuration.GetIsAngstroem()); 1593 1688 if ((!BondGraphFileName.empty()) && (configuration.BG->LoadBondLengthTable(BondGraphFileName))) { 1594 Log() << Verbose(0) << "Bond length table loaded successfully." << endl;1689 DoLog(0) && (Log() << Verbose(0) << "Bond length table loaded successfully." << endl); 1595 1690 } else { 1596 eLog() << Verbose(1) << "Bond length table loading failed." << endl;1691 DoeLog(1) && (eLog()<< Verbose(1) << "Bond length table loading failed." << endl); 1597 1692 } 1598 1693 } … … 1601 1696 argptr = 1; 1602 1697 do { 1603 Log() << Verbose(0) << "Current Command line argument: " << argv[argptr] << "." << endl;1698 DoLog(0) && (Log() << Verbose(0) << "Current Command line argument: " << argv[argptr] << "." << endl); 1604 1699 if (argv[argptr][0] == '-') { 1605 1700 argptr++; … … 1610 1705 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 1611 1706 ExitFlag = 255; 1612 eLog() << Verbose(0) << "Not enough arguments for parsing: -p <xyz file>" << endl;1707 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough arguments for parsing: -p <xyz file>" << endl); 1613 1708 performCriticalExit(); 1614 1709 } else { 1615 1710 SaveFlag = true; 1616 Log() << Verbose(1) << "Parsing xyz file for new atoms." << endl;1711 DoLog(1) && (Log() << Verbose(1) << "Parsing xyz file for new atoms." << endl); 1617 1712 if (!mol->AddXYZFile(argv[argptr])) 1618 Log() << Verbose(2) << "File not found." << endl;1713 DoLog(2) && (Log() << Verbose(2) << "File not found." << endl); 1619 1714 else { 1620 Log() << Verbose(2) << "File found and parsed." << endl;1715 DoLog(2) && (Log() << Verbose(2) << "File found and parsed." << endl); 1621 1716 configPresent = present; 1622 1717 } … … 1627 1722 if ((argptr >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) || (!IsValidNumber(argv[argptr+3]))) { 1628 1723 ExitFlag = 255; 1629 eLog() << Verbose(0) << "Not enough or invalid arguments for adding atom: -a <element> <x> <y> <z>" << endl;1724 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments for adding atom: -a <element> <x> <y> <z>" << endl); 1630 1725 performCriticalExit(); 1631 1726 } else { 1632 1727 SaveFlag = true; 1633 Log() << Verbose(1) << "Adding new atom with element " << argv[argptr] << " at (" << argv[argptr+1] << "," << argv[argptr+2] << "," << argv[argptr+3] << "), ";1728 DoLog(1) && (Log() << Verbose(1) << "Adding new atom with element " << argv[argptr] << " at (" << argv[argptr+1] << "," << argv[argptr+2] << "," << argv[argptr+3] << "), "); 1634 1729 first = new atom; 1635 1730 first->type = periode->FindElement(atoi(argv[argptr])); 1636 1731 if (first->type != NULL) 1637 Log() << Verbose(2) << "found element " << first->type->name << endl;1732 DoLog(2) && (Log() << Verbose(2) << "found element " << first->type->name << endl); 1638 1733 for (int i=NDIM;i--;) 1639 1734 first->x.x[i] = atof(argv[argptr+1+i]); … … 1643 1738 configPresent = present; 1644 1739 } else 1645 eLog() << Verbose(1) << "Could not find the specified element." << endl;1740 DoeLog(1) && (eLog()<< Verbose(1) << "Could not find the specified element." << endl); 1646 1741 argptr+=4; 1647 1742 } … … 1656 1751 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 1657 1752 ExitFlag = 255; 1658 eLog() << Verbose(0) << "Not enough or invalid arguments given for setting MPQC basis: -B <basis name>" << endl;1753 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for setting MPQC basis: -B <basis name>" << endl); 1659 1754 performCriticalExit(); 1660 1755 } else { 1661 1756 configuration.basis = argv[argptr]; 1662 Log() << Verbose(1) << "Setting MPQC basis to " << configuration.basis << "." << endl;1757 DoLog(1) && (Log() << Verbose(1) << "Setting MPQC basis to " << configuration.basis << "." << endl); 1663 1758 argptr+=1; 1664 1759 } … … 1667 1762 if (ExitFlag == 0) ExitFlag = 1; 1668 1763 { 1669 Log() << Verbose(1) << "Depth-First-Search Analysis." << endl;1764 DoLog(1) && (Log() << Verbose(1) << "Depth-First-Search Analysis." << endl); 1670 1765 MoleculeLeafClass *Subgraphs = NULL; // list of subgraphs from DFS analysis 1671 1766 int *MinimumRingSize = new int[mol->AtomCount]; … … 1698 1793 break; 1699 1794 case 'I': 1700 Log() << Verbose(1) << "Dissecting molecular system into a set of disconnected subgraphs ... " << endl;1795 DoLog(1) && (Log() << Verbose(1) << "Dissecting molecular system into a set of disconnected subgraphs ... " << endl); 1701 1796 // @TODO rather do the dissection afterwards 1702 1797 molecules->DissectMoleculeIntoConnectedSubgraphs(periode, &configuration); … … 1709 1804 } 1710 1805 } 1711 if ( mol == NULL) {1806 if ((mol == NULL) && (!molecules->ListOfMolecules.empty())) { 1712 1807 mol = *(molecules->ListOfMolecules.begin()); 1713 mol->ActiveFlag = true; 1808 if (mol != NULL) 1809 mol->ActiveFlag = true; 1714 1810 } 1715 1811 break; 1716 1812 case 'C': 1717 if (ExitFlag == 0) ExitFlag = 1; 1718 if ((argptr >= argc)) { 1719 ExitFlag = 255; 1720 eLog() << Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C <type: E/P/S> [more params] <output> <bin output> <BinStart> <BinEnd>" << endl; 1721 performCriticalExit(); 1722 } else { 1723 switch(argv[argptr][0]) { 1724 case 'E': 1725 { 1726 if ((argptr+6 >= argc) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+5])) || (!IsValidNumber(argv[argptr+6])) || (!IsValidNumber(argv[argptr+2])) || (argv[argptr+1][0] == '-') || (argv[argptr+2][0] == '-') || (argv[argptr+3][0] == '-') || (argv[argptr+4][0] == '-')) { 1727 ExitFlag = 255; 1728 eLog() << Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C E <Z1> <Z2> <output> <bin output>" << endl; 1729 performCriticalExit(); 1730 } else { 1731 ofstream output(argv[argptr+3]); 1732 ofstream binoutput(argv[argptr+4]); 1733 const double BinStart = atof(argv[argptr+5]); 1734 const double BinEnd = atof(argv[argptr+6]); 1735 1736 element *elemental = periode->FindElement((const int) atoi(argv[argptr+1])); 1737 element *elemental2 = periode->FindElement((const int) atoi(argv[argptr+2])); 1738 PairCorrelationMap *correlationmap = PairCorrelation(molecules, elemental, elemental2); 1739 //OutputCorrelationToSurface(&output, correlationmap); 1740 BinPairMap *binmap = BinData( correlationmap, 0.5, BinStart, BinEnd ); 1741 OutputCorrelation ( &binoutput, binmap ); 1742 output.close(); 1743 binoutput.close(); 1744 delete(binmap); 1745 delete(correlationmap); 1746 argptr+=7; 1813 { 1814 int ranges[3] = {1, 1, 1}; 1815 bool periodic = (argv[argptr-1][2] =='p'); 1816 if (ExitFlag == 0) ExitFlag = 1; 1817 if ((argptr >= argc)) { 1818 ExitFlag = 255; 1819 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C[p] <type: E/P/S> [more params] <output> <bin output> <BinStart> <BinEnd>" << endl); 1820 performCriticalExit(); 1821 } else { 1822 switch(argv[argptr][0]) { 1823 case 'E': 1824 { 1825 if ((argptr+6 >= argc) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+5])) || (!IsValidNumber(argv[argptr+6])) || (!IsValidNumber(argv[argptr+2])) || (argv[argptr+1][0] == '-') || (argv[argptr+2][0] == '-') || (argv[argptr+3][0] == '-') || (argv[argptr+4][0] == '-')) { 1826 ExitFlag = 255; 1827 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C E <Z1> <Z2> <output> <bin output>" << endl); 1828 performCriticalExit(); 1829 } else { 1830 ofstream output(argv[argptr+3]); 1831 ofstream binoutput(argv[argptr+4]); 1832 const double BinStart = atof(argv[argptr+5]); 1833 const double BinEnd = atof(argv[argptr+6]); 1834 1835 element *elemental = periode->FindElement((const int) atoi(argv[argptr+1])); 1836 element *elemental2 = periode->FindElement((const int) atoi(argv[argptr+2])); 1837 PairCorrelationMap *correlationmap = NULL; 1838 if (periodic) 1839 correlationmap = PeriodicPairCorrelation(molecules, elemental, elemental2, ranges); 1840 else 1841 correlationmap = PairCorrelation(molecules, elemental, elemental2); 1842 //OutputCorrelationToSurface(&output, correlationmap); 1843 BinPairMap *binmap = BinData( correlationmap, 0.5, BinStart, BinEnd ); 1844 OutputCorrelation ( &binoutput, binmap ); 1845 output.close(); 1846 binoutput.close(); 1847 delete(binmap); 1848 delete(correlationmap); 1849 argptr+=7; 1850 } 1747 1851 } 1748 } 1749 break; 1750 1751 case 'P': 1752 { 1753 if ((argptr+8 >= argc) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) || (!IsValidNumber(argv[argptr+3])) || (!IsValidNumber(argv[argptr+4])) || (!IsValidNumber(argv[argptr+7])) || (!IsValidNumber(argv[argptr+8])) || (argv[argptr+1][0] == '-') || (argv[argptr+2][0] == '-') || (argv[argptr+3][0] == '-') || (argv[argptr+4][0] == '-') || (argv[argptr+5][0] == '-') || (argv[argptr+6][0] == '-')) { 1754 ExitFlag = 255; 1755 eLog() << Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C P <Z1> <x> <y> <z> <output> <bin output>" << endl; 1756 performCriticalExit(); 1757 } else { 1758 ofstream output(argv[argptr+5]); 1759 ofstream binoutput(argv[argptr+6]); 1760 const double BinStart = atof(argv[argptr+7]); 1761 const double BinEnd = atof(argv[argptr+8]); 1762 1763 element *elemental = periode->FindElement((const int) atoi(argv[argptr+1])); 1764 Vector *Point = new Vector((const double) atof(argv[argptr+1]),(const double) atof(argv[argptr+2]),(const double) atof(argv[argptr+3])); 1765 CorrelationToPointMap *correlationmap = CorrelationToPoint(molecules, elemental, Point); 1766 //OutputCorrelationToSurface(&output, correlationmap); 1767 BinPairMap *binmap = BinData( correlationmap, 0.5, BinStart, BinEnd ); 1768 OutputCorrelation ( &binoutput, binmap ); 1769 output.close(); 1770 binoutput.close(); 1771 delete(Point); 1772 delete(binmap); 1773 delete(correlationmap); 1774 argptr+=9; 1852 break; 1853 1854 case 'P': 1855 { 1856 if ((argptr+8 >= argc) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) || (!IsValidNumber(argv[argptr+3])) || (!IsValidNumber(argv[argptr+4])) || (!IsValidNumber(argv[argptr+7])) || (!IsValidNumber(argv[argptr+8])) || (argv[argptr+1][0] == '-') || (argv[argptr+2][0] == '-') || (argv[argptr+3][0] == '-') || (argv[argptr+4][0] == '-') || (argv[argptr+5][0] == '-') || (argv[argptr+6][0] == '-')) { 1857 ExitFlag = 255; 1858 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C P <Z1> <x> <y> <z> <output> <bin output>" << endl); 1859 performCriticalExit(); 1860 } else { 1861 ofstream output(argv[argptr+5]); 1862 ofstream binoutput(argv[argptr+6]); 1863 const double BinStart = atof(argv[argptr+7]); 1864 const double BinEnd = atof(argv[argptr+8]); 1865 1866 element *elemental = periode->FindElement((const int) atoi(argv[argptr+1])); 1867 Vector *Point = new Vector((const double) atof(argv[argptr+1]),(const double) atof(argv[argptr+2]),(const double) atof(argv[argptr+3])); 1868 CorrelationToPointMap *correlationmap = NULL; 1869 if (periodic) 1870 correlationmap = PeriodicCorrelationToPoint(molecules, elemental, Point, ranges); 1871 else 1872 correlationmap = CorrelationToPoint(molecules, elemental, Point); 1873 //OutputCorrelationToSurface(&output, correlationmap); 1874 BinPairMap *binmap = BinData( correlationmap, 0.5, BinStart, BinEnd ); 1875 OutputCorrelation ( &binoutput, binmap ); 1876 output.close(); 1877 binoutput.close(); 1878 delete(Point); 1879 delete(binmap); 1880 delete(correlationmap); 1881 argptr+=9; 1882 } 1775 1883 } 1776 } 1777 break; 1778 1779 case 'S': 1780 { 1781 if ((argptr+6 >= argc) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+4])) || (!IsValidNumber(argv[argptr+5])) || (!IsValidNumber(argv[argptr+6])) || (argv[argptr+1][0] == '-') || (argv[argptr+2][0] == '-') || (argv[argptr+3][0] == '-')) { 1782 ExitFlag = 255; 1783 eLog() << Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C S <Z> <output> <bin output> <BinWidth> <BinStart> <BinEnd>" << endl; 1784 performCriticalExit(); 1785 } else { 1786 ofstream output(argv[argptr+2]); 1787 ofstream binoutput(argv[argptr+3]); 1788 const double radius = 4.; 1789 const double BinWidth = atof(argv[argptr+4]); 1790 const double BinStart = atof(argv[argptr+5]); 1791 const double BinEnd = atof(argv[argptr+6]); 1792 double LCWidth = 20.; 1793 if (BinEnd > 0) { 1794 if (BinEnd > 2.*radius) 1795 LCWidth = BinEnd; 1884 break; 1885 1886 case 'S': 1887 { 1888 if ((argptr+6 >= argc) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+4])) || (!IsValidNumber(argv[argptr+5])) || (!IsValidNumber(argv[argptr+6])) || (argv[argptr+1][0] == '-') || (argv[argptr+2][0] == '-') || (argv[argptr+3][0] == '-')) { 1889 ExitFlag = 255; 1890 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C S <Z> <output> <bin output> <BinWidth> <BinStart> <BinEnd>" << endl); 1891 performCriticalExit(); 1892 } else { 1893 ofstream output(argv[argptr+2]); 1894 ofstream binoutput(argv[argptr+3]); 1895 const double radius = 4.; 1896 const double BinWidth = atof(argv[argptr+4]); 1897 const double BinStart = atof(argv[argptr+5]); 1898 const double BinEnd = atof(argv[argptr+6]); 1899 double LCWidth = 20.; 1900 if (BinEnd > 0) { 1901 if (BinEnd > 2.*radius) 1902 LCWidth = BinEnd; 1903 else 1904 LCWidth = 2.*radius; 1905 } 1906 1907 // get the boundary 1908 class molecule *Boundary = NULL; 1909 class Tesselation *TesselStruct = NULL; 1910 const LinkedCell *LCList = NULL; 1911 // find biggest molecule 1912 int counter = 0; 1913 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) { 1914 if ((Boundary == NULL) || (Boundary->AtomCount < (*BigFinder)->AtomCount)) { 1915 Boundary = *BigFinder; 1916 } 1917 counter++; 1918 } 1919 bool *Actives = Malloc<bool>(counter, "ParseCommandLineOptions() - case C -- *Actives"); 1920 counter = 0; 1921 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) { 1922 Actives[counter++] = (*BigFinder)->ActiveFlag; 1923 (*BigFinder)->ActiveFlag = (*BigFinder == Boundary) ? false : true; 1924 } 1925 LCList = new LinkedCell(Boundary, LCWidth); 1926 element *elemental = periode->FindElement((const int) atoi(argv[argptr+1])); 1927 FindNonConvexBorder(Boundary, TesselStruct, LCList, radius, NULL); 1928 CorrelationToSurfaceMap *surfacemap = NULL; 1929 if (periodic) 1930 surfacemap = PeriodicCorrelationToSurface( molecules, elemental, TesselStruct, LCList, ranges); 1796 1931 else 1797 LCWidth = 2.*radius; 1932 surfacemap = CorrelationToSurface( molecules, elemental, TesselStruct, LCList); 1933 OutputCorrelationToSurface(&output, surfacemap); 1934 // check whether radius was appropriate 1935 { 1936 double start; double end; 1937 GetMinMax( surfacemap, start, end); 1938 if (LCWidth < end) 1939 DoeLog(1) && (eLog()<< Verbose(1) << "Linked Cell width is smaller than the found range of values! Bins can only be correct up to: " << radius << "." << endl); 1940 } 1941 BinPairMap *binmap = BinData( surfacemap, BinWidth, BinStart, BinEnd ); 1942 OutputCorrelation ( &binoutput, binmap ); 1943 output.close(); 1944 binoutput.close(); 1945 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) 1946 (*BigFinder)->ActiveFlag = Actives[counter++]; 1947 Free(&Actives); 1948 delete(LCList); 1949 delete(TesselStruct); 1950 delete(binmap); 1951 delete(surfacemap); 1952 argptr+=7; 1798 1953 } 1799 1800 // get the boundary1801 class molecule *Boundary = NULL;1802 class Tesselation *TesselStruct = NULL;1803 const LinkedCell *LCList = NULL;1804 // find biggest molecule1805 int counter = 0;1806 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) {1807 if ((Boundary == NULL) || (Boundary->AtomCount < (*BigFinder)->AtomCount)) {1808 Boundary = *BigFinder;1809 }1810 counter++;1811 }1812 bool *Actives = Malloc<bool>(counter, "ParseCommandLineOptions() - case C -- *Actives");1813 counter = 0;1814 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) {1815 Actives[counter++] = (*BigFinder)->ActiveFlag;1816 (*BigFinder)->ActiveFlag = (*BigFinder == Boundary) ? false : true;1817 }1818 LCList = new LinkedCell(Boundary, LCWidth);1819 element *elemental = periode->FindElement((const int) atoi(argv[argptr+1]));1820 FindNonConvexBorder(Boundary, TesselStruct, LCList, radius, NULL);1821 //int ranges[NDIM] = {1,1,1};1822 CorrelationToSurfaceMap *surfacemap = CorrelationToSurface( molecules, elemental, TesselStruct, LCList); // for Periodic..(): ..., ranges );1823 OutputCorrelationToSurface(&output, surfacemap);1824 // check whether radius was appropriate1825 {1826 double start; double end;1827 GetMinMax( surfacemap, start, end);1828 if (LCWidth < end)1829 eLog() << Verbose(1) << "Linked Cell width is smaller than the found range of values! Bins can only be correct up to: " << radius << "." << endl;1830 }1831 BinPairMap *binmap = BinData( surfacemap, BinWidth, BinStart, BinEnd );1832 OutputCorrelation ( &binoutput, binmap );1833 output.close();1834 binoutput.close();1835 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++)1836 (*BigFinder)->ActiveFlag = Actives[counter++];1837 Free(&Actives);1838 delete(LCList);1839 delete(TesselStruct);1840 delete(binmap);1841 delete(surfacemap);1842 argptr+=7;1843 1954 } 1844 }1845 break; 1846 1847 default:1848 ExitFlag = 255;1849 eLog() << Verbose(0) << "Invalid type given for pair correlation analysis: -C <type: E/P/S> [more params] <output> <bin output>" << endl;1850 performCriticalExit();1851 break;1955 break; 1956 1957 default: 1958 ExitFlag = 255; 1959 DoeLog(0) && (eLog()<< Verbose(0) << "Invalid type given for pair correlation analysis: -C <type: E/P/S> [more params] <output> <bin output>" << endl); 1960 performCriticalExit(); 1961 break; 1962 } 1852 1963 } 1853 }1854 break;1964 break; 1965 } 1855 1966 case 'E': 1856 1967 if (ExitFlag == 0) ExitFlag = 1; 1857 1968 if ((argptr+1 >= argc) || (!IsValidNumber(argv[argptr])) || (argv[argptr+1][0] == '-')) { 1858 1969 ExitFlag = 255; 1859 eLog() << Verbose(0) << "Not enough or invalid arguments given for changing element: -E <atom nr.> <element>" << endl;1970 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for changing element: -E <atom nr.> <element>" << endl); 1860 1971 performCriticalExit(); 1861 1972 } else { 1862 1973 SaveFlag = true; 1863 Log() << Verbose(1) << "Changing atom " << argv[argptr] << " to element " << argv[argptr+1] << "." << endl;1974 DoLog(1) && (Log() << Verbose(1) << "Changing atom " << argv[argptr] << " to element " << argv[argptr+1] << "." << endl); 1864 1975 first = mol->FindAtom(atoi(argv[argptr])); 1865 1976 first->type = periode->FindElement(atoi(argv[argptr+1])); … … 1870 1981 if (ExitFlag == 0) ExitFlag = 1; 1871 1982 MaxDistance = -1; 1872 if (argv[argptr-1][2] == 'F') { 1983 if (argv[argptr-1][2] == 'F') { // option is -FF? 1873 1984 // fetch first argument as max distance to surface 1874 1985 MaxDistance = atof(argv[argptr++]); 1875 Log() << Verbose(0) << "Filling with maximum layer distance of " << MaxDistance << "." << endl;1986 DoLog(0) && (Log() << Verbose(0) << "Filling with maximum layer distance of " << MaxDistance << "." << endl); 1876 1987 } 1877 1988 if ((argptr+7 >=argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) || (!IsValidNumber(argv[argptr+3])) || (!IsValidNumber(argv[argptr+4])) || (!IsValidNumber(argv[argptr+5])) || (!IsValidNumber(argv[argptr+6])) || (!IsValidNumber(argv[argptr+7]))) { 1878 1989 ExitFlag = 255; 1879 eLog() << Verbose(0) << "Not enough or invalid arguments given for filling box with water: -F <xyz of filler> <dist_x> <dist_y> <dist_z> <boundary> <randatom> <randmol> <DoRotate>" << endl;1990 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for filling box with water: -F <xyz of filler> <dist_x> <dist_y> <dist_z> <boundary> <randatom> <randmol> <DoRotate>" << endl); 1880 1991 performCriticalExit(); 1881 1992 } else { 1882 1993 SaveFlag = true; 1883 Log() << Verbose(1) << "Filling Box with water molecules." << endl;1994 DoLog(1) && (Log() << Verbose(1) << "Filling Box with water molecules." << endl); 1884 1995 // construct water molecule 1885 1996 molecule *filler = new molecule(periode); 1886 1997 if (!filler->AddXYZFile(argv[argptr])) { 1887 eLog() << Verbose(0) << "Could not parse filler molecule from " << argv[argptr] << "." << endl;1998 DoeLog(0) && (eLog()<< Verbose(0) << "Could not parse filler molecule from " << argv[argptr] << "." << endl); 1888 1999 } 1889 2000 filler->SetNameFromFilename(argv[argptr]); … … 1907 2018 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 1908 2019 ExitFlag =255; 1909 eLog() << Verbose(0) << "Missing source file for bonds in molecule: -A <bond sourcefile>" << endl;2020 DoeLog(0) && (eLog()<< Verbose(0) << "Missing source file for bonds in molecule: -A <bond sourcefile>" << endl); 1910 2021 performCriticalExit(); 1911 2022 } else { 1912 Log() << Verbose(0) << "Parsing bonds from " << argv[argptr] << "." << endl;2023 DoLog(0) && (Log() << Verbose(0) << "Parsing bonds from " << argv[argptr] << "." << endl); 1913 2024 ifstream *input = new ifstream(argv[argptr]); 1914 2025 mol->CreateAdjacencyListFromDbondFile(input); … … 1922 2033 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 1923 2034 ExitFlag =255; 1924 eLog() << Verbose(0) << "Missing path of adjacency file: -j <path>" << endl;2035 DoeLog(0) && (eLog()<< Verbose(0) << "Missing path of adjacency file: -j <path>" << endl); 1925 2036 performCriticalExit(); 1926 2037 } else { 1927 Log() << Verbose(0) << "Storing adjacency to path " << argv[argptr] << "." << endl;2038 DoLog(0) && (Log() << Verbose(0) << "Storing adjacency to path " << argv[argptr] << "." << endl); 1928 2039 configuration.BG->ConstructBondGraph(mol); 1929 mol->StoreAdjacencyToFile( argv[argptr]);2040 mol->StoreAdjacencyToFile(NULL, argv[argptr]); 1930 2041 argptr+=1; 1931 2042 } … … 1936 2047 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 1937 2048 ExitFlag =255; 1938 eLog() << Verbose(0) << "Missing path of bonds file: -j <path>" << endl;2049 DoeLog(0) && (eLog()<< Verbose(0) << "Missing path of bonds file: -j <path>" << endl); 1939 2050 performCriticalExit(); 1940 2051 } else { 1941 Log() << Verbose(0) << "Storing bonds to path " << argv[argptr] << "." << endl;2052 DoLog(0) && (Log() << Verbose(0) << "Storing bonds to path " << argv[argptr] << "." << endl); 1942 2053 configuration.BG->ConstructBondGraph(mol); 1943 mol->StoreBondsToFile( argv[argptr]);2054 mol->StoreBondsToFile(NULL, argv[argptr]); 1944 2055 argptr+=1; 1945 2056 } … … 1950 2061 if ((argptr+1 >= argc) || (argv[argptr+1][0] == '-')){ 1951 2062 ExitFlag = 255; 1952 eLog() << Verbose(0) << "Not enough or invalid arguments given for non-convex envelope: -o <radius> <tecplot output file>" << endl;2063 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for non-convex envelope: -o <radius> <tecplot output file>" << endl); 1953 2064 performCriticalExit(); 1954 2065 } else { … … 1958 2069 //string filename(argv[argptr+1]); 1959 2070 //filename.append(".csv"); 1960 Log() << Verbose(0) << "Evaluating non-convex envelope of biggest molecule.";1961 Log() << Verbose(1) << "Using rolling ball of radius " << atof(argv[argptr]) << " and storing tecplot data in " << argv[argptr+1] << "." << endl;2071 DoLog(0) && (Log() << Verbose(0) << "Evaluating non-convex envelope of biggest molecule."); 2072 DoLog(1) && (Log() << Verbose(1) << "Using rolling ball of radius " << atof(argv[argptr]) << " and storing tecplot data in " << argv[argptr+1] << "." << endl); 1962 2073 // find biggest molecule 1963 2074 int counter = 0; … … 1969 2080 counter++; 1970 2081 } 1971 Log() << Verbose(1) << "Biggest molecule has " << Boundary->AtomCount << " atoms." << endl;2082 DoLog(1) && (Log() << Verbose(1) << "Biggest molecule has " << Boundary->AtomCount << " atoms." << endl); 1972 2083 start = clock(); 1973 2084 LCList = new LinkedCell(Boundary, atof(argv[argptr])*2.); … … 1976 2087 //FindDistributionOfEllipsoids(T, &LCList, N, number, filename.c_str()); 1977 2088 end = clock(); 1978 Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl;2089 DoLog(0) && (Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl); 1979 2090 delete(LCList); 1980 2091 delete(T); … … 1986 2097 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 1987 2098 ExitFlag = 255; 1988 eLog() << Verbose(0) << "Not enough or invalid arguments given for storing tempature: -S <temperature file>" << endl;2099 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for storing tempature: -S <temperature file>" << endl); 1989 2100 performCriticalExit(); 1990 2101 } else { 1991 Log() << Verbose(1) << "Storing temperatures in " << argv[argptr] << "." << endl;2102 DoLog(1) && (Log() << Verbose(1) << "Storing temperatures in " << argv[argptr] << "." << endl); 1992 2103 ofstream *output = new ofstream(argv[argptr], ios::trunc); 1993 2104 if (!mol->OutputTemperatureFromTrajectories(output, 0, mol->MDSteps)) 1994 Log() << Verbose(2) << "File could not be written." << endl;2105 DoLog(2) && (Log() << Verbose(2) << "File could not be written." << endl); 1995 2106 else 1996 Log() << Verbose(2) << "File stored." << endl;2107 DoLog(2) && (Log() << Verbose(2) << "File stored." << endl); 1997 2108 output->close(); 1998 2109 delete(output); … … 2004 2115 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 2005 2116 ExitFlag = 255; 2006 eLog() << Verbose(0) << "Not enough or invalid arguments given for storing tempature: -L <step0> <step1> <prefix> <identity mapping?>" << endl;2117 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for storing tempature: -L <step0> <step1> <prefix> <identity mapping?>" << endl); 2007 2118 performCriticalExit(); 2008 2119 } else { 2009 2120 SaveFlag = true; 2010 Log() << Verbose(1) << "Linear interpolation between configuration " << argv[argptr] << " and " << argv[argptr+1] << "." << endl;2121 DoLog(1) && (Log() << Verbose(1) << "Linear interpolation between configuration " << argv[argptr] << " and " << argv[argptr+1] << "." << endl); 2011 2122 if (atoi(argv[argptr+3]) == 1) 2012 Log() << Verbose(1) << "Using Identity for the permutation map." << endl;2123 DoLog(1) && (Log() << Verbose(1) << "Using Identity for the permutation map." << endl); 2013 2124 if (!mol->LinearInterpolationBetweenConfiguration(atoi(argv[argptr]), atoi(argv[argptr+1]), argv[argptr+2], configuration, atoi(argv[argptr+3])) == 1 ? true : false) 2014 Log() << Verbose(2) << "Could not store " << argv[argptr+2] << " files." << endl;2125 DoLog(2) && (Log() << Verbose(2) << "Could not store " << argv[argptr+2] << " files." << endl); 2015 2126 else 2016 Log() << Verbose(2) << "Steps created and " << argv[argptr+2] << " files stored." << endl;2127 DoLog(2) && (Log() << Verbose(2) << "Steps created and " << argv[argptr+2] << " files stored." << endl); 2017 2128 argptr+=4; 2018 2129 } … … 2022 2133 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 2023 2134 ExitFlag = 255; 2024 eLog() << Verbose(0) << "Not enough or invalid arguments given for parsing and integrating forces: -P <forces file>" << endl;2135 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for parsing and integrating forces: -P <forces file>" << endl); 2025 2136 performCriticalExit(); 2026 2137 } else { 2027 2138 SaveFlag = true; 2028 Log() << Verbose(1) << "Parsing forces file and Verlet integrating." << endl;2139 DoLog(1) && (Log() << Verbose(1) << "Parsing forces file and Verlet integrating." << endl); 2029 2140 if (!mol->VerletForceIntegration(argv[argptr], configuration)) 2030 Log() << Verbose(2) << "File not found." << endl;2141 DoLog(2) && (Log() << Verbose(2) << "File not found." << endl); 2031 2142 else 2032 Log() << Verbose(2) << "File found and parsed." << endl;2143 DoLog(2) && (Log() << Verbose(2) << "File found and parsed." << endl); 2033 2144 argptr+=1; 2034 2145 } … … 2038 2149 if ((argptr+1 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1]))) { 2039 2150 ExitFlag = 255; 2040 eLog() << Verbose(0) << "Not enough or invalid arguments given for removing atoms: -R <id> <distance>" << endl;2151 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for removing atoms: -R <id> <distance>" << endl); 2041 2152 performCriticalExit(); 2042 2153 } else { 2043 2154 SaveFlag = true; 2044 Log() << Verbose(1) << "Removing atoms around " << argv[argptr] << " with radius " << argv[argptr+1] << "." << endl;2155 DoLog(1) && (Log() << Verbose(1) << "Removing atoms around " << argv[argptr] << " with radius " << argv[argptr+1] << "." << endl); 2045 2156 double tmp1 = atof(argv[argptr+1]); 2046 2157 atom *third = mol->FindAtom(atoi(argv[argptr])); … … 2055 2166 } 2056 2167 } else { 2057 eLog() << Verbose(1) << "Removal failed due to missing atoms on molecule or wrong id." << endl;2168 DoeLog(1) && (eLog()<< Verbose(1) << "Removal failed due to missing atoms on molecule or wrong id." << endl); 2058 2169 } 2059 2170 argptr+=2; … … 2064 2175 if ((argptr+2 >= argc) || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) { 2065 2176 ExitFlag = 255; 2066 eLog() << Verbose(0) << "Not enough or invalid arguments given for translation: -t <x> <y> <z>" << endl;2177 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for translation: -t <x> <y> <z>" << endl); 2067 2178 performCriticalExit(); 2068 2179 } else { 2069 2180 if (ExitFlag == 0) ExitFlag = 1; 2070 2181 SaveFlag = true; 2071 Log() << Verbose(1) << "Translating all ions by given vector." << endl;2182 DoLog(1) && (Log() << Verbose(1) << "Translating all ions by given vector." << endl); 2072 2183 for (int i=NDIM;i--;) 2073 2184 x.x[i] = atof(argv[argptr+i]); … … 2080 2191 if ((argptr+2 >= argc) || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) { 2081 2192 ExitFlag = 255; 2082 eLog() << Verbose(0) << "Not enough or invalid arguments given for periodic translation: -T <x> <y> <z>" << endl;2193 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for periodic translation: -T <x> <y> <z>" << endl); 2083 2194 performCriticalExit(); 2084 2195 } else { 2085 2196 if (ExitFlag == 0) ExitFlag = 1; 2086 2197 SaveFlag = true; 2087 Log() << Verbose(1) << "Translating all ions periodically by given vector." << endl;2198 DoLog(1) && (Log() << Verbose(1) << "Translating all ions periodically by given vector." << endl); 2088 2199 for (int i=NDIM;i--;) 2089 2200 x.x[i] = atof(argv[argptr+i]); … … 2096 2207 if ((argptr >= argc) || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) { 2097 2208 ExitFlag = 255; 2098 eLog() << Verbose(0) << "Not enough or invalid arguments given for scaling: -s <factor_x> [factor_y] [factor_z]" << endl;2209 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for scaling: -s <factor_x> [factor_y] [factor_z]" << endl); 2099 2210 performCriticalExit(); 2100 2211 } else { 2101 2212 SaveFlag = true; 2102 2213 j = -1; 2103 Log() << Verbose(1) << "Scaling all ion positions by factor." << endl;2214 DoLog(1) && (Log() << Verbose(1) << "Scaling all ion positions by factor." << endl); 2104 2215 factor = new double[NDIM]; 2105 2216 factor[0] = atof(argv[argptr]); … … 2121 2232 if ((argptr+5 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) || (!IsValidNumber(argv[argptr+3])) || (!IsValidNumber(argv[argptr+4])) || (!IsValidNumber(argv[argptr+5])) ) { 2122 2233 ExitFlag = 255; 2123 eLog() << Verbose(0) << "Not enough or invalid arguments given for centering in box: -b <xx> <xy> <xz> <yy> <yz> <zz>" << endl;2234 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for centering in box: -b <xx> <xy> <xz> <yy> <yz> <zz>" << endl); 2124 2235 performCriticalExit(); 2125 2236 } else { 2126 2237 SaveFlag = true; 2127 2238 j = -1; 2128 Log() << Verbose(1) << "Centering atoms in config file within given simulation box." << endl;2239 DoLog(1) && (Log() << Verbose(1) << "Centering atoms in config file within given simulation box." << endl); 2129 2240 double * const cell_size = World::get()->cell_size; 2130 2241 for (int i=0;i<6;i++) { … … 2140 2251 if ((argptr+5 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) || (!IsValidNumber(argv[argptr+3])) || (!IsValidNumber(argv[argptr+4])) || (!IsValidNumber(argv[argptr+5])) ) { 2141 2252 ExitFlag = 255; 2142 eLog() << Verbose(0) << "Not enough or invalid arguments given for bounding in box: -B <xx> <xy> <xz> <yy> <yz> <zz>" << endl;2253 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for bounding in box: -B <xx> <xy> <xz> <yy> <yz> <zz>" << endl); 2143 2254 performCriticalExit(); 2144 2255 } else { 2145 2256 SaveFlag = true; 2146 2257 j = -1; 2147 Log() << Verbose(1) << "Centering atoms in config file within given simulation box." << endl;2258 DoLog(1) && (Log() << Verbose(1) << "Centering atoms in config file within given simulation box." << endl); 2148 2259 double * const cell_size = World::get()->cell_size; 2149 2260 for (int i=0;i<6;i++) { … … 2159 2270 if ((argptr+2 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) { 2160 2271 ExitFlag = 255; 2161 eLog() << Verbose(0) << "Not enough or invalid arguments given for centering with boundary: -c <boundary_x> <boundary_y> <boundary_z>" << endl;2272 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for centering with boundary: -c <boundary_x> <boundary_y> <boundary_z>" << endl); 2162 2273 performCriticalExit(); 2163 2274 } else { 2164 2275 SaveFlag = true; 2165 2276 j = -1; 2166 Log() << Verbose(1) << "Centering atoms in config file within given additional boundary." << endl;2277 DoLog(1) && (Log() << Verbose(1) << "Centering atoms in config file within given additional boundary." << endl); 2167 2278 // make every coordinate positive 2168 2279 mol->CenterEdge(&x); … … 2184 2295 if (ExitFlag == 0) ExitFlag = 1; 2185 2296 SaveFlag = true; 2186 Log() << Verbose(1) << "Centering atoms on edge and setting box dimensions." << endl;2297 DoLog(1) && (Log() << Verbose(1) << "Centering atoms on edge and setting box dimensions." << endl); 2187 2298 x.Zero(); 2188 2299 mol->CenterEdge(&x); … … 2194 2305 if ((argptr >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr]))) { 2195 2306 ExitFlag = 255; 2196 eLog() << Verbose(0) << "Not enough or invalid arguments given for removing atoms: -r <id>" << endl;2307 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for removing atoms: -r <id>" << endl); 2197 2308 performCriticalExit(); 2198 2309 } else { 2199 2310 SaveFlag = true; 2200 Log() << Verbose(1) << "Removing atom " << argv[argptr] << "." << endl;2311 DoLog(1) && (Log() << Verbose(1) << "Removing atom " << argv[argptr] << "." << endl); 2201 2312 atom *first = mol->FindAtom(atoi(argv[argptr])); 2202 2313 mol->RemoveAtom(first); … … 2208 2319 if ((argptr+1 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1]))) { 2209 2320 ExitFlag = 255; 2210 eLog() << Verbose(0) << "Not enough or invalid arguments for fragmentation: -f <max. bond distance> <bond order>" << endl;2321 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments for fragmentation: -f <max. bond distance> <bond order>" << endl); 2211 2322 performCriticalExit(); 2212 2323 } else { 2213 Log() << Verbose(0) << "Fragmenting molecule with bond distance " << argv[argptr] << " angstroem, order of " << argv[argptr+1] << "." << endl;2214 Log() << Verbose(0) << "Creating connection matrix..." << endl;2324 DoLog(0) && (Log() << Verbose(0) << "Fragmenting molecule with bond distance " << argv[argptr] << " angstroem, order of " << argv[argptr+1] << "." << endl); 2325 DoLog(0) && (Log() << Verbose(0) << "Creating connection matrix..." << endl); 2215 2326 start = clock(); 2216 2327 mol->CreateAdjacencyList(atof(argv[argptr++]), configuration.GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL); 2217 Log() << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl;2328 DoLog(0) && (Log() << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl); 2218 2329 if (mol->first->next != mol->last) { 2219 2330 ExitFlag = mol->FragmentMolecule(atoi(argv[argptr]), &configuration); 2220 2331 } 2221 2332 end = clock(); 2222 Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl;2333 DoLog(0) && (Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl); 2223 2334 argptr+=2; 2224 2335 } … … 2228 2339 j = atoi(argv[argptr++]); 2229 2340 if ((j<0) || (j>1)) { 2230 eLog() << Verbose(1) << "Argument of '-m' should be either 0 for no-rotate or 1 for rotate." << endl;2341 DoeLog(1) && (eLog()<< Verbose(1) << "Argument of '-m' should be either 0 for no-rotate or 1 for rotate." << endl); 2231 2342 j = 0; 2232 2343 } 2233 2344 if (j) { 2234 2345 SaveFlag = true; 2235 Log() << Verbose(0) << "Converting to prinicipal axis system." << endl;2346 DoLog(0) && (Log() << Verbose(0) << "Converting to prinicipal axis system." << endl); 2236 2347 } else 2237 Log() << Verbose(0) << "Evaluating prinicipal axis." << endl;2348 DoLog(0) && (Log() << Verbose(0) << "Evaluating prinicipal axis." << endl); 2238 2349 mol->PrincipalAxisSystem((bool)j); 2239 2350 break; … … 2242 2353 if ((argptr+1 >= argc) || (argv[argptr][0] == '-')){ 2243 2354 ExitFlag = 255; 2244 eLog() << Verbose(0) << "Not enough or invalid arguments given for convex envelope: -o <convex output file> <non-convex output file>" << endl;2355 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for convex envelope: -o <convex output file> <non-convex output file>" << endl); 2245 2356 performCriticalExit(); 2246 2357 } else { 2247 2358 class Tesselation *TesselStruct = NULL; 2248 2359 const LinkedCell *LCList = NULL; 2249 Log() << Verbose(0) << "Evaluating volume of the convex envelope.";2250 Log() << Verbose(1) << "Storing tecplot convex data in " << argv[argptr] << "." << endl;2251 Log() << Verbose(1) << "Storing tecplot non-convex data in " << argv[argptr+1] << "." << endl;2360 DoLog(0) && (Log() << Verbose(0) << "Evaluating volume of the convex envelope."); 2361 DoLog(1) && (Log() << Verbose(1) << "Storing tecplot convex data in " << argv[argptr] << "." << endl); 2362 DoLog(1) && (Log() << Verbose(1) << "Storing tecplot non-convex data in " << argv[argptr+1] << "." << endl); 2252 2363 LCList = new LinkedCell(mol, 10.); 2253 2364 //FindConvexBorder(mol, LCList, argv[argptr]); … … 2256 2367 double volumedifference = ConvexizeNonconvexEnvelope(TesselStruct, mol, argv[argptr]); 2257 2368 double clustervolume = VolumeOfConvexEnvelope(TesselStruct, &configuration); 2258 Log() << Verbose(0) << "The tesselated volume area is " << clustervolume << " " << (configuration.GetIsAngstroem() ? "angstrom" : "atomiclength") << "^3." << endl;2259 Log() << Verbose(0) << "The non-convex tesselated volume area is " << clustervolume-volumedifference << " " << (configuration.GetIsAngstroem() ? "angstrom" : "atomiclength") << "^3." << endl;2369 DoLog(0) && (Log() << Verbose(0) << "The tesselated volume area is " << clustervolume << " " << (configuration.GetIsAngstroem() ? "angstrom" : "atomiclength") << "^3." << endl); 2370 DoLog(0) && (Log() << Verbose(0) << "The non-convex tesselated volume area is " << clustervolume-volumedifference << " " << (configuration.GetIsAngstroem() ? "angstrom" : "atomiclength") << "^3." << endl); 2260 2371 delete(TesselStruct); 2261 2372 delete(LCList); … … 2267 2378 if ((argptr+1 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) ) { 2268 2379 ExitFlag = 255; 2269 eLog() << Verbose(0) << "Not enough or invalid arguments given for suspension with specified volume: -U <volume> <density>" << endl;2380 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for suspension with specified volume: -U <volume> <density>" << endl); 2270 2381 performCriticalExit(); 2271 2382 } else { 2272 2383 volume = atof(argv[argptr++]); 2273 Log() << Verbose(0) << "Using " << volume << " angstrom^3 as the volume instead of convex envelope one's." << endl;2384 DoLog(0) && (Log() << Verbose(0) << "Using " << volume << " angstrom^3 as the volume instead of convex envelope one's." << endl); 2274 2385 } 2275 2386 case 'u': … … 2278 2389 if (volume != -1) 2279 2390 ExitFlag = 255; 2280 eLog() << Verbose(0) << "Not enough or invalid arguments given for suspension: -u <density>" << endl;2391 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for suspension: -u <density>" << endl); 2281 2392 performCriticalExit(); 2282 2393 } else { 2283 2394 double density; 2284 2395 SaveFlag = true; 2285 Log() << Verbose(0) << "Evaluating necessary cell volume for a cluster suspended in water.";2396 DoLog(0) && (Log() << Verbose(0) << "Evaluating necessary cell volume for a cluster suspended in water."); 2286 2397 density = atof(argv[argptr++]); 2287 2398 if (density < 1.0) { 2288 eLog() << Verbose(1) << "Density must be greater than 1.0g/cm^3 !" << endl;2399 DoeLog(1) && (eLog()<< Verbose(1) << "Density must be greater than 1.0g/cm^3 !" << endl); 2289 2400 density = 1.3; 2290 2401 } … … 2292 2403 // repetition[i] = atoi(argv[argptr++]); 2293 2404 // if (repetition[i] < 1) 2294 // eLog() << Verbose(1) << "repetition value must be greater 1!" << endl;2405 // DoeLog(1) && (eLog()<< Verbose(1) << "repetition value must be greater 1!" << endl); 2295 2406 // repetition[i] = 1; 2296 2407 // } … … 2302 2413 if ((argptr+2 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) { 2303 2414 ExitFlag = 255; 2304 eLog() << Verbose(0) << "Not enough or invalid arguments given for repeating cells: -d <repeat_x> <repeat_y> <repeat_z>" << endl;2415 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for repeating cells: -d <repeat_x> <repeat_y> <repeat_z>" << endl); 2305 2416 performCriticalExit(); 2306 2417 } else { … … 2313 2424 Vector ** vectors; 2314 2425 if (faktor < 1) { 2315 eLog() << Verbose(1) << "Repetition factor mus be greater than 1!" << endl;2426 DoeLog(1) && (eLog()<< Verbose(1) << "Repetition factor mus be greater than 1!" << endl); 2316 2427 faktor = 1; 2317 2428 } … … 2330 2441 } 2331 2442 if (count != j) 2332 eLog() << Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl;2443 DoeLog(1) && (eLog()<< Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl); 2333 2444 x.Zero(); 2334 2445 y.Zero(); … … 2371 2482 } else { // no arguments, hence scan the elements db 2372 2483 if (periode->LoadPeriodentafel(configuration.databasepath)) 2373 Log() << Verbose(0) << "Element list loaded successfully." << endl;2484 DoLog(0) && (Log() << Verbose(0) << "Element list loaded successfully." << endl); 2374 2485 else 2375 Log() << Verbose(0) << "Element list loading failed." << endl;2486 DoLog(0) && (Log() << Verbose(0) << "Element list loading failed." << endl); 2376 2487 configuration.RetrieveConfigPathAndName("main_pcp_linux"); 2377 2488 } … … 2396 2507 2397 2508 cout << ESPACKVersion << endl; 2509 2510 DoLog(1) && (Log() << Verbose(1) << "test" << endl); 2511 DoLog(3) && (Log() << Verbose(1) << "test"); 2398 2512 2399 2513 setVerbosity(0); … … 2425 2539 double * const cell_size = World::get()->cell_size; 2426 2540 if (cell_size[0] == 0.) { 2427 Log() << Verbose(0) << "enter lower tridiagonal form of basis matrix" << endl << endl;2541 DoLog(0) && (Log() << Verbose(0) << "enter lower tridiagonal form of basis matrix" << endl << endl); 2428 2542 for (int i=0;i<6;i++) { 2429 Log() << Verbose(1) << "Cell size" << i << ": ";2543 DoLog(1) && (Log() << Verbose(1) << "Cell size" << i << ": "); 2430 2544 cin >> cell_size[i]; 2431 2545 } … … 2438 2552 2439 2553 // now the main construction loop 2440 Log() << Verbose(0) << endl << "Now comes the real construction..." << endl;2554 DoLog(0) && (Log() << Verbose(0) << endl << "Now comes the real construction..." << endl); 2441 2555 do { 2442 Log() << Verbose(0) << endl << endl;2443 Log() << Verbose(0) << "============Molecule list=======================" << endl;2556 DoLog(0) && (Log() << Verbose(0) << endl << endl); 2557 DoLog(0) && (Log() << Verbose(0) << "============Molecule list=======================" << endl); 2444 2558 molecules->Enumerate((ofstream *)&cout); 2445 Log() << Verbose(0) << "============Menu===============================" << endl;2446 Log() << Verbose(0) << "a - set molecule (in)active" << endl;2447 Log() << Verbose(0) << "e - edit molecules (load, parse, save)" << endl;2448 Log() << Verbose(0) << "g - globally manipulate atoms in molecule" << endl;2449 Log() << Verbose(0) << "M - Merge molecules" << endl;2450 Log() << Verbose(0) << "m - manipulate atoms" << endl;2451 Log() << Verbose(0) << "-----------------------------------------------" << endl;2452 Log() << Verbose(0) << "c - edit the current configuration" << endl;2453 Log() << Verbose(0) << "-----------------------------------------------" << endl;2454 Log() << Verbose(0) << "s - save current setup to config file" << endl;2455 Log() << Verbose(0) << "T - call the current test routine" << endl;2456 Log() << Verbose(0) << "q - quit" << endl;2457 Log() << Verbose(0) << "===============================================" << endl;2458 Log() << Verbose(0) << "Input: ";2559 DoLog(0) && (Log() << Verbose(0) << "============Menu===============================" << endl); 2560 DoLog(0) && (Log() << Verbose(0) << "a - set molecule (in)active" << endl); 2561 DoLog(0) && (Log() << Verbose(0) << "e - edit molecules (load, parse, save)" << endl); 2562 DoLog(0) && (Log() << Verbose(0) << "g - globally manipulate atoms in molecule" << endl); 2563 DoLog(0) && (Log() << Verbose(0) << "M - Merge molecules" << endl); 2564 DoLog(0) && (Log() << Verbose(0) << "m - manipulate atoms" << endl); 2565 DoLog(0) && (Log() << Verbose(0) << "-----------------------------------------------" << endl); 2566 DoLog(0) && (Log() << Verbose(0) << "c - edit the current configuration" << endl); 2567 DoLog(0) && (Log() << Verbose(0) << "-----------------------------------------------" << endl); 2568 DoLog(0) && (Log() << Verbose(0) << "s - save current setup to config file" << endl); 2569 DoLog(0) && (Log() << Verbose(0) << "T - call the current test routine" << endl); 2570 DoLog(0) && (Log() << Verbose(0) << "q - quit" << endl); 2571 DoLog(0) && (Log() << Verbose(0) << "===============================================" << endl); 2572 DoLog(0) && (Log() << Verbose(0) << "Input: "); 2459 2573 cin >> choice; 2460 2574 … … 2462 2576 case 'a': // (in)activate molecule 2463 2577 { 2464 Log() << Verbose(0) << "Enter index of molecule: ";2578 DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule: "); 2465 2579 cin >> j; 2466 2580 for(MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) … … 2508 2622 // save element data base 2509 2623 if (periode->StorePeriodentafel(configuration->databasepath)) //ElementsFileName 2510 Log() << Verbose(0) << "Saving of elements.db successful." << endl;2624 DoLog(0) && (Log() << Verbose(0) << "Saving of elements.db successful." << endl); 2511 2625 else 2512 Log() << Verbose(0) << "Saving of elements.db failed." << endl;2626 DoLog(0) && (Log() << Verbose(0) << "Saving of elements.db failed." << endl); 2513 2627 2514 2628 delete(molecules); // also free's all molecules contained
Note:
See TracChangeset
for help on using the changeset viewer.