Changeset 47d041 for src/moleculelist.cpp
- Timestamp:
- Nov 3, 2011, 7:44:01 PM (14 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, Candidate_v1.7.0, Candidate_v1.7.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:
- 41a467
- Parents:
- 50e4e5
- git-author:
- Frederik Heber <heber@…> (10/27/11 11:53:58)
- git-committer:
- Frederik Heber <heber@…> (11/03/11 19:44:01)
- File:
-
- 1 edited
-
src/moleculelist.cpp (modified) (21 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/moleculelist.cpp
r50e4e5 r47d041 56 56 MoleculeListClass::~MoleculeListClass() 57 57 { 58 DoLog(4) && (Log() << Verbose(4) << "Clearing ListOfMolecules." << endl);58 LOG(4, "Clearing ListOfMolecules."); 59 59 for(MoleculeList::iterator MolRunner = ListOfMolecules.begin(); MolRunner != ListOfMolecules.end(); ++MolRunner) 60 60 (*MolRunner)->signOff(this); … … 111 111 112 112 // sort each atom list and put the numbers into a list, then go through 113 //L og() << Verbose(0) << "Comparing fragment no. " << *(molecule **)a << " to " << *(molecule **)b << "." << endl;113 //LOG(0, "Comparing fragment no. " << *(molecule **)a << " to " << *(molecule **)b << "."); 114 114 // Yes those types are awkward... but check it for yourself it checks out this way 115 115 molecule *const *mol1_ptr= static_cast<molecule *const *>(a); … … 238 238 void MoleculeListClass::Output(std::ostream *out) 239 239 { 240 DoLog(1) && (Log() << Verbose(1) << "MoleculeList: "); 241 for (MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++) 242 DoLog(0) && (Log() << Verbose(0) << *ListRunner << "\t"); 243 DoLog(0) && (Log() << Verbose(0) << endl); 240 if (DoLog(1)) { 241 std::stringstream output; 242 output << "MoleculeList: "; 243 for (MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++) 244 output << *ListRunner << "\t"; 245 LOG(1, output.str()); 246 } 244 247 }; 245 248 … … 257 260 number = (int)floor(((double)number / 10.)); 258 261 order++; 259 //L og() << Verbose(0) << "Number is " << number << ", order is " << order << "." << endl;262 //LOG(0, "Number is " << number << ", order is " << order << "."); 260 263 } 261 264 // allocate string … … 268 271 number = (int)floor(((double)number / 10.)); 269 272 } 270 //L og() << Verbose(0) << returnstring << endl;273 //LOG(0, returnstring); 271 274 return returnstring; 272 275 }; … … 292 295 char *FragmentNumber = NULL; 293 296 294 DoLog(1) && (Log() << Verbose(1) <<"Saving hydrogen saturation correction ... ");297 LOG(1, "Saving hydrogen saturation correction ... "); 295 298 // 0. parse in fit constant files that should have the same dimension as the final energy files 296 299 // 0a. find dimension of matrices with constants … … 300 303 input.open(line.c_str()); 301 304 if (input.fail()) { 302 DoLog(1) && (Log() << Verbose(1) << endl << "Unable to open " << line << ", is the directory correct?" << endl);305 LOG(1, endl << "Unable to open " << line << ", is the directory correct?"); 303 306 return false; 304 307 } … … 317 320 b++; 318 321 } 319 DoLog(0) && (Log() << Verbose(0) <<"I recognized " << a << " columns and " << b << " rows, ");322 LOG(0, "I recognized " << a << " columns and " << b << " rows, "); 320 323 input.close(); 321 324 … … 341 344 input.open(line.c_str()); 342 345 if (input.fail()) { 343 DoeLog(0) && (eLog()<< Verbose(0) << endl << "Unable to open " << line << ", is the directory correct?" << endl);346 ELOG(0, endl << "Unable to open " << line << ", is the directory correct?"); 344 347 performCriticalExit(); 345 348 return false; … … 348 351 while ((!input.eof()) && (k < b)) { 349 352 input.getline(ParsedLine, 1023); 350 //L og() << Verbose(0) << "Current Line: " << ParsedLine << endl;353 //LOG(1, "INFO: Current Line: " << ParsedLine); 351 354 zeile.str(ParsedLine); 352 355 zeile.clear(); 353 356 l = 0; 357 //std::stringstream output; 354 358 while ((!zeile.eof()) && (l < a)) { 355 359 zeile >> FitConstant[i][l][k]; 356 // Log() << Verbose(0)<< FitConstant[i][l][k] << "\t";360 //output << FitConstant[i][l][k] << "\t"; 357 361 l++; 358 362 } 359 //L og() << Verbose(0) << endl;363 //LOG(1, "INFO: fit constant are " << output.str()); 360 364 k++; 361 365 } 362 366 input.close(); 363 367 } 364 for (int k = 0; k < 3; k++) { 365 DoLog(0) && (Log() << Verbose(0) << "Constants " << k << ":" << endl); 366 for (int j = 0; j < b; j++) { 367 for (int i = 0; i < a; i++) { 368 DoLog(0) && (Log() << Verbose(0) << FitConstant[k][i][j] << "\t"); 369 } 370 DoLog(0) && (Log() << Verbose(0) << endl); 371 } 372 DoLog(0) && (Log() << Verbose(0) << endl); 368 if (DoLog(1)) { 369 for (int k = 0; k < 3; k++) { 370 std::stringstream output; 371 output << "Constants " << k << ": "; 372 for (int j = 0; j < b; j++) { 373 for (int i = 0; i < a; i++) { 374 output << FitConstant[k][i][j] << "\t"; 375 } 376 output << std::endl; 377 } 378 LOG(0, output.str()); 379 } 373 380 } 374 381 … … 386 393 // 2. take every hydrogen that is a saturated one 387 394 for (molecule::const_iterator iter = (*ListRunner)->begin(); iter != (*ListRunner)->end(); ++iter) { 388 //L og() << Verbose(1) << "(*iter): " << *(*iter) << " with first bond " << *((*iter)->getListOfBonds().begin()) << "." << endl;395 //LOG(1, "(*iter): " << *(*iter) << " with first bond " << *((*iter)->getListOfBonds().begin()) << "."); 389 396 if (((*iter)->getType()->getAtomicNumber() == 1) && (((*iter)->father == NULL) 390 397 || ((*iter)->father->getType()->getAtomicNumber() != 1))) { // if it's a hydrogen 391 398 for (molecule::const_iterator runner = (*ListRunner)->begin(); runner != (*ListRunner)->end(); ++runner) { 392 //L og() << Verbose(2) << "Runner: " << *(*runner) << " with first bond " << *((*iter)->getListOfBonds().begin()) << "." << endl;399 //LOG(2, "Runner: " << *(*runner) << " with first bond " << *((*iter)->getListOfBonds().begin()) << "."); 393 400 // 3. take every other hydrogen that is the not the first and not bound to same bonding partner 394 401 const BondList &bondlist = (*runner)->getListOfBonds(); … … 397 404 // 4. evaluate the morse potential for each matrix component and add up 398 405 distance = (*runner)->distance(*(*iter)); 399 //Log() << Verbose(0) << "Fragment " << (*ListRunner)->name << ": " << *(*runner) << "<= " << distance << "=>" << *(*iter) << ":" << endl; 406 //std::stringstream output; 407 //output << "Fragment " << (*ListRunner)->name << ": " << *(*runner) << "<= " << distance << "=>" << *(*iter) << ":"; 400 408 for (int k = 0; k < a; k++) { 401 409 for (int j = 0; j < b; j++) { … … 408 416 default: 409 417 tmp = FitConstant[0][k][j] * pow(distance, FitConstant[1][k][j]) + FitConstant[2][k][j]; 418 break; 410 419 }; 411 420 correction[k][j] -= tmp; // ground state is actually lower (disturbed by additional interaction) 412 // Log() << Verbose(0)<< tmp << "\t";421 //output << tmp << "\t"; 413 422 } 414 // Log() << Verbose(0)<< endl;423 //output << endl; 415 424 } 416 //L og() << Verbose(0) << endl;425 //LOG(0, output.str()); 417 426 } 418 427 } … … 459 468 } 460 469 delete[](FitConstant); 461 DoLog(0) && (Log() << Verbose(0) << "done." << endl);470 LOG(0, "done."); 462 471 return true; 463 472 }; … … 477 486 478 487 // open file for the force factors 479 DoLog(1) && (Log() << Verbose(1) <<"Saving force factors ... ");488 LOG(1, "Saving force factors ... "); 480 489 if (!ForcesFile.fail()) { 481 //Log() << Verbose(1) << "Final AtomicForcesList: ";482 490 //output << prefix << "Forces" << endl; 483 491 for (MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++) { … … 488 496 if ((*atomIter)->getType()->getNumber() == (*elemIter).first) { 489 497 if (((*atomIter)->GetTrueFather() != NULL) && ((*atomIter)->GetTrueFather() != (*atomIter))) {// if there is a rea 490 //Log() << Verbose(0) << "Walker is " << *Walker << " with true father " << *( Walker->GetTrueFather()) << ", it491 498 ForcesFile << SortIndex[(*atomIter)->GetTrueFather()->getNr()] << "\t"; 492 499 } else … … 500 507 } 501 508 ForcesFile.close(); 502 DoLog(1) && (Log() << Verbose(1) << "done." << endl);509 LOG(1, "done."); 503 510 } else { 504 511 status = false; 505 DoLog(1) && (Log() << Verbose(1) << "failed to open file " << filename << "." << endl);512 LOG(1, "failed to open file " << filename << "."); 506 513 } 507 514 ForcesFile.close(); … … 640 647 Vector center; 641 648 char filename[MAXSTRINGSIZE]; 642 Log() << Verbose(0)<< "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl;649 std::cout << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl; 643 650 mol = World::getInstance().createMolecule(); 644 651 do { 645 Log() << Verbose(0)<< "Enter file name: ";652 std::cout << "Enter file name: "; 646 653 cin >> filename; 647 654 } while (!mol->AddXYZFile(filename)); … … 661 668 molecule *mol = NULL; 662 669 do { 663 Log() << Verbose(0)<< "Enter index of molecule: ";670 std::cout << "Enter index of molecule: "; 664 671 cin >> nr; 665 672 mol = ReturnIndex(nr); 666 673 } while (mol == NULL); 667 Log() << Verbose(0)<< "Enter name: ";674 std::cout << "Enter name: "; 668 675 cin >> filename; 669 676 mol->SetNameFromFilename(filename); … … 676 683 mol = NULL; 677 684 do { 678 Log() << Verbose(0)<< "Enter index of molecule: ";685 std::cout << "Enter index of molecule: "; 679 686 cin >> nr; 680 687 mol = ReturnIndex(nr); 681 688 } while (mol == NULL); 682 Log() << Verbose(0)<< "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl;689 std::cout << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl; 683 690 do { 684 Log() << Verbose(0)<< "Enter file name: ";691 std::cout << "Enter file name: "; 685 692 cin >> filename; 686 693 } while (!mol->AddXYZFile(filename)); … … 691 698 int nr; 692 699 molecule *mol = NULL; 693 Log() << Verbose(0)<< "Enter index of molecule: ";700 std::cout << "Enter index of molecule: "; 694 701 cin >> nr; 695 702 for(MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++)
Note:
See TracChangeset
for help on using the changeset viewer.
