Changes in src/builder.cpp [a67d19:4fc93f]
- File:
-
- 1 edited
-
src/builder.cpp (modified) (134 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/builder.cpp
ra67d19 r4fc93f 50 50 using namespace std; 51 51 52 #include <cstring>53 54 #include "analysis_bonds.hpp"55 52 #include "analysis_correlation.hpp" 56 53 #include "atom.hpp" … … 68 65 #include "molecule.hpp" 69 66 #include "periodentafel.hpp" 70 #include "version.h"71 #include "World.hpp"72 67 73 68 /********************************************* Subsubmenu routine ************************************/ … … 86 81 bool valid; 87 82 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: ";83 Log() << Verbose(0) << "===========ADD ATOM============================" << endl; 84 Log() << Verbose(0) << " a - state absolute coordinates of atom" << endl; 85 Log() << Verbose(0) << " b - state relative coordinates of atom wrt to reference point" << endl; 86 Log() << Verbose(0) << " c - state relative coordinates of atom wrt to already placed atom" << endl; 87 Log() << Verbose(0) << " d - state two atoms, two angles and a distance" << endl; 88 Log() << Verbose(0) << " e - least square distance position to a set of atoms" << endl; 89 Log() << Verbose(0) << "all else - go back" << endl; 90 Log() << Verbose(0) << "===============================================" << endl; 91 Log() << Verbose(0) << "Note: Specifiy angles in degrees not multiples of Pi!" << endl; 92 Log() << Verbose(0) << "INPUT: "; 98 93 cin >> choice; 99 94 100 95 switch (choice) { 101 96 default: 102 DoeLog(2) && (eLog()<< Verbose(2) << "Not a valid choice." << endl);97 eLog() << Verbose(2) << "Not a valid choice." << endl; 103 98 break; 104 99 case 'a': // absolute coordinates of atom 105 cout<< Verbose(0) << "Enter absolute coordinates." << endl;100 Log() << Verbose(0) << "Enter absolute coordinates." << endl; 106 101 first = new atom; 107 first->x.AskPosition( World::get()->cell_size, false);102 first->x.AskPosition(mol->cell_size, false); 108 103 first->type = periode->AskElement(); // give type 109 104 mol->AddAtom(first); // add to molecule … … 114 109 valid = true; 115 110 do { 116 if (!valid) DoeLog(2) && (eLog()<< Verbose(2) << "Resulting position out of cell." << endl);117 cout<< Verbose(0) << "Enter reference coordinates." << endl;118 x.AskPosition( World::get()->cell_size, true);119 cout<< Verbose(0) << "Enter relative coordinates." << endl;120 first->x.AskPosition( World::get()->cell_size, false);111 if (!valid) eLog() << Verbose(2) << "Resulting position out of cell." << endl; 112 Log() << Verbose(0) << "Enter reference coordinates." << endl; 113 x.AskPosition(mol->cell_size, true); 114 Log() << Verbose(0) << "Enter relative coordinates." << endl; 115 first->x.AskPosition(mol->cell_size, false); 121 116 first->x.AddVector((const Vector *)&x); 122 cout<< Verbose(0) << "\n";117 Log() << Verbose(0) << "\n"; 123 118 } while (!(valid = mol->CheckBounds((const Vector *)&first->x))); 124 119 first->type = periode->AskElement(); // give type … … 130 125 valid = true; 131 126 do { 132 if (!valid) DoeLog(2) && (eLog()<< Verbose(2) << "Resulting position out of cell." << endl);127 if (!valid) eLog() << Verbose(2) << "Resulting position out of cell." << endl; 133 128 second = mol->AskAtom("Enter atom number: "); 134 DoLog(0) && (Log() << Verbose(0) << "Enter relative coordinates." << endl);135 first->x.AskPosition( World::get()->cell_size, false);129 Log() << Verbose(0) << "Enter relative coordinates." << endl; 130 first->x.AskPosition(mol->cell_size, false); 136 131 for (int i=NDIM;i--;) { 137 132 first->x.x[i] += second->x.x[i]; … … 147 142 do { 148 143 if (!valid) { 149 DoeLog(2) && (eLog()<< Verbose(2) << "Resulting coordinates out of cell - " << first->x << endl);144 eLog() << Verbose(2) << "Resulting coordinates out of cell - " << first->x << endl; 150 145 } 151 cout<< Verbose(0) << "First, we need two atoms, the first atom is the central, while the second is the outer one." << endl;146 Log() << Verbose(0) << "First, we need two atoms, the first atom is the central, while the second is the outer one." << endl; 152 147 second = mol->AskAtom("Enter central atom: "); 153 148 third = mol->AskAtom("Enter second atom (specifying the axis for first angle): "); … … 160 155 c *= M_PI/180.; 161 156 bound(&c, -M_PI, M_PI); 162 cout<< Verbose(0) << "radius: " << a << "\t phi: " << b*180./M_PI << "\t theta: " << c*180./M_PI << endl;157 Log() << Verbose(0) << "radius: " << a << "\t phi: " << b*180./M_PI << "\t theta: " << c*180./M_PI << endl; 163 158 /* 164 159 second->Output(1,1,(ofstream *)&cout); … … 172 167 173 168 if (!z.SolveSystem(&x,&y,&n, b, c, a)) { 174 coutg() << Verbose(0) << "Failure solving self-dependent linear system!" << endl;169 Log() << Verbose(0) << "Failure solving self-dependent linear system!" << endl; 175 170 continue; 176 171 } 177 DoLog(0) && (Log() << Verbose(0) << "resulting relative coordinates: ");172 Log() << Verbose(0) << "resulting relative coordinates: "; 178 173 z.Output(); 179 DoLog(0) && (Log() << Verbose(0) << endl);174 Log() << Verbose(0) << endl; 180 175 */ 181 176 // calc axis vector … … 185 180 Log() << Verbose(0) << "x: ", 186 181 x.Output(); 187 DoLog(0) && (Log() << Verbose(0) << endl);182 Log() << Verbose(0) << endl; 188 183 z.MakeNormalVector(&second->x,&third->x,&fourth->x); 189 184 Log() << Verbose(0) << "z: ", 190 185 z.Output(); 191 DoLog(0) && (Log() << Verbose(0) << endl);186 Log() << Verbose(0) << endl; 192 187 y.MakeNormalVector(&x,&z); 193 188 Log() << Verbose(0) << "y: ", 194 189 y.Output(); 195 DoLog(0) && (Log() << Verbose(0) << endl);190 Log() << Verbose(0) << endl; 196 191 197 192 // rotate vector around first angle … … 200 195 Log() << Verbose(0) << "Rotated vector: ", 201 196 first->x.Output(); 202 DoLog(0) && (Log() << Verbose(0) << endl);197 Log() << Verbose(0) << endl; 203 198 // remove the projection onto the rotation plane of the second angle 204 199 n.CopyVector(&y); … … 206 201 Log() << Verbose(0) << "N1: ", 207 202 n.Output(); 208 DoLog(0) && (Log() << Verbose(0) << endl);203 Log() << Verbose(0) << endl; 209 204 first->x.SubtractVector(&n); 210 205 Log() << Verbose(0) << "Subtracted vector: ", 211 206 first->x.Output(); 212 DoLog(0) && (Log() << Verbose(0) << endl);207 Log() << Verbose(0) << endl; 213 208 n.CopyVector(&z); 214 209 n.Scale(first->x.ScalarProduct(&z)); 215 210 Log() << Verbose(0) << "N2: ", 216 211 n.Output(); 217 DoLog(0) && (Log() << Verbose(0) << endl);212 Log() << Verbose(0) << endl; 218 213 first->x.SubtractVector(&n); 219 214 Log() << Verbose(0) << "2nd subtracted vector: ", 220 215 first->x.Output(); 221 DoLog(0) && (Log() << Verbose(0) << endl);216 Log() << Verbose(0) << endl; 222 217 223 218 // rotate another vector around second angle … … 226 221 Log() << Verbose(0) << "2nd Rotated vector: ", 227 222 n.Output(); 228 DoLog(0) && (Log() << Verbose(0) << endl);223 Log() << Verbose(0) << endl; 229 224 230 225 // add the two linear independent vectors … … 234 229 first->x.AddVector(&second->x); 235 230 236 DoLog(0) && (Log() << Verbose(0) << "resulting coordinates: ");231 Log() << Verbose(0) << "resulting coordinates: "; 237 232 first->x.Output(); 238 DoLog(0) && (Log() << Verbose(0) << endl);233 Log() << Verbose(0) << endl; 239 234 } while (!(valid = mol->CheckBounds((const Vector *)&first->x))); 240 235 first->type = periode->AskElement(); // give type … … 249 244 atoms[i] = NULL; 250 245 int i=0, j=0; 251 cout<< Verbose(0) << "Now we need at least three molecules.\n";246 Log() << Verbose(0) << "Now we need at least three molecules.\n"; 252 247 do { 253 cout<< Verbose(0) << "Enter " << i+1 << "th atom: ";248 Log() << Verbose(0) << "Enter " << i+1 << "th atom: "; 254 249 cin >> j; 255 250 if (j != -1) { … … 266 261 } else { 267 262 delete first; 268 cout<< Verbose(0) << "Please enter at least two vectors!\n";263 Log() << Verbose(0) << "Please enter at least two vectors!\n"; 269 264 } 270 265 break; … … 280 275 char choice; // menu choice char 281 276 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: ";277 Log() << Verbose(0) << "===========CENTER ATOMS=========================" << endl; 278 Log() << Verbose(0) << " a - on origin" << endl; 279 Log() << Verbose(0) << " b - on center of gravity" << endl; 280 Log() << Verbose(0) << " c - within box with additional boundary" << endl; 281 Log() << Verbose(0) << " d - within given simulation box" << endl; 282 Log() << Verbose(0) << "all else - go back" << endl; 283 Log() << Verbose(0) << "===============================================" << endl; 284 Log() << Verbose(0) << "INPUT: "; 290 285 cin >> choice; 291 286 292 287 switch (choice) { 293 288 default: 294 cout<< Verbose(0) << "Not a valid choice." << endl;289 Log() << Verbose(0) << "Not a valid choice." << endl; 295 290 break; 296 291 case 'a': 297 cout<< Verbose(0) << "Centering atoms in config file on origin." << endl;292 Log() << Verbose(0) << "Centering atoms in config file on origin." << endl; 298 293 mol->CenterOrigin(); 299 294 break; 300 295 case 'b': 301 cout<< Verbose(0) << "Centering atoms in config file on center of gravity." << endl;296 Log() << Verbose(0) << "Centering atoms in config file on center of gravity." << endl; 302 297 mol->CenterPeriodic(); 303 298 break; 304 299 case 'c': 305 cout<< Verbose(0) << "Centering atoms in config file within given additional boundary." << endl;300 Log() << Verbose(0) << "Centering atoms in config file within given additional boundary." << endl; 306 301 for (int i=0;i<NDIM;i++) { 307 cout<< Verbose(0) << "Enter axis " << i << " boundary: ";302 Log() << Verbose(0) << "Enter axis " << i << " boundary: "; 308 303 cin >> y.x[i]; 309 304 } … … 316 311 break; 317 312 case 'd': 318 cout<< Verbose(1) << "Centering atoms in config file within given simulation box." << endl;313 Log() << Verbose(1) << "Centering atoms in config file within given simulation box." << endl; 319 314 for (int i=0;i<NDIM;i++) { 320 cout<< Verbose(0) << "Enter axis " << i << " boundary: ";315 Log() << Verbose(0) << "Enter axis " << i << " boundary: "; 321 316 cin >> x.x[i]; 322 317 } … … 339 334 char choice; // menu choice char 340 335 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: ";336 Log() << Verbose(0) << "===========ALIGN ATOMS=========================" << endl; 337 Log() << Verbose(0) << " a - state three atoms defining align plane" << endl; 338 Log() << Verbose(0) << " b - state alignment vector" << endl; 339 Log() << Verbose(0) << " c - state two atoms in alignment direction" << endl; 340 Log() << Verbose(0) << " d - align automatically by least square fit" << endl; 341 Log() << Verbose(0) << "all else - go back" << endl; 342 Log() << Verbose(0) << "===============================================" << endl; 343 Log() << Verbose(0) << "INPUT: "; 349 344 cin >> choice; 350 345 … … 359 354 break; 360 355 case 'b': // normal vector of mirror plane 361 cout<< Verbose(0) << "Enter normal vector of mirror plane." << endl;362 n.AskPosition( World::get()->cell_size,0);356 Log() << Verbose(0) << "Enter normal vector of mirror plane." << endl; 357 n.AskPosition(mol->cell_size,0); 363 358 n.Normalize(); 364 359 break; … … 379 374 fscanf(stdin, "%3s", shorthand); 380 375 } while ((param.type = periode->FindElement(shorthand)) == NULL); 381 cout<< Verbose(0) << "Element is " << param.type->name << endl;376 Log() << Verbose(0) << "Element is " << param.type->name << endl; 382 377 mol->GetAlignvector(¶m); 383 378 for (int i=NDIM;i--;) { … … 386 381 } 387 382 gsl_vector_free(param.x); 388 cout<< Verbose(0) << "Offset vector: ";383 Log() << Verbose(0) << "Offset vector: "; 389 384 x.Output(); 390 DoLog(0) && (Log() << Verbose(0) << endl);385 Log() << Verbose(0) << endl; 391 386 n.Normalize(); 392 387 break; 393 388 }; 394 DoLog(0) && (Log() << Verbose(0) << "Alignment vector: ");389 Log() << Verbose(0) << "Alignment vector: "; 395 390 n.Output(); 396 DoLog(0) && (Log() << Verbose(0) << endl);391 Log() << Verbose(0) << endl; 397 392 mol->Align(&n); 398 393 }; … … 407 402 char choice; // menu choice char 408 403 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: ");404 Log() << Verbose(0) << "===========MIRROR ATOMS=========================" << endl; 405 Log() << Verbose(0) << " a - state three atoms defining mirror plane" << endl; 406 Log() << Verbose(0) << " b - state normal vector of mirror plane" << endl; 407 Log() << Verbose(0) << " c - state two atoms in normal direction" << endl; 408 Log() << Verbose(0) << "all else - go back" << endl; 409 Log() << Verbose(0) << "===============================================" << endl; 410 Log() << Verbose(0) << "INPUT: "; 416 411 cin >> choice; 417 412 … … 426 421 break; 427 422 case 'b': // normal vector of mirror plane 428 DoLog(0) && (Log() << Verbose(0) << "Enter normal vector of mirror plane." << endl);429 n.AskPosition( World::get()->cell_size,0);423 Log() << Verbose(0) << "Enter normal vector of mirror plane." << endl; 424 n.AskPosition(mol->cell_size,0); 430 425 n.Normalize(); 431 426 break; … … 439 434 break; 440 435 }; 441 DoLog(0) && (Log() << Verbose(0) << "Normal vector: ");436 Log() << Verbose(0) << "Normal vector: "; 442 437 n.Output(); 443 DoLog(0) && (Log() << Verbose(0) << endl);438 Log() << Verbose(0) << endl; 444 439 mol->Mirror((const Vector *)&n); 445 440 }; … … 455 450 char choice; // menu choice char 456 451 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: ");452 Log() << Verbose(0) << "===========REMOVE ATOMS=========================" << endl; 453 Log() << Verbose(0) << " a - state atom for removal by number" << endl; 454 Log() << Verbose(0) << " b - keep only in radius around atom" << endl; 455 Log() << Verbose(0) << " c - remove this with one axis greater value" << endl; 456 Log() << Verbose(0) << "all else - go back" << endl; 457 Log() << Verbose(0) << "===============================================" << endl; 458 Log() << Verbose(0) << "INPUT: "; 464 459 cin >> choice; 465 460 … … 468 463 case 'a': 469 464 if (mol->RemoveAtom(mol->AskAtom("Enter number of atom within molecule: "))) 470 DoLog(1) && (Log() << Verbose(1) << "Atom removed." << endl);465 Log() << Verbose(1) << "Atom removed." << endl; 471 466 else 472 DoLog(1) && (Log() << Verbose(1) << "Atom not found." << endl);467 Log() << Verbose(1) << "Atom not found." << endl; 473 468 break; 474 469 case 'b': 475 470 second = mol->AskAtom("Enter number of atom as reference point: "); 476 DoLog(0) && (Log() << Verbose(0) << "Enter radius: ");471 Log() << Verbose(0) << "Enter radius: "; 477 472 cin >> tmp1; 478 473 first = mol->start; … … 486 481 break; 487 482 case 'c': 488 DoLog(0) && (Log() << Verbose(0) << "Which axis is it: ");483 Log() << Verbose(0) << "Which axis is it: "; 489 484 cin >> axis; 490 DoLog(0) && (Log() << Verbose(0) << "Lower boundary: ");485 Log() << Verbose(0) << "Lower boundary: "; 491 486 cin >> tmp1; 492 DoLog(0) && (Log() << Verbose(0) << "Upper boundary: ");487 Log() << Verbose(0) << "Upper boundary: "; 493 488 cin >> tmp2; 494 489 first = mol->start; … … 520 515 char choice; // menu choice char 521 516 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: ");517 Log() << Verbose(0) << "===========MEASURE ATOMS=========================" << endl; 518 Log() << Verbose(0) << " a - calculate bond length between one atom and all others" << endl; 519 Log() << Verbose(0) << " b - calculate bond length between two atoms" << endl; 520 Log() << Verbose(0) << " c - calculate bond angle" << endl; 521 Log() << Verbose(0) << " d - calculate principal axis of the system" << endl; 522 Log() << Verbose(0) << " e - calculate volume of the convex envelope" << endl; 523 Log() << Verbose(0) << " f - calculate temperature from current velocity" << endl; 524 Log() << Verbose(0) << " g - output all temperatures per step from velocities" << endl; 525 Log() << Verbose(0) << "all else - go back" << endl; 526 Log() << Verbose(0) << "===============================================" << endl; 527 Log() << Verbose(0) << "INPUT: "; 533 528 cin >> choice; 534 529 535 530 switch(choice) { 536 531 default: 537 DoLog(1) && (Log() << Verbose(1) << "Not a valid choice." << endl);532 Log() << Verbose(1) << "Not a valid choice." << endl; 538 533 break; 539 534 case 'a': … … 567 562 x.SubtractVector((const Vector *)&second->x); 568 563 tmp1 = x.Norm(); 569 DoLog(1) && (Log() << Verbose(1) << "Distance vector is ");564 Log() << Verbose(1) << "Distance vector is "; 570 565 x.Output(); 571 DoLog(0) && (Log() << Verbose(0) << "." << endl << "Norm of distance is " << tmp1 << "." << endl);566 Log() << Verbose(0) << "." << endl << "Norm of distance is " << tmp1 << "." << endl; 572 567 break; 573 568 574 569 case 'c': 575 DoLog(0) && (Log() << Verbose(0) << "Evaluating bond angle between three - first, central, last - atoms." << endl);570 Log() << Verbose(0) << "Evaluating bond angle between three - first, central, last - atoms." << endl; 576 571 first = mol->AskAtom("Enter first atom: "); 577 572 second = mol->AskAtom("Enter central atom: "); … … 582 577 y.CopyVector((const Vector *)&third->x); 583 578 y.SubtractVector((const Vector *)&second->x); 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);579 Log() << Verbose(0) << "Bond angle between first atom Nr." << first->nr << ", central atom Nr." << second->nr << " and last atom Nr." << third->nr << ": "; 580 Log() << Verbose(0) << (acos(x.ScalarProduct((const Vector *)&y)/(y.Norm()*x.Norm()))/M_PI*180.) << " degrees" << endl; 586 581 break; 587 582 case 'd': 588 DoLog(0) && (Log() << Verbose(0) << "Evaluating prinicipal axis." << endl);589 DoLog(0) && (Log() << Verbose(0) << "Shall we rotate? [0/1]: ");583 Log() << Verbose(0) << "Evaluating prinicipal axis." << endl; 584 Log() << Verbose(0) << "Shall we rotate? [0/1]: "; 590 585 cin >> Z; 591 586 if ((Z >=0) && (Z <=1)) … … 596 591 case 'e': 597 592 { 598 DoLog(0) && (Log() << Verbose(0) << "Evaluating volume of the convex envelope.");593 Log() << Verbose(0) << "Evaluating volume of the convex envelope."; 599 594 class Tesselation *TesselStruct = NULL; 600 595 const LinkedCell *LCList = NULL; … … 602 597 FindConvexBorder(mol, TesselStruct, LCList, NULL); 603 598 double clustervolume = VolumeOfConvexEnvelope(TesselStruct, configuration); 604 DoLog(0) && (Log() << Verbose(0) << "The tesselated surface area is " << clustervolume << "." << endl);\599 Log() << Verbose(0) << "The tesselated surface area is " << clustervolume << "." << endl;\ 605 600 delete(LCList); 606 601 delete(TesselStruct); … … 613 608 { 614 609 char filename[255]; 615 DoLog(0) && (Log() << Verbose(0) << "Please enter filename: " << endl);610 Log() << Verbose(0) << "Please enter filename: " << endl; 616 611 cin >> filename; 617 DoLog(1) && (Log() << Verbose(1) << "Storing temperatures in " << filename << "." << endl);612 Log() << Verbose(1) << "Storing temperatures in " << filename << "." << endl; 618 613 ofstream *output = new ofstream(filename, ios::trunc); 619 614 if (!mol->OutputTemperatureFromTrajectories(output, 0, mol->MDSteps)) 620 DoLog(2) && (Log() << Verbose(2) << "File could not be written." << endl);615 Log() << Verbose(2) << "File could not be written." << endl; 621 616 else 622 DoLog(2) && (Log() << Verbose(2) << "File stored." << endl);617 Log() << Verbose(2) << "File stored." << endl; 623 618 output->close(); 624 619 delete(output); … … 637 632 clock_t start, end; 638 633 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: ");634 Log() << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl; 635 Log() << Verbose(0) << "What's the desired bond order: "; 641 636 cin >> Order1; 642 637 if (mol->first->next != mol->last) { // there are bonds … … 644 639 mol->FragmentMolecule(Order1, configuration); 645 640 end = clock(); 646 DoLog(0) && (Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl);641 Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl; 647 642 } else 648 DoLog(0) && (Log() << Verbose(0) << "Connection matrix has not yet been generated!" << endl);643 Log() << Verbose(0) << "Connection matrix has not yet been generated!" << endl; 649 644 }; 650 645 … … 657 652 static void ManipulateAtoms(periodentafel *periode, MoleculeListClass *molecules, config *configuration) 658 653 { 659 atom *first, *second , *third;654 atom *first, *second; 660 655 molecule *mol = NULL; 661 656 Vector x,y,z,n; // coordinates for absolute point in cell volume … … 665 660 bool valid; 666 661 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); 662 Log() << Verbose(0) << "=========MANIPULATE ATOMS======================" << endl; 663 Log() << Verbose(0) << "a - add an atom" << endl; 664 Log() << Verbose(0) << "r - remove an atom" << endl; 665 Log() << Verbose(0) << "b - scale a bond between atoms" << endl; 666 Log() << Verbose(0) << "u - change an atoms element" << endl; 667 Log() << Verbose(0) << "l - measure lengths, angles, ... for an atom" << endl; 668 Log() << Verbose(0) << "all else - go back" << endl; 669 Log() << Verbose(0) << "===============================================" << endl; 676 670 if (molecules->NumberOfActiveMolecules() > 1) 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: ");671 eLog() << Verbose(2) << "There is more than one molecule active! Atoms will be added to each." << endl; 672 Log() << Verbose(0) << "INPUT: "; 679 673 cin >> choice; 680 674 681 675 switch (choice) { 682 676 default: 683 DoLog(0) && (Log() << Verbose(0) << "Not a valid choice." << endl);677 Log() << Verbose(0) << "Not a valid choice." << endl; 684 678 break; 685 679 … … 688 682 if ((*ListRunner)->ActiveFlag) { 689 683 mol = *ListRunner; 690 DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl);684 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl; 691 685 AddAtoms(periode, mol); 692 686 } … … 697 691 if ((*ListRunner)->ActiveFlag) { 698 692 mol = *ListRunner; 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);693 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl; 694 Log() << Verbose(0) << "Scaling bond length between two atoms." << endl; 701 695 first = mol->AskAtom("Enter first (fixed) atom: "); 702 696 second = mol->AskAtom("Enter second (shifting) atom: "); … … 705 699 minBond += (first->x.x[i]-second->x.x[i])*(first->x.x[i] - second->x.x[i]); 706 700 minBond = sqrt(minBond); 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.]: ");701 Log() << Verbose(0) << "Current Bond length between " << first->type->name << " Atom " << first->nr << " and " << second->type->name << " Atom " << second->nr << ": " << minBond << " a.u." << endl; 702 Log() << Verbose(0) << "Enter new bond length [a.u.]: "; 709 703 cin >> bond; 710 704 for (int i=NDIM;i--;) { … … 720 714 if ((*ListRunner)->ActiveFlag) { 721 715 mol = *ListRunner; 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: ");716 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl; 717 Log() << Verbose(0) << "Angstroem -> Bohrradius: 1.8897261\t\tBohrradius -> Angstroem: 0.52917721" << endl; 718 Log() << Verbose(0) << "Enter three factors: "; 725 719 factor = new double[NDIM]; 726 720 cin >> factor[0]; … … 737 731 if ((*ListRunner)->ActiveFlag) { 738 732 mol = *ListRunner; 739 DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl);733 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl; 740 734 MeasureAtoms(periode, mol, configuration); 741 735 } … … 746 740 if ((*ListRunner)->ActiveFlag) { 747 741 mol = *ListRunner; 748 DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl);742 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl; 749 743 RemoveAtoms(mol); 750 744 } 751 break;752 753 case 't': // turn/rotate atom754 for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)755 if ((*ListRunner)->ActiveFlag) {756 mol = *ListRunner;757 DoLog(0) && (Log() << Verbose(0) << "Turning atom around another bond - first is atom to turn, second (central) and third specify bond" << endl);758 first = mol->AskAtom("Enter turning atom: ");759 second = mol->AskAtom("Enter central atom: ");760 third = mol->AskAtom("Enter bond atom: ");761 cout << Verbose(0) << "Enter new angle in degrees: ";762 double tmp = 0.;763 cin >> tmp;764 // calculate old angle765 x.CopyVector((const Vector *)&first->x);766 x.SubtractVector((const Vector *)&second->x);767 y.CopyVector((const Vector *)&third->x);768 y.SubtractVector((const Vector *)&second->x);769 double alpha = (acos(x.ScalarProduct((const Vector *)&y)/(y.Norm()*x.Norm()))/M_PI*180.);770 cout << Verbose(0) << "Bond angle between first atom Nr." << first->nr << ", central atom Nr." << second->nr << " and last atom Nr." << third->nr << ": ";771 cout << Verbose(0) << alpha << " degrees" << endl;772 // rotate773 z.MakeNormalVector(&x,&y);774 x.RotateVector(&z,(alpha-tmp)*M_PI/180.);775 x.AddVector(&second->x);776 first->x.CopyVector(&x);777 // check new angle778 x.CopyVector((const Vector *)&first->x);779 x.SubtractVector((const Vector *)&second->x);780 alpha = (acos(x.ScalarProduct((const Vector *)&y)/(y.Norm()*x.Norm()))/M_PI*180.);781 cout << Verbose(0) << "new Bond angle between first atom Nr." << first->nr << ", central atom Nr." << second->nr << " and last atom Nr." << third->nr << ": ";782 cout << Verbose(0) << alpha << " degrees" << endl;783 }784 745 break; 785 746 … … 789 750 int Z; 790 751 mol = *ListRunner; 791 DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl);752 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl; 792 753 first = NULL; 793 754 do { 794 DoLog(0) && (Log() << Verbose(0) << "Change the element of which atom: ");755 Log() << Verbose(0) << "Change the element of which atom: "; 795 756 cin >> Z; 796 757 } while ((first = mol->FindAtom(Z)) == NULL); 797 DoLog(0) && (Log() << Verbose(0) << "New element by atomic number Z: ");758 Log() << Verbose(0) << "New element by atomic number Z: "; 798 759 cin >> Z; 799 760 first->type = periode->FindElement(Z); 800 DoLog(0) && (Log() << Verbose(0) << "Atom " << first->nr << "'s element is " << first->type->name << "." << endl);761 Log() << Verbose(0) << "Atom " << first->nr << "'s element is " << first->type->name << "." << endl; 801 762 } 802 763 break; … … 819 780 MoleculeLeafClass *Subgraphs = NULL; 820 781 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);782 Log() << Verbose(0) << "=========MANIPULATE GLOBALLY===================" << endl; 783 Log() << Verbose(0) << "c - scale by unit transformation" << endl; 784 Log() << Verbose(0) << "d - duplicate molecule/periodic cell" << endl; 785 Log() << Verbose(0) << "f - fragment molecule many-body bond order style" << endl; 786 Log() << Verbose(0) << "g - center atoms in box" << endl; 787 Log() << Verbose(0) << "i - realign molecule" << endl; 788 Log() << Verbose(0) << "m - mirror all molecules" << endl; 789 Log() << Verbose(0) << "o - create connection matrix" << endl; 790 Log() << Verbose(0) << "t - translate molecule by vector" << endl; 791 Log() << Verbose(0) << "all else - go back" << endl; 792 Log() << Verbose(0) << "===============================================" << endl; 832 793 if (molecules->NumberOfActiveMolecules() > 1) 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: ");794 eLog() << Verbose(2) << "There is more than one molecule active! Atoms will be added to each." << endl; 795 Log() << Verbose(0) << "INPUT: "; 835 796 cin >> choice; 836 797 837 798 switch (choice) { 838 799 default: 839 DoLog(0) && (Log() << Verbose(0) << "Not a valid choice." << endl);800 Log() << Verbose(0) << "Not a valid choice." << endl; 840 801 break; 841 802 … … 844 805 if ((*ListRunner)->ActiveFlag) { 845 806 mol = *ListRunner; 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]: ");807 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl; 808 Log() << Verbose(0) << "State the axis [(+-)123]: "; 848 809 cin >> axis; 849 DoLog(0) && (Log() << Verbose(0) << "State the factor: ");810 Log() << Verbose(0) << "State the factor: "; 850 811 cin >> faktor; 851 812 … … 864 825 } 865 826 if (count != j) 866 DoeLog(1) && (eLog()<< Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl);827 eLog() << Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl; 867 828 x.Zero(); 868 829 y.Zero(); 869 y.x[abs(axis)-1] = World::get()->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] * abs(axis)/axis; // last term is for sign, first is for magnitude830 y.x[abs(axis)-1] = mol->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] * abs(axis)/axis; // last term is for sign, first is for magnitude 870 831 for (int i=1;i<faktor;i++) { // then add this list with respective translation factor times 871 832 x.AddVector(&y); // per factor one cell width further … … 890 851 mol->Translate(&x); 891 852 } 892 World::get()->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor;853 mol->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor; 893 854 } 894 855 } … … 903 864 if ((*ListRunner)->ActiveFlag) { 904 865 mol = *ListRunner; 905 DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl);866 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl; 906 867 CenterAtoms(mol); 907 868 } … … 912 873 if ((*ListRunner)->ActiveFlag) { 913 874 mol = *ListRunner; 914 DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl);875 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl; 915 876 AlignAtoms(periode, mol); 916 877 } … … 921 882 if ((*ListRunner)->ActiveFlag) { 922 883 mol = *ListRunner; 923 DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl);884 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl; 924 885 MirrorAtoms(mol); 925 886 } … … 932 893 double bonddistance; 933 894 clock_t start,end; 934 DoLog(0) && (Log() << Verbose(0) << "What's the maximum bond distance: ");895 Log() << Verbose(0) << "What's the maximum bond distance: "; 935 896 cin >> bonddistance; 936 897 start = clock(); 937 898 mol->CreateAdjacencyList(bonddistance, configuration->GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL); 938 899 end = clock(); 939 DoLog(0) && (Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl);900 Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl; 940 901 } 941 902 break; … … 945 906 if ((*ListRunner)->ActiveFlag) { 946 907 mol = *ListRunner; 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);949 x.AskPosition( World::get()->cell_size,0);908 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl; 909 Log() << Verbose(0) << "Enter translation vector." << endl; 910 x.AskPosition(mol->cell_size,0); 950 911 mol->Center.AddVector((const Vector *)&x); 951 912 } … … 974 935 molecule *mol = NULL; 975 936 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: ");937 Log() << Verbose(0) << "==========EDIT MOLECULES=====================" << endl; 938 Log() << Verbose(0) << "c - create new molecule" << endl; 939 Log() << Verbose(0) << "l - load molecule from xyz file" << endl; 940 Log() << Verbose(0) << "n - change molecule's name" << endl; 941 Log() << Verbose(0) << "N - give molecules filename" << endl; 942 Log() << Verbose(0) << "p - parse atoms in xyz file into molecule" << endl; 943 Log() << Verbose(0) << "r - remove a molecule" << endl; 944 Log() << Verbose(0) << "all else - go back" << endl; 945 Log() << Verbose(0) << "===============================================" << endl; 946 Log() << Verbose(0) << "INPUT: "; 986 947 cin >> choice; 987 948 988 949 switch (choice) { 989 950 default: 990 DoLog(0) && (Log() << Verbose(0) << "Not a valid choice." << endl);951 Log() << Verbose(0) << "Not a valid choice." << endl; 991 952 break; 992 953 case 'c': … … 998 959 { 999 960 char filename[MAXSTRINGSIZE]; 1000 DoLog(0) && (Log() << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl);961 Log() << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl; 1001 962 mol = new molecule(periode); 1002 963 do { 1003 DoLog(0) && (Log() << Verbose(0) << "Enter file name: ");964 Log() << Verbose(0) << "Enter file name: "; 1004 965 cin >> filename; 1005 966 } while (!mol->AddXYZFile(filename)); … … 1007 968 // center at set box dimensions 1008 969 mol->CenterEdge(¢er); 1009 double * const cell_size = World::get()->cell_size; 1010 cell_size[0] = center.x[0]; 1011 cell_size[1] = 0; 1012 cell_size[2] = center.x[1]; 1013 cell_size[3] = 0; 1014 cell_size[4] = 0; 1015 cell_size[5] = center.x[2]; 970 mol->cell_size[0] = center.x[0]; 971 mol->cell_size[1] = 0; 972 mol->cell_size[2] = center.x[1]; 973 mol->cell_size[3] = 0; 974 mol->cell_size[4] = 0; 975 mol->cell_size[5] = center.x[2]; 1016 976 molecules->insert(mol); 1017 977 } … … 1022 982 char filename[MAXSTRINGSIZE]; 1023 983 do { 1024 DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule: ");984 Log() << Verbose(0) << "Enter index of molecule: "; 1025 985 cin >> nr; 1026 986 mol = molecules->ReturnIndex(nr); 1027 987 } while (mol == NULL); 1028 DoLog(0) && (Log() << Verbose(0) << "Enter name: ");988 Log() << Verbose(0) << "Enter name: "; 1029 989 cin >> filename; 1030 990 strcpy(mol->name, filename); … … 1036 996 char filename[MAXSTRINGSIZE]; 1037 997 do { 1038 DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule: ");998 Log() << Verbose(0) << "Enter index of molecule: "; 1039 999 cin >> nr; 1040 1000 mol = molecules->ReturnIndex(nr); 1041 1001 } while (mol == NULL); 1042 DoLog(0) && (Log() << Verbose(0) << "Enter name: ");1002 Log() << Verbose(0) << "Enter name: "; 1043 1003 cin >> filename; 1044 1004 mol->SetNameFromFilename(filename); … … 1051 1011 mol = NULL; 1052 1012 do { 1053 DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule: ");1013 Log() << Verbose(0) << "Enter index of molecule: "; 1054 1014 cin >> nr; 1055 1015 mol = molecules->ReturnIndex(nr); 1056 1016 } while (mol == NULL); 1057 DoLog(0) && (Log() << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl);1017 Log() << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl; 1058 1018 do { 1059 DoLog(0) && (Log() << Verbose(0) << "Enter file name: ");1019 Log() << Verbose(0) << "Enter file name: "; 1060 1020 cin >> filename; 1061 1021 } while (!mol->AddXYZFile(filename)); … … 1065 1025 1066 1026 case 'r': 1067 DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule: ");1027 Log() << Verbose(0) << "Enter index of molecule: "; 1068 1028 cin >> nr; 1069 1029 count = 1; … … 1088 1048 char choice; // menu choice char 1089 1049 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: "); 1050 Log() << Verbose(0) << "===========MERGE MOLECULES=====================" << endl; 1051 Log() << Verbose(0) << "a - simple add of one molecule to another" << endl; 1052 Log() << Verbose(0) << "e - embedding merge of two molecules" << endl; 1053 Log() << Verbose(0) << "m - multi-merge of all molecules" << endl; 1054 Log() << Verbose(0) << "s - scatter merge of two molecules" << endl; 1055 Log() << Verbose(0) << "t - simple merge of two molecules" << endl; 1056 Log() << Verbose(0) << "all else - go back" << endl; 1057 Log() << Verbose(0) << "===============================================" << endl; 1058 Log() << Verbose(0) << "INPUT: "; 1103 1059 cin >> choice; 1104 1060 1105 1061 switch (choice) { 1106 1062 default: 1107 DoLog(0) && (Log() << Verbose(0) << "Not a valid choice." << endl);1063 Log() << Verbose(0) << "Not a valid choice." << endl; 1108 1064 break; 1109 1065 … … 1114 1070 { 1115 1071 do { 1116 DoLog(0) && (Log() << Verbose(0) << "Enter index of destination molecule: ");1072 Log() << Verbose(0) << "Enter index of destination molecule: "; 1117 1073 cin >> dest; 1118 1074 destmol = molecules->ReturnIndex(dest); 1119 1075 } while ((destmol == NULL) && (dest != -1)); 1120 1076 do { 1121 DoLog(0) && (Log() << Verbose(0) << "Enter index of source molecule to add from: ");1077 Log() << Verbose(0) << "Enter index of source molecule to add from: "; 1122 1078 cin >> src; 1123 1079 srcmol = molecules->ReturnIndex(src); … … 1129 1085 break; 1130 1086 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 else1151 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 else1177 cout << "-" << elements[i]->symbol;1178 }1179 cout << " bonds." << endl;1180 }1181 break;1182 1183 1087 case 'e': 1184 1088 { … … 1186 1090 molecule *srcmol = NULL, *destmol = NULL; 1187 1091 do { 1188 DoLog(0) && (Log() << Verbose(0) << "Enter index of matrix molecule (the variable one): ");1092 Log() << Verbose(0) << "Enter index of matrix molecule (the variable one): "; 1189 1093 cin >> src; 1190 1094 srcmol = molecules->ReturnIndex(src); 1191 1095 } while ((srcmol == NULL) && (src != -1)); 1192 1096 do { 1193 DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule to merge into (the fixed one): ");1097 Log() << Verbose(0) << "Enter index of molecule to merge into (the fixed one): "; 1194 1098 cin >> dest; 1195 1099 destmol = molecules->ReturnIndex(dest); … … 1200 1104 break; 1201 1105 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 1212 1106 case 'm': 1213 1107 { … … 1215 1109 molecule *mol = NULL; 1216 1110 do { 1217 DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule to merge into: ");1111 Log() << Verbose(0) << "Enter index of molecule to merge into: "; 1218 1112 cin >> nr; 1219 1113 mol = molecules->ReturnIndex(nr); … … 1232 1126 1233 1127 case 's': 1234 DoLog(0) && (Log() << Verbose(0) << "Not implemented yet." << endl);1128 Log() << Verbose(0) << "Not implemented yet." << endl; 1235 1129 break; 1236 1130 … … 1241 1135 { 1242 1136 do { 1243 DoLog(0) && (Log() << Verbose(0) << "Enter index of destination molecule: ");1137 Log() << Verbose(0) << "Enter index of destination molecule: "; 1244 1138 cin >> dest; 1245 1139 destmol = molecules->ReturnIndex(dest); 1246 1140 } while ((destmol == NULL) && (dest != -1)); 1247 1141 do { 1248 DoLog(0) && (Log() << Verbose(0) << "Enter index of source molecule to merge into: ");1142 Log() << Verbose(0) << "Enter index of source molecule to merge into: "; 1249 1143 cin >> src; 1250 1144 srcmol = molecules->ReturnIndex(src); … … 1275 1169 mol = (molecules->ListOfMolecules.front())->CopyMolecule(); 1276 1170 else { 1277 DoeLog(0) && (eLog()<< Verbose(0) << "I don't have anything to test on ... ");1171 eLog() << Verbose(0) << "I don't have anything to test on ... "; 1278 1172 performCriticalExit(); 1279 1173 return; … … 1282 1176 1283 1177 // generate some KeySets 1284 DoLog(0) && (Log() << Verbose(0) << "Generating KeySets." << endl);1178 Log() << Verbose(0) << "Generating KeySets." << endl; 1285 1179 KeySet TestSets[mol->AtomCount+1]; 1286 1180 i=1; … … 1292 1186 i++; 1293 1187 } 1294 DoLog(0) && (Log() << Verbose(0) << "Testing insertion of already present item in KeySets." << endl);1188 Log() << Verbose(0) << "Testing insertion of already present item in KeySets." << endl; 1295 1189 KeySetTestPair test; 1296 1190 test = TestSets[mol->AtomCount-1].insert(Walker->nr); 1297 1191 if (test.second) { 1298 DoLog(1) && (Log() << Verbose(1) << "Insertion worked?!" << endl);1192 Log() << Verbose(1) << "Insertion worked?!" << endl; 1299 1193 } else { 1300 DoLog(1) && (Log() << Verbose(1) << "Insertion rejected: Present object is " << (*test.first) << "." << endl);1194 Log() << Verbose(1) << "Insertion rejected: Present object is " << (*test.first) << "." << endl; 1301 1195 } 1302 1196 TestSets[mol->AtomCount].insert(mol->end->previous->nr); … … 1304 1198 1305 1199 // constructing Graph structure 1306 DoLog(0) && (Log() << Verbose(0) << "Generating Subgraph class." << endl);1200 Log() << Verbose(0) << "Generating Subgraph class." << endl; 1307 1201 Graph Subgraphs; 1308 1202 1309 1203 // insert KeySets into Subgraphs 1310 DoLog(0) && (Log() << Verbose(0) << "Inserting KeySets into Subgraph class." << endl);1204 Log() << Verbose(0) << "Inserting KeySets into Subgraph class." << endl; 1311 1205 for (int j=0;j<mol->AtomCount;j++) { 1312 1206 Subgraphs.insert(GraphPair (TestSets[j],pair<int, double>(counter++, 1.))); 1313 1207 } 1314 DoLog(0) && (Log() << Verbose(0) << "Testing insertion of already present item in Subgraph." << endl);1208 Log() << Verbose(0) << "Testing insertion of already present item in Subgraph." << endl; 1315 1209 GraphTestPair test2; 1316 1210 test2 = Subgraphs.insert(GraphPair (TestSets[mol->AtomCount],pair<int, double>(counter++, 1.))); 1317 1211 if (test2.second) { 1318 DoLog(1) && (Log() << Verbose(1) << "Insertion worked?!" << endl);1212 Log() << Verbose(1) << "Insertion worked?!" << endl; 1319 1213 } else { 1320 DoLog(1) && (Log() << Verbose(1) << "Insertion rejected: Present object is " << (*(test2.first)).second.first << "." << endl);1214 Log() << Verbose(1) << "Insertion rejected: Present object is " << (*(test2.first)).second.first << "." << endl; 1321 1215 } 1322 1216 1323 1217 // show graphs 1324 DoLog(0) && (Log() << Verbose(0) << "Showing Subgraph's contents, checking that it's sorted." << endl);1218 Log() << Verbose(0) << "Showing Subgraph's contents, checking that it's sorted." << endl; 1325 1219 Graph::iterator A = Subgraphs.begin(); 1326 1220 while (A != Subgraphs.end()) { 1327 DoLog(0) && (Log() << Verbose(0) << (*A).second.first << ": ");1221 Log() << Verbose(0) << (*A).second.first << ": "; 1328 1222 KeySet::iterator key = (*A).first.begin(); 1329 1223 comp = -1; 1330 1224 while (key != (*A).first.end()) { 1331 1225 if ((*key) > comp) 1332 DoLog(0) && (Log() << Verbose(0) << (*key) << " ");1226 Log() << Verbose(0) << (*key) << " "; 1333 1227 else 1334 DoLog(0) && (Log() << Verbose(0) << (*key) << "! ");1228 Log() << Verbose(0) << (*key) << "! "; 1335 1229 comp = (*key); 1336 1230 key++; 1337 1231 } 1338 DoLog(0) && (Log() << Verbose(0) << endl);1232 Log() << Verbose(0) << endl; 1339 1233 A++; 1340 1234 } … … 1356 1250 1357 1251 if (!strcmp(configuration->configpath, configuration->GetDefaultPath())) { 1358 DoeLog(2) && (eLog()<< Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl);1252 eLog() << Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl; 1359 1253 } 1360 1254 … … 1365 1259 if (output == NULL) 1366 1260 strcpy(filename,"main_pcp_linux"); 1367 DoLog(0) && (Log() << Verbose(0) << "Saving as pdb input ");1261 Log() << Verbose(0) << "Saving as pdb input "; 1368 1262 if (configuration->SavePDB(filename, molecules)) 1369 DoLog(0) && (Log() << Verbose(0) << "done." << endl);1263 Log() << Verbose(0) << "done." << endl; 1370 1264 else 1371 DoLog(0) && (Log() << Verbose(0) << "failed." << endl);1265 Log() << Verbose(0) << "failed." << endl; 1372 1266 1373 1267 // then save as tremolo data file … … 1376 1270 if (output == NULL) 1377 1271 strcpy(filename,"main_pcp_linux"); 1378 DoLog(0) && (Log() << Verbose(0) << "Saving as tremolo data input ");1272 Log() << Verbose(0) << "Saving as tremolo data input "; 1379 1273 if (configuration->SaveTREMOLO(filename, molecules)) 1380 DoLog(0) && (Log() << Verbose(0) << "done." << endl);1274 Log() << Verbose(0) << "done." << endl; 1381 1275 else 1382 DoLog(0) && (Log() << Verbose(0) << "failed." << endl);1276 Log() << Verbose(0) << "failed." << endl; 1383 1277 1384 1278 // translate each to its center and merge all molecules in MoleculeListClass into this molecule … … 1400 1294 } 1401 1295 1402 DoLog(0) && (Log() << Verbose(0) << "Storing configuration ... " << endl);1296 Log() << Verbose(0) << "Storing configuration ... " << endl; 1403 1297 // get correct valence orbitals 1404 1298 mol->CalculateOrbitals(*configuration); … … 1416 1310 output.close(); 1417 1311 output.clear(); 1418 DoLog(0) && (Log() << Verbose(0) << "Saving of config file ");1312 Log() << Verbose(0) << "Saving of config file "; 1419 1313 if (configuration->Save(filename, periode, mol)) 1420 DoLog(0) && (Log() << Verbose(0) << "successful." << endl);1314 Log() << Verbose(0) << "successful." << endl; 1421 1315 else 1422 DoLog(0) && (Log() << Verbose(0) << "failed." << endl);1316 Log() << Verbose(0) << "failed." << endl; 1423 1317 1424 1318 // and save to xyz file … … 1433 1327 output.open(filename, ios::trunc); 1434 1328 } 1435 DoLog(0) && (Log() << Verbose(0) << "Saving of XYZ file ");1329 Log() << Verbose(0) << "Saving of XYZ file "; 1436 1330 if (mol->MDSteps <= 1) { 1437 1331 if (mol->OutputXYZ(&output)) 1438 DoLog(0) && (Log() << Verbose(0) << "successful." << endl);1332 Log() << Verbose(0) << "successful." << endl; 1439 1333 else 1440 DoLog(0) && (Log() << Verbose(0) << "failed." << endl);1334 Log() << Verbose(0) << "failed." << endl; 1441 1335 } else { 1442 1336 if (mol->OutputTrajectoriesXYZ(&output)) 1443 DoLog(0) && (Log() << Verbose(0) << "successful." << endl);1337 Log() << Verbose(0) << "successful." << endl; 1444 1338 else 1445 DoLog(0) && (Log() << Verbose(0) << "failed." << endl);1339 Log() << Verbose(0) << "failed." << endl; 1446 1340 } 1447 1341 output.close(); … … 1453 1347 if (output == NULL) 1454 1348 strcpy(filename,"main_pcp_linux"); 1455 DoLog(0) && (Log() << Verbose(0) << "Saving as mpqc input ");1349 Log() << Verbose(0) << "Saving as mpqc input "; 1456 1350 if (configuration->SaveMPQC(filename, mol)) 1457 DoLog(0) && (Log() << Verbose(0) << "done." << endl);1351 Log() << Verbose(0) << "done." << endl; 1458 1352 else 1459 DoLog(0) && (Log() << Verbose(0) << "failed." << endl);1353 Log() << Verbose(0) << "failed." << endl; 1460 1354 1461 1355 if (!strcmp(configuration->configpath, configuration->GetDefaultPath())) { 1462 DoeLog(2) && (eLog()<< Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl);1356 eLog() << Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl; 1463 1357 } 1464 1358 … … 1490 1384 enum ConfigStatus configPresent = absent; 1491 1385 clock_t start,end; 1492 double MaxDistance = -1;1493 1386 int argptr; 1494 1387 molecule *mol = NULL; … … 1502 1395 do { 1503 1396 if (argv[argptr][0] == '-') { 1504 DoLog(0) && (Log() << Verbose(0) << "Recognized command line argument: " << argv[argptr][1] << ".\n");1397 Log() << Verbose(0) << "Recognized command line argument: " << argv[argptr][1] << ".\n"; 1505 1398 argptr++; 1506 1399 switch(argv[argptr-1][1]) { … … 1508 1401 case 'H': 1509 1402 case '?': 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); 1403 Log() << Verbose(0) << "MoleCuilder suite" << endl << "==================" << endl << endl; 1404 Log() << Verbose(0) << "Usage: " << argv[0] << "[config file] [-{acefpsthH?vfrp}] [further arguments]" << endl; 1405 Log() << Verbose(0) << "or simply " << argv[0] << " without arguments for interactive session." << endl; 1406 Log() << Verbose(0) << "\t-a Z x1 x2 x3\tAdd new atom of element Z at coordinates (x1,x2,x3)." << endl; 1407 Log() << Verbose(0) << "\t-A <source>\tCreate adjacency list from bonds parsed from 'dbond'-style file." <<endl; 1408 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; 1409 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; 1410 Log() << Verbose(0) << "\t-c x1 x2 x3\tCenter atoms in domain with a minimum distance to boundary of (x1,x2,x3)." << endl; 1411 Log() << Verbose(0) << "\t-C\tPair Correlation analysis." << endl; 1412 Log() << Verbose(0) << "\t-d x1 x2 x3\tDuplicate cell along each axis by given factor." << endl; 1413 Log() << Verbose(0) << "\t-D <bond distance>\tDepth-First-Search Analysis of the molecule, giving cycles and tree/back edges." << endl; 1414 Log() << Verbose(0) << "\t-e <file>\tSets the databases path to be parsed (default: ./)." << endl; 1415 Log() << Verbose(0) << "\t-E <id> <Z>\tChange atom <id>'s element to <Z>, <id> begins at 0." << endl; 1416 Log() << Verbose(0) << "\t-f/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; 1417 Log() << Verbose(0) << "\t-g <file>\tParses a bond length table from the given file." << endl; 1418 Log() << Verbose(0) << "\t-h/-H/-?\tGive this help screen." << endl; 1419 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; 1420 Log() << Verbose(0) << "\t-m <0/1>\tCalculate (0)/ Align in(1) PAS with greatest EV along z axis." << endl; 1421 Log() << Verbose(0) << "\t-M <basis>\tSetting basis to store to MPQC config files." << endl; 1422 Log() << Verbose(0) << "\t-n\tFast parsing (i.e. no trajectories are looked for)." << endl; 1423 Log() << Verbose(0) << "\t-N <radius> <file>\tGet non-convex-envelope." << endl; 1424 Log() << Verbose(0) << "\t-o <out>\tGet volume of the convex envelope (and store to tecplot file)." << endl; 1425 Log() << Verbose(0) << "\t-O\tCenter atoms in origin." << endl; 1426 Log() << Verbose(0) << "\t-p <file>\tParse given xyz file and create raw config file from it." << endl; 1427 Log() << Verbose(0) << "\t-P <file>\tParse given forces file and append as an MD step to config file via Verlet." << endl; 1428 Log() << Verbose(0) << "\t-r <id>\t\tRemove an atom with given id." << endl; 1429 Log() << Verbose(0) << "\t-R <id> <radius>\t\tRemove all atoms out of sphere around a given one." << endl; 1430 Log() << Verbose(0) << "\t-s x1 x2 x3\tScale all atom coordinates by this vector (x1,x2,x3)." << endl; 1431 Log() << Verbose(0) << "\t-S <file> Store temperatures from the config file in <file>." << endl; 1432 Log() << Verbose(0) << "\t-t x1 x2 x3\tTranslate all atoms by this vector (x1,x2,x3)." << endl; 1433 Log() << Verbose(0) << "\t-T x1 x2 x3\tTranslate periodically all atoms by this vector (x1,x2,x3)." << endl; 1434 Log() << Verbose(0) << "\t-u rho\tsuspend in water solution and output necessary cell lengths, average density rho and repetition." << endl; 1435 Log() << Verbose(0) << "\t-v\t\tsets verbosity (more is more)." << endl; 1436 Log() << Verbose(0) << "\t-V\t\tGives version information." << endl; 1437 Log() << Verbose(0) << "Note: config files must not begin with '-' !" << endl; 1551 1438 return (1); 1552 1439 break; … … 1556 1443 } 1557 1444 setVerbosity(verbosity); 1558 DoLog(0) && (Log() << Verbose(0) << "Setting verbosity to " << verbosity << "." << endl);1445 Log() << Verbose(0) << "Setting verbosity to " << verbosity << "." << endl; 1559 1446 break; 1560 1447 case 'V': 1561 DoLog(0) && (Log() << Verbose(0) << argv[0] << " " << VERSIONSTRING << endl);1562 DoLog(0) && (Log() << Verbose(0) << "Build your own molecule position set." << endl);1448 Log() << Verbose(0) << argv[0] << " " << VERSIONSTRING << endl; 1449 Log() << Verbose(0) << "Build your own molecule position set." << endl; 1563 1450 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 }1581 1451 break; 1582 1452 case 'e': 1583 1453 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 1584 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments for specifying element db: -e <db file>" << endl);1454 eLog() << Verbose(0) << "Not enough or invalid arguments for specifying element db: -e <db file>" << endl; 1585 1455 performCriticalExit(); 1586 1456 } else { 1587 DoLog(0) && (Log() << Verbose(0) << "Using " << argv[argptr] << " as elements database." << endl);1457 Log() << Verbose(0) << "Using " << argv[argptr] << " as elements database." << endl; 1588 1458 strncpy (configuration.databasepath, argv[argptr], MAXSTRINGSIZE-1); 1589 1459 argptr+=1; … … 1592 1462 case 'g': 1593 1463 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 1594 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments for specifying bond length table: -g <table file>" << endl);1464 eLog() << Verbose(0) << "Not enough or invalid arguments for specifying bond length table: -g <table file>" << endl; 1595 1465 performCriticalExit(); 1596 1466 } else { 1597 1467 BondGraphFileName = argv[argptr]; 1598 DoLog(0) && (Log() << Verbose(0) << "Using " << BondGraphFileName << " as bond length table." << endl);1468 Log() << Verbose(0) << "Using " << BondGraphFileName << " as bond length table." << endl; 1599 1469 argptr+=1; 1600 1470 } 1601 1471 break; 1602 1472 case 'n': 1603 DoLog(0) && (Log() << Verbose(0) << "I won't parse trajectories." << endl);1473 Log() << Verbose(0) << "I won't parse trajectories." << endl; 1604 1474 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 }1615 1475 break; 1616 1476 default: // no match? Step on … … 1624 1484 // 3a. Parse the element database 1625 1485 if (periode->LoadPeriodentafel(configuration.databasepath)) { 1626 DoLog(0) && (Log() << Verbose(0) << "Element list loaded successfully." << endl);1486 Log() << Verbose(0) << "Element list loaded successfully." << endl; 1627 1487 //periode->Output(); 1628 1488 } else { 1629 DoLog(0) && (Log() << Verbose(0) << "Element list loading failed." << endl);1489 Log() << Verbose(0) << "Element list loading failed." << endl; 1630 1490 return 1; 1631 1491 } … … 1633 1493 if (argv[1][0] != '-') { 1634 1494 // simply create a new molecule, wherein the config file is loaded and the manipulation takes place 1635 DoLog(0) && (Log() << Verbose(0) << "Config file given." << endl);1495 Log() << Verbose(0) << "Config file given." << endl; 1636 1496 test.open(argv[1], ios::in); 1637 1497 if (test == NULL) { … … 1639 1499 output.open(argv[1], ios::out); 1640 1500 if (output == NULL) { 1641 DoLog(1) && (Log() << Verbose(1) << "Specified config file " << argv[1] << " not found." << endl);1501 Log() << Verbose(1) << "Specified config file " << argv[1] << " not found." << endl; 1642 1502 configPresent = absent; 1643 1503 } else { 1644 DoLog(0) && (Log() << Verbose(0) << "Empty configuration file." << endl);1504 Log() << Verbose(0) << "Empty configuration file." << endl; 1645 1505 ConfigFileName = argv[1]; 1646 1506 configPresent = empty; … … 1650 1510 test.close(); 1651 1511 ConfigFileName = argv[1]; 1652 DoLog(1) && (Log() << Verbose(1) << "Specified config file found, parsing ... ");1512 Log() << Verbose(1) << "Specified config file found, parsing ... "; 1653 1513 switch (configuration.TestSyntax(ConfigFileName, periode)) { 1654 1514 case 1: 1655 DoLog(0) && (Log() << Verbose(0) << "new syntax." << endl);1515 Log() << Verbose(0) << "new syntax." << endl; 1656 1516 configuration.Load(ConfigFileName, BondGraphFileName, periode, molecules); 1657 1517 configPresent = present; 1658 1518 break; 1659 1519 case 0: 1660 DoLog(0) && (Log() << Verbose(0) << "old syntax." << endl);1520 Log() << Verbose(0) << "old syntax." << endl; 1661 1521 configuration.LoadOld(ConfigFileName, BondGraphFileName, periode, molecules); 1662 1522 configPresent = present; 1663 1523 break; 1664 1524 default: 1665 DoLog(0) && (Log() << Verbose(0) << "Unknown syntax or empty, yet present file." << endl);1525 Log() << Verbose(0) << "Unknown syntax or empty, yet present file." << endl; 1666 1526 configPresent = empty; 1667 1527 } … … 1686 1546 if (configuration.BG == NULL) { 1687 1547 configuration.BG = new BondGraph(configuration.GetIsAngstroem()); 1688 if (( !BondGraphFileName.empty()) && (configuration.BG->LoadBondLengthTable(BondGraphFileName))) {1689 DoLog(0) && (Log() << Verbose(0) << "Bond length table loaded successfully." << endl);1548 if ((BondGraphFileName.empty()) && (configuration.BG->LoadBondLengthTable(BondGraphFileName))) { 1549 Log() << Verbose(0) << "Bond length table loaded successfully." << endl; 1690 1550 } else { 1691 DoeLog(1) && (eLog()<< Verbose(1) << "Bond length table loading failed." << endl);1551 eLog() << Verbose(1) << "Bond length table loading failed." << endl; 1692 1552 } 1693 1553 } … … 1696 1556 argptr = 1; 1697 1557 do { 1698 DoLog(0) && (Log() << Verbose(0) << "Current Command line argument: " << argv[argptr] << "." << endl);1558 Log() << Verbose(0) << "Current Command line argument: " << argv[argptr] << "." << endl; 1699 1559 if (argv[argptr][0] == '-') { 1700 1560 argptr++; … … 1705 1565 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 1706 1566 ExitFlag = 255; 1707 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough arguments for parsing: -p <xyz file>" << endl);1567 eLog() << Verbose(0) << "Not enough arguments for parsing: -p <xyz file>" << endl; 1708 1568 performCriticalExit(); 1709 1569 } else { 1710 1570 SaveFlag = true; 1711 DoLog(1) && (Log() << Verbose(1) << "Parsing xyz file for new atoms." << endl);1571 Log() << Verbose(1) << "Parsing xyz file for new atoms." << endl; 1712 1572 if (!mol->AddXYZFile(argv[argptr])) 1713 DoLog(2) && (Log() << Verbose(2) << "File not found." << endl);1573 Log() << Verbose(2) << "File not found." << endl; 1714 1574 else { 1715 DoLog(2) && (Log() << Verbose(2) << "File found and parsed." << endl); 1575 Log() << Verbose(2) << "File found and parsed." << endl; 1576 // @TODO rather do the dissection afterwards 1577 // mol->SetNameFromFilename(argv[argptr]); 1578 // molecules->ListOfMolecules.remove(mol); 1579 // molecules->DissectMoleculeIntoConnectedSubgraphs(mol,&configuration); 1580 // delete(mol); 1581 // if (molecules->ListOfMolecules.size() != 0) { 1582 // for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) 1583 // if ((*ListRunner)->ActiveFlag) { 1584 // mol = *ListRunner; 1585 // break; 1586 // } 1587 // } 1716 1588 configPresent = present; 1717 1589 } … … 1722 1594 if ((argptr >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) || (!IsValidNumber(argv[argptr+3]))) { 1723 1595 ExitFlag = 255; 1724 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments for adding atom: -a <element> <x> <y> <z>" << endl);1596 eLog() << Verbose(0) << "Not enough or invalid arguments for adding atom: -a <element> <x> <y> <z>" << endl; 1725 1597 performCriticalExit(); 1726 1598 } else { 1727 1599 SaveFlag = true; 1728 DoLog(1) && (Log() << Verbose(1) << "Adding new atom with element " << argv[argptr] << " at (" << argv[argptr+1] << "," << argv[argptr+2] << "," << argv[argptr+3] << "), ");1600 Log() << Verbose(1) << "Adding new atom with element " << argv[argptr] << " at (" << argv[argptr+1] << "," << argv[argptr+2] << "," << argv[argptr+3] << "), "; 1729 1601 first = new atom; 1730 1602 first->type = periode->FindElement(atoi(argv[argptr])); 1731 1603 if (first->type != NULL) 1732 DoLog(2) && (Log() << Verbose(2) << "found element " << first->type->name << endl);1604 Log() << Verbose(2) << "found element " << first->type->name << endl; 1733 1605 for (int i=NDIM;i--;) 1734 1606 first->x.x[i] = atof(argv[argptr+1+i]); … … 1738 1610 configPresent = present; 1739 1611 } else 1740 DoeLog(1) && (eLog()<< Verbose(1) << "Could not find the specified element." << endl);1612 eLog() << Verbose(1) << "Could not find the specified element." << endl; 1741 1613 argptr+=4; 1742 1614 } … … 1751 1623 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 1752 1624 ExitFlag = 255; 1753 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for setting MPQC basis: -B <basis name>" << endl);1625 eLog() << Verbose(0) << "Not enough or invalid arguments given for setting MPQC basis: -B <basis name>" << endl; 1754 1626 performCriticalExit(); 1755 1627 } else { 1756 1628 configuration.basis = argv[argptr]; 1757 DoLog(1) && (Log() << Verbose(1) << "Setting MPQC basis to " << configuration.basis << "." << endl);1629 Log() << Verbose(1) << "Setting MPQC basis to " << configuration.basis << "." << endl; 1758 1630 argptr+=1; 1759 1631 } … … 1762 1634 if (ExitFlag == 0) ExitFlag = 1; 1763 1635 { 1764 DoLog(1) && (Log() << Verbose(1) << "Depth-First-Search Analysis." << endl);1636 Log() << Verbose(1) << "Depth-First-Search Analysis." << endl; 1765 1637 MoleculeLeafClass *Subgraphs = NULL; // list of subgraphs from DFS analysis 1766 1638 int *MinimumRingSize = new int[mol->AtomCount]; … … 1792 1664 //argptr+=1; 1793 1665 break; 1794 case 'I': 1795 DoLog(1) && (Log() << Verbose(1) << "Dissecting molecular system into a set of disconnected subgraphs ... " << endl); 1796 // @TODO rather do the dissection afterwards 1797 molecules->DissectMoleculeIntoConnectedSubgraphs(periode, &configuration); 1798 mol = NULL; 1799 if (molecules->ListOfMolecules.size() != 0) { 1800 for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) 1801 if ((*ListRunner)->ActiveFlag) { 1802 mol = *ListRunner; 1803 break; 1666 case 'C': 1667 if (ExitFlag == 0) ExitFlag = 1; 1668 if ((argptr+2 >= argc) || (!IsValidNumber(argv[argptr])) || (argv[argptr][0] == '-') || (argv[argptr+1][0] == '-') || (argv[argptr+2][0] == '-')) { 1669 ExitFlag = 255; 1670 eLog() << Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C <Z> <output> <bin output>" << endl; 1671 performCriticalExit(); 1672 } else { 1673 SaveFlag = false; 1674 ofstream output(argv[argptr+1]); 1675 ofstream binoutput(argv[argptr+2]); 1676 const double radius = 5.; 1677 1678 // get the boundary 1679 class molecule *Boundary = NULL; 1680 class Tesselation *TesselStruct = NULL; 1681 const LinkedCell *LCList = NULL; 1682 // find biggest molecule 1683 int counter = 0; 1684 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) { 1685 if ((Boundary == NULL) || (Boundary->AtomCount < (*BigFinder)->AtomCount)) { 1686 Boundary = *BigFinder; 1804 1687 } 1805 } 1806 if ((mol == NULL) && (!molecules->ListOfMolecules.empty())) { 1807 mol = *(molecules->ListOfMolecules.begin()); 1808 if (mol != NULL) 1809 mol->ActiveFlag = true; 1810 } 1811 break; 1812 case 'C': 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 } 1851 } 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 } 1883 } 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); 1931 else 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; 1953 } 1954 } 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 } 1688 counter++; 1963 1689 } 1964 break; 1965 } 1690 bool *Actives = Malloc<bool>(counter, "ParseCommandLineOptions() - case C -- *Actives"); 1691 counter = 0; 1692 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) { 1693 Actives[counter] = (*BigFinder)->ActiveFlag; 1694 (*BigFinder)->ActiveFlag = (*BigFinder == Boundary) ? false : true; 1695 } 1696 LCList = new LinkedCell(Boundary, 2.*radius); 1697 element *elemental = periode->FindElement((const int) atoi(argv[argptr])); 1698 FindNonConvexBorder(Boundary, TesselStruct, LCList, radius, NULL); 1699 int ranges[NDIM] = {1,1,1}; 1700 CorrelationToSurfaceMap *surfacemap = PeriodicCorrelationToSurface( molecules, elemental, TesselStruct, LCList, ranges ); 1701 BinPairMap *binmap = BinData( surfacemap, 0.5, 0., 0. ); 1702 OutputCorrelation ( &binoutput, binmap ); 1703 output.close(); 1704 binoutput.close(); 1705 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) 1706 (*BigFinder)->ActiveFlag = Actives[counter]; 1707 Free(&Actives); 1708 delete(LCList); 1709 delete(TesselStruct); 1710 argptr+=3; 1711 } 1712 break; 1966 1713 case 'E': 1967 1714 if (ExitFlag == 0) ExitFlag = 1; 1968 1715 if ((argptr+1 >= argc) || (!IsValidNumber(argv[argptr])) || (argv[argptr+1][0] == '-')) { 1969 1716 ExitFlag = 255; 1970 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for changing element: -E <atom nr.> <element>" << endl);1717 eLog() << Verbose(0) << "Not enough or invalid arguments given for changing element: -E <atom nr.> <element>" << endl; 1971 1718 performCriticalExit(); 1972 1719 } else { 1973 1720 SaveFlag = true; 1974 DoLog(1) && (Log() << Verbose(1) << "Changing atom " << argv[argptr] << " to element " << argv[argptr+1] << "." << endl);1721 Log() << Verbose(1) << "Changing atom " << argv[argptr] << " to element " << argv[argptr+1] << "." << endl; 1975 1722 first = mol->FindAtom(atoi(argv[argptr])); 1976 1723 first->type = periode->FindElement(atoi(argv[argptr+1])); … … 1980 1727 case 'F': 1981 1728 if (ExitFlag == 0) ExitFlag = 1; 1982 MaxDistance = -1; 1983 if (argv[argptr-1][2] == 'F') { // option is -FF? 1984 // fetch first argument as max distance to surface 1985 MaxDistance = atof(argv[argptr++]); 1986 DoLog(0) && (Log() << Verbose(0) << "Filling with maximum layer distance of " << MaxDistance << "." << endl); 1987 } 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]))) { 1729 if (argptr+5 >=argc) { 1989 1730 ExitFlag = 255; 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);1731 eLog() << Verbose(0) << "Not enough or invalid arguments given for filling box with water: -F <dist_x> <dist_y> <dist_z> <randatom> <randmol> <DoRotate>" << endl; 1991 1732 performCriticalExit(); 1992 1733 } else { 1993 1734 SaveFlag = true; 1994 DoLog(1) && (Log() << Verbose(1) << "Filling Box with water molecules." << endl);1735 Log() << Verbose(1) << "Filling Box with water molecules." << endl; 1995 1736 // construct water molecule 1996 molecule *filler = new molecule(periode); 1997 if (!filler->AddXYZFile(argv[argptr])) { 1998 DoeLog(0) && (eLog()<< Verbose(0) << "Could not parse filler molecule from " << argv[argptr] << "." << endl); 1999 } 2000 filler->SetNameFromFilename(argv[argptr]); 2001 configuration.BG->ConstructBondGraph(filler); 1737 molecule *filler = new molecule(periode);; 2002 1738 molecule *Filling = NULL; 1739 atom *second = NULL, *third = NULL; 1740 first = new atom(); 1741 first->type = periode->FindElement(1); 1742 first->x.Init(0.441, -0.143, 0.); 1743 filler->AddAtom(first); 1744 second = new atom(); 1745 second->type = periode->FindElement(1); 1746 second->x.Init(-0.464, 1.137, 0.0); 1747 filler->AddAtom(second); 1748 third = new atom(); 1749 third->type = periode->FindElement(8); 1750 third->x.Init(-0.464, 0.177, 0.); 1751 filler->AddAtom(third); 1752 filler->AddBond(first, third, 1); 1753 filler->AddBond(second, third, 1); 2003 1754 // call routine 2004 1755 double distance[NDIM]; 2005 1756 for (int i=0;i<NDIM;i++) 2006 distance[i] = atof(argv[argptr+i +1]);2007 Filling = FillBoxWithMolecule(molecules, filler, configuration, MaxDistance, distance, atof(argv[argptr+4]), atof(argv[argptr+5]), atof(argv[argptr+6]), atoi(argv[argptr+7]));1757 distance[i] = atof(argv[argptr+i]); 1758 Filling = FillBoxWithMolecule(molecules, filler, configuration, distance, atof(argv[argptr+3]), atof(argv[argptr+4]), atoi(argv[argptr+5])); 2008 1759 if (Filling != NULL) { 2009 Filling->ActiveFlag = false;2010 1760 molecules->insert(Filling); 2011 1761 } … … 2018 1768 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 2019 1769 ExitFlag =255; 2020 DoeLog(0) && (eLog()<< Verbose(0) << "Missing source file for bonds in molecule: -A <bond sourcefile>" << endl);1770 eLog() << Verbose(0) << "Missing source file for bonds in molecule: -A <bond sourcefile>" << endl; 2021 1771 performCriticalExit(); 2022 1772 } else { 2023 DoLog(0) && (Log() << Verbose(0) << "Parsing bonds from " << argv[argptr] << "." << endl);1773 Log() << Verbose(0) << "Parsing bonds from " << argv[argptr] << "." << endl; 2024 1774 ifstream *input = new ifstream(argv[argptr]); 2025 1775 mol->CreateAdjacencyListFromDbondFile(input); … … 2028 1778 } 2029 1779 break; 2030 2031 case 'J':2032 if (ExitFlag == 0) ExitFlag = 1;2033 if ((argptr >= argc) || (argv[argptr][0] == '-')) {2034 ExitFlag =255;2035 DoeLog(0) && (eLog()<< Verbose(0) << "Missing path of adjacency file: -j <path>" << endl);2036 performCriticalExit();2037 } else {2038 DoLog(0) && (Log() << Verbose(0) << "Storing adjacency to path " << argv[argptr] << "." << endl);2039 configuration.BG->ConstructBondGraph(mol);2040 mol->StoreAdjacencyToFile(NULL, argv[argptr]);2041 argptr+=1;2042 }2043 break;2044 2045 case 'j':2046 if (ExitFlag == 0) ExitFlag = 1;2047 if ((argptr >= argc) || (argv[argptr][0] == '-')) {2048 ExitFlag =255;2049 DoeLog(0) && (eLog()<< Verbose(0) << "Missing path of bonds file: -j <path>" << endl);2050 performCriticalExit();2051 } else {2052 DoLog(0) && (Log() << Verbose(0) << "Storing bonds to path " << argv[argptr] << "." << endl);2053 configuration.BG->ConstructBondGraph(mol);2054 mol->StoreBondsToFile(NULL, argv[argptr]);2055 argptr+=1;2056 }2057 break;2058 2059 1780 case 'N': 2060 1781 if (ExitFlag == 0) ExitFlag = 1; 2061 1782 if ((argptr+1 >= argc) || (argv[argptr+1][0] == '-')){ 2062 1783 ExitFlag = 255; 2063 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for non-convex envelope: -o <radius> <tecplot output file>" << endl);1784 eLog() << Verbose(0) << "Not enough or invalid arguments given for non-convex envelope: -o <radius> <tecplot output file>" << endl; 2064 1785 performCriticalExit(); 2065 1786 } else { … … 2069 1790 //string filename(argv[argptr+1]); 2070 1791 //filename.append(".csv"); 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);1792 Log() << Verbose(0) << "Evaluating non-convex envelope of biggest molecule."; 1793 Log() << Verbose(1) << "Using rolling ball of radius " << atof(argv[argptr]) << " and storing tecplot data in " << argv[argptr+1] << "." << endl; 2073 1794 // find biggest molecule 2074 1795 int counter = 0; … … 2080 1801 counter++; 2081 1802 } 2082 DoLog(1) && (Log() << Verbose(1) << "Biggest molecule has " << Boundary->AtomCount << " atoms." << endl);1803 Log() << Verbose(1) << "Biggest molecule has " << Boundary->AtomCount << " atoms." << endl; 2083 1804 start = clock(); 2084 1805 LCList = new LinkedCell(Boundary, atof(argv[argptr])*2.); … … 2087 1808 //FindDistributionOfEllipsoids(T, &LCList, N, number, filename.c_str()); 2088 1809 end = clock(); 2089 DoLog(0) && (Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl);1810 Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl; 2090 1811 delete(LCList); 2091 1812 delete(T); … … 2097 1818 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 2098 1819 ExitFlag = 255; 2099 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for storing tempature: -S <temperature file>" << endl);1820 eLog() << Verbose(0) << "Not enough or invalid arguments given for storing tempature: -S <temperature file>" << endl; 2100 1821 performCriticalExit(); 2101 1822 } else { 2102 DoLog(1) && (Log() << Verbose(1) << "Storing temperatures in " << argv[argptr] << "." << endl);1823 Log() << Verbose(1) << "Storing temperatures in " << argv[argptr] << "." << endl; 2103 1824 ofstream *output = new ofstream(argv[argptr], ios::trunc); 2104 1825 if (!mol->OutputTemperatureFromTrajectories(output, 0, mol->MDSteps)) 2105 DoLog(2) && (Log() << Verbose(2) << "File could not be written." << endl);1826 Log() << Verbose(2) << "File could not be written." << endl; 2106 1827 else 2107 DoLog(2) && (Log() << Verbose(2) << "File stored." << endl);1828 Log() << Verbose(2) << "File stored." << endl; 2108 1829 output->close(); 2109 1830 delete(output); … … 2115 1836 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 2116 1837 ExitFlag = 255; 2117 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for storing tempature: -L <step0> <step1> <prefix> <identity mapping?>" << endl);1838 eLog() << Verbose(0) << "Not enough or invalid arguments given for storing tempature: -L <step0> <step1> <prefix> <identity mapping?>" << endl; 2118 1839 performCriticalExit(); 2119 1840 } else { 2120 1841 SaveFlag = true; 2121 DoLog(1) && (Log() << Verbose(1) << "Linear interpolation between configuration " << argv[argptr] << " and " << argv[argptr+1] << "." << endl);1842 Log() << Verbose(1) << "Linear interpolation between configuration " << argv[argptr] << " and " << argv[argptr+1] << "." << endl; 2122 1843 if (atoi(argv[argptr+3]) == 1) 2123 DoLog(1) && (Log() << Verbose(1) << "Using Identity for the permutation map." << endl);1844 Log() << Verbose(1) << "Using Identity for the permutation map." << endl; 2124 1845 if (!mol->LinearInterpolationBetweenConfiguration(atoi(argv[argptr]), atoi(argv[argptr+1]), argv[argptr+2], configuration, atoi(argv[argptr+3])) == 1 ? true : false) 2125 DoLog(2) && (Log() << Verbose(2) << "Could not store " << argv[argptr+2] << " files." << endl);1846 Log() << Verbose(2) << "Could not store " << argv[argptr+2] << " files." << endl; 2126 1847 else 2127 DoLog(2) && (Log() << Verbose(2) << "Steps created and " << argv[argptr+2] << " files stored." << endl);1848 Log() << Verbose(2) << "Steps created and " << argv[argptr+2] << " files stored." << endl; 2128 1849 argptr+=4; 2129 1850 } … … 2133 1854 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 2134 1855 ExitFlag = 255; 2135 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for parsing and integrating forces: -P <forces file>" << endl);1856 eLog() << Verbose(0) << "Not enough or invalid arguments given for parsing and integrating forces: -P <forces file>" << endl; 2136 1857 performCriticalExit(); 2137 1858 } else { 2138 1859 SaveFlag = true; 2139 DoLog(1) && (Log() << Verbose(1) << "Parsing forces file and Verlet integrating." << endl);1860 Log() << Verbose(1) << "Parsing forces file and Verlet integrating." << endl; 2140 1861 if (!mol->VerletForceIntegration(argv[argptr], configuration)) 2141 DoLog(2) && (Log() << Verbose(2) << "File not found." << endl);1862 Log() << Verbose(2) << "File not found." << endl; 2142 1863 else 2143 DoLog(2) && (Log() << Verbose(2) << "File found and parsed." << endl);1864 Log() << Verbose(2) << "File found and parsed." << endl; 2144 1865 argptr+=1; 2145 1866 } … … 2149 1870 if ((argptr+1 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1]))) { 2150 1871 ExitFlag = 255; 2151 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for removing atoms: -R <id> <distance>" << endl);1872 eLog() << Verbose(0) << "Not enough or invalid arguments given for removing atoms: -R <id> <distance>" << endl; 2152 1873 performCriticalExit(); 2153 1874 } else { 2154 1875 SaveFlag = true; 2155 DoLog(1) && (Log() << Verbose(1) << "Removing atoms around " << argv[argptr] << " with radius " << argv[argptr+1] << "." << endl);1876 Log() << Verbose(1) << "Removing atoms around " << argv[argptr] << " with radius " << argv[argptr+1] << "." << endl; 2156 1877 double tmp1 = atof(argv[argptr+1]); 2157 1878 atom *third = mol->FindAtom(atoi(argv[argptr])); … … 2166 1887 } 2167 1888 } else { 2168 DoeLog(1) && (eLog()<< Verbose(1) << "Removal failed due to missing atoms on molecule or wrong id." << endl);1889 eLog() << Verbose(1) << "Removal failed due to missing atoms on molecule or wrong id." << endl; 2169 1890 } 2170 1891 argptr+=2; … … 2175 1896 if ((argptr+2 >= argc) || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) { 2176 1897 ExitFlag = 255; 2177 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for translation: -t <x> <y> <z>" << endl);1898 eLog() << Verbose(0) << "Not enough or invalid arguments given for translation: -t <x> <y> <z>" << endl; 2178 1899 performCriticalExit(); 2179 1900 } else { 2180 1901 if (ExitFlag == 0) ExitFlag = 1; 2181 1902 SaveFlag = true; 2182 DoLog(1) && (Log() << Verbose(1) << "Translating all ions by given vector." << endl);1903 Log() << Verbose(1) << "Translating all ions by given vector." << endl; 2183 1904 for (int i=NDIM;i--;) 2184 1905 x.x[i] = atof(argv[argptr+i]); … … 2191 1912 if ((argptr+2 >= argc) || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) { 2192 1913 ExitFlag = 255; 2193 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for periodic translation: -T <x> <y> <z>" << endl);1914 eLog() << Verbose(0) << "Not enough or invalid arguments given for periodic translation: -T <x> <y> <z>" << endl; 2194 1915 performCriticalExit(); 2195 1916 } else { 2196 1917 if (ExitFlag == 0) ExitFlag = 1; 2197 1918 SaveFlag = true; 2198 DoLog(1) && (Log() << Verbose(1) << "Translating all ions periodically by given vector." << endl);1919 Log() << Verbose(1) << "Translating all ions periodically by given vector." << endl; 2199 1920 for (int i=NDIM;i--;) 2200 1921 x.x[i] = atof(argv[argptr+i]); … … 2207 1928 if ((argptr >= argc) || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) { 2208 1929 ExitFlag = 255; 2209 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for scaling: -s <factor_x> [factor_y] [factor_z]" << endl);1930 eLog() << Verbose(0) << "Not enough or invalid arguments given for scaling: -s <factor_x> [factor_y] [factor_z]" << endl; 2210 1931 performCriticalExit(); 2211 1932 } else { 2212 1933 SaveFlag = true; 2213 1934 j = -1; 2214 DoLog(1) && (Log() << Verbose(1) << "Scaling all ion positions by factor." << endl);1935 Log() << Verbose(1) << "Scaling all ion positions by factor." << endl; 2215 1936 factor = new double[NDIM]; 2216 1937 factor[0] = atof(argv[argptr]); … … 2218 1939 factor[2] = atof(argv[argptr+2]); 2219 1940 mol->Scale((const double ** const)&factor); 2220 double * const cell_size = World::get()->cell_size;2221 1941 for (int i=0;i<NDIM;i++) { 2222 1942 j += i+1; 2223 1943 x.x[i] = atof(argv[NDIM+i]); 2224 cell_size[j]*=factor[i];1944 mol->cell_size[j]*=factor[i]; 2225 1945 } 2226 1946 delete[](factor); … … 2232 1952 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])) ) { 2233 1953 ExitFlag = 255; 2234 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for centering in box: -b <xx> <xy> <xz> <yy> <yz> <zz>" << endl);1954 eLog() << Verbose(0) << "Not enough or invalid arguments given for centering in box: -b <xx> <xy> <xz> <yy> <yz> <zz>" << endl; 2235 1955 performCriticalExit(); 2236 1956 } else { 2237 1957 SaveFlag = true; 2238 1958 j = -1; 2239 DoLog(1) && (Log() << Verbose(1) << "Centering atoms in config file within given simulation box." << endl); 2240 double * const cell_size = World::get()->cell_size; 1959 Log() << Verbose(1) << "Centering atoms in config file within given simulation box." << endl; 2241 1960 for (int i=0;i<6;i++) { 2242 cell_size[i] = atof(argv[argptr+i]);1961 mol->cell_size[i] = atof(argv[argptr+i]); 2243 1962 } 2244 1963 // center … … 2251 1970 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])) ) { 2252 1971 ExitFlag = 255; 2253 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for bounding in box: -B <xx> <xy> <xz> <yy> <yz> <zz>" << endl);1972 eLog() << Verbose(0) << "Not enough or invalid arguments given for bounding in box: -B <xx> <xy> <xz> <yy> <yz> <zz>" << endl; 2254 1973 performCriticalExit(); 2255 1974 } else { 2256 1975 SaveFlag = true; 2257 1976 j = -1; 2258 DoLog(1) && (Log() << Verbose(1) << "Centering atoms in config file within given simulation box." << endl); 2259 double * const cell_size = World::get()->cell_size; 1977 Log() << Verbose(1) << "Centering atoms in config file within given simulation box." << endl; 2260 1978 for (int i=0;i<6;i++) { 2261 cell_size[i] = atof(argv[argptr+i]);1979 mol->cell_size[i] = atof(argv[argptr+i]); 2262 1980 } 2263 1981 // center … … 2270 1988 if ((argptr+2 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) { 2271 1989 ExitFlag = 255; 2272 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for centering with boundary: -c <boundary_x> <boundary_y> <boundary_z>" << endl);1990 eLog() << Verbose(0) << "Not enough or invalid arguments given for centering with boundary: -c <boundary_x> <boundary_y> <boundary_z>" << endl; 2273 1991 performCriticalExit(); 2274 1992 } else { 2275 1993 SaveFlag = true; 2276 1994 j = -1; 2277 DoLog(1) && (Log() << Verbose(1) << "Centering atoms in config file within given additional boundary." << endl);1995 Log() << Verbose(1) << "Centering atoms in config file within given additional boundary." << endl; 2278 1996 // make every coordinate positive 2279 1997 mol->CenterEdge(&x); … … 2281 1999 mol->SetBoxDimension(&x); 2282 2000 // translate each coordinate by boundary 2283 double * const cell_size = World::get()->cell_size;2284 2001 j=-1; 2285 2002 for (int i=0;i<NDIM;i++) { 2286 2003 j += i+1; 2287 2004 x.x[i] = atof(argv[argptr+i]); 2288 cell_size[j] += x.x[i]*2.;2005 mol->cell_size[j] += x.x[i]*2.; 2289 2006 } 2290 2007 mol->Translate((const Vector *)&x); … … 2295 2012 if (ExitFlag == 0) ExitFlag = 1; 2296 2013 SaveFlag = true; 2297 DoLog(1) && (Log() << Verbose(1) << "Centering atoms on edge and setting box dimensions." << endl);2014 Log() << Verbose(1) << "Centering atoms on edge and setting box dimensions." << endl; 2298 2015 x.Zero(); 2299 2016 mol->CenterEdge(&x); … … 2305 2022 if ((argptr >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr]))) { 2306 2023 ExitFlag = 255; 2307 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for removing atoms: -r <id>" << endl);2024 eLog() << Verbose(0) << "Not enough or invalid arguments given for removing atoms: -r <id>" << endl; 2308 2025 performCriticalExit(); 2309 2026 } else { 2310 2027 SaveFlag = true; 2311 DoLog(1) && (Log() << Verbose(1) << "Removing atom " << argv[argptr] << "." << endl);2028 Log() << Verbose(1) << "Removing atom " << argv[argptr] << "." << endl; 2312 2029 atom *first = mol->FindAtom(atoi(argv[argptr])); 2313 2030 mol->RemoveAtom(first); … … 2319 2036 if ((argptr+1 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1]))) { 2320 2037 ExitFlag = 255; 2321 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments for fragmentation: -f <max. bond distance> <bond order>" << endl);2038 eLog() << Verbose(0) << "Not enough or invalid arguments for fragmentation: -f <max. bond distance> <bond order>" << endl; 2322 2039 performCriticalExit(); 2323 2040 } else { 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);2041 Log() << Verbose(0) << "Fragmenting molecule with bond distance " << argv[argptr] << " angstroem, order of " << argv[argptr+1] << "." << endl; 2042 Log() << Verbose(0) << "Creating connection matrix..." << endl; 2326 2043 start = clock(); 2327 2044 mol->CreateAdjacencyList(atof(argv[argptr++]), configuration.GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL); 2328 DoLog(0) && (Log() << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl);2045 Log() << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl; 2329 2046 if (mol->first->next != mol->last) { 2330 2047 ExitFlag = mol->FragmentMolecule(atoi(argv[argptr]), &configuration); 2331 2048 } 2332 2049 end = clock(); 2333 DoLog(0) && (Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl);2050 Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl; 2334 2051 argptr+=2; 2335 2052 } … … 2339 2056 j = atoi(argv[argptr++]); 2340 2057 if ((j<0) || (j>1)) { 2341 DoeLog(1) && (eLog()<< Verbose(1) << "Argument of '-m' should be either 0 for no-rotate or 1 for rotate." << endl);2058 eLog() << Verbose(1) << "Argument of '-m' should be either 0 for no-rotate or 1 for rotate." << endl; 2342 2059 j = 0; 2343 2060 } 2344 2061 if (j) { 2345 2062 SaveFlag = true; 2346 DoLog(0) && (Log() << Verbose(0) << "Converting to prinicipal axis system." << endl);2063 Log() << Verbose(0) << "Converting to prinicipal axis system." << endl; 2347 2064 } else 2348 DoLog(0) && (Log() << Verbose(0) << "Evaluating prinicipal axis." << endl);2065 Log() << Verbose(0) << "Evaluating prinicipal axis." << endl; 2349 2066 mol->PrincipalAxisSystem((bool)j); 2350 2067 break; … … 2353 2070 if ((argptr+1 >= argc) || (argv[argptr][0] == '-')){ 2354 2071 ExitFlag = 255; 2355 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for convex envelope: -o <convex output file> <non-convex output file>" << endl);2072 eLog() << Verbose(0) << "Not enough or invalid arguments given for convex envelope: -o <convex output file> <non-convex output file>" << endl; 2356 2073 performCriticalExit(); 2357 2074 } else { 2358 2075 class Tesselation *TesselStruct = NULL; 2359 2076 const LinkedCell *LCList = NULL; 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);2077 Log() << Verbose(0) << "Evaluating volume of the convex envelope."; 2078 Log() << Verbose(1) << "Storing tecplot convex data in " << argv[argptr] << "." << endl; 2079 Log() << Verbose(1) << "Storing tecplot non-convex data in " << argv[argptr+1] << "." << endl; 2363 2080 LCList = new LinkedCell(mol, 10.); 2364 2081 //FindConvexBorder(mol, LCList, argv[argptr]); … … 2367 2084 double volumedifference = ConvexizeNonconvexEnvelope(TesselStruct, mol, argv[argptr]); 2368 2085 double clustervolume = VolumeOfConvexEnvelope(TesselStruct, &configuration); 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);2086 Log() << Verbose(0) << "The tesselated volume area is " << clustervolume << " " << (configuration.GetIsAngstroem() ? "angstrom" : "atomiclength") << "^3." << endl; 2087 Log() << Verbose(0) << "The non-convex tesselated volume area is " << clustervolume-volumedifference << " " << (configuration.GetIsAngstroem() ? "angstrom" : "atomiclength") << "^3." << endl; 2371 2088 delete(TesselStruct); 2372 2089 delete(LCList); … … 2378 2095 if ((argptr+1 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) ) { 2379 2096 ExitFlag = 255; 2380 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for suspension with specified volume: -U <volume> <density>" << endl);2097 eLog() << Verbose(0) << "Not enough or invalid arguments given for suspension with specified volume: -U <volume> <density>" << endl; 2381 2098 performCriticalExit(); 2382 2099 } else { 2383 2100 volume = atof(argv[argptr++]); 2384 DoLog(0) && (Log() << Verbose(0) << "Using " << volume << " angstrom^3 as the volume instead of convex envelope one's." << endl);2101 Log() << Verbose(0) << "Using " << volume << " angstrom^3 as the volume instead of convex envelope one's." << endl; 2385 2102 } 2386 2103 case 'u': … … 2389 2106 if (volume != -1) 2390 2107 ExitFlag = 255; 2391 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for suspension: -u <density>" << endl);2108 eLog() << Verbose(0) << "Not enough arguments given for suspension: -u <density>" << endl; 2392 2109 performCriticalExit(); 2393 2110 } else { 2394 2111 double density; 2395 2112 SaveFlag = true; 2396 DoLog(0) && (Log() << Verbose(0) << "Evaluating necessary cell volume for a cluster suspended in water.");2113 Log() << Verbose(0) << "Evaluating necessary cell volume for a cluster suspended in water."; 2397 2114 density = atof(argv[argptr++]); 2398 2115 if (density < 1.0) { 2399 DoeLog(1) && (eLog()<< Verbose(1) << "Density must be greater than 1.0g/cm^3 !" << endl);2116 eLog() << Verbose(1) << "Density must be greater than 1.0g/cm^3 !" << endl; 2400 2117 density = 1.3; 2401 2118 } … … 2403 2120 // repetition[i] = atoi(argv[argptr++]); 2404 2121 // if (repetition[i] < 1) 2405 // DoeLog(1) && (eLog()<< Verbose(1) << "repetition value must be greater 1!" << endl);2122 // eLog() << Verbose(1) << "repetition value must be greater 1!" << endl; 2406 2123 // repetition[i] = 1; 2407 2124 // } … … 2413 2130 if ((argptr+2 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) { 2414 2131 ExitFlag = 255; 2415 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for repeating cells: -d <repeat_x> <repeat_y> <repeat_z>" << endl);2132 eLog() << Verbose(0) << "Not enough or invalid arguments given for repeating cells: -d <repeat_x> <repeat_y> <repeat_z>" << endl; 2416 2133 performCriticalExit(); 2417 2134 } else { 2418 2135 SaveFlag = true; 2419 double * const cell_size = World::get()->cell_size;2420 2136 for (int axis = 1; axis <= NDIM; axis++) { 2421 2137 int faktor = atoi(argv[argptr++]); … … 2424 2140 Vector ** vectors; 2425 2141 if (faktor < 1) { 2426 DoeLog(1) && (eLog()<< Verbose(1) << "Repetition factor mus be greater than 1!" << endl);2142 eLog() << Verbose(1) << "Repetition factor mus be greater than 1!" << endl; 2427 2143 faktor = 1; 2428 2144 } … … 2441 2157 } 2442 2158 if (count != j) 2443 DoeLog(1) && (eLog()<< Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl);2159 eLog() << Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl; 2444 2160 x.Zero(); 2445 2161 y.Zero(); 2446 y.x[abs(axis)-1] = cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] * abs(axis)/axis; // last term is for sign, first is for magnitude2162 y.x[abs(axis)-1] = mol->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] * abs(axis)/axis; // last term is for sign, first is for magnitude 2447 2163 for (int i=1;i<faktor;i++) { // then add this list with respective translation factor times 2448 2164 x.AddVector(&y); // per factor one cell width further … … 2465 2181 mol->Translate(&x); 2466 2182 } 2467 cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor;2183 mol->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor; 2468 2184 } 2469 2185 } … … 2482 2198 } else { // no arguments, hence scan the elements db 2483 2199 if (periode->LoadPeriodentafel(configuration.databasepath)) 2484 DoLog(0) && (Log() << Verbose(0) << "Element list loaded successfully." << endl);2200 Log() << Verbose(0) << "Element list loaded successfully." << endl; 2485 2201 else 2486 DoLog(0) && (Log() << Verbose(0) << "Element list loading failed." << endl);2202 Log() << Verbose(0) << "Element list loading failed." << endl; 2487 2203 configuration.RetrieveConfigPathAndName("main_pcp_linux"); 2488 2204 } … … 2505 2221 char *ConfigFileName = NULL; 2506 2222 int j; 2507 2508 cout << ESPACKVersion << endl;2509 2510 DoLog(1) && (Log() << Verbose(1) << "test" << endl);2511 DoLog(3) && (Log() << Verbose(1) << "test");2512 2223 2513 2224 setVerbosity(0); … … 2537 2248 if (molecules->ListOfMolecules.size() == 0) { 2538 2249 mol = new molecule(periode); 2539 double * const cell_size = World::get()->cell_size; 2540 if (cell_size[0] == 0.) { 2541 DoLog(0) && (Log() << Verbose(0) << "enter lower tridiagonal form of basis matrix" << endl << endl); 2250 if (mol->cell_size[0] == 0.) { 2251 Log() << Verbose(0) << "enter lower tridiagonal form of basis matrix" << endl << endl; 2542 2252 for (int i=0;i<6;i++) { 2543 DoLog(1) && (Log() << Verbose(1) << "Cell size" << i << ": ");2544 cin >> cell_size[i];2253 Log() << Verbose(1) << "Cell size" << i << ": "; 2254 cin >> mol->cell_size[i]; 2545 2255 } 2546 2256 } … … 2552 2262 2553 2263 // now the main construction loop 2554 DoLog(0) && (Log() << Verbose(0) << endl << "Now comes the real construction..." << endl);2264 Log() << Verbose(0) << endl << "Now comes the real construction..." << endl; 2555 2265 do { 2556 DoLog(0) && (Log() << Verbose(0) << endl << endl);2557 DoLog(0) && (Log() << Verbose(0) << "============Molecule list=======================" << endl);2266 Log() << Verbose(0) << endl << endl; 2267 Log() << Verbose(0) << "============Molecule list=======================" << endl; 2558 2268 molecules->Enumerate((ofstream *)&cout); 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: ");2269 Log() << Verbose(0) << "============Menu===============================" << endl; 2270 Log() << Verbose(0) << "a - set molecule (in)active" << endl; 2271 Log() << Verbose(0) << "e - edit molecules (load, parse, save)" << endl; 2272 Log() << Verbose(0) << "g - globally manipulate atoms in molecule" << endl; 2273 Log() << Verbose(0) << "M - Merge molecules" << endl; 2274 Log() << Verbose(0) << "m - manipulate atoms" << endl; 2275 Log() << Verbose(0) << "-----------------------------------------------" << endl; 2276 Log() << Verbose(0) << "c - edit the current configuration" << endl; 2277 Log() << Verbose(0) << "-----------------------------------------------" << endl; 2278 Log() << Verbose(0) << "s - save current setup to config file" << endl; 2279 Log() << Verbose(0) << "T - call the current test routine" << endl; 2280 Log() << Verbose(0) << "q - quit" << endl; 2281 Log() << Verbose(0) << "===============================================" << endl; 2282 Log() << Verbose(0) << "Input: "; 2573 2283 cin >> choice; 2574 2284 … … 2576 2286 case 'a': // (in)activate molecule 2577 2287 { 2578 DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule: ");2288 Log() << Verbose(0) << "Enter index of molecule: "; 2579 2289 cin >> j; 2580 2290 for(MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) … … 2622 2332 // save element data base 2623 2333 if (periode->StorePeriodentafel(configuration->databasepath)) //ElementsFileName 2624 DoLog(0) && (Log() << Verbose(0) << "Saving of elements.db successful." << endl);2334 Log() << Verbose(0) << "Saving of elements.db successful." << endl; 2625 2335 else 2626 DoLog(0) && (Log() << Verbose(0) << "Saving of elements.db failed." << endl);2336 Log() << Verbose(0) << "Saving of elements.db failed." << endl; 2627 2337 2628 2338 delete(molecules); // also free's all molecules contained
Note:
See TracChangeset
for help on using the changeset viewer.
