Changeset 5f612ee for src/builder.cpp
- Timestamp:
- Apr 27, 2010, 2:25:42 PM (15 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- 632bc3
- Parents:
- 13d5a9 (diff), c695c9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/builder.cpp
r13d5a9 r5f612ee 54 54 #include <cstring> 55 55 56 #include "analysis_bonds.hpp" 56 57 #include "analysis_correlation.hpp" 57 58 #include "atom.hpp" … … 79 80 #include "World.hpp" 80 81 #include "version.h" 82 #include "World.hpp" 81 83 82 84 /********************************************* Subsubmenu routine ************************************/ … … 95 97 bool valid; 96 98 97 Log()<< Verbose(0) << "===========ADD ATOM============================" << endl;98 Log()<< Verbose(0) << " a - state absolute coordinates of atom" << endl;99 Log()<< Verbose(0) << " b - state relative coordinates of atom wrt to reference point" << endl;100 Log()<< Verbose(0) << " c - state relative coordinates of atom wrt to already placed atom" << endl;101 Log()<< Verbose(0) << " d - state two atoms, two angles and a distance" << endl;102 Log()<< Verbose(0) << " e - least square distance position to a set of atoms" << endl;103 Log()<< Verbose(0) << "all else - go back" << endl;104 Log()<< Verbose(0) << "===============================================" << endl;105 Log()<< Verbose(0) << "Note: Specifiy angles in degrees not multiples of Pi!" << endl;106 Log()<< Verbose(0) << "INPUT: ";99 cout << Verbose(0) << "===========ADD ATOM============================" << endl; 100 cout << Verbose(0) << " a - state absolute coordinates of atom" << endl; 101 cout << Verbose(0) << " b - state relative coordinates of atom wrt to reference point" << endl; 102 cout << Verbose(0) << " c - state relative coordinates of atom wrt to already placed atom" << endl; 103 cout << Verbose(0) << " d - state two atoms, two angles and a distance" << endl; 104 cout << Verbose(0) << " e - least square distance position to a set of atoms" << endl; 105 cout << Verbose(0) << "all else - go back" << endl; 106 cout << Verbose(0) << "===============================================" << endl; 107 cout << Verbose(0) << "Note: Specifiy angles in degrees not multiples of Pi!" << endl; 108 cout << Verbose(0) << "INPUT: "; 107 109 cin >> choice; 108 110 109 111 switch (choice) { 110 112 default: 111 eLog() << Verbose(2) << "Not a valid choice." << endl;113 DoeLog(2) && (eLog()<< Verbose(2) << "Not a valid choice." << endl); 112 114 break; 113 115 case 'a': // absolute coordinates of atom 114 Log()<< Verbose(0) << "Enter absolute coordinates." << endl;116 cout << Verbose(0) << "Enter absolute coordinates." << endl; 115 117 first = new atom; 116 first->x.AskPosition( mol->cell_size, false);118 first->x.AskPosition(World::getInstance().getDomain(), false); 117 119 first->type = periode->AskElement(); // give type 118 120 mol->AddAtom(first); // add to molecule … … 123 125 valid = true; 124 126 do { 125 if (!valid) eLog() << Verbose(2) << "Resulting position out of cell." << endl;126 Log()<< Verbose(0) << "Enter reference coordinates." << endl;127 x.AskPosition( mol->cell_size, true);128 Log()<< Verbose(0) << "Enter relative coordinates." << endl;129 first->x.AskPosition( mol->cell_size, false);127 if (!valid) DoeLog(2) && (eLog()<< Verbose(2) << "Resulting position out of cell." << endl); 128 cout << Verbose(0) << "Enter reference coordinates." << endl; 129 x.AskPosition(World::getInstance().getDomain(), true); 130 cout << Verbose(0) << "Enter relative coordinates." << endl; 131 first->x.AskPosition(World::getInstance().getDomain(), false); 130 132 first->x.AddVector((const Vector *)&x); 131 Log()<< Verbose(0) << "\n";133 cout << Verbose(0) << "\n"; 132 134 } while (!(valid = mol->CheckBounds((const Vector *)&first->x))); 133 135 first->type = periode->AskElement(); // give type … … 139 141 valid = true; 140 142 do { 141 if (!valid) eLog() << Verbose(2) << "Resulting position out of cell." << endl;143 if (!valid) DoeLog(2) && (eLog()<< Verbose(2) << "Resulting position out of cell." << endl); 142 144 second = mol->AskAtom("Enter atom number: "); 143 Log() << Verbose(0) << "Enter relative coordinates." << endl;144 first->x.AskPosition( mol->cell_size, false);145 DoLog(0) && (Log() << Verbose(0) << "Enter relative coordinates." << endl); 146 first->x.AskPosition(World::getInstance().getDomain(), false); 145 147 for (int i=NDIM;i--;) { 146 148 first->x.x[i] += second->x.x[i]; … … 156 158 do { 157 159 if (!valid) { 158 eLog() << Verbose(2) << "Resulting coordinates out of cell - " << first->x << endl;160 DoeLog(2) && (eLog()<< Verbose(2) << "Resulting coordinates out of cell - " << first->x << endl); 159 161 } 160 Log()<< Verbose(0) << "First, we need two atoms, the first atom is the central, while the second is the outer one." << endl;162 cout << Verbose(0) << "First, we need two atoms, the first atom is the central, while the second is the outer one." << endl; 161 163 second = mol->AskAtom("Enter central atom: "); 162 164 third = mol->AskAtom("Enter second atom (specifying the axis for first angle): "); … … 169 171 c *= M_PI/180.; 170 172 bound(&c, -M_PI, M_PI); 171 Log()<< Verbose(0) << "radius: " << a << "\t phi: " << b*180./M_PI << "\t theta: " << c*180./M_PI << endl;173 cout << Verbose(0) << "radius: " << a << "\t phi: " << b*180./M_PI << "\t theta: " << c*180./M_PI << endl; 172 174 /* 173 175 second->Output(1,1,(ofstream *)&cout); … … 181 183 182 184 if (!z.SolveSystem(&x,&y,&n, b, c, a)) { 183 Log() << Verbose(0) << "Failure solving self-dependent linear system!" << endl;185 coutg() << Verbose(0) << "Failure solving self-dependent linear system!" << endl; 184 186 continue; 185 187 } 186 Log() << Verbose(0) << "resulting relative coordinates: ";188 DoLog(0) && (Log() << Verbose(0) << "resulting relative coordinates: "); 187 189 z.Output(); 188 Log() << Verbose(0) << endl;190 DoLog(0) && (Log() << Verbose(0) << endl); 189 191 */ 190 192 // calc axis vector … … 194 196 Log() << Verbose(0) << "x: ", 195 197 x.Output(); 196 Log() << Verbose(0) << endl;198 DoLog(0) && (Log() << Verbose(0) << endl); 197 199 z.MakeNormalVector(&second->x,&third->x,&fourth->x); 198 200 Log() << Verbose(0) << "z: ", 199 201 z.Output(); 200 Log() << Verbose(0) << endl;202 DoLog(0) && (Log() << Verbose(0) << endl); 201 203 y.MakeNormalVector(&x,&z); 202 204 Log() << Verbose(0) << "y: ", 203 205 y.Output(); 204 Log() << Verbose(0) << endl;206 DoLog(0) && (Log() << Verbose(0) << endl); 205 207 206 208 // rotate vector around first angle … … 209 211 Log() << Verbose(0) << "Rotated vector: ", 210 212 first->x.Output(); 211 Log() << Verbose(0) << endl;213 DoLog(0) && (Log() << Verbose(0) << endl); 212 214 // remove the projection onto the rotation plane of the second angle 213 215 n.CopyVector(&y); … … 215 217 Log() << Verbose(0) << "N1: ", 216 218 n.Output(); 217 Log() << Verbose(0) << endl;219 DoLog(0) && (Log() << Verbose(0) << endl); 218 220 first->x.SubtractVector(&n); 219 221 Log() << Verbose(0) << "Subtracted vector: ", 220 222 first->x.Output(); 221 Log() << Verbose(0) << endl;223 DoLog(0) && (Log() << Verbose(0) << endl); 222 224 n.CopyVector(&z); 223 225 n.Scale(first->x.ScalarProduct(&z)); 224 226 Log() << Verbose(0) << "N2: ", 225 227 n.Output(); 226 Log() << Verbose(0) << endl;228 DoLog(0) && (Log() << Verbose(0) << endl); 227 229 first->x.SubtractVector(&n); 228 230 Log() << Verbose(0) << "2nd subtracted vector: ", 229 231 first->x.Output(); 230 Log() << Verbose(0) << endl;232 DoLog(0) && (Log() << Verbose(0) << endl); 231 233 232 234 // rotate another vector around second angle … … 235 237 Log() << Verbose(0) << "2nd Rotated vector: ", 236 238 n.Output(); 237 Log() << Verbose(0) << endl;239 DoLog(0) && (Log() << Verbose(0) << endl); 238 240 239 241 // add the two linear independent vectors … … 243 245 first->x.AddVector(&second->x); 244 246 245 Log() << Verbose(0) << "resulting coordinates: ";247 DoLog(0) && (Log() << Verbose(0) << "resulting coordinates: "); 246 248 first->x.Output(); 247 Log() << Verbose(0) << endl;249 DoLog(0) && (Log() << Verbose(0) << endl); 248 250 } while (!(valid = mol->CheckBounds((const Vector *)&first->x))); 249 251 first->type = periode->AskElement(); // give type … … 258 260 atoms[i] = NULL; 259 261 int i=0, j=0; 260 Log()<< Verbose(0) << "Now we need at least three molecules.\n";262 cout << Verbose(0) << "Now we need at least three molecules.\n"; 261 263 do { 262 Log()<< Verbose(0) << "Enter " << i+1 << "th atom: ";264 cout << Verbose(0) << "Enter " << i+1 << "th atom: "; 263 265 cin >> j; 264 266 if (j != -1) { … … 274 276 } else { 275 277 delete first; 276 Log()<< Verbose(0) << "Please enter at least two vectors!\n";278 cout << Verbose(0) << "Please enter at least two vectors!\n"; 277 279 } 278 280 break; … … 288 290 char choice; // menu choice char 289 291 290 Log()<< Verbose(0) << "===========CENTER ATOMS=========================" << endl;291 Log()<< Verbose(0) << " a - on origin" << endl;292 Log()<< Verbose(0) << " b - on center of gravity" << endl;293 Log()<< Verbose(0) << " c - within box with additional boundary" << endl;294 Log()<< Verbose(0) << " d - within given simulation box" << endl;295 Log()<< Verbose(0) << "all else - go back" << endl;296 Log()<< Verbose(0) << "===============================================" << endl;297 Log()<< Verbose(0) << "INPUT: ";292 cout << Verbose(0) << "===========CENTER ATOMS=========================" << endl; 293 cout << Verbose(0) << " a - on origin" << endl; 294 cout << Verbose(0) << " b - on center of gravity" << endl; 295 cout << Verbose(0) << " c - within box with additional boundary" << endl; 296 cout << Verbose(0) << " d - within given simulation box" << endl; 297 cout << Verbose(0) << "all else - go back" << endl; 298 cout << Verbose(0) << "===============================================" << endl; 299 cout << Verbose(0) << "INPUT: "; 298 300 cin >> choice; 299 301 300 302 switch (choice) { 301 303 default: 302 Log()<< Verbose(0) << "Not a valid choice." << endl;304 cout << Verbose(0) << "Not a valid choice." << endl; 303 305 break; 304 306 case 'a': 305 Log()<< Verbose(0) << "Centering atoms in config file on origin." << endl;307 cout << Verbose(0) << "Centering atoms in config file on origin." << endl; 306 308 mol->CenterOrigin(); 307 309 break; 308 310 case 'b': 309 Log()<< Verbose(0) << "Centering atoms in config file on center of gravity." << endl;311 cout << Verbose(0) << "Centering atoms in config file on center of gravity." << endl; 310 312 mol->CenterPeriodic(); 311 313 break; 312 314 case 'c': 313 Log()<< Verbose(0) << "Centering atoms in config file within given additional boundary." << endl;315 cout << Verbose(0) << "Centering atoms in config file within given additional boundary." << endl; 314 316 for (int i=0;i<NDIM;i++) { 315 Log()<< Verbose(0) << "Enter axis " << i << " boundary: ";317 cout << Verbose(0) << "Enter axis " << i << " boundary: "; 316 318 cin >> y.x[i]; 317 319 } … … 324 326 break; 325 327 case 'd': 326 Log()<< Verbose(1) << "Centering atoms in config file within given simulation box." << endl;328 cout << Verbose(1) << "Centering atoms in config file within given simulation box." << endl; 327 329 for (int i=0;i<NDIM;i++) { 328 Log()<< Verbose(0) << "Enter axis " << i << " boundary: ";330 cout << Verbose(0) << "Enter axis " << i << " boundary: "; 329 331 cin >> x.x[i]; 330 332 } … … 347 349 char choice; // menu choice char 348 350 349 Log()<< Verbose(0) << "===========ALIGN ATOMS=========================" << endl;350 Log()<< Verbose(0) << " a - state three atoms defining align plane" << endl;351 Log()<< Verbose(0) << " b - state alignment vector" << endl;352 Log()<< Verbose(0) << " c - state two atoms in alignment direction" << endl;353 Log()<< Verbose(0) << " d - align automatically by least square fit" << endl;354 Log()<< Verbose(0) << "all else - go back" << endl;355 Log()<< Verbose(0) << "===============================================" << endl;356 Log()<< Verbose(0) << "INPUT: ";351 cout << Verbose(0) << "===========ALIGN ATOMS=========================" << endl; 352 cout << Verbose(0) << " a - state three atoms defining align plane" << endl; 353 cout << Verbose(0) << " b - state alignment vector" << endl; 354 cout << Verbose(0) << " c - state two atoms in alignment direction" << endl; 355 cout << Verbose(0) << " d - align automatically by least square fit" << endl; 356 cout << Verbose(0) << "all else - go back" << endl; 357 cout << Verbose(0) << "===============================================" << endl; 358 cout << Verbose(0) << "INPUT: "; 357 359 cin >> choice; 358 360 … … 367 369 break; 368 370 case 'b': // normal vector of mirror plane 369 Log()<< Verbose(0) << "Enter normal vector of mirror plane." << endl;370 n.AskPosition( mol->cell_size,0);371 cout << Verbose(0) << "Enter normal vector of mirror plane." << endl; 372 n.AskPosition(World::getInstance().getDomain(),0); 371 373 n.Normalize(); 372 374 break; … … 387 389 fscanf(stdin, "%3s", shorthand); 388 390 } while ((param.type = periode->FindElement(shorthand)) == NULL); 389 Log()<< Verbose(0) << "Element is " << param.type->name << endl;391 cout << Verbose(0) << "Element is " << param.type->name << endl; 390 392 mol->GetAlignvector(¶m); 391 393 for (int i=NDIM;i--;) { … … 394 396 } 395 397 gsl_vector_free(param.x); 396 Log()<< Verbose(0) << "Offset vector: ";398 cout << Verbose(0) << "Offset vector: "; 397 399 x.Output(); 398 Log() << Verbose(0) << endl;400 DoLog(0) && (Log() << Verbose(0) << endl); 399 401 n.Normalize(); 400 402 break; 401 403 }; 402 Log() << Verbose(0) << "Alignment vector: ";404 DoLog(0) && (Log() << Verbose(0) << "Alignment vector: "); 403 405 n.Output(); 404 Log() << Verbose(0) << endl;406 DoLog(0) && (Log() << Verbose(0) << endl); 405 407 mol->Align(&n); 406 408 }; … … 415 417 char choice; // menu choice char 416 418 417 Log() << Verbose(0) << "===========MIRROR ATOMS=========================" << endl;418 Log() << Verbose(0) << " a - state three atoms defining mirror plane" << endl;419 Log() << Verbose(0) << " b - state normal vector of mirror plane" << endl;420 Log() << Verbose(0) << " c - state two atoms in normal direction" << endl;421 Log() << Verbose(0) << "all else - go back" << endl;422 Log() << Verbose(0) << "===============================================" << endl;423 Log() << Verbose(0) << "INPUT: ";419 DoLog(0) && (Log() << Verbose(0) << "===========MIRROR ATOMS=========================" << endl); 420 DoLog(0) && (Log() << Verbose(0) << " a - state three atoms defining mirror plane" << endl); 421 DoLog(0) && (Log() << Verbose(0) << " b - state normal vector of mirror plane" << endl); 422 DoLog(0) && (Log() << Verbose(0) << " c - state two atoms in normal direction" << endl); 423 DoLog(0) && (Log() << Verbose(0) << "all else - go back" << endl); 424 DoLog(0) && (Log() << Verbose(0) << "===============================================" << endl); 425 DoLog(0) && (Log() << Verbose(0) << "INPUT: "); 424 426 cin >> choice; 425 427 … … 434 436 break; 435 437 case 'b': // normal vector of mirror plane 436 Log() << Verbose(0) << "Enter normal vector of mirror plane." << endl;437 n.AskPosition( mol->cell_size,0);438 DoLog(0) && (Log() << Verbose(0) << "Enter normal vector of mirror plane." << endl); 439 n.AskPosition(World::getInstance().getDomain(),0); 438 440 n.Normalize(); 439 441 break; … … 447 449 break; 448 450 }; 449 Log() << Verbose(0) << "Normal vector: ";451 DoLog(0) && (Log() << Verbose(0) << "Normal vector: "); 450 452 n.Output(); 451 Log() << Verbose(0) << endl;453 DoLog(0) && (Log() << Verbose(0) << endl); 452 454 mol->Mirror((const Vector *)&n); 453 455 }; … … 463 465 char choice; // menu choice char 464 466 465 Log() << Verbose(0) << "===========REMOVE ATOMS=========================" << endl;466 Log() << Verbose(0) << " a - state atom for removal by number" << endl;467 Log() << Verbose(0) << " b - keep only in radius around atom" << endl;468 Log() << Verbose(0) << " c - remove this with one axis greater value" << endl;469 Log() << Verbose(0) << "all else - go back" << endl;470 Log() << Verbose(0) << "===============================================" << endl;471 Log() << Verbose(0) << "INPUT: ";467 DoLog(0) && (Log() << Verbose(0) << "===========REMOVE ATOMS=========================" << endl); 468 DoLog(0) && (Log() << Verbose(0) << " a - state atom for removal by number" << endl); 469 DoLog(0) && (Log() << Verbose(0) << " b - keep only in radius around atom" << endl); 470 DoLog(0) && (Log() << Verbose(0) << " c - remove this with one axis greater value" << endl); 471 DoLog(0) && (Log() << Verbose(0) << "all else - go back" << endl); 472 DoLog(0) && (Log() << Verbose(0) << "===============================================" << endl); 473 DoLog(0) && (Log() << Verbose(0) << "INPUT: "); 472 474 cin >> choice; 473 475 … … 476 478 case 'a': 477 479 if (mol->RemoveAtom(mol->AskAtom("Enter number of atom within molecule: "))) 478 Log() << Verbose(1) << "Atom removed." << endl;480 DoLog(1) && (Log() << Verbose(1) << "Atom removed." << endl); 479 481 else 480 Log() << Verbose(1) << "Atom not found." << endl;482 DoLog(1) && (Log() << Verbose(1) << "Atom not found." << endl); 481 483 break; 482 484 case 'b': 483 485 second = mol->AskAtom("Enter number of atom as reference point: "); 484 Log() << Verbose(0) << "Enter radius: ";486 DoLog(0) && (Log() << Verbose(0) << "Enter radius: "); 485 487 cin >> tmp1; 486 488 first = mol->start; … … 494 496 break; 495 497 case 'c': 496 Log() << Verbose(0) << "Which axis is it: ";498 DoLog(0) && (Log() << Verbose(0) << "Which axis is it: "); 497 499 cin >> axis; 498 Log() << Verbose(0) << "Lower boundary: ";500 DoLog(0) && (Log() << Verbose(0) << "Lower boundary: "); 499 501 cin >> tmp1; 500 Log() << Verbose(0) << "Upper boundary: ";502 DoLog(0) && (Log() << Verbose(0) << "Upper boundary: "); 501 503 cin >> tmp2; 502 504 first = mol->start; … … 528 530 char choice; // menu choice char 529 531 530 Log() << Verbose(0) << "===========MEASURE ATOMS=========================" << endl;531 Log() << Verbose(0) << " a - calculate bond length between one atom and all others" << endl;532 Log() << Verbose(0) << " b - calculate bond length between two atoms" << endl;533 Log() << Verbose(0) << " c - calculate bond angle" << endl;534 Log() << Verbose(0) << " d - calculate principal axis of the system" << endl;535 Log() << Verbose(0) << " e - calculate volume of the convex envelope" << endl;536 Log() << Verbose(0) << " f - calculate temperature from current velocity" << endl;537 Log() << Verbose(0) << " g - output all temperatures per step from velocities" << endl;538 Log() << Verbose(0) << "all else - go back" << endl;539 Log() << Verbose(0) << "===============================================" << endl;540 Log() << Verbose(0) << "INPUT: ";532 DoLog(0) && (Log() << Verbose(0) << "===========MEASURE ATOMS=========================" << endl); 533 DoLog(0) && (Log() << Verbose(0) << " a - calculate bond length between one atom and all others" << endl); 534 DoLog(0) && (Log() << Verbose(0) << " b - calculate bond length between two atoms" << endl); 535 DoLog(0) && (Log() << Verbose(0) << " c - calculate bond angle" << endl); 536 DoLog(0) && (Log() << Verbose(0) << " d - calculate principal axis of the system" << endl); 537 DoLog(0) && (Log() << Verbose(0) << " e - calculate volume of the convex envelope" << endl); 538 DoLog(0) && (Log() << Verbose(0) << " f - calculate temperature from current velocity" << endl); 539 DoLog(0) && (Log() << Verbose(0) << " g - output all temperatures per step from velocities" << endl); 540 DoLog(0) && (Log() << Verbose(0) << "all else - go back" << endl); 541 DoLog(0) && (Log() << Verbose(0) << "===============================================" << endl); 542 DoLog(0) && (Log() << Verbose(0) << "INPUT: "); 541 543 cin >> choice; 542 544 543 545 switch(choice) { 544 546 default: 545 Log() << Verbose(1) << "Not a valid choice." << endl;547 DoLog(1) && (Log() << Verbose(1) << "Not a valid choice." << endl); 546 548 break; 547 549 case 'a': … … 575 577 x.SubtractVector((const Vector *)&second->x); 576 578 tmp1 = x.Norm(); 577 Log() << Verbose(1) << "Distance vector is ";579 DoLog(1) && (Log() << Verbose(1) << "Distance vector is "); 578 580 x.Output(); 579 Log() << Verbose(0) << "." << endl << "Norm of distance is " << tmp1 << "." << endl;581 DoLog(0) && (Log() << Verbose(0) << "." << endl << "Norm of distance is " << tmp1 << "." << endl); 580 582 break; 581 583 582 584 case 'c': 583 Log() << Verbose(0) << "Evaluating bond angle between three - first, central, last - atoms." << endl;585 DoLog(0) && (Log() << Verbose(0) << "Evaluating bond angle between three - first, central, last - atoms." << endl); 584 586 first = mol->AskAtom("Enter first atom: "); 585 587 second = mol->AskAtom("Enter central atom: "); … … 590 592 y.CopyVector((const Vector *)&third->x); 591 593 y.SubtractVector((const Vector *)&second->x); 592 Log() << Verbose(0) << "Bond angle between first atom Nr." << first->nr << ", central atom Nr." << second->nr << " and last atom Nr." << third->nr << ": ";593 Log() << Verbose(0) << (acos(x.ScalarProduct((const Vector *)&y)/(y.Norm()*x.Norm()))/M_PI*180.) << " degrees" << endl;594 DoLog(0) && (Log() << Verbose(0) << "Bond angle between first atom Nr." << first->nr << ", central atom Nr." << second->nr << " and last atom Nr." << third->nr << ": "); 595 DoLog(0) && (Log() << Verbose(0) << (acos(x.ScalarProduct((const Vector *)&y)/(y.Norm()*x.Norm()))/M_PI*180.) << " degrees" << endl); 594 596 break; 595 597 case 'd': 596 Log() << Verbose(0) << "Evaluating prinicipal axis." << endl;597 Log() << Verbose(0) << "Shall we rotate? [0/1]: ";598 DoLog(0) && (Log() << Verbose(0) << "Evaluating prinicipal axis." << endl); 599 DoLog(0) && (Log() << Verbose(0) << "Shall we rotate? [0/1]: "); 598 600 cin >> Z; 599 601 if ((Z >=0) && (Z <=1)) … … 604 606 case 'e': 605 607 { 606 Log() << Verbose(0) << "Evaluating volume of the convex envelope.";608 DoLog(0) && (Log() << Verbose(0) << "Evaluating volume of the convex envelope."); 607 609 class Tesselation *TesselStruct = NULL; 608 610 const LinkedCell *LCList = NULL; … … 610 612 FindConvexBorder(mol, TesselStruct, LCList, NULL); 611 613 double clustervolume = VolumeOfConvexEnvelope(TesselStruct, configuration); 612 Log() << Verbose(0) << "The tesselated surface area is " << clustervolume << "." << endl;\614 DoLog(0) && (Log() << Verbose(0) << "The tesselated surface area is " << clustervolume << "." << endl);\ 613 615 delete(LCList); 614 616 delete(TesselStruct); … … 621 623 { 622 624 char filename[255]; 623 Log() << Verbose(0) << "Please enter filename: " << endl;625 DoLog(0) && (Log() << Verbose(0) << "Please enter filename: " << endl); 624 626 cin >> filename; 625 Log() << Verbose(1) << "Storing temperatures in " << filename << "." << endl;627 DoLog(1) && (Log() << Verbose(1) << "Storing temperatures in " << filename << "." << endl); 626 628 ofstream *output = new ofstream(filename, ios::trunc); 627 629 if (!mol->OutputTemperatureFromTrajectories(output, 0, mol->MDSteps)) 628 Log() << Verbose(2) << "File could not be written." << endl;630 DoLog(2) && (Log() << Verbose(2) << "File could not be written." << endl); 629 631 else 630 Log() << Verbose(2) << "File stored." << endl;632 DoLog(2) && (Log() << Verbose(2) << "File stored." << endl); 631 633 output->close(); 632 634 delete(output); … … 645 647 clock_t start, end; 646 648 647 Log() << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl;648 Log() << Verbose(0) << "What's the desired bond order: ";649 DoLog(0) && (Log() << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl); 650 DoLog(0) && (Log() << Verbose(0) << "What's the desired bond order: "); 649 651 cin >> Order1; 650 652 if (mol->first->next != mol->last) { // there are bonds … … 652 654 mol->FragmentMolecule(Order1, configuration); 653 655 end = clock(); 654 Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl;656 DoLog(0) && (Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl); 655 657 } else 656 Log() << Verbose(0) << "Connection matrix has not yet been generated!" << endl;658 DoLog(0) && (Log() << Verbose(0) << "Connection matrix has not yet been generated!" << endl); 657 659 }; 658 660 … … 665 667 static void ManipulateAtoms(periodentafel *periode, MoleculeListClass *molecules, config *configuration) 666 668 { 667 atom *first, *second ;669 atom *first, *second, *third; 668 670 molecule *mol = NULL; 669 671 Vector x,y,z,n; // coordinates for absolute point in cell volume … … 673 675 bool valid; 674 676 675 Log() << Verbose(0) << "=========MANIPULATE ATOMS======================" << endl; 676 Log() << Verbose(0) << "a - add an atom" << endl; 677 Log() << Verbose(0) << "r - remove an atom" << endl; 678 Log() << Verbose(0) << "b - scale a bond between atoms" << endl; 679 Log() << Verbose(0) << "u - change an atoms element" << endl; 680 Log() << Verbose(0) << "l - measure lengths, angles, ... for an atom" << endl; 681 Log() << Verbose(0) << "all else - go back" << endl; 682 Log() << Verbose(0) << "===============================================" << endl; 677 DoLog(0) && (Log() << Verbose(0) << "=========MANIPULATE ATOMS======================" << endl); 678 DoLog(0) && (Log() << Verbose(0) << "a - add an atom" << endl); 679 DoLog(0) && (Log() << Verbose(0) << "r - remove an atom" << endl); 680 DoLog(0) && (Log() << Verbose(0) << "b - scale a bond between atoms" << endl); 681 DoLog(0) && (Log() << Verbose(0) << "t - turn an atom round another bond" << endl); 682 DoLog(0) && (Log() << Verbose(0) << "u - change an atoms element" << endl); 683 DoLog(0) && (Log() << Verbose(0) << "l - measure lengths, angles, ... for an atom" << endl); 684 DoLog(0) && (Log() << Verbose(0) << "all else - go back" << endl); 685 DoLog(0) && (Log() << Verbose(0) << "===============================================" << endl); 683 686 if (molecules->NumberOfActiveMolecules() > 1) 684 eLog() << Verbose(2) << "There is more than one molecule active! Atoms will be added to each." << endl;685 Log() << Verbose(0) << "INPUT: ";687 DoeLog(2) && (eLog()<< Verbose(2) << "There is more than one molecule active! Atoms will be added to each." << endl); 688 DoLog(0) && (Log() << Verbose(0) << "INPUT: "); 686 689 cin >> choice; 687 690 688 691 switch (choice) { 689 692 default: 690 Log() << Verbose(0) << "Not a valid choice." << endl;693 DoLog(0) && (Log() << Verbose(0) << "Not a valid choice." << endl); 691 694 break; 692 695 … … 695 698 if ((*ListRunner)->ActiveFlag) { 696 699 mol = *ListRunner; 697 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;700 DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl); 698 701 AddAtoms(periode, mol); 699 702 } … … 704 707 if ((*ListRunner)->ActiveFlag) { 705 708 mol = *ListRunner; 706 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;707 Log() << Verbose(0) << "Scaling bond length between two atoms." << endl;709 DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl); 710 DoLog(0) && (Log() << Verbose(0) << "Scaling bond length between two atoms." << endl); 708 711 first = mol->AskAtom("Enter first (fixed) atom: "); 709 712 second = mol->AskAtom("Enter second (shifting) atom: "); … … 712 715 minBond += (first->x.x[i]-second->x.x[i])*(first->x.x[i] - second->x.x[i]); 713 716 minBond = sqrt(minBond); 714 Log() << Verbose(0) << "Current Bond length between " << first->type->name << " Atom " << first->nr << " and " << second->type->name << " Atom " << second->nr << ": " << minBond << " a.u." << endl;715 Log() << Verbose(0) << "Enter new bond length [a.u.]: ";717 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); 718 DoLog(0) && (Log() << Verbose(0) << "Enter new bond length [a.u.]: "); 716 719 cin >> bond; 717 720 for (int i=NDIM;i--;) { … … 727 730 if ((*ListRunner)->ActiveFlag) { 728 731 mol = *ListRunner; 729 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;730 Log() << Verbose(0) << "Angstroem -> Bohrradius: 1.8897261\t\tBohrradius -> Angstroem: 0.52917721" << endl;731 Log() << Verbose(0) << "Enter three factors: ";732 DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl); 733 DoLog(0) && (Log() << Verbose(0) << "Angstroem -> Bohrradius: 1.8897261\t\tBohrradius -> Angstroem: 0.52917721" << endl); 734 DoLog(0) && (Log() << Verbose(0) << "Enter three factors: "); 732 735 factor = new double[NDIM]; 733 736 cin >> factor[0]; … … 744 747 if ((*ListRunner)->ActiveFlag) { 745 748 mol = *ListRunner; 746 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;749 DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl); 747 750 MeasureAtoms(periode, mol, configuration); 748 751 } … … 753 756 if ((*ListRunner)->ActiveFlag) { 754 757 mol = *ListRunner; 755 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;758 DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl); 756 759 RemoveAtoms(mol); 757 760 } 761 break; 762 763 case 't': // turn/rotate atom 764 for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) 765 if ((*ListRunner)->ActiveFlag) { 766 mol = *ListRunner; 767 DoLog(0) && (Log() << Verbose(0) << "Turning atom around another bond - first is atom to turn, second (central) and third specify bond" << endl); 768 first = mol->AskAtom("Enter turning atom: "); 769 second = mol->AskAtom("Enter central atom: "); 770 third = mol->AskAtom("Enter bond atom: "); 771 cout << Verbose(0) << "Enter new angle in degrees: "; 772 double tmp = 0.; 773 cin >> tmp; 774 // calculate old angle 775 x.CopyVector((const Vector *)&first->x); 776 x.SubtractVector((const Vector *)&second->x); 777 y.CopyVector((const Vector *)&third->x); 778 y.SubtractVector((const Vector *)&second->x); 779 double alpha = (acos(x.ScalarProduct((const Vector *)&y)/(y.Norm()*x.Norm()))/M_PI*180.); 780 cout << Verbose(0) << "Bond angle between first atom Nr." << first->nr << ", central atom Nr." << second->nr << " and last atom Nr." << third->nr << ": "; 781 cout << Verbose(0) << alpha << " degrees" << endl; 782 // rotate 783 z.MakeNormalVector(&x,&y); 784 x.RotateVector(&z,(alpha-tmp)*M_PI/180.); 785 x.AddVector(&second->x); 786 first->x.CopyVector(&x); 787 // check new angle 788 x.CopyVector((const Vector *)&first->x); 789 x.SubtractVector((const Vector *)&second->x); 790 alpha = (acos(x.ScalarProduct((const Vector *)&y)/(y.Norm()*x.Norm()))/M_PI*180.); 791 cout << Verbose(0) << "new Bond angle between first atom Nr." << first->nr << ", central atom Nr." << second->nr << " and last atom Nr." << third->nr << ": "; 792 cout << Verbose(0) << alpha << " degrees" << endl; 793 } 758 794 break; 759 795 … … 763 799 int Z; 764 800 mol = *ListRunner; 765 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;801 DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl); 766 802 first = NULL; 767 803 do { 768 Log() << Verbose(0) << "Change the element of which atom: ";804 DoLog(0) && (Log() << Verbose(0) << "Change the element of which atom: "); 769 805 cin >> Z; 770 806 } while ((first = mol->FindAtom(Z)) == NULL); 771 Log() << Verbose(0) << "New element by atomic number Z: ";807 DoLog(0) && (Log() << Verbose(0) << "New element by atomic number Z: "); 772 808 cin >> Z; 773 809 first->type = periode->FindElement(Z); 774 Log() << Verbose(0) << "Atom " << first->nr << "'s element is " << first->type->name << "." << endl;810 DoLog(0) && (Log() << Verbose(0) << "Atom " << first->nr << "'s element is " << first->type->name << "." << endl); 775 811 } 776 812 break; … … 793 829 MoleculeLeafClass *Subgraphs = NULL; 794 830 795 Log() << Verbose(0) << "=========MANIPULATE GLOBALLY===================" << endl;796 Log() << Verbose(0) << "c - scale by unit transformation" << endl;797 Log() << Verbose(0) << "d - duplicate molecule/periodic cell" << endl;798 Log() << Verbose(0) << "f - fragment molecule many-body bond order style" << endl;799 Log() << Verbose(0) << "g - center atoms in box" << endl;800 Log() << Verbose(0) << "i - realign molecule" << endl;801 Log() << Verbose(0) << "m - mirror all molecules" << endl;802 Log() << Verbose(0) << "o - create connection matrix" << endl;803 Log() << Verbose(0) << "t - translate molecule by vector" << endl;804 Log() << Verbose(0) << "all else - go back" << endl;805 Log() << Verbose(0) << "===============================================" << endl;831 DoLog(0) && (Log() << Verbose(0) << "=========MANIPULATE GLOBALLY===================" << endl); 832 DoLog(0) && (Log() << Verbose(0) << "c - scale by unit transformation" << endl); 833 DoLog(0) && (Log() << Verbose(0) << "d - duplicate molecule/periodic cell" << endl); 834 DoLog(0) && (Log() << Verbose(0) << "f - fragment molecule many-body bond order style" << endl); 835 DoLog(0) && (Log() << Verbose(0) << "g - center atoms in box" << endl); 836 DoLog(0) && (Log() << Verbose(0) << "i - realign molecule" << endl); 837 DoLog(0) && (Log() << Verbose(0) << "m - mirror all molecules" << endl); 838 DoLog(0) && (Log() << Verbose(0) << "o - create connection matrix" << endl); 839 DoLog(0) && (Log() << Verbose(0) << "t - translate molecule by vector" << endl); 840 DoLog(0) && (Log() << Verbose(0) << "all else - go back" << endl); 841 DoLog(0) && (Log() << Verbose(0) << "===============================================" << endl); 806 842 if (molecules->NumberOfActiveMolecules() > 1) 807 eLog() << Verbose(2) << "There is more than one molecule active! Atoms will be added to each." << endl;808 Log() << Verbose(0) << "INPUT: ";843 DoeLog(2) && (eLog()<< Verbose(2) << "There is more than one molecule active! Atoms will be added to each." << endl); 844 DoLog(0) && (Log() << Verbose(0) << "INPUT: "); 809 845 cin >> choice; 810 846 811 847 switch (choice) { 812 848 default: 813 Log() << Verbose(0) << "Not a valid choice." << endl;849 DoLog(0) && (Log() << Verbose(0) << "Not a valid choice." << endl); 814 850 break; 815 851 … … 818 854 if ((*ListRunner)->ActiveFlag) { 819 855 mol = *ListRunner; 820 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;821 Log() << Verbose(0) << "State the axis [(+-)123]: ";856 DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl); 857 DoLog(0) && (Log() << Verbose(0) << "State the axis [(+-)123]: "); 822 858 cin >> axis; 823 Log() << Verbose(0) << "State the factor: ";859 DoLog(0) && (Log() << Verbose(0) << "State the factor: "); 824 860 cin >> faktor; 825 861 … … 838 874 } 839 875 if (count != j) 840 eLog() << Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl;876 DoeLog(1) && (eLog()<< Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl); 841 877 x.Zero(); 842 878 y.Zero(); 843 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 magnitude879 y.x[abs(axis)-1] = World::getInstance().getDomain()[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] * abs(axis)/axis; // last term is for sign, first is for magnitude 844 880 for (int i=1;i<faktor;i++) { // then add this list with respective translation factor times 845 881 x.AddVector(&y); // per factor one cell width further … … 864 900 mol->Translate(&x); 865 901 } 866 mol->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor;902 World::getInstance().getDomain()[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor; 867 903 } 868 904 } … … 877 913 if ((*ListRunner)->ActiveFlag) { 878 914 mol = *ListRunner; 879 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;915 DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl); 880 916 CenterAtoms(mol); 881 917 } … … 886 922 if ((*ListRunner)->ActiveFlag) { 887 923 mol = *ListRunner; 888 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;924 DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl); 889 925 AlignAtoms(periode, mol); 890 926 } … … 895 931 if ((*ListRunner)->ActiveFlag) { 896 932 mol = *ListRunner; 897 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;933 DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl); 898 934 MirrorAtoms(mol); 899 935 } … … 906 942 double bonddistance; 907 943 clock_t start,end; 908 Log() << Verbose(0) << "What's the maximum bond distance: ";944 DoLog(0) && (Log() << Verbose(0) << "What's the maximum bond distance: "); 909 945 cin >> bonddistance; 910 946 start = clock(); 911 947 mol->CreateAdjacencyList(bonddistance, configuration->GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL); 912 948 end = clock(); 913 Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl;949 DoLog(0) && (Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl); 914 950 } 915 951 break; … … 919 955 if ((*ListRunner)->ActiveFlag) { 920 956 mol = *ListRunner; 921 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;922 Log() << Verbose(0) << "Enter translation vector." << endl;923 x.AskPosition( mol->cell_size,0);957 DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl); 958 DoLog(0) && (Log() << Verbose(0) << "Enter translation vector." << endl); 959 x.AskPosition(World::getInstance().getDomain(),0); 924 960 mol->Center.AddVector((const Vector *)&x); 925 961 } … … 948 984 molecule *mol = NULL; 949 985 950 Log() << Verbose(0) << "==========EDIT MOLECULES=====================" << endl;951 Log() << Verbose(0) << "c - create new molecule" << endl;952 Log() << Verbose(0) << "l - load molecule from xyz file" << endl;953 Log() << Verbose(0) << "n - change molecule's name" << endl;954 Log() << Verbose(0) << "N - give molecules filename" << endl;955 Log() << Verbose(0) << "p - parse atoms in xyz file into molecule" << endl;956 Log() << Verbose(0) << "r - remove a molecule" << endl;957 Log() << Verbose(0) << "all else - go back" << endl;958 Log() << Verbose(0) << "===============================================" << endl;959 Log() << Verbose(0) << "INPUT: ";986 DoLog(0) && (Log() << Verbose(0) << "==========EDIT MOLECULES=====================" << endl); 987 DoLog(0) && (Log() << Verbose(0) << "c - create new molecule" << endl); 988 DoLog(0) && (Log() << Verbose(0) << "l - load molecule from xyz file" << endl); 989 DoLog(0) && (Log() << Verbose(0) << "n - change molecule's name" << endl); 990 DoLog(0) && (Log() << Verbose(0) << "N - give molecules filename" << endl); 991 DoLog(0) && (Log() << Verbose(0) << "p - parse atoms in xyz file into molecule" << endl); 992 DoLog(0) && (Log() << Verbose(0) << "r - remove a molecule" << endl); 993 DoLog(0) && (Log() << Verbose(0) << "all else - go back" << endl); 994 DoLog(0) && (Log() << Verbose(0) << "===============================================" << endl); 995 DoLog(0) && (Log() << Verbose(0) << "INPUT: "); 960 996 cin >> choice; 961 997 962 998 switch (choice) { 963 999 default: 964 Log() << Verbose(0) << "Not a valid choice." << endl;1000 DoLog(0) && (Log() << Verbose(0) << "Not a valid choice." << endl); 965 1001 break; 966 1002 case 'c': 967 mol = new molecule(periode);1003 mol = World::getInstance().createMolecule(); 968 1004 molecules->insert(mol); 969 1005 break; … … 972 1008 { 973 1009 char filename[MAXSTRINGSIZE]; 974 Log() << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl;975 mol = new molecule(periode);1010 DoLog(0) && (Log() << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl); 1011 mol = World::getInstance().createMolecule(); 976 1012 do { 977 Log() << Verbose(0) << "Enter file name: ";1013 DoLog(0) && (Log() << Verbose(0) << "Enter file name: "); 978 1014 cin >> filename; 979 1015 } while (!mol->AddXYZFile(filename)); … … 981 1017 // center at set box dimensions 982 1018 mol->CenterEdge(¢er); 983 mol->cell_size[0] = center.x[0]; 984 mol->cell_size[1] = 0; 985 mol->cell_size[2] = center.x[1]; 986 mol->cell_size[3] = 0; 987 mol->cell_size[4] = 0; 988 mol->cell_size[5] = center.x[2]; 1019 double * const cell_size = World::getInstance().getDomain(); 1020 cell_size[0] = center.x[0]; 1021 cell_size[1] = 0; 1022 cell_size[2] = center.x[1]; 1023 cell_size[3] = 0; 1024 cell_size[4] = 0; 1025 cell_size[5] = center.x[2]; 989 1026 molecules->insert(mol); 990 1027 } … … 995 1032 char filename[MAXSTRINGSIZE]; 996 1033 do { 997 Log() << Verbose(0) << "Enter index of molecule: ";1034 DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule: "); 998 1035 cin >> nr; 999 1036 mol = molecules->ReturnIndex(nr); 1000 1037 } while (mol == NULL); 1001 Log() << Verbose(0) << "Enter name: ";1038 DoLog(0) && (Log() << Verbose(0) << "Enter name: "); 1002 1039 cin >> filename; 1003 1040 strcpy(mol->name, filename); … … 1009 1046 char filename[MAXSTRINGSIZE]; 1010 1047 do { 1011 Log() << Verbose(0) << "Enter index of molecule: ";1048 DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule: "); 1012 1049 cin >> nr; 1013 1050 mol = molecules->ReturnIndex(nr); 1014 1051 } while (mol == NULL); 1015 Log() << Verbose(0) << "Enter name: ";1052 DoLog(0) && (Log() << Verbose(0) << "Enter name: "); 1016 1053 cin >> filename; 1017 1054 mol->SetNameFromFilename(filename); … … 1024 1061 mol = NULL; 1025 1062 do { 1026 Log() << Verbose(0) << "Enter index of molecule: ";1063 DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule: "); 1027 1064 cin >> nr; 1028 1065 mol = molecules->ReturnIndex(nr); 1029 1066 } while (mol == NULL); 1030 Log() << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl;1067 DoLog(0) && (Log() << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl); 1031 1068 do { 1032 Log() << Verbose(0) << "Enter file name: ";1069 DoLog(0) && (Log() << Verbose(0) << "Enter file name: "); 1033 1070 cin >> filename; 1034 1071 } while (!mol->AddXYZFile(filename)); … … 1038 1075 1039 1076 case 'r': 1040 Log() << Verbose(0) << "Enter index of molecule: ";1077 DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule: "); 1041 1078 cin >> nr; 1042 1079 count = 1; … … 1061 1098 char choice; // menu choice char 1062 1099 1063 Log() << Verbose(0) << "===========MERGE MOLECULES=====================" << endl; 1064 Log() << Verbose(0) << "a - simple add of one molecule to another" << endl; 1065 Log() << Verbose(0) << "e - embedding merge of two molecules" << endl; 1066 Log() << Verbose(0) << "m - multi-merge of all molecules" << endl; 1067 Log() << Verbose(0) << "s - scatter merge of two molecules" << endl; 1068 Log() << Verbose(0) << "t - simple merge of two molecules" << endl; 1069 Log() << Verbose(0) << "all else - go back" << endl; 1070 Log() << Verbose(0) << "===============================================" << endl; 1071 Log() << Verbose(0) << "INPUT: "; 1100 DoLog(0) && (Log() << Verbose(0) << "===========MERGE MOLECULES=====================" << endl); 1101 DoLog(0) && (Log() << Verbose(0) << "a - simple add of one molecule to another" << endl); 1102 DoLog(0) && (Log() << Verbose(0) << "b - count the number of bonds of two elements" << endl); 1103 DoLog(0) && (Log() << Verbose(0) << "B - count the number of bonds of three elements " << endl); 1104 DoLog(0) && (Log() << Verbose(0) << "e - embedding merge of two molecules" << endl); 1105 DoLog(0) && (Log() << Verbose(0) << "h - count the number of hydrogen bonds" << endl); 1106 DoLog(0) && (Log() << Verbose(0) << "b - count the number of hydrogen bonds" << endl); 1107 DoLog(0) && (Log() << Verbose(0) << "m - multi-merge of all molecules" << endl); 1108 DoLog(0) && (Log() << Verbose(0) << "s - scatter merge of two molecules" << endl); 1109 DoLog(0) && (Log() << Verbose(0) << "t - simple merge of two molecules" << endl); 1110 DoLog(0) && (Log() << Verbose(0) << "all else - go back" << endl); 1111 DoLog(0) && (Log() << Verbose(0) << "===============================================" << endl); 1112 DoLog(0) && (Log() << Verbose(0) << "INPUT: "); 1072 1113 cin >> choice; 1073 1114 1074 1115 switch (choice) { 1075 1116 default: 1076 Log() << Verbose(0) << "Not a valid choice." << endl;1117 DoLog(0) && (Log() << Verbose(0) << "Not a valid choice." << endl); 1077 1118 break; 1078 1119 … … 1083 1124 { 1084 1125 do { 1085 Log() << Verbose(0) << "Enter index of destination molecule: ";1126 DoLog(0) && (Log() << Verbose(0) << "Enter index of destination molecule: "); 1086 1127 cin >> dest; 1087 1128 destmol = molecules->ReturnIndex(dest); 1088 1129 } while ((destmol == NULL) && (dest != -1)); 1089 1130 do { 1090 Log() << Verbose(0) << "Enter index of source molecule to add from: ";1131 DoLog(0) && (Log() << Verbose(0) << "Enter index of source molecule to add from: "); 1091 1132 cin >> src; 1092 1133 srcmol = molecules->ReturnIndex(src); … … 1098 1139 break; 1099 1140 1141 case 'b': 1142 { 1143 const int nr = 2; 1144 char *names[nr] = {"first", "second"}; 1145 int Z[nr]; 1146 element *elements[nr]; 1147 for (int i=0;i<nr;i++) { 1148 Z[i] = 0; 1149 do { 1150 cout << "Enter " << names[i] << " element: "; 1151 cin >> Z[i]; 1152 } while ((Z[i] <= 0) && (Z[i] > MAX_ELEMENTS)); 1153 elements[i] = periode->FindElement(Z[i]); 1154 } 1155 const int count = CountBondsOfTwo(molecules, elements[0], elements[1]); 1156 cout << endl << "There are " << count << " "; 1157 for (int i=0;i<nr;i++) { 1158 if (i==0) 1159 cout << elements[i]->symbol; 1160 else 1161 cout << "-" << elements[i]->symbol; 1162 } 1163 cout << " bonds." << endl; 1164 } 1165 break; 1166 1167 case 'B': 1168 { 1169 const int nr = 3; 1170 char *names[nr] = {"first", "second", "third"}; 1171 int Z[nr]; 1172 element *elements[nr]; 1173 for (int i=0;i<nr;i++) { 1174 Z[i] = 0; 1175 do { 1176 cout << "Enter " << names[i] << " element: "; 1177 cin >> Z[i]; 1178 } while ((Z[i] <= 0) && (Z[i] > MAX_ELEMENTS)); 1179 elements[i] = periode->FindElement(Z[i]); 1180 } 1181 const int count = CountBondsOfThree(molecules, elements[0], elements[1], elements[2]); 1182 cout << endl << "There are " << count << " "; 1183 for (int i=0;i<nr;i++) { 1184 if (i==0) 1185 cout << elements[i]->symbol; 1186 else 1187 cout << "-" << elements[i]->symbol; 1188 } 1189 cout << " bonds." << endl; 1190 } 1191 break; 1192 1100 1193 case 'e': 1101 1194 { … … 1103 1196 molecule *srcmol = NULL, *destmol = NULL; 1104 1197 do { 1105 Log() << Verbose(0) << "Enter index of matrix molecule (the variable one): ";1198 DoLog(0) && (Log() << Verbose(0) << "Enter index of matrix molecule (the variable one): "); 1106 1199 cin >> src; 1107 1200 srcmol = molecules->ReturnIndex(src); 1108 1201 } while ((srcmol == NULL) && (src != -1)); 1109 1202 do { 1110 Log() << Verbose(0) << "Enter index of molecule to merge into (the fixed one): ";1203 DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule to merge into (the fixed one): "); 1111 1204 cin >> dest; 1112 1205 destmol = molecules->ReturnIndex(dest); … … 1117 1210 break; 1118 1211 1212 case 'h': 1213 { 1214 int Z; 1215 cout << "Please enter interface element: "; 1216 cin >> Z; 1217 element * const InterfaceElement = periode->FindElement(Z); 1218 cout << endl << "There are " << CountHydrogenBridgeBonds(molecules, InterfaceElement) << " hydrogen bridges with connections to " << (InterfaceElement != 0 ? InterfaceElement->name : "None") << "." << endl; 1219 } 1220 break; 1221 1119 1222 case 'm': 1120 1223 { … … 1122 1225 molecule *mol = NULL; 1123 1226 do { 1124 Log() << Verbose(0) << "Enter index of molecule to merge into: ";1227 DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule to merge into: "); 1125 1228 cin >> nr; 1126 1229 mol = molecules->ReturnIndex(nr); … … 1139 1242 1140 1243 case 's': 1141 Log() << Verbose(0) << "Not implemented yet." << endl;1244 DoLog(0) && (Log() << Verbose(0) << "Not implemented yet." << endl); 1142 1245 break; 1143 1246 … … 1148 1251 { 1149 1252 do { 1150 Log() << Verbose(0) << "Enter index of destination molecule: ";1253 DoLog(0) && (Log() << Verbose(0) << "Enter index of destination molecule: "); 1151 1254 cin >> dest; 1152 1255 destmol = molecules->ReturnIndex(dest); 1153 1256 } while ((destmol == NULL) && (dest != -1)); 1154 1257 do { 1155 Log() << Verbose(0) << "Enter index of source molecule to merge into: ";1258 DoLog(0) && (Log() << Verbose(0) << "Enter index of source molecule to merge into: "); 1156 1259 cin >> src; 1157 1260 srcmol = molecules->ReturnIndex(src); … … 1181 1284 mol = (molecules->ListOfMolecules.front())->CopyMolecule(); 1182 1285 else { 1183 eLog() << Verbose(0) << "I don't have anything to test on ... ";1286 DoeLog(0) && (eLog()<< Verbose(0) << "I don't have anything to test on ... "); 1184 1287 performCriticalExit(); 1185 1288 return; … … 1188 1291 1189 1292 // generate some KeySets 1190 Log() << Verbose(0) << "Generating KeySets." << endl;1293 DoLog(0) && (Log() << Verbose(0) << "Generating KeySets." << endl); 1191 1294 KeySet TestSets[mol->AtomCount+1]; 1192 1295 i=1; … … 1198 1301 i++; 1199 1302 } 1200 Log() << Verbose(0) << "Testing insertion of already present item in KeySets." << endl;1303 DoLog(0) && (Log() << Verbose(0) << "Testing insertion of already present item in KeySets." << endl); 1201 1304 KeySetTestPair test; 1202 1305 test = TestSets[mol->AtomCount-1].insert(Walker->nr); 1203 1306 if (test.second) { 1204 Log() << Verbose(1) << "Insertion worked?!" << endl;1307 DoLog(1) && (Log() << Verbose(1) << "Insertion worked?!" << endl); 1205 1308 } else { 1206 Log() << Verbose(1) << "Insertion rejected: Present object is " << (*test.first) << "." << endl;1309 DoLog(1) && (Log() << Verbose(1) << "Insertion rejected: Present object is " << (*test.first) << "." << endl); 1207 1310 } 1208 1311 TestSets[mol->AtomCount].insert(mol->end->previous->nr); … … 1210 1313 1211 1314 // constructing Graph structure 1212 Log() << Verbose(0) << "Generating Subgraph class." << endl;1315 DoLog(0) && (Log() << Verbose(0) << "Generating Subgraph class." << endl); 1213 1316 Graph Subgraphs; 1214 1317 1215 1318 // insert KeySets into Subgraphs 1216 Log() << Verbose(0) << "Inserting KeySets into Subgraph class." << endl;1319 DoLog(0) && (Log() << Verbose(0) << "Inserting KeySets into Subgraph class." << endl); 1217 1320 for (int j=0;j<mol->AtomCount;j++) { 1218 1321 Subgraphs.insert(GraphPair (TestSets[j],pair<int, double>(counter++, 1.))); 1219 1322 } 1220 Log() << Verbose(0) << "Testing insertion of already present item in Subgraph." << endl;1323 DoLog(0) && (Log() << Verbose(0) << "Testing insertion of already present item in Subgraph." << endl); 1221 1324 GraphTestPair test2; 1222 1325 test2 = Subgraphs.insert(GraphPair (TestSets[mol->AtomCount],pair<int, double>(counter++, 1.))); 1223 1326 if (test2.second) { 1224 Log() << Verbose(1) << "Insertion worked?!" << endl;1327 DoLog(1) && (Log() << Verbose(1) << "Insertion worked?!" << endl); 1225 1328 } else { 1226 Log() << Verbose(1) << "Insertion rejected: Present object is " << (*(test2.first)).second.first << "." << endl;1329 DoLog(1) && (Log() << Verbose(1) << "Insertion rejected: Present object is " << (*(test2.first)).second.first << "." << endl); 1227 1330 } 1228 1331 1229 1332 // show graphs 1230 Log() << Verbose(0) << "Showing Subgraph's contents, checking that it's sorted." << endl;1333 DoLog(0) && (Log() << Verbose(0) << "Showing Subgraph's contents, checking that it's sorted." << endl); 1231 1334 Graph::iterator A = Subgraphs.begin(); 1232 1335 while (A != Subgraphs.end()) { 1233 Log() << Verbose(0) << (*A).second.first << ": ";1336 DoLog(0) && (Log() << Verbose(0) << (*A).second.first << ": "); 1234 1337 KeySet::iterator key = (*A).first.begin(); 1235 1338 comp = -1; 1236 1339 while (key != (*A).first.end()) { 1237 1340 if ((*key) > comp) 1238 Log() << Verbose(0) << (*key) << " ";1341 DoLog(0) && (Log() << Verbose(0) << (*key) << " "); 1239 1342 else 1240 Log() << Verbose(0) << (*key) << "! ";1343 DoLog(0) && (Log() << Verbose(0) << (*key) << "! "); 1241 1344 comp = (*key); 1242 1345 key++; 1243 1346 } 1244 Log() << Verbose(0) << endl;1347 DoLog(0) && (Log() << Verbose(0) << endl); 1245 1348 A++; 1246 1349 } … … 1249 1352 1250 1353 #endif 1354 1355 /** Tries given filename or standard on saving the config file. 1356 * \param *ConfigFileName name of file 1357 * \param *configuration pointer to configuration structure with all the values 1358 * \param *periode pointer to periodentafel structure with all the elements 1359 * \param *molecules list of molecules structure with all the atoms and coordinates 1360 */ 1361 static void SaveConfig(char *ConfigFileName, config *configuration, periodentafel *periode, MoleculeListClass *molecules) 1362 { 1363 char filename[MAXSTRINGSIZE]; 1364 ofstream output; 1365 molecule *mol = World::getInstance().createMolecule(); 1366 mol->SetNameFromFilename(ConfigFileName); 1367 1368 if (!strcmp(configuration->configpath, configuration->GetDefaultPath())) { 1369 DoeLog(2) && (eLog()<< Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl); 1370 } 1371 1372 1373 // first save as PDB data 1374 if (ConfigFileName != NULL) 1375 strcpy(filename, ConfigFileName); 1376 if (output == NULL) 1377 strcpy(filename,"main_pcp_linux"); 1378 DoLog(0) && (Log() << Verbose(0) << "Saving as pdb input "); 1379 if (configuration->SavePDB(filename, molecules)) 1380 DoLog(0) && (Log() << Verbose(0) << "done." << endl); 1381 else 1382 DoLog(0) && (Log() << Verbose(0) << "failed." << endl); 1383 1384 // then save as tremolo data file 1385 if (ConfigFileName != NULL) 1386 strcpy(filename, ConfigFileName); 1387 if (output == NULL) 1388 strcpy(filename,"main_pcp_linux"); 1389 DoLog(0) && (Log() << Verbose(0) << "Saving as tremolo data input "); 1390 if (configuration->SaveTREMOLO(filename, molecules)) 1391 DoLog(0) && (Log() << Verbose(0) << "done." << endl); 1392 else 1393 DoLog(0) && (Log() << Verbose(0) << "failed." << endl); 1394 1395 // translate each to its center and merge all molecules in MoleculeListClass into this molecule 1396 int N = molecules->ListOfMolecules.size(); 1397 int *src = new int[N]; 1398 N=0; 1399 for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) { 1400 src[N++] = (*ListRunner)->IndexNr; 1401 (*ListRunner)->Translate(&(*ListRunner)->Center); 1402 } 1403 molecules->SimpleMultiAdd(mol, src, N); 1404 delete[](src); 1405 1406 // ... and translate back 1407 for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) { 1408 (*ListRunner)->Center.Scale(-1.); 1409 (*ListRunner)->Translate(&(*ListRunner)->Center); 1410 (*ListRunner)->Center.Scale(-1.); 1411 } 1412 1413 DoLog(0) && (Log() << Verbose(0) << "Storing configuration ... " << endl); 1414 // get correct valence orbitals 1415 mol->CalculateOrbitals(*configuration); 1416 configuration->InitMaxMinStopStep = configuration->MaxMinStopStep = configuration->MaxPsiDouble; 1417 if (ConfigFileName != NULL) { // test the file name 1418 strcpy(filename, ConfigFileName); 1419 output.open(filename, ios::trunc); 1420 } else if (strlen(configuration->configname) != 0) { 1421 strcpy(filename, configuration->configname); 1422 output.open(configuration->configname, ios::trunc); 1423 } else { 1424 strcpy(filename, DEFAULTCONFIG); 1425 output.open(DEFAULTCONFIG, ios::trunc); 1426 } 1427 output.close(); 1428 output.clear(); 1429 DoLog(0) && (Log() << Verbose(0) << "Saving of config file "); 1430 if (configuration->Save(filename, periode, mol)) 1431 DoLog(0) && (Log() << Verbose(0) << "successful." << endl); 1432 else 1433 DoLog(0) && (Log() << Verbose(0) << "failed." << endl); 1434 1435 // and save to xyz file 1436 if (ConfigFileName != NULL) { 1437 strcpy(filename, ConfigFileName); 1438 strcat(filename, ".xyz"); 1439 output.open(filename, ios::trunc); 1440 } 1441 if (output == NULL) { 1442 strcpy(filename,"main_pcp_linux"); 1443 strcat(filename, ".xyz"); 1444 output.open(filename, ios::trunc); 1445 } 1446 DoLog(0) && (Log() << Verbose(0) << "Saving of XYZ file "); 1447 if (mol->MDSteps <= 1) { 1448 if (mol->OutputXYZ(&output)) 1449 DoLog(0) && (Log() << Verbose(0) << "successful." << endl); 1450 else 1451 DoLog(0) && (Log() << Verbose(0) << "failed." << endl); 1452 } else { 1453 if (mol->OutputTrajectoriesXYZ(&output)) 1454 DoLog(0) && (Log() << Verbose(0) << "successful." << endl); 1455 else 1456 DoLog(0) && (Log() << Verbose(0) << "failed." << endl); 1457 } 1458 output.close(); 1459 output.clear(); 1460 1461 // and save as MPQC configuration 1462 if (ConfigFileName != NULL) 1463 strcpy(filename, ConfigFileName); 1464 if (output == NULL) 1465 strcpy(filename,"main_pcp_linux"); 1466 DoLog(0) && (Log() << Verbose(0) << "Saving as mpqc input "); 1467 if (configuration->SaveMPQC(filename, mol)) 1468 DoLog(0) && (Log() << Verbose(0) << "done." << endl); 1469 else 1470 DoLog(0) && (Log() << Verbose(0) << "failed." << endl); 1471 1472 if (!strcmp(configuration->configpath, configuration->GetDefaultPath())) { 1473 DoeLog(2) && (eLog()<< Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl); 1474 } 1475 1476 World::getInstance().destroyMolecule(mol); 1477 }; 1251 1478 1252 1479 /** Parses the command line options. … … 1275 1502 enum ConfigStatus configPresent = absent; 1276 1503 clock_t start,end; 1504 double MaxDistance = -1; 1277 1505 int argptr; 1278 1506 molecule *mol = NULL; … … 1286 1514 do { 1287 1515 if (argv[argptr][0] == '-') { 1288 Log() << Verbose(0) << "Recognized command line argument: " << argv[argptr][1] << ".\n";1516 DoLog(0) && (Log() << Verbose(0) << "Recognized command line argument: " << argv[argptr][1] << ".\n"); 1289 1517 argptr++; 1290 1518 switch(argv[argptr-1][1]) { … … 1292 1520 case 'H': 1293 1521 case '?': 1294 Log() << Verbose(0) << "MoleCuilder suite" << endl << "==================" << endl << endl; 1295 Log() << Verbose(0) << "Usage: " << argv[0] << "[config file] [-{acefpsthH?vfrp}] [further arguments]" << endl; 1296 Log() << Verbose(0) << "or simply " << argv[0] << " without arguments for interactive session." << endl; 1297 Log() << Verbose(0) << "\t-a Z x1 x2 x3\tAdd new atom of element Z at coordinates (x1,x2,x3)." << endl; 1298 Log() << Verbose(0) << "\t-A <source>\tCreate adjacency list from bonds parsed from 'dbond'-style file." <<endl; 1299 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; 1300 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; 1301 Log() << Verbose(0) << "\t-c x1 x2 x3\tCenter atoms in domain with a minimum distance to boundary of (x1,x2,x3)." << endl; 1302 Log() << Verbose(0) << "\t-C <Z> <output> <bin output>\tPair Correlation analysis." << endl; 1303 Log() << Verbose(0) << "\t-d x1 x2 x3\tDuplicate cell along each axis by given factor." << endl; 1304 Log() << Verbose(0) << "\t-D <bond distance>\tDepth-First-Search Analysis of the molecule, giving cycles and tree/back edges." << endl; 1305 Log() << Verbose(0) << "\t-e <file>\tSets the databases path to be parsed (default: ./)." << endl; 1306 Log() << Verbose(0) << "\t-E <id> <Z>\tChange atom <id>'s element to <Z>, <id> begins at 0." << endl; 1307 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; 1308 Log() << Verbose(0) << "\t-F <dist_x> <dist_y> <dist_z> <epsilon> <randatom> <randmol> <DoRotate>\tFilling Box with water molecules." << endl; 1309 Log() << Verbose(0) << "\t-g <file>\tParses a bond length table from the given file." << endl; 1310 Log() << Verbose(0) << "\t-h/-H/-?\tGive this help screen." << endl; 1311 Log() << Verbose(0) << "\t-I\t Dissect current system of molecules into a set of disconnected (subgraphs of) molecules." << endl; 1312 Log() << Verbose(0) << "\t-j\t<path> Store all bonds to file." << endl; 1313 Log() << Verbose(0) << "\t-J\t<path> Store adjacency per atom to file." << endl; 1314 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; 1315 Log() << Verbose(0) << "\t-m <0/1>\tCalculate (0)/ Align in(1) PAS with greatest EV along z axis." << endl; 1316 Log() << Verbose(0) << "\t-M <basis>\tSetting basis to store to MPQC config files." << endl; 1317 Log() << Verbose(0) << "\t-n\tFast parsing (i.e. no trajectories are looked for)." << endl; 1318 Log() << Verbose(0) << "\t-N <radius> <file>\tGet non-convex-envelope." << endl; 1319 Log() << Verbose(0) << "\t-o <out>\tGet volume of the convex envelope (and store to tecplot file)." << endl; 1320 Log() << Verbose(0) << "\t-O\tCenter atoms in origin." << endl; 1321 Log() << Verbose(0) << "\t-p <file>\tParse given xyz file and create raw config file from it." << endl; 1322 Log() << Verbose(0) << "\t-P <file>\tParse given forces file and append as an MD step to config file via Verlet." << endl; 1323 Log() << Verbose(0) << "\t-r <id>\t\tRemove an atom with given id." << endl; 1324 Log() << Verbose(0) << "\t-R <id> <radius>\t\tRemove all atoms out of sphere around a given one." << endl; 1325 Log() << Verbose(0) << "\t-s x1 x2 x3\tScale all atom coordinates by this vector (x1,x2,x3)." << endl; 1326 Log() << Verbose(0) << "\t-S <file> Store temperatures from the config file in <file>." << endl; 1327 Log() << Verbose(0) << "\t-t x1 x2 x3\tTranslate all atoms by this vector (x1,x2,x3)." << endl; 1328 Log() << Verbose(0) << "\t-T x1 x2 x3\tTranslate periodically all atoms by this vector (x1,x2,x3)." << endl; 1329 Log() << Verbose(0) << "\t-u rho\tsuspend in water solution and output necessary cell lengths, average density rho and repetition." << endl; 1330 Log() << Verbose(0) << "\t-v\t\tsets verbosity (more is more)." << endl; 1331 Log() << Verbose(0) << "\t-V\t\tGives version information." << endl; 1332 Log() << Verbose(0) << "Note: config files must not begin with '-' !" << endl; 1522 DoLog(0) && (Log() << Verbose(0) << "MoleCuilder suite" << endl << "==================" << endl << endl); 1523 DoLog(0) && (Log() << Verbose(0) << "Usage: " << argv[0] << "[config file] [-{acefpsthH?vfrp}] [further arguments]" << endl); 1524 DoLog(0) && (Log() << Verbose(0) << "or simply " << argv[0] << " without arguments for interactive session." << endl); 1525 DoLog(0) && (Log() << Verbose(0) << "\t-a Z x1 x2 x3\tAdd new atom of element Z at coordinates (x1,x2,x3)." << endl); 1526 DoLog(0) && (Log() << Verbose(0) << "\t-A <source>\tCreate adjacency list from bonds parsed from 'dbond'-style file." <<endl); 1527 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); 1528 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); 1529 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); 1530 DoLog(0) && (Log() << Verbose(0) << "\t-C <type> [params] <output> <bin output> <BinWidth> <BinStart> <BinEnd>\tPair Correlation analysis." << endl); 1531 DoLog(0) && (Log() << Verbose(0) << "\t-d x1 x2 x3\tDuplicate cell along each axis by given factor." << endl); 1532 DoLog(0) && (Log() << Verbose(0) << "\t-D <bond distance>\tDepth-First-Search Analysis of the molecule, giving cycles and tree/back edges." << endl); 1533 DoLog(0) && (Log() << Verbose(0) << "\t-e <file>\tSets the databases path to be parsed (default: ./)." << endl); 1534 DoLog(0) && (Log() << Verbose(0) << "\t-E <id> <Z>\tChange atom <id>'s element to <Z>, <id> begins at 0." << endl); 1535 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); 1536 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); 1537 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); 1538 DoLog(0) && (Log() << Verbose(0) << "\t-g <file>\tParses a bond length table from the given file." << endl); 1539 DoLog(0) && (Log() << Verbose(0) << "\t-h/-H/-?\tGive this help screen." << endl); 1540 DoLog(0) && (Log() << Verbose(0) << "\t-I\t Dissect current system of molecules into a set of disconnected (subgraphs of) molecules." << endl); 1541 DoLog(0) && (Log() << Verbose(0) << "\t-j\t<path> Store all bonds to file." << endl); 1542 DoLog(0) && (Log() << Verbose(0) << "\t-J\t<path> Store adjacency per atom to file." << endl); 1543 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); 1544 DoLog(0) && (Log() << Verbose(0) << "\t-m <0/1>\tCalculate (0)/ Align in(1) PAS with greatest EV along z axis." << endl); 1545 DoLog(0) && (Log() << Verbose(0) << "\t-M <basis>\tSetting basis to store to MPQC config files." << endl); 1546 DoLog(0) && (Log() << Verbose(0) << "\t-n\tFast parsing (i.e. no trajectories are looked for)." << endl); 1547 DoLog(0) && (Log() << Verbose(0) << "\t-N <radius> <file>\tGet non-convex-envelope." << endl); 1548 DoLog(0) && (Log() << Verbose(0) << "\t-o <out>\tGet volume of the convex envelope (and store to tecplot file)." << endl); 1549 DoLog(0) && (Log() << Verbose(0) << "\t-O\tCenter atoms in origin." << endl); 1550 DoLog(0) && (Log() << Verbose(0) << "\t-p <file>\tParse given xyz file and create raw config file from it." << endl); 1551 DoLog(0) && (Log() << Verbose(0) << "\t-P <file>\tParse given forces file and append as an MD step to config file via Verlet." << endl); 1552 DoLog(0) && (Log() << Verbose(0) << "\t-r <id>\t\tRemove an atom with given id." << endl); 1553 DoLog(0) && (Log() << Verbose(0) << "\t-R <id> <radius>\t\tRemove all atoms out of sphere around a given one." << endl); 1554 DoLog(0) && (Log() << Verbose(0) << "\t-s x1 x2 x3\tScale all atom coordinates by this vector (x1,x2,x3)." << endl); 1555 DoLog(0) && (Log() << Verbose(0) << "\t-S <file> Store temperatures from the config file in <file>." << endl); 1556 DoLog(0) && (Log() << Verbose(0) << "\t-t x1 x2 x3\tTranslate all atoms by this vector (x1,x2,x3)." << endl); 1557 DoLog(0) && (Log() << Verbose(0) << "\t-T x1 x2 x3\tTranslate periodically all atoms by this vector (x1,x2,x3)." << endl); 1558 DoLog(0) && (Log() << Verbose(0) << "\t-u rho\tsuspend in water solution and output necessary cell lengths, average density rho and repetition." << endl); 1559 DoLog(0) && (Log() << Verbose(0) << "\t-v\t\tsets verbosity (more is more)." << endl); 1560 DoLog(0) && (Log() << Verbose(0) << "\t-V\t\tGives version information." << endl); 1561 DoLog(0) && (Log() << Verbose(0) << "\t-X\t\tset default name of a molecule." << endl); 1562 DoLog(0) && (Log() << Verbose(0) << "Note: config files must not begin with '-' !" << endl); 1333 1563 return (1); 1334 1564 break; … … 1338 1568 } 1339 1569 setVerbosity(verbosity); 1340 Log() << Verbose(0) << "Setting verbosity to " << verbosity << "." << endl;1570 DoLog(0) && (Log() << Verbose(0) << "Setting verbosity to " << verbosity << "." << endl); 1341 1571 break; 1342 1572 case 'V': 1343 Log() << Verbose(0) << argv[0] << " " << VERSIONSTRING << endl;1344 Log() << Verbose(0) << "Build your own molecule position set." << endl;1573 DoLog(0) && (Log() << Verbose(0) << argv[0] << " " << VERSIONSTRING << endl); 1574 DoLog(0) && (Log() << Verbose(0) << "Build your own molecule position set." << endl); 1345 1575 return (1); 1576 break; 1577 case 'B': 1578 if (ExitFlag == 0) ExitFlag = 1; 1579 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])) ) { 1580 ExitFlag = 255; 1581 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for bounding in box: -B <xx> <xy> <xz> <yy> <yz> <zz>" << endl); 1582 performCriticalExit(); 1583 } else { 1584 SaveFlag = true; 1585 j = -1; 1586 DoLog(1) && (Log() << Verbose(1) << "Centering atoms in config file within given simulation box." << endl); 1587 double * const cell_size = World::getInstance().getDomain(); 1588 for (int i=0;i<6;i++) { 1589 cell_size[i] = atof(argv[argptr+i]); 1590 } 1591 argptr+=6; 1592 } 1346 1593 break; 1347 1594 case 'e': 1348 1595 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 1349 eLog() << Verbose(0) << "Not enough or invalid arguments for specifying element db: -e <db file>" << endl;1596 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments for specifying element db: -e <db file>" << endl); 1350 1597 performCriticalExit(); 1351 1598 } else { 1352 Log() << Verbose(0) << "Using " << argv[argptr] << " as elements database." << endl;1599 DoLog(0) && (Log() << Verbose(0) << "Using " << argv[argptr] << " as elements database." << endl); 1353 1600 strncpy (configuration.databasepath, argv[argptr], MAXSTRINGSIZE-1); 1354 1601 argptr+=1; … … 1357 1604 case 'g': 1358 1605 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 1359 eLog() << Verbose(0) << "Not enough or invalid arguments for specifying bond length table: -g <table file>" << endl;1606 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments for specifying bond length table: -g <table file>" << endl); 1360 1607 performCriticalExit(); 1361 1608 } else { 1362 1609 BondGraphFileName = argv[argptr]; 1363 Log() << Verbose(0) << "Using " << BondGraphFileName << " as bond length table." << endl;1610 DoLog(0) && (Log() << Verbose(0) << "Using " << BondGraphFileName << " as bond length table." << endl); 1364 1611 argptr+=1; 1365 1612 } 1366 1613 break; 1367 1614 case 'n': 1368 Log() << Verbose(0) << "I won't parse trajectories." << endl;1615 DoLog(0) && (Log() << Verbose(0) << "I won't parse trajectories." << endl); 1369 1616 configuration.FastParsing = true; 1617 break; 1618 case 'X': 1619 { 1620 World::getInstance().setDefaultName(argv[argptr]); 1621 DoLog(0) && (Log() << Verbose(0) << "Default name of new molecules set to " << *World::getInstance().getDefaultName() << "." << endl); 1622 } 1370 1623 break; 1371 1624 default: // no match? Step on … … 1379 1632 // 3a. Parse the element database 1380 1633 if (periode->LoadPeriodentafel(configuration.databasepath)) { 1381 Log() << Verbose(0) << "Element list loaded successfully." << endl;1634 DoLog(0) && (Log() << Verbose(0) << "Element list loaded successfully." << endl); 1382 1635 //periode->Output(); 1383 1636 } else { 1384 Log() << Verbose(0) << "Element list loading failed." << endl;1637 DoLog(0) && (Log() << Verbose(0) << "Element list loading failed." << endl); 1385 1638 return 1; 1386 1639 } … … 1388 1641 if (argv[1][0] != '-') { 1389 1642 // simply create a new molecule, wherein the config file is loaded and the manipulation takes place 1390 Log() << Verbose(0) << "Config file given." << endl;1643 DoLog(0) && (Log() << Verbose(0) << "Config file given." << endl); 1391 1644 test.open(argv[1], ios::in); 1392 1645 if (test == NULL) { … … 1394 1647 output.open(argv[1], ios::out); 1395 1648 if (output == NULL) { 1396 Log() << Verbose(1) << "Specified config file " << argv[1] << " not found." << endl;1649 DoLog(1) && (Log() << Verbose(1) << "Specified config file " << argv[1] << " not found." << endl); 1397 1650 configPresent = absent; 1398 1651 } else { 1399 Log() << Verbose(0) << "Empty configuration file." << endl;1652 DoLog(0) && (Log() << Verbose(0) << "Empty configuration file." << endl); 1400 1653 ConfigFileName = argv[1]; 1401 1654 configPresent = empty; … … 1405 1658 test.close(); 1406 1659 ConfigFileName = argv[1]; 1407 Log() << Verbose(1) << "Specified config file found, parsing ... ";1660 DoLog(1) && (Log() << Verbose(1) << "Specified config file found, parsing ... "); 1408 1661 switch (configuration.TestSyntax(ConfigFileName, periode)) { 1409 1662 case 1: 1410 Log() << Verbose(0) << "new syntax." << endl;1663 DoLog(0) && (Log() << Verbose(0) << "new syntax." << endl); 1411 1664 configuration.Load(ConfigFileName, BondGraphFileName, periode, molecules); 1412 1665 configPresent = present; 1413 1666 break; 1414 1667 case 0: 1415 Log() << Verbose(0) << "old syntax." << endl;1668 DoLog(0) && (Log() << Verbose(0) << "old syntax." << endl); 1416 1669 configuration.LoadOld(ConfigFileName, BondGraphFileName, periode, molecules); 1417 1670 configPresent = present; 1418 1671 break; 1419 1672 default: 1420 Log() << Verbose(0) << "Unknown syntax or empty, yet present file." << endl;1673 DoLog(0) && (Log() << Verbose(0) << "Unknown syntax or empty, yet present file." << endl); 1421 1674 configPresent = empty; 1422 1675 } … … 1442 1695 configuration.BG = new BondGraph(configuration.GetIsAngstroem()); 1443 1696 if ((!BondGraphFileName.empty()) && (configuration.BG->LoadBondLengthTable(BondGraphFileName))) { 1444 Log() << Verbose(0) << "Bond length table loaded successfully." << endl;1697 DoLog(0) && (Log() << Verbose(0) << "Bond length table loaded successfully." << endl); 1445 1698 } else { 1446 eLog() << Verbose(1) << "Bond length table loading failed." << endl;1699 DoeLog(1) && (eLog()<< Verbose(1) << "Bond length table loading failed." << endl); 1447 1700 } 1448 1701 } … … 1451 1704 argptr = 1; 1452 1705 do { 1453 Log() << Verbose(0) << "Current Command line argument: " << argv[argptr] << "." << endl;1706 DoLog(0) && (Log() << Verbose(0) << "Current Command line argument: " << argv[argptr] << "." << endl); 1454 1707 if (argv[argptr][0] == '-') { 1455 1708 argptr++; … … 1460 1713 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 1461 1714 ExitFlag = 255; 1462 eLog() << Verbose(0) << "Not enough arguments for parsing: -p <xyz file>" << endl;1715 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough arguments for parsing: -p <xyz file>" << endl); 1463 1716 performCriticalExit(); 1464 1717 } else { 1465 1718 SaveFlag = true; 1466 Log() << Verbose(1) << "Parsing xyz file for new atoms." << endl;1719 DoLog(1) && (Log() << Verbose(1) << "Parsing xyz file for new atoms." << endl); 1467 1720 if (!mol->AddXYZFile(argv[argptr])) 1468 Log() << Verbose(2) << "File not found." << endl;1721 DoLog(2) && (Log() << Verbose(2) << "File not found." << endl); 1469 1722 else { 1470 Log() << Verbose(2) << "File found and parsed." << endl;1723 DoLog(2) && (Log() << Verbose(2) << "File found and parsed." << endl); 1471 1724 configPresent = present; 1472 1725 } … … 1477 1730 if ((argptr >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) || (!IsValidNumber(argv[argptr+3]))) { 1478 1731 ExitFlag = 255; 1479 eLog() << Verbose(0) << "Not enough or invalid arguments for adding atom: -a <element> <x> <y> <z>" << endl;1732 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments for adding atom: -a <element> <x> <y> <z>" << endl); 1480 1733 performCriticalExit(); 1481 1734 } else { … … 1485 1738 first->type = periode->FindElement(atoi(argv[argptr])); 1486 1739 if (first->type != NULL) 1487 Log() << Verbose(2) << "found element " << first->type->name << endl;1740 DoLog(2) && (Log() << Verbose(2) << "found element " << first->type->name << endl); 1488 1741 for (int i=NDIM;i--;) 1489 1742 first->x.x[i] = atof(argv[argptr+1+i]); … … 1493 1746 configPresent = present; 1494 1747 } else 1495 eLog() << Verbose(1) << "Could not find the specified element." << endl;1748 DoeLog(1) && (eLog()<< Verbose(1) << "Could not find the specified element." << endl); 1496 1749 argptr+=4; 1497 1750 } … … 1506 1759 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 1507 1760 ExitFlag = 255; 1508 eLog() << Verbose(0) << "Not enough or invalid arguments given for setting MPQC basis: -B <basis name>" << endl;1761 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for setting MPQC basis: -B <basis name>" << endl); 1509 1762 performCriticalExit(); 1510 1763 } else { 1511 1764 configuration.basis = argv[argptr]; 1512 Log() << Verbose(1) << "Setting MPQC basis to " << configuration.basis << "." << endl;1765 DoLog(1) && (Log() << Verbose(1) << "Setting MPQC basis to " << configuration.basis << "." << endl); 1513 1766 argptr+=1; 1514 1767 } … … 1517 1770 if (ExitFlag == 0) ExitFlag = 1; 1518 1771 { 1519 Log() << Verbose(1) << "Depth-First-Search Analysis." << endl;1772 DoLog(1) && (Log() << Verbose(1) << "Depth-First-Search Analysis." << endl); 1520 1773 MoleculeLeafClass *Subgraphs = NULL; // list of subgraphs from DFS analysis 1521 1774 int *MinimumRingSize = new int[mol->AtomCount]; … … 1548 1801 break; 1549 1802 case 'I': 1550 Log() << Verbose(1) << "Dissecting molecular system into a set of disconnected subgraphs ... " << endl;1803 DoLog(1) && (Log() << Verbose(1) << "Dissecting molecular system into a set of disconnected subgraphs ... " << endl); 1551 1804 // @TODO rather do the dissection afterwards 1552 1805 molecules->DissectMoleculeIntoConnectedSubgraphs(periode, &configuration); … … 1559 1812 } 1560 1813 } 1561 if ( mol == NULL) {1814 if ((mol == NULL) && (!molecules->ListOfMolecules.empty())) { 1562 1815 mol = *(molecules->ListOfMolecules.begin()); 1563 mol->ActiveFlag = true; 1816 if (mol != NULL) 1817 mol->ActiveFlag = true; 1564 1818 } 1565 1819 break; 1566 1820 case 'C': 1567 if (ExitFlag == 0) ExitFlag = 1; 1568 if ((argptr+2 >= argc) || (!IsValidNumber(argv[argptr])) || (argv[argptr][0] == '-') || (argv[argptr+1][0] == '-') || (argv[argptr+2][0] == '-')) { 1569 ExitFlag = 255; 1570 eLog() << Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C <Z> <output> <bin output>" << endl; 1571 performCriticalExit(); 1572 } else { 1573 ofstream output(argv[argptr+1]); 1574 ofstream binoutput(argv[argptr+2]); 1575 const double radius = 5.; 1576 1577 // get the boundary 1578 class molecule *Boundary = NULL; 1579 class Tesselation *TesselStruct = NULL; 1580 const LinkedCell *LCList = NULL; 1581 // find biggest molecule 1582 int counter = 0; 1583 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) { 1584 if ((Boundary == NULL) || (Boundary->AtomCount < (*BigFinder)->AtomCount)) { 1585 Boundary = *BigFinder; 1821 { 1822 int ranges[3] = {1, 1, 1}; 1823 bool periodic = (argv[argptr-1][2] =='p'); 1824 if (ExitFlag == 0) ExitFlag = 1; 1825 if ((argptr >= argc)) { 1826 ExitFlag = 255; 1827 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); 1828 performCriticalExit(); 1829 } else { 1830 switch(argv[argptr][0]) { 1831 case 'E': 1832 { 1833 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] == '-')) { 1834 ExitFlag = 255; 1835 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C E <Z1> <Z2> <output> <bin output>" << endl); 1836 performCriticalExit(); 1837 } else { 1838 ofstream output(argv[argptr+3]); 1839 ofstream binoutput(argv[argptr+4]); 1840 const double BinStart = atof(argv[argptr+5]); 1841 const double BinEnd = atof(argv[argptr+6]); 1842 1843 const element *elemental = periode->FindElement((const int) atoi(argv[argptr+1])); 1844 const element *elemental2 = periode->FindElement((const int) atoi(argv[argptr+2])); 1845 PairCorrelationMap *correlationmap = NULL; 1846 if (periodic) 1847 correlationmap = PeriodicPairCorrelation(molecules, elemental, elemental2, ranges); 1848 else 1849 correlationmap = PairCorrelation(molecules, elemental, elemental2); 1850 //OutputCorrelationToSurface(&output, correlationmap); 1851 BinPairMap *binmap = BinData( correlationmap, 0.5, BinStart, BinEnd ); 1852 OutputCorrelation ( &binoutput, binmap ); 1853 output.close(); 1854 binoutput.close(); 1855 delete(binmap); 1856 delete(correlationmap); 1857 argptr+=7; 1858 } 1859 } 1860 break; 1861 1862 case 'P': 1863 { 1864 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] == '-')) { 1865 ExitFlag = 255; 1866 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); 1867 performCriticalExit(); 1868 } else { 1869 ofstream output(argv[argptr+5]); 1870 ofstream binoutput(argv[argptr+6]); 1871 const double BinStart = atof(argv[argptr+7]); 1872 const double BinEnd = atof(argv[argptr+8]); 1873 1874 const element *elemental = periode->FindElement((const int) atoi(argv[argptr+1])); 1875 Vector *Point = new Vector((const double) atof(argv[argptr+1]),(const double) atof(argv[argptr+2]),(const double) atof(argv[argptr+3])); 1876 CorrelationToPointMap *correlationmap = NULL; 1877 if (periodic) 1878 correlationmap = PeriodicCorrelationToPoint(molecules, elemental, Point, ranges); 1879 else 1880 correlationmap = CorrelationToPoint(molecules, elemental, Point); 1881 //OutputCorrelationToSurface(&output, correlationmap); 1882 BinPairMap *binmap = BinData( correlationmap, 0.5, BinStart, BinEnd ); 1883 OutputCorrelation ( &binoutput, binmap ); 1884 output.close(); 1885 binoutput.close(); 1886 delete(Point); 1887 delete(binmap); 1888 delete(correlationmap); 1889 argptr+=9; 1890 } 1891 } 1892 break; 1893 1894 case 'S': 1895 { 1896 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] == '-')) { 1897 ExitFlag = 255; 1898 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); 1899 performCriticalExit(); 1900 } else { 1901 ofstream output(argv[argptr+2]); 1902 ofstream binoutput(argv[argptr+3]); 1903 const double radius = 4.; 1904 const double BinWidth = atof(argv[argptr+4]); 1905 const double BinStart = atof(argv[argptr+5]); 1906 const double BinEnd = atof(argv[argptr+6]); 1907 double LCWidth = 20.; 1908 if (BinEnd > 0) { 1909 if (BinEnd > 2.*radius) 1910 LCWidth = BinEnd; 1911 else 1912 LCWidth = 2.*radius; 1913 } 1914 1915 // get the boundary 1916 class molecule *Boundary = NULL; 1917 class Tesselation *TesselStruct = NULL; 1918 const LinkedCell *LCList = NULL; 1919 // find biggest molecule 1920 int counter = 0; 1921 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) { 1922 if ((Boundary == NULL) || (Boundary->AtomCount < (*BigFinder)->AtomCount)) { 1923 Boundary = *BigFinder; 1924 } 1925 counter++; 1926 } 1927 bool *Actives = Malloc<bool>(counter, "ParseCommandLineOptions() - case C -- *Actives"); 1928 counter = 0; 1929 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) { 1930 Actives[counter++] = (*BigFinder)->ActiveFlag; 1931 (*BigFinder)->ActiveFlag = (*BigFinder == Boundary) ? false : true; 1932 } 1933 LCList = new LinkedCell(Boundary, LCWidth); 1934 const element *elemental = periode->FindElement((const int) atoi(argv[argptr+1])); 1935 FindNonConvexBorder(Boundary, TesselStruct, LCList, radius, NULL); 1936 CorrelationToSurfaceMap *surfacemap = NULL; 1937 if (periodic) 1938 surfacemap = PeriodicCorrelationToSurface( molecules, elemental, TesselStruct, LCList, ranges); 1939 else 1940 surfacemap = CorrelationToSurface( molecules, elemental, TesselStruct, LCList); 1941 OutputCorrelationToSurface(&output, surfacemap); 1942 // check whether radius was appropriate 1943 { 1944 double start; double end; 1945 GetMinMax( surfacemap, start, end); 1946 if (LCWidth < end) 1947 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); 1948 } 1949 BinPairMap *binmap = BinData( surfacemap, BinWidth, BinStart, BinEnd ); 1950 OutputCorrelation ( &binoutput, binmap ); 1951 output.close(); 1952 binoutput.close(); 1953 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) 1954 (*BigFinder)->ActiveFlag = Actives[counter++]; 1955 Free(&Actives); 1956 delete(LCList); 1957 delete(TesselStruct); 1958 delete(binmap); 1959 delete(surfacemap); 1960 argptr+=7; 1961 } 1962 } 1963 break; 1964 1965 default: 1966 ExitFlag = 255; 1967 DoeLog(0) && (eLog()<< Verbose(0) << "Invalid type given for pair correlation analysis: -C <type: E/P/S> [more params] <output> <bin output>" << endl); 1968 performCriticalExit(); 1969 break; 1586 1970 } 1587 counter++;1588 1971 } 1589 bool *Actives = Malloc<bool>(counter, "ParseCommandLineOptions() - case C -- *Actives"); 1590 counter = 0; 1591 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) { 1592 Actives[counter++] = (*BigFinder)->ActiveFlag; 1593 (*BigFinder)->ActiveFlag = (*BigFinder == Boundary) ? false : true; 1594 } 1595 LCList = new LinkedCell(Boundary, 2.*radius); 1596 const element *elemental = periode->FindElement((atomicNumber_t) atoi(argv[argptr])); 1597 FindNonConvexBorder(Boundary, TesselStruct, LCList, radius, NULL); 1598 int ranges[NDIM] = {1,1,1}; 1599 CorrelationToSurfaceMap *surfacemap = PeriodicCorrelationToSurface( molecules, elemental, TesselStruct, LCList, ranges ); 1600 OutputCorrelationToSurface(&output, surfacemap); 1601 BinPairMap *binmap = BinData( surfacemap, 0.5, 0., 20. ); 1602 OutputCorrelation ( &binoutput, binmap ); 1603 output.close(); 1604 binoutput.close(); 1605 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) 1606 (*BigFinder)->ActiveFlag = Actives[counter++]; 1607 Free(&Actives); 1608 delete(LCList); 1609 delete(TesselStruct); 1610 argptr+=3; 1611 } 1612 break; 1972 break; 1973 } 1613 1974 case 'E': 1614 1975 if (ExitFlag == 0) ExitFlag = 1; 1615 1976 if ((argptr+1 >= argc) || (!IsValidNumber(argv[argptr])) || (argv[argptr+1][0] == '-')) { 1616 1977 ExitFlag = 255; 1617 eLog() << Verbose(0) << "Not enough or invalid arguments given for changing element: -E <atom nr.> <element>" << endl;1978 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for changing element: -E <atom nr.> <element>" << endl); 1618 1979 performCriticalExit(); 1619 1980 } else { 1620 1981 SaveFlag = true; 1621 Log() << Verbose(1) << "Changing atom " << argv[argptr] << " to element " << argv[argptr+1] << "." << endl;1982 DoLog(1) && (Log() << Verbose(1) << "Changing atom " << argv[argptr] << " to element " << argv[argptr+1] << "." << endl); 1622 1983 first = mol->FindAtom(atoi(argv[argptr])); 1623 1984 first->type = periode->FindElement(atoi(argv[argptr+1])); … … 1627 1988 case 'F': 1628 1989 if (ExitFlag == 0) ExitFlag = 1; 1629 if (argptr+6 >=argc) { 1990 MaxDistance = -1; 1991 if (argv[argptr-1][2] == 'F') { // option is -FF? 1992 // fetch first argument as max distance to surface 1993 MaxDistance = atof(argv[argptr++]); 1994 DoLog(0) && (Log() << Verbose(0) << "Filling with maximum layer distance of " << MaxDistance << "." << endl); 1995 } 1996 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]))) { 1630 1997 ExitFlag = 255; 1631 eLog() << Verbose(0) << "Not enough or invalid arguments given for filling box with water: -F <dist_x> <dist_y> <dist_z> <boundary> <randatom> <randmol> <DoRotate>" << endl;1998 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); 1632 1999 performCriticalExit(); 1633 2000 } else { 1634 2001 SaveFlag = true; 1635 Log() << Verbose(1) << "Filling Box with water molecules." << endl;2002 DoLog(1) && (Log() << Verbose(1) << "Filling Box with water molecules." << endl); 1636 2003 // construct water molecule 1637 2004 molecule *filler = World::getInstance().createMolecule(); 2005 if (!filler->AddXYZFile(argv[argptr])) { 2006 DoeLog(0) && (eLog()<< Verbose(0) << "Could not parse filler molecule from " << argv[argptr] << "." << endl); 2007 } 2008 filler->SetNameFromFilename(argv[argptr]); 2009 configuration.BG->ConstructBondGraph(filler); 1638 2010 molecule *Filling = NULL; 1639 2011 atom *second = NULL, *third = NULL; 1640 // first = new atom();1641 // first->type = periode->FindElement(5);1642 // first->x.Zero();1643 // filler->AddAtom(first);1644 2012 first = World::getInstance().createAtom(); 1645 2013 first->type = periode->FindElement(1); … … 1659 2027 double distance[NDIM]; 1660 2028 for (int i=0;i<NDIM;i++) 1661 distance[i] = atof(argv[argptr+i ]);1662 Filling = FillBoxWithMolecule(molecules, filler, configuration, distance, atof(argv[argptr+3]), atof(argv[argptr+4]), atof(argv[argptr+5]), atoi(argv[argptr+6]));2029 distance[i] = atof(argv[argptr+i+1]); 2030 Filling = FillBoxWithMolecule(molecules, filler, configuration, MaxDistance, distance, atof(argv[argptr+4]), atof(argv[argptr+5]), atof(argv[argptr+6]), atoi(argv[argptr+7])); 1663 2031 if (Filling != NULL) { 1664 2032 Filling->ActiveFlag = false; … … 1673 2041 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 1674 2042 ExitFlag =255; 1675 eLog() << Verbose(0) << "Missing source file for bonds in molecule: -A <bond sourcefile>" << endl;2043 DoeLog(0) && (eLog()<< Verbose(0) << "Missing source file for bonds in molecule: -A <bond sourcefile>" << endl); 1676 2044 performCriticalExit(); 1677 2045 } else { 1678 Log() << Verbose(0) << "Parsing bonds from " << argv[argptr] << "." << endl;2046 DoLog(0) && (Log() << Verbose(0) << "Parsing bonds from " << argv[argptr] << "." << endl); 1679 2047 ifstream *input = new ifstream(argv[argptr]); 1680 2048 mol->CreateAdjacencyListFromDbondFile(input); … … 1688 2056 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 1689 2057 ExitFlag =255; 1690 eLog() << Verbose(0) << "Missing path of adjacency file: -j <path>" << endl;2058 DoeLog(0) && (eLog()<< Verbose(0) << "Missing path of adjacency file: -j <path>" << endl); 1691 2059 performCriticalExit(); 1692 2060 } else { 1693 Log() << Verbose(0) << "Storing adjacency to path " << argv[argptr] << "." << endl;2061 DoLog(0) && (Log() << Verbose(0) << "Storing adjacency to path " << argv[argptr] << "." << endl); 1694 2062 configuration.BG->ConstructBondGraph(mol); 1695 mol->StoreAdjacencyToFile( argv[argptr]);2063 mol->StoreAdjacencyToFile(NULL, argv[argptr]); 1696 2064 argptr+=1; 1697 2065 } … … 1702 2070 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 1703 2071 ExitFlag =255; 1704 eLog() << Verbose(0) << "Missing path of bonds file: -j <path>" << endl;2072 DoeLog(0) && (eLog()<< Verbose(0) << "Missing path of bonds file: -j <path>" << endl); 1705 2073 performCriticalExit(); 1706 2074 } else { 1707 Log() << Verbose(0) << "Storing bonds to path " << argv[argptr] << "." << endl;2075 DoLog(0) && (Log() << Verbose(0) << "Storing bonds to path " << argv[argptr] << "." << endl); 1708 2076 configuration.BG->ConstructBondGraph(mol); 1709 mol->StoreBondsToFile( argv[argptr]);2077 mol->StoreBondsToFile(NULL, argv[argptr]); 1710 2078 argptr+=1; 1711 2079 } … … 1716 2084 if ((argptr+1 >= argc) || (argv[argptr+1][0] == '-')){ 1717 2085 ExitFlag = 255; 1718 eLog() << Verbose(0) << "Not enough or invalid arguments given for non-convex envelope: -o <radius> <tecplot output file>" << endl;2086 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for non-convex envelope: -o <radius> <tecplot output file>" << endl); 1719 2087 performCriticalExit(); 1720 2088 } else { … … 1724 2092 //string filename(argv[argptr+1]); 1725 2093 //filename.append(".csv"); 1726 Log() << Verbose(0) << "Evaluating non-convex envelope of biggest molecule.";1727 Log() << Verbose(1) << "Using rolling ball of radius " << atof(argv[argptr]) << " and storing tecplot data in " << argv[argptr+1] << "." << endl;2094 DoLog(0) && (Log() << Verbose(0) << "Evaluating non-convex envelope of biggest molecule."); 2095 DoLog(1) && (Log() << Verbose(1) << "Using rolling ball of radius " << atof(argv[argptr]) << " and storing tecplot data in " << argv[argptr+1] << "." << endl); 1728 2096 // find biggest molecule 1729 2097 int counter = 0; … … 1735 2103 counter++; 1736 2104 } 1737 Log() << Verbose(1) << "Biggest molecule has " << Boundary->AtomCount << " atoms." << endl;2105 DoLog(1) && (Log() << Verbose(1) << "Biggest molecule has " << Boundary->AtomCount << " atoms." << endl); 1738 2106 start = clock(); 1739 2107 LCList = new LinkedCell(Boundary, atof(argv[argptr])*2.); … … 1742 2110 //FindDistributionOfEllipsoids(T, &LCList, N, number, filename.c_str()); 1743 2111 end = clock(); 1744 Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl;2112 DoLog(0) && (Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl); 1745 2113 delete(LCList); 1746 2114 delete(T); … … 1752 2120 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 1753 2121 ExitFlag = 255; 1754 eLog() << Verbose(0) << "Not enough or invalid arguments given for storing tempature: -S <temperature file>" << endl;2122 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for storing tempature: -S <temperature file>" << endl); 1755 2123 performCriticalExit(); 1756 2124 } else { 1757 Log() << Verbose(1) << "Storing temperatures in " << argv[argptr] << "." << endl;2125 DoLog(1) && (Log() << Verbose(1) << "Storing temperatures in " << argv[argptr] << "." << endl); 1758 2126 ofstream *output = new ofstream(argv[argptr], ios::trunc); 1759 2127 if (!mol->OutputTemperatureFromTrajectories(output, 0, mol->MDSteps)) 1760 Log() << Verbose(2) << "File could not be written." << endl;2128 DoLog(2) && (Log() << Verbose(2) << "File could not be written." << endl); 1761 2129 else 1762 Log() << Verbose(2) << "File stored." << endl;2130 DoLog(2) && (Log() << Verbose(2) << "File stored." << endl); 1763 2131 output->close(); 1764 2132 delete(output); … … 1770 2138 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 1771 2139 ExitFlag = 255; 1772 eLog() << Verbose(0) << "Not enough or invalid arguments given for storing tempature: -L <step0> <step1> <prefix> <identity mapping?>" << endl;2140 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for storing tempature: -L <step0> <step1> <prefix> <identity mapping?>" << endl); 1773 2141 performCriticalExit(); 1774 2142 } else { 1775 2143 SaveFlag = true; 1776 Log() << Verbose(1) << "Linear interpolation between configuration " << argv[argptr] << " and " << argv[argptr+1] << "." << endl;2144 DoLog(1) && (Log() << Verbose(1) << "Linear interpolation between configuration " << argv[argptr] << " and " << argv[argptr+1] << "." << endl); 1777 2145 if (atoi(argv[argptr+3]) == 1) 1778 Log() << Verbose(1) << "Using Identity for the permutation map." << endl;2146 DoLog(1) && (Log() << Verbose(1) << "Using Identity for the permutation map." << endl); 1779 2147 if (!mol->LinearInterpolationBetweenConfiguration(atoi(argv[argptr]), atoi(argv[argptr+1]), argv[argptr+2], configuration, atoi(argv[argptr+3])) == 1 ? true : false) 1780 Log() << Verbose(2) << "Could not store " << argv[argptr+2] << " files." << endl;2148 DoLog(2) && (Log() << Verbose(2) << "Could not store " << argv[argptr+2] << " files." << endl); 1781 2149 else 1782 Log() << Verbose(2) << "Steps created and " << argv[argptr+2] << " files stored." << endl;2150 DoLog(2) && (Log() << Verbose(2) << "Steps created and " << argv[argptr+2] << " files stored." << endl); 1783 2151 argptr+=4; 1784 2152 } … … 1788 2156 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 1789 2157 ExitFlag = 255; 1790 eLog() << Verbose(0) << "Not enough or invalid arguments given for parsing and integrating forces: -P <forces file>" << endl;2158 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for parsing and integrating forces: -P <forces file>" << endl); 1791 2159 performCriticalExit(); 1792 2160 } else { 1793 2161 SaveFlag = true; 1794 Log() << Verbose(1) << "Parsing forces file and Verlet integrating." << endl;2162 DoLog(1) && (Log() << Verbose(1) << "Parsing forces file and Verlet integrating." << endl); 1795 2163 if (!mol->VerletForceIntegration(argv[argptr], configuration)) 1796 Log() << Verbose(2) << "File not found." << endl;2164 DoLog(2) && (Log() << Verbose(2) << "File not found." << endl); 1797 2165 else 1798 Log() << Verbose(2) << "File found and parsed." << endl;2166 DoLog(2) && (Log() << Verbose(2) << "File found and parsed." << endl); 1799 2167 argptr+=1; 1800 2168 } … … 1804 2172 if ((argptr+1 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1]))) { 1805 2173 ExitFlag = 255; 1806 eLog() << Verbose(0) << "Not enough or invalid arguments given for removing atoms: -R <id> <distance>" << endl;2174 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for removing atoms: -R <id> <distance>" << endl); 1807 2175 performCriticalExit(); 1808 2176 } else { 1809 2177 SaveFlag = true; 1810 Log() << Verbose(1) << "Removing atoms around " << argv[argptr] << " with radius " << argv[argptr+1] << "." << endl;2178 DoLog(1) && (Log() << Verbose(1) << "Removing atoms around " << argv[argptr] << " with radius " << argv[argptr+1] << "." << endl); 1811 2179 double tmp1 = atof(argv[argptr+1]); 1812 2180 atom *third = mol->FindAtom(atoi(argv[argptr])); … … 1821 2189 } 1822 2190 } else { 1823 eLog() << Verbose(1) << "Removal failed due to missing atoms on molecule or wrong id." << endl;2191 DoeLog(1) && (eLog()<< Verbose(1) << "Removal failed due to missing atoms on molecule or wrong id." << endl); 1824 2192 } 1825 2193 argptr+=2; … … 1830 2198 if ((argptr+2 >= argc) || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) { 1831 2199 ExitFlag = 255; 1832 eLog() << Verbose(0) << "Not enough or invalid arguments given for translation: -t <x> <y> <z>" << endl;2200 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for translation: -t <x> <y> <z>" << endl); 1833 2201 performCriticalExit(); 1834 2202 } else { 1835 2203 if (ExitFlag == 0) ExitFlag = 1; 1836 2204 SaveFlag = true; 1837 Log() << Verbose(1) << "Translating all ions by given vector." << endl;2205 DoLog(1) && (Log() << Verbose(1) << "Translating all ions by given vector." << endl); 1838 2206 for (int i=NDIM;i--;) 1839 2207 x.x[i] = atof(argv[argptr+i]); … … 1846 2214 if ((argptr+2 >= argc) || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) { 1847 2215 ExitFlag = 255; 1848 eLog() << Verbose(0) << "Not enough or invalid arguments given for periodic translation: -T <x> <y> <z>" << endl;2216 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for periodic translation: -T <x> <y> <z>" << endl); 1849 2217 performCriticalExit(); 1850 2218 } else { 1851 2219 if (ExitFlag == 0) ExitFlag = 1; 1852 2220 SaveFlag = true; 1853 Log() << Verbose(1) << "Translating all ions periodically by given vector." << endl;2221 DoLog(1) && (Log() << Verbose(1) << "Translating all ions periodically by given vector." << endl); 1854 2222 for (int i=NDIM;i--;) 1855 2223 x.x[i] = atof(argv[argptr+i]); … … 1862 2230 if ((argptr >= argc) || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) { 1863 2231 ExitFlag = 255; 1864 eLog() << Verbose(0) << "Not enough or invalid arguments given for scaling: -s <factor_x> [factor_y] [factor_z]" << endl;2232 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for scaling: -s <factor_x> [factor_y] [factor_z]" << endl); 1865 2233 performCriticalExit(); 1866 2234 } else { 1867 2235 SaveFlag = true; 1868 2236 j = -1; 1869 Log() << Verbose(1) << "Scaling all ion positions by factor." << endl;2237 DoLog(1) && (Log() << Verbose(1) << "Scaling all ion positions by factor." << endl); 1870 2238 factor = new double[NDIM]; 1871 2239 factor[0] = atof(argv[argptr]); … … 1873 2241 factor[2] = atof(argv[argptr+2]); 1874 2242 mol->Scale((const double ** const)&factor); 2243 double * const cell_size = World::getInstance().getDomain(); 1875 2244 for (int i=0;i<NDIM;i++) { 1876 2245 j += i+1; 1877 2246 x.x[i] = atof(argv[NDIM+i]); 1878 mol->cell_size[j]*=factor[i];2247 cell_size[j]*=factor[i]; 1879 2248 } 1880 2249 delete[](factor); … … 1886 2255 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])) ) { 1887 2256 ExitFlag = 255; 1888 eLog() << Verbose(0) << "Not enough or invalid arguments given for centering in box: -b <xx> <xy> <xz> <yy> <yz> <zz>" << endl;2257 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for centering in box: -b <xx> <xy> <xz> <yy> <yz> <zz>" << endl); 1889 2258 performCriticalExit(); 1890 2259 } else { 1891 2260 SaveFlag = true; 1892 2261 j = -1; 1893 Log() << Verbose(1) << "Centering atoms in config file within given simulation box." << endl; 2262 DoLog(1) && (Log() << Verbose(1) << "Centering atoms in config file within given simulation box." << endl); 2263 double * const cell_size = World::getInstance().getDomain(); 1894 2264 for (int i=0;i<6;i++) { 1895 mol->cell_size[i] = atof(argv[argptr+i]);2265 cell_size[i] = atof(argv[argptr+i]); 1896 2266 } 1897 2267 // center … … 1904 2274 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])) ) { 1905 2275 ExitFlag = 255; 1906 eLog() << Verbose(0) << "Not enough or invalid arguments given for bounding in box: -B <xx> <xy> <xz> <yy> <yz> <zz>" << endl;2276 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for bounding in box: -B <xx> <xy> <xz> <yy> <yz> <zz>" << endl); 1907 2277 performCriticalExit(); 1908 2278 } else { 1909 2279 SaveFlag = true; 1910 2280 j = -1; 1911 Log() << Verbose(1) << "Centering atoms in config file within given simulation box." << endl; 2281 DoLog(1) && (Log() << Verbose(1) << "Centering atoms in config file within given simulation box." << endl); 2282 double * const cell_size = World::getInstance().getDomain(); 1912 2283 for (int i=0;i<6;i++) { 1913 mol->cell_size[i] = atof(argv[argptr+i]);2284 cell_size[i] = atof(argv[argptr+i]); 1914 2285 } 1915 2286 // center … … 1922 2293 if ((argptr+2 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) { 1923 2294 ExitFlag = 255; 1924 eLog() << Verbose(0) << "Not enough or invalid arguments given for centering with boundary: -c <boundary_x> <boundary_y> <boundary_z>" << endl;2295 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for centering with boundary: -c <boundary_x> <boundary_y> <boundary_z>" << endl); 1925 2296 performCriticalExit(); 1926 2297 } else { 1927 2298 SaveFlag = true; 1928 2299 j = -1; 1929 Log() << Verbose(1) << "Centering atoms in config file within given additional boundary." << endl;2300 DoLog(1) && (Log() << Verbose(1) << "Centering atoms in config file within given additional boundary." << endl); 1930 2301 // make every coordinate positive 1931 2302 mol->CenterEdge(&x); … … 1933 2304 mol->SetBoxDimension(&x); 1934 2305 // translate each coordinate by boundary 2306 double * const cell_size = World::getInstance().getDomain(); 1935 2307 j=-1; 1936 2308 for (int i=0;i<NDIM;i++) { 1937 2309 j += i+1; 1938 2310 x.x[i] = atof(argv[argptr+i]); 1939 mol->cell_size[j] += x.x[i]*2.;2311 cell_size[j] += x.x[i]*2.; 1940 2312 } 1941 2313 mol->Translate((const Vector *)&x); … … 1946 2318 if (ExitFlag == 0) ExitFlag = 1; 1947 2319 SaveFlag = true; 1948 Log() << Verbose(1) << "Centering atoms on edge and setting box dimensions." << endl;2320 DoLog(1) && (Log() << Verbose(1) << "Centering atoms on edge and setting box dimensions." << endl); 1949 2321 x.Zero(); 1950 2322 mol->CenterEdge(&x); … … 1956 2328 if ((argptr >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr]))) { 1957 2329 ExitFlag = 255; 1958 eLog() << Verbose(0) << "Not enough or invalid arguments given for removing atoms: -r <id>" << endl;2330 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for removing atoms: -r <id>" << endl); 1959 2331 performCriticalExit(); 1960 2332 } else { 1961 2333 SaveFlag = true; 1962 Log() << Verbose(1) << "Removing atom " << argv[argptr] << "." << endl;2334 DoLog(1) && (Log() << Verbose(1) << "Removing atom " << argv[argptr] << "." << endl); 1963 2335 atom *first = mol->FindAtom(atoi(argv[argptr])); 1964 2336 mol->RemoveAtom(first); … … 1970 2342 if ((argptr+1 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1]))) { 1971 2343 ExitFlag = 255; 1972 eLog() << Verbose(0) << "Not enough or invalid arguments for fragmentation: -f <max. bond distance> <bond order>" << endl;2344 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments for fragmentation: -f <max. bond distance> <bond order>" << endl); 1973 2345 performCriticalExit(); 1974 2346 } else { 1975 Log() << Verbose(0) << "Fragmenting molecule with bond distance " << argv[argptr] << " angstroem, order of " << argv[argptr+1] << "." << endl;1976 Log() << Verbose(0) << "Creating connection matrix..." << endl;2347 DoLog(0) && (Log() << Verbose(0) << "Fragmenting molecule with bond distance " << argv[argptr] << " angstroem, order of " << argv[argptr+1] << "." << endl); 2348 DoLog(0) && (Log() << Verbose(0) << "Creating connection matrix..." << endl); 1977 2349 start = clock(); 1978 mol->CreateAdjacencyList(atof(argv[argptr ++]), configuration.GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL);1979 Log() << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl;2350 mol->CreateAdjacencyList(atof(argv[argptr]), configuration.GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL); 2351 DoLog(0) && (Log() << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl); 1980 2352 if (mol->first->next != mol->last) { 1981 ExitFlag = mol->FragmentMolecule(atoi(argv[argptr ]), &configuration);2353 ExitFlag = mol->FragmentMolecule(atoi(argv[argptr+1]), &configuration); 1982 2354 } 1983 2355 end = clock(); 1984 Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl;2356 DoLog(0) && (Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl); 1985 2357 argptr+=2; 1986 2358 } … … 1990 2362 j = atoi(argv[argptr++]); 1991 2363 if ((j<0) || (j>1)) { 1992 eLog() << Verbose(1) << "Argument of '-m' should be either 0 for no-rotate or 1 for rotate." << endl;2364 DoeLog(1) && (eLog()<< Verbose(1) << "Argument of '-m' should be either 0 for no-rotate or 1 for rotate." << endl); 1993 2365 j = 0; 1994 2366 } 1995 2367 if (j) { 1996 2368 SaveFlag = true; 1997 Log() << Verbose(0) << "Converting to prinicipal axis system." << endl;2369 DoLog(0) && (Log() << Verbose(0) << "Converting to prinicipal axis system." << endl); 1998 2370 } else 1999 Log() << Verbose(0) << "Evaluating prinicipal axis." << endl;2371 DoLog(0) && (Log() << Verbose(0) << "Evaluating prinicipal axis." << endl); 2000 2372 mol->PrincipalAxisSystem((bool)j); 2001 2373 break; … … 2004 2376 if ((argptr+1 >= argc) || (argv[argptr][0] == '-')){ 2005 2377 ExitFlag = 255; 2006 eLog() << Verbose(0) << "Not enough or invalid arguments given for convex envelope: -o <convex output file> <non-convex output file>" << endl;2378 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for convex envelope: -o <convex output file> <non-convex output file>" << endl); 2007 2379 performCriticalExit(); 2008 2380 } else { 2009 2381 class Tesselation *TesselStruct = NULL; 2010 2382 const LinkedCell *LCList = NULL; 2011 Log() << Verbose(0) << "Evaluating volume of the convex envelope.";2012 Log() << Verbose(1) << "Storing tecplot convex data in " << argv[argptr] << "." << endl;2013 Log() << Verbose(1) << "Storing tecplot non-convex data in " << argv[argptr+1] << "." << endl;2383 DoLog(0) && (Log() << Verbose(0) << "Evaluating volume of the convex envelope."); 2384 DoLog(1) && (Log() << Verbose(1) << "Storing tecplot convex data in " << argv[argptr] << "." << endl); 2385 DoLog(1) && (Log() << Verbose(1) << "Storing tecplot non-convex data in " << argv[argptr+1] << "." << endl); 2014 2386 LCList = new LinkedCell(mol, 10.); 2015 2387 //FindConvexBorder(mol, LCList, argv[argptr]); … … 2018 2390 double volumedifference = ConvexizeNonconvexEnvelope(TesselStruct, mol, argv[argptr]); 2019 2391 double clustervolume = VolumeOfConvexEnvelope(TesselStruct, &configuration); 2020 Log() << Verbose(0) << "The tesselated volume area is " << clustervolume << " " << (configuration.GetIsAngstroem() ? "angstrom" : "atomiclength") << "^3." << endl;2021 Log() << Verbose(0) << "The non-convex tesselated volume area is " << clustervolume-volumedifference << " " << (configuration.GetIsAngstroem() ? "angstrom" : "atomiclength") << "^3." << endl;2392 DoLog(0) && (Log() << Verbose(0) << "The tesselated volume area is " << clustervolume << " " << (configuration.GetIsAngstroem() ? "angstrom" : "atomiclength") << "^3." << endl); 2393 DoLog(0) && (Log() << Verbose(0) << "The non-convex tesselated volume area is " << clustervolume-volumedifference << " " << (configuration.GetIsAngstroem() ? "angstrom" : "atomiclength") << "^3." << endl); 2022 2394 delete(TesselStruct); 2023 2395 delete(LCList); … … 2029 2401 if ((argptr+1 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) ) { 2030 2402 ExitFlag = 255; 2031 eLog() << Verbose(0) << "Not enough or invalid arguments given for suspension with specified volume: -U <volume> <density>" << endl;2403 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for suspension with specified volume: -U <volume> <density>" << endl); 2032 2404 performCriticalExit(); 2033 2405 } else { 2034 2406 volume = atof(argv[argptr++]); 2035 Log() << Verbose(0) << "Using " << volume << " angstrom^3 as the volume instead of convex envelope one's." << endl;2407 DoLog(0) && (Log() << Verbose(0) << "Using " << volume << " angstrom^3 as the volume instead of convex envelope one's." << endl); 2036 2408 } 2037 2409 case 'u': … … 2040 2412 if (volume != -1) 2041 2413 ExitFlag = 255; 2042 eLog() << Verbose(0) << "Not enough or invalid arguments given for suspension: -u <density>" << endl;2414 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for suspension: -u <density>" << endl); 2043 2415 performCriticalExit(); 2044 2416 } else { 2045 2417 double density; 2046 2418 SaveFlag = true; 2047 Log() << Verbose(0) << "Evaluating necessary cell volume for a cluster suspended in water.";2419 DoLog(0) && (Log() << Verbose(0) << "Evaluating necessary cell volume for a cluster suspended in water."); 2048 2420 density = atof(argv[argptr++]); 2049 2421 if (density < 1.0) { 2050 eLog() << Verbose(1) << "Density must be greater than 1.0g/cm^3 !" << endl;2422 DoeLog(1) && (eLog()<< Verbose(1) << "Density must be greater than 1.0g/cm^3 !" << endl); 2051 2423 density = 1.3; 2052 2424 } … … 2054 2426 // repetition[i] = atoi(argv[argptr++]); 2055 2427 // if (repetition[i] < 1) 2056 // eLog() << Verbose(1) << "repetition value must be greater 1!" << endl;2428 // DoeLog(1) && (eLog()<< Verbose(1) << "repetition value must be greater 1!" << endl); 2057 2429 // repetition[i] = 1; 2058 2430 // } … … 2064 2436 if ((argptr+2 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) { 2065 2437 ExitFlag = 255; 2066 eLog() << Verbose(0) << "Not enough or invalid arguments given for repeating cells: -d <repeat_x> <repeat_y> <repeat_z>" << endl;2438 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for repeating cells: -d <repeat_x> <repeat_y> <repeat_z>" << endl); 2067 2439 performCriticalExit(); 2068 2440 } else { 2069 2441 SaveFlag = true; 2442 double * const cell_size = World::getInstance().getDomain(); 2070 2443 for (int axis = 1; axis <= NDIM; axis++) { 2071 2444 int faktor = atoi(argv[argptr++]); … … 2074 2447 Vector ** vectors; 2075 2448 if (faktor < 1) { 2076 eLog() << Verbose(1) << "Repetition factor must be greater than 1!" << endl;2449 DoeLog(1) && (eLog()<< Verbose(1) << "Repetition factor mus be greater than 1!" << endl); 2077 2450 faktor = 1; 2078 2451 } … … 2091 2464 } 2092 2465 if (count != j) 2093 eLog() << Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl;2466 DoeLog(1) && (eLog()<< Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl); 2094 2467 x.Zero(); 2095 2468 y.Zero(); 2096 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 magnitude2469 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 magnitude 2097 2470 for (int i=1;i<faktor;i++) { // then add this list with respective translation factor times 2098 2471 x.AddVector(&y); // per factor one cell width further … … 2115 2488 mol->Translate(&x); 2116 2489 } 2117 mol->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor;2490 cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor; 2118 2491 } 2119 2492 } … … 2132 2505 } else { // no arguments, hence scan the elements db 2133 2506 if (periode->LoadPeriodentafel(configuration.databasepath)) 2134 Log() << Verbose(0) << "Element list loaded successfully." << endl;2507 DoLog(0) && (Log() << Verbose(0) << "Element list loaded successfully." << endl); 2135 2508 else 2136 Log() << Verbose(0) << "Element list loading failed." << endl;2509 DoLog(0) && (Log() << Verbose(0) << "Element list loading failed." << endl); 2137 2510 configuration.RetrieveConfigPathAndName("main_pcp_linux"); 2138 2511 } … … 2191 2564 char *ConfigFileName = NULL; 2192 2565 int j; 2566 2567 cout << ESPACKVersion << endl; 2193 2568 2194 2569 setVerbosity(0); … … 2210 2585 World::getInstance().getMolecules()->insert(mol); 2211 2586 cout << "Molecule created" << endl; 2212 if( mol->cell_size[0] == 0.){2587 if(World::getInstance().getDomain()[0] == 0.){ 2213 2588 Log() << Verbose(0) << "enter lower tridiagonal form of basis matrix" << endl << endl; 2214 2589 for(int i = 0;i < 6;i++){ 2215 2590 Log() << Verbose(1) << "Cell size" << i << ": "; 2216 cin >> mol->cell_size[i];2591 cin >> World::getInstance().getDomain()[i]; 2217 2592 } 2218 2593 }
Note:
See TracChangeset
for help on using the changeset viewer.