Changeset e138de for src/parser.cpp
- Timestamp:
- Nov 4, 2009, 7:56:04 PM (16 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, 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:
- 1614174, e5ad5c
- Parents:
- 7326b2
- File:
-
- 1 edited
-
src/parser.cpp (modified) (47 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/parser.cpp
r7326b2 re138de 30 30 if (input == NULL) { 31 31 if (!test) 32 cout<< endl << "Unable to open " << filename << ", is the directory correct?" << endl;32 Log() << Verbose(0) << endl << "Unable to open " << filename << ", is the directory correct?" << endl; 33 33 return false; 34 34 } … … 107 107 bool MatrixContainer::InitialiseIndices(class MatrixContainer *Matrix) 108 108 { 109 cout<< "Initialising indices";109 Log() << Verbose(0) << "Initialising indices"; 110 110 if (Matrix == NULL) { 111 cout<< " with trivial mapping." << endl;111 Log() << Verbose(0) << " with trivial mapping." << endl; 112 112 Indices = Malloc<int*>(MatrixCounter + 1, "MatrixContainer::InitialiseIndices: **Indices"); 113 113 for(int i=MatrixCounter+1;i--;) { … … 117 117 } 118 118 } else { 119 cout<< " from other MatrixContainer." << endl;119 Log() << Verbose(0) << " from other MatrixContainer." << endl; 120 120 if (MatrixCounter != Matrix->MatrixCounter) 121 121 return false; … … 127 127 for(int j=Matrix->RowCounter[i];j--;) { 128 128 Indices[i][j] = Matrix->Indices[i][j]; 129 // cout<< Indices[i][j] << "\t";129 //Log() << Verbose(0) << Indices[i][j] << "\t"; 130 130 } 131 // cout<< endl;131 //Log() << Verbose(0) << endl; 132 132 } 133 133 } … … 156 156 157 157 input.open(name, ios::in); 158 // cout<< "Opening " << name << " ... " << input << endl;158 //Log() << Verbose(0) << "Opening " << name << " ... " << input << endl; 159 159 if (input == NULL) { 160 cerr<< endl << "Unable to open " << name << ", is the directory correct?" << endl;160 eLog() << Verbose(0) << endl << "Unable to open " << name << ", is the directory correct?" << endl; 161 161 return false; 162 162 } … … 171 171 for(int k=skipcolumns;k--;) 172 172 line >> Header[MatrixNr]; 173 // cout<< line.str() << endl;173 //Log() << Verbose(0) << line.str() << endl; 174 174 ColumnCounter[MatrixNr]=0; 175 175 while ( getline(line,token, '\t') ) { … … 177 177 ColumnCounter[MatrixNr]++; 178 178 } 179 // cout<< line.str() << endl;180 // cout<< "ColumnCounter[" << MatrixNr << "]: " << ColumnCounter[MatrixNr] << "." << endl;179 //Log() << Verbose(0) << line.str() << endl; 180 //Log() << Verbose(0) << "ColumnCounter[" << MatrixNr << "]: " << ColumnCounter[MatrixNr] << "." << endl; 181 181 if (ColumnCounter[MatrixNr] == 0) 182 cerr<< "ColumnCounter[" << MatrixNr << "]: " << ColumnCounter[MatrixNr] << " from file " << name << ", this is probably an error!" << endl;182 eLog() << Verbose(0) << "ColumnCounter[" << MatrixNr << "]: " << ColumnCounter[MatrixNr] << " from file " << name << ", this is probably an error!" << endl; 183 183 184 184 // scan rest for number of rows/lines … … 186 186 while (!input.eof()) { 187 187 input.getline(filename, 1023); 188 // cout<< "Comparing: " << strncmp(filename,"MeanForce",9) << endl;188 //Log() << Verbose(0) << "Comparing: " << strncmp(filename,"MeanForce",9) << endl; 189 189 RowCounter[MatrixNr]++; // then line was not last MeanForce 190 190 if (strncmp(filename,"MeanForce", 9) == 0) { … … 192 192 } 193 193 } 194 // cout<< "RowCounter[" << MatrixNr << "]: " << RowCounter[MatrixNr] << " from file " << name << "." << endl;194 //Log() << Verbose(0) << "RowCounter[" << MatrixNr << "]: " << RowCounter[MatrixNr] << " from file " << name << "." << endl; 195 195 if (RowCounter[MatrixNr] == 0) 196 cerr<< "RowCounter[" << MatrixNr << "]: " << RowCounter[MatrixNr] << " from file " << name << ", this is probably an error!" << endl;196 eLog() << Verbose(0) << "RowCounter[" << MatrixNr << "]: " << RowCounter[MatrixNr] << " from file " << name << ", this is probably an error!" << endl; 197 197 198 198 // allocate matrix if it's not zero dimension in one direction … … 213 213 input.getline(filename, 1023); 214 214 stringstream lines(filename); 215 // cout<< "Matrix at level " << j << ":";// << filename << endl;215 //Log() << Verbose(0) << "Matrix at level " << j << ":";// << filename << endl; 216 216 for(int k=skipcolumns;k--;) 217 217 lines >> filename; 218 218 for(int k=0;(k<ColumnCounter[MatrixNr]) && (!lines.eof());k++) { 219 219 lines >> Matrix[MatrixNr][j][k]; 220 // cout<< " " << setprecision(2) << Matrix[MatrixNr][j][k];;220 //Log() << Verbose(0) << " " << setprecision(2) << Matrix[MatrixNr][j][k];; 221 221 } 222 // cout<< endl;222 //Log() << Verbose(0) << endl; 223 223 Matrix[MatrixNr][ RowCounter[MatrixNr] ] = Malloc<double>(ColumnCounter[MatrixNr], "MatrixContainer::ParseMatrix: *Matrix[RowCounter[MatrixNr]][]"); 224 224 for(int j=ColumnCounter[MatrixNr];j--;) … … 226 226 } 227 227 } else { 228 cerr<< "ERROR: Matrix nr. " << MatrixNr << " has column and row count of (" << ColumnCounter[MatrixNr] << "," << RowCounter[MatrixNr] << "), could not allocate nor parse!" << endl;228 eLog() << Verbose(0) << "ERROR: Matrix nr. " << MatrixNr << " has column and row count of (" << ColumnCounter[MatrixNr] << "," << RowCounter[MatrixNr] << "), could not allocate nor parse!" << endl; 229 229 } 230 230 input.close(); … … 263 263 input.open(file.str().c_str(), ios::in); 264 264 if (input == NULL) { 265 cout<< endl << "Unable to open " << file.str() << ", is the directory correct?" << endl;265 Log() << Verbose(0) << endl << "Unable to open " << file.str() << ", is the directory correct?" << endl; 266 266 return false; 267 267 } … … 272 272 } 273 273 input.close(); 274 cout<< "Determined " << MatrixCounter << " fragments." << endl;275 276 cout<< "Parsing through each fragment and retrieving " << prefix << suffix << "." << endl;274 Log() << Verbose(0) << "Determined " << MatrixCounter << " fragments." << endl; 275 276 Log() << Verbose(0) << "Parsing through each fragment and retrieving " << prefix << suffix << "." << endl; 277 277 Header = ReAlloc<char*>(Header, MatrixCounter + 1, "MatrixContainer::ParseFragmentMatrix: **Header"); // one more each for the total molecule 278 278 Matrix = ReAlloc<double**>(Matrix, MatrixCounter + 1, "MatrixContainer::ParseFragmentMatrix: ***Matrix"); // one more each for the total molecule … … 407 407 // go through each order 408 408 for (int CurrentFragment=0;CurrentFragment<KeySets.FragmentsPerOrder[Order];CurrentFragment++) { 409 // cout<< "Current Fragment is " << CurrentFragment << "/" << KeySets.OrderSet[Order][CurrentFragment] << "." << endl;409 //Log() << Verbose(0) << "Current Fragment is " << CurrentFragment << "/" << KeySets.OrderSet[Order][CurrentFragment] << "." << endl; 410 410 // then go per order through each suborder and pick together all the terms that contain this fragment 411 411 for(int SubOrder=0;SubOrder<=Order;SubOrder++) { // go through all suborders up to the desired order 412 412 for (int j=0;j<KeySets.FragmentsPerOrder[SubOrder];j++) { // go through all possible fragments of size suborder 413 413 if (KeySets.Contains(KeySets.OrderSet[Order][CurrentFragment], KeySets.OrderSet[SubOrder][j])) { 414 // cout<< "Current other fragment is " << j << "/" << KeySets.OrderSet[SubOrder][j] << "." << endl;414 //Log() << Verbose(0) << "Current other fragment is " << j << "/" << KeySets.OrderSet[SubOrder][j] << "." << endl; 415 415 // if the fragment's indices are all in the current fragment 416 416 for(int k=0;k<RowCounter[ KeySets.OrderSet[SubOrder][j] ];k++) { // go through all atoms in this fragment 417 417 int m = MatrixValues.Indices[ KeySets.OrderSet[SubOrder][j] ][k]; 418 // cout<< "Current index is " << k << "/" << m << "." << endl;418 //Log() << Verbose(0) << "Current index is " << k << "/" << m << "." << endl; 419 419 if (m != -1) { // if it's not an added hydrogen 420 420 for (int l=0;l<RowCounter[ KeySets.OrderSet[Order][CurrentFragment] ];l++) { // look for the corresponding index in the current fragment 421 // cout<< "Comparing " << m << " with " << MatrixValues.Indices[ KeySets.OrderSet[Order][CurrentFragment] ][l] << "." << endl;421 //Log() << Verbose(0) << "Comparing " << m << " with " << MatrixValues.Indices[ KeySets.OrderSet[Order][CurrentFragment] ][l] << "." << endl; 422 422 if (m == MatrixValues.Indices[ KeySets.OrderSet[Order][CurrentFragment] ][l]) { 423 423 m = l; … … 425 425 } 426 426 } 427 // cout<< "Corresponding index in CurrentFragment is " << m << "." << endl;427 //Log() << Verbose(0) << "Corresponding index in CurrentFragment is " << m << "." << endl; 428 428 if (m > RowCounter[ KeySets.OrderSet[Order][CurrentFragment] ]) { 429 cerr<< "In fragment No. " << KeySets.OrderSet[Order][CurrentFragment] << " current force index " << m << " is greater than " << RowCounter[ KeySets.OrderSet[Order][CurrentFragment] ] << "!" << endl;429 eLog() << Verbose(0) << "In fragment No. " << KeySets.OrderSet[Order][CurrentFragment] << " current force index " << m << " is greater than " << RowCounter[ KeySets.OrderSet[Order][CurrentFragment] ] << "!" << endl; 430 430 return false; 431 431 } … … 439 439 } 440 440 //if ((ColumnCounter[ KeySets.OrderSet[SubOrder][j] ]>1) && (RowCounter[0]-1 >= 1)) 441 // cout<< "Fragments[ KeySets.OrderSet[" << Order << "][" << CurrentFragment << "]=" << KeySets.OrderSet[Order][CurrentFragment] << " ][" << RowCounter[0]-1 << "][" << 1 << "] = " << Matrix[ KeySets.OrderSet[Order][CurrentFragment] ][RowCounter[0]-1][1] << endl;441 //Log() << Verbose(0) << "Fragments[ KeySets.OrderSet[" << Order << "][" << CurrentFragment << "]=" << KeySets.OrderSet[Order][CurrentFragment] << " ][" << RowCounter[0]-1 << "][" << 1 << "] = " << Matrix[ KeySets.OrderSet[Order][CurrentFragment] ][RowCounter[0]-1][1] << endl; 442 442 } 443 443 } else { 444 // cout<< "Fragment " << KeySets.OrderSet[SubOrder][j] << " is not contained in fragment " << KeySets.OrderSet[Order][CurrentFragment] << "." << endl;444 //Log() << Verbose(0) << "Fragment " << KeySets.OrderSet[SubOrder][j] << " is not contained in fragment " << KeySets.OrderSet[Order][CurrentFragment] << "." << endl; 445 445 } 446 446 } 447 447 } 448 // cout<< "Final Fragments[ KeySets.OrderSet[" << Order << "][" << CurrentFragment << "]=" << KeySets.OrderSet[Order][CurrentFragment] << " ][" << KeySets.AtomCounter[0]-1 << "][" << 1 << "] = " << Matrix[ KeySets.OrderSet[Order][CurrentFragment] ][KeySets.AtomCounter[0]-1][1] << endl;448 //Log() << Verbose(0) << "Final Fragments[ KeySets.OrderSet[" << Order << "][" << CurrentFragment << "]=" << KeySets.OrderSet[Order][CurrentFragment] << " ][" << KeySets.AtomCounter[0]-1 << "][" << 1 << "] = " << Matrix[ KeySets.OrderSet[Order][CurrentFragment] ][KeySets.AtomCounter[0]-1][1] << endl; 449 449 } 450 450 … … 462 462 char *FragmentNumber = NULL; 463 463 464 cout<< "Writing fragment files." << endl;464 Log() << Verbose(0) << "Writing fragment files." << endl; 465 465 for(int i=0;i<MatrixCounter;i++) { 466 466 stringstream line; … … 470 470 output.open(line.str().c_str(), ios::out); 471 471 if (output == NULL) { 472 cerr<< "Unable to open output energy file " << line.str() << "!" << endl;472 eLog() << Verbose(0) << "Unable to open output energy file " << line.str() << "!" << endl; 473 473 return false; 474 474 } … … 495 495 stringstream line; 496 496 497 cout<< "Writing matrix values of " << suffix << "." << endl;497 Log() << Verbose(0) << "Writing matrix values of " << suffix << "." << endl; 498 498 line << name << prefix << suffix; 499 499 output.open(line.str().c_str(), ios::out); 500 500 if (output == NULL) { 501 cerr<< "Unable to open output matrix file " << line.str() << "!" << endl;501 eLog() << Verbose(0) << "Unable to open output matrix file " << line.str() << "!" << endl; 502 502 return false; 503 503 } … … 520 520 bool EnergyMatrix::ParseIndices() 521 521 { 522 cout<< "Parsing energy indices." << endl;522 Log() << Verbose(0) << "Parsing energy indices." << endl; 523 523 Indices = Malloc<int*>(MatrixCounter + 1, "EnergyMatrix::ParseIndices: **Indices"); 524 524 for(int i=MatrixCounter+1;i--;) { … … 579 579 } 580 580 // allocate last plus one matrix 581 cout<< "Allocating last plus one matrix with " << (RowCounter[MatrixCounter]+1) << " rows and " << ColumnCounter[MatrixCounter] << " columns." << endl;581 Log() << Verbose(0) << "Allocating last plus one matrix with " << (RowCounter[MatrixCounter]+1) << " rows and " << ColumnCounter[MatrixCounter] << " columns." << endl; 582 582 Matrix[MatrixCounter] = Malloc<double*>(RowCounter[MatrixCounter] + 1, "MatrixContainer::ParseFragmentMatrix: **Matrix[]"); 583 583 for(int j=0;j<=RowCounter[MatrixCounter];j++) … … 606 606 stringstream line; 607 607 608 cout<< "Parsing force indices for " << MatrixCounter << " matrices." << endl;608 Log() << Verbose(0) << "Parsing force indices for " << MatrixCounter << " matrices." << endl; 609 609 Indices = Malloc<int*>(MatrixCounter + 1, "ForceMatrix::ParseIndices: **Indices"); 610 610 line << name << FRAGMENTPREFIX << FORCESFILE; 611 611 input.open(line.str().c_str(), ios::in); 612 // cout<< "Opening " << line.str() << " ... " << input << endl;612 //Log() << Verbose(0) << "Opening " << line.str() << " ... " << input << endl; 613 613 if (input == NULL) { 614 cout<< endl << "Unable to open " << line.str() << ", is the directory correct?" << endl;614 Log() << Verbose(0) << endl << "Unable to open " << line.str() << ", is the directory correct?" << endl; 615 615 return false; 616 616 } … … 622 622 Indices[i] = Malloc<int>(RowCounter[i], "ForceMatrix::ParseIndices: *Indices[]"); 623 623 FragmentNumber = FixedDigitNumber(MatrixCounter, i); 624 // cout<< FRAGMENTPREFIX << FragmentNumber << "[" << RowCounter[i] << "]:";624 //Log() << Verbose(0) << FRAGMENTPREFIX << FragmentNumber << "[" << RowCounter[i] << "]:"; 625 625 Free(&FragmentNumber); 626 626 for(int j=0;(j<RowCounter[i]) && (!line.eof());j++) { 627 627 line >> Indices[i][j]; 628 // cout<< " " << Indices[i][j];629 } 630 // cout<< endl;628 //Log() << Verbose(0) << " " << Indices[i][j]; 629 } 630 //Log() << Verbose(0) << endl; 631 631 } 632 632 Indices[MatrixCounter] = Malloc<int>(RowCounter[MatrixCounter], "ForceMatrix::ParseIndices: *Indices[]"); … … 655 655 int j = Indices[ FragmentNr ][l]; 656 656 if (j > RowCounter[MatrixCounter]) { 657 cerr<< "Current force index " << j << " is greater than " << RowCounter[MatrixCounter] << "!" << endl;657 eLog() << Verbose(0) << "Current force index " << j << " is greater than " << RowCounter[MatrixCounter] << "!" << endl; 658 658 return false; 659 659 } 660 660 if (j != -1) { 661 //if (j == 0) cout<< "Summing onto ion 0, type 0 from fragment " << FragmentNr << ", ion " << l << "." << endl;661 //if (j == 0) Log() << Verbose(0) << "Summing onto ion 0, type 0 from fragment " << FragmentNr << ", ion " << l << "." << endl; 662 662 for(int k=2;k<ColumnCounter[MatrixCounter];k++) 663 663 Matrix[MatrixCounter][j][k] += sign*Fragments.Matrix[ FragmentNr ][l][k]; … … 690 690 input.open(file.str().c_str(), ios::in); 691 691 if (input == NULL) { 692 cout<< endl << "Unable to open " << file.str() << ", is the directory correct?" << endl;692 Log() << Verbose(0) << endl << "Unable to open " << file.str() << ", is the directory correct?" << endl; 693 693 return false; 694 694 } … … 699 699 while (!zeile.eof()) { 700 700 zeile >> nr; 701 // cout<< "Current index: " << nr << "." << endl;701 //Log() << Verbose(0) << "Current index: " << nr << "." << endl; 702 702 if (nr > RowCounter[MatrixCounter]) 703 703 RowCounter[MatrixCounter] = nr; … … 714 714 715 715 // allocate last plus one matrix 716 cout<< "Allocating last plus one matrix with " << (RowCounter[MatrixCounter]+1) << " rows and " << ColumnCounter[MatrixCounter] << " columns." << endl;716 Log() << Verbose(0) << "Allocating last plus one matrix with " << (RowCounter[MatrixCounter]+1) << " rows and " << ColumnCounter[MatrixCounter] << " columns." << endl; 717 717 Matrix[MatrixCounter] = Malloc<double*>(RowCounter[MatrixCounter] + 1, "MatrixContainer::ParseFragmentMatrix: **Matrix[]"); 718 718 for(int j=0;j<=RowCounter[MatrixCounter];j++) … … 743 743 stringstream line; 744 744 745 cout<< "Parsing hessian indices for " << MatrixCounter << " matrices." << endl;745 Log() << Verbose(0) << "Parsing hessian indices for " << MatrixCounter << " matrices." << endl; 746 746 Indices = Malloc<int*>(MatrixCounter + 1, "HessianMatrix::ParseIndices: **Indices"); 747 747 line << name << FRAGMENTPREFIX << FORCESFILE; 748 748 input.open(line.str().c_str(), ios::in); 749 // cout<< "Opening " << line.str() << " ... " << input << endl;749 //Log() << Verbose(0) << "Opening " << line.str() << " ... " << input << endl; 750 750 if (input == NULL) { 751 cout<< endl << "Unable to open " << line.str() << ", is the directory correct?" << endl;751 Log() << Verbose(0) << endl << "Unable to open " << line.str() << ", is the directory correct?" << endl; 752 752 return false; 753 753 } … … 759 759 Indices[i] = Malloc<int>(RowCounter[i], "HessianMatrix::ParseIndices: *Indices[]"); 760 760 FragmentNumber = FixedDigitNumber(MatrixCounter, i); 761 // cout<< FRAGMENTPREFIX << FragmentNumber << "[" << RowCounter[i] << "]:";761 //Log() << Verbose(0) << FRAGMENTPREFIX << FragmentNumber << "[" << RowCounter[i] << "]:"; 762 762 Free(&FragmentNumber); 763 763 for(int j=0;(j<RowCounter[i]) && (!line.eof());j++) { 764 764 line >> Indices[i][j]; 765 // cout<< " " << Indices[i][j];766 } 767 // cout<< endl;765 //Log() << Verbose(0) << " " << Indices[i][j]; 766 } 767 //Log() << Verbose(0) << endl; 768 768 } 769 769 Indices[MatrixCounter] = Malloc<int>(RowCounter[MatrixCounter], "HessianMatrix::ParseIndices: *Indices[]"); … … 792 792 int j = Indices[ FragmentNr ][l]; 793 793 if (j > RowCounter[MatrixCounter]) { 794 cerr<< "Current hessian index " << j << " is greater than " << RowCounter[MatrixCounter] << ", where i=" << i << ", Order=" << Order << ", l=" << l << " and FragmentNr=" << FragmentNr << "!" << endl;794 eLog() << Verbose(0) << "Current hessian index " << j << " is greater than " << RowCounter[MatrixCounter] << ", where i=" << i << ", Order=" << Order << ", l=" << l << " and FragmentNr=" << FragmentNr << "!" << endl; 795 795 return false; 796 796 } … … 799 799 int k = Indices[ FragmentNr ][m]; 800 800 if (k > ColumnCounter[MatrixCounter]) { 801 cerr<< "Current hessian index " << k << " is greater than " << ColumnCounter[MatrixCounter] << ", where m=" << m << ", j=" << j << ", i=" << i << ", Order=" << Order << ", l=" << l << " and FragmentNr=" << FragmentNr << "!" << endl;801 eLog() << Verbose(0) << "Current hessian index " << k << " is greater than " << ColumnCounter[MatrixCounter] << ", where m=" << m << ", j=" << j << ", i=" << i << ", Order=" << Order << ", l=" << l << " and FragmentNr=" << FragmentNr << "!" << endl; 802 802 return false; 803 803 } 804 804 if (k != -1) { 805 // cout<< "Adding " << sign*Fragments.Matrix[ FragmentNr ][l][m] << " from [" << l << "][" << m << "] onto [" << j << "][" << k << "]." << endl;805 //Log() << Verbose(0) << "Adding " << sign*Fragments.Matrix[ FragmentNr ][l][m] << " from [" << l << "][" << m << "] onto [" << j << "][" << k << "]." << endl; 806 806 Matrix[MatrixCounter][j][k] += sign*Fragments.Matrix[ FragmentNr ][l][m]; 807 807 } … … 831 831 // go through each order 832 832 for (int CurrentFragment=0;CurrentFragment<KeySets.FragmentsPerOrder[Order];CurrentFragment++) { 833 // cout<< "Current Fragment is " << CurrentFragment << "/" << KeySets.OrderSet[Order][CurrentFragment] << "." << endl;833 //Log() << Verbose(0) << "Current Fragment is " << CurrentFragment << "/" << KeySets.OrderSet[Order][CurrentFragment] << "." << endl; 834 834 // then go per order through each suborder and pick together all the terms that contain this fragment 835 835 for(int SubOrder=0;SubOrder<=Order;SubOrder++) { // go through all suborders up to the desired order 836 836 for (int j=0;j<KeySets.FragmentsPerOrder[SubOrder];j++) { // go through all possible fragments of size suborder 837 837 if (KeySets.Contains(KeySets.OrderSet[Order][CurrentFragment], KeySets.OrderSet[SubOrder][j])) { 838 // cout<< "Current other fragment is " << j << "/" << KeySets.OrderSet[SubOrder][j] << "." << endl;838 //Log() << Verbose(0) << "Current other fragment is " << j << "/" << KeySets.OrderSet[SubOrder][j] << "." << endl; 839 839 // if the fragment's indices are all in the current fragment 840 840 for(int k=0;k<RowCounter[ KeySets.OrderSet[SubOrder][j] ];k++) { // go through all atoms in this fragment 841 841 int m = MatrixValues.Indices[ KeySets.OrderSet[SubOrder][j] ][k]; 842 // cout<< "Current row index is " << k << "/" << m << "." << endl;842 //Log() << Verbose(0) << "Current row index is " << k << "/" << m << "." << endl; 843 843 if (m != -1) { // if it's not an added hydrogen 844 844 for (int l=0;l<RowCounter[ KeySets.OrderSet[Order][CurrentFragment] ];l++) { // look for the corresponding index in the current fragment 845 // cout<< "Comparing " << m << " with " << MatrixValues.Indices[ KeySets.OrderSet[Order][CurrentFragment] ][l] << "." << endl;845 //Log() << Verbose(0) << "Comparing " << m << " with " << MatrixValues.Indices[ KeySets.OrderSet[Order][CurrentFragment] ][l] << "." << endl; 846 846 if (m == MatrixValues.Indices[ KeySets.OrderSet[Order][CurrentFragment] ][l]) { 847 847 m = l; … … 849 849 } 850 850 } 851 // cout<< "Corresponding row index for " << k << " in CurrentFragment is " << m << "." << endl;851 //Log() << Verbose(0) << "Corresponding row index for " << k << " in CurrentFragment is " << m << "." << endl; 852 852 if (m > RowCounter[ KeySets.OrderSet[Order][CurrentFragment] ]) { 853 cerr<< "In fragment No. " << KeySets.OrderSet[Order][CurrentFragment] << " current row index " << m << " is greater than " << RowCounter[ KeySets.OrderSet[Order][CurrentFragment] ] << "!" << endl;853 eLog() << Verbose(0) << "In fragment No. " << KeySets.OrderSet[Order][CurrentFragment] << " current row index " << m << " is greater than " << RowCounter[ KeySets.OrderSet[Order][CurrentFragment] ] << "!" << endl; 854 854 return false; 855 855 } … … 857 857 for(int l=0;l<ColumnCounter[ KeySets.OrderSet[SubOrder][j] ];l++) { 858 858 int n = MatrixValues.Indices[ KeySets.OrderSet[SubOrder][j] ][l]; 859 // cout<< "Current column index is " << l << "/" << n << "." << endl;859 //Log() << Verbose(0) << "Current column index is " << l << "/" << n << "." << endl; 860 860 if (n != -1) { // if it's not an added hydrogen 861 861 for (int p=0;p<ColumnCounter[ KeySets.OrderSet[Order][CurrentFragment] ];p++) { // look for the corresponding index in the current fragment 862 // cout<< "Comparing " << n << " with " << MatrixValues.Indices[ KeySets.OrderSet[Order][CurrentFragment] ][p] << "." << endl;862 //Log() << Verbose(0) << "Comparing " << n << " with " << MatrixValues.Indices[ KeySets.OrderSet[Order][CurrentFragment] ][p] << "." << endl; 863 863 if (n == MatrixValues.Indices[ KeySets.OrderSet[Order][CurrentFragment] ][p]) { 864 864 n = p; … … 866 866 } 867 867 } 868 // cout<< "Corresponding column index for " << l << " in CurrentFragment is " << n << "." << endl;868 //Log() << Verbose(0) << "Corresponding column index for " << l << " in CurrentFragment is " << n << "." << endl; 869 869 if (n > ColumnCounter[ KeySets.OrderSet[Order][CurrentFragment] ]) { 870 cerr<< "In fragment No. " << KeySets.OrderSet[Order][CurrentFragment] << " current column index " << n << " is greater than " << ColumnCounter[ KeySets.OrderSet[Order][CurrentFragment] ] << "!" << endl;870 eLog() << Verbose(0) << "In fragment No. " << KeySets.OrderSet[Order][CurrentFragment] << " current column index " << n << " is greater than " << ColumnCounter[ KeySets.OrderSet[Order][CurrentFragment] ] << "!" << endl; 871 871 return false; 872 872 } 873 873 if (Order == SubOrder) { // equal order is always copy from Energies 874 // cout<< "Adding " << MatrixValues.Matrix[ KeySets.OrderSet[SubOrder][j] ][k][l] << " from [" << k << "][" << l << "] onto [" << m << "][" << n << "]." << endl;874 //Log() << Verbose(0) << "Adding " << MatrixValues.Matrix[ KeySets.OrderSet[SubOrder][j] ][k][l] << " from [" << k << "][" << l << "] onto [" << m << "][" << n << "]." << endl; 875 875 Matrix[ KeySets.OrderSet[Order][CurrentFragment] ][m][n] += MatrixValues.Matrix[ KeySets.OrderSet[SubOrder][j] ][k][l]; 876 876 } else { 877 // cout<< "Subtracting " << Matrix[ KeySets.OrderSet[SubOrder][j] ][k][l] << " from [" << k << "][" << l << "] onto [" << m << "][" << n << "]." << endl;877 //Log() << Verbose(0) << "Subtracting " << Matrix[ KeySets.OrderSet[SubOrder][j] ][k][l] << " from [" << k << "][" << l << "] onto [" << m << "][" << n << "]." << endl; 878 878 Matrix[ KeySets.OrderSet[Order][CurrentFragment] ][m][n] -= Matrix[ KeySets.OrderSet[SubOrder][j] ][k][l]; 879 879 } … … 882 882 } 883 883 //if ((ColumnCounter[ KeySets.OrderSet[SubOrder][j] ]>1) && (RowCounter[0]-1 >= 1)) 884 // cout<< "Fragments[ KeySets.OrderSet[" << Order << "][" << CurrentFragment << "]=" << KeySets.OrderSet[Order][CurrentFragment] << " ][" << RowCounter[0]-1 << "][" << 1 << "] = " << Matrix[ KeySets.OrderSet[Order][CurrentFragment] ][RowCounter[0]-1][1] << endl;884 //Log() << Verbose(0) << "Fragments[ KeySets.OrderSet[" << Order << "][" << CurrentFragment << "]=" << KeySets.OrderSet[Order][CurrentFragment] << " ][" << RowCounter[0]-1 << "][" << 1 << "] = " << Matrix[ KeySets.OrderSet[Order][CurrentFragment] ][RowCounter[0]-1][1] << endl; 885 885 } 886 886 } else { 887 // cout<< "Fragment " << KeySets.OrderSet[SubOrder][j] << " is not contained in fragment " << KeySets.OrderSet[Order][CurrentFragment] << "." << endl;887 //Log() << Verbose(0) << "Fragment " << KeySets.OrderSet[SubOrder][j] << " is not contained in fragment " << KeySets.OrderSet[Order][CurrentFragment] << "." << endl; 888 888 } 889 889 } 890 890 } 891 // cout<< "Final Fragments[ KeySets.OrderSet[" << Order << "][" << CurrentFragment << "]=" << KeySets.OrderSet[Order][CurrentFragment] << " ][" << KeySets.AtomCounter[0]-1 << "][" << 1 << "] = " << Matrix[ KeySets.OrderSet[Order][CurrentFragment] ][KeySets.AtomCounter[0]-1][1] << endl;891 //Log() << Verbose(0) << "Final Fragments[ KeySets.OrderSet[" << Order << "][" << CurrentFragment << "]=" << KeySets.OrderSet[Order][CurrentFragment] << " ][" << KeySets.AtomCounter[0]-1 << "][" << 1 << "] = " << Matrix[ KeySets.OrderSet[Order][CurrentFragment] ][KeySets.AtomCounter[0]-1][1] << endl; 892 892 } 893 893 … … 916 916 input.open(file.str().c_str(), ios::in); 917 917 if (input == NULL) { 918 cout<< endl << "Unable to open " << file.str() << ", is the directory correct?" << endl;918 Log() << Verbose(0) << endl << "Unable to open " << file.str() << ", is the directory correct?" << endl; 919 919 return false; 920 920 } … … 926 926 while (!zeile.eof()) { 927 927 zeile >> nr; 928 // cout<< "Current index: " << nr << "." << endl;928 //Log() << Verbose(0) << "Current index: " << nr << "." << endl; 929 929 if (nr > RowCounter[MatrixCounter]) { 930 930 RowCounter[MatrixCounter] = nr; … … 938 938 939 939 // allocate last plus one matrix 940 cout<< "Allocating last plus one matrix with " << (RowCounter[MatrixCounter]+1) << " rows and " << ColumnCounter[MatrixCounter] << " columns." << endl;940 Log() << Verbose(0) << "Allocating last plus one matrix with " << (RowCounter[MatrixCounter]+1) << " rows and " << ColumnCounter[MatrixCounter] << " columns." << endl; 941 941 Matrix[MatrixCounter] = Malloc<double*>(RowCounter[MatrixCounter] + 1, "MatrixContainer::ParseFragmentMatrix: **Matrix[]"); 942 942 for(int j=0;j<=RowCounter[MatrixCounter];j++) … … 993 993 994 994 FragmentCounter = FCounter; 995 cout<< "Parsing key sets." << endl;995 Log() << Verbose(0) << "Parsing key sets." << endl; 996 996 KeySets = Malloc<int*>(FragmentCounter, "KeySetsContainer::ParseKeySets: **KeySets"); 997 997 for(int i=FragmentCounter;i--;) … … 1000 1000 input.open(file.str().c_str(), ios::in); 1001 1001 if (input == NULL) { 1002 cout<< endl << "Unable to open " << file.str() << ", is the directory correct?" << endl;1002 Log() << Verbose(0) << endl << "Unable to open " << file.str() << ", is the directory correct?" << endl; 1003 1003 return false; 1004 1004 } … … 1013 1013 KeySets[i][j] = -1; 1014 1014 FragmentNumber = FixedDigitNumber(FragmentCounter, i); 1015 // cout<< FRAGMENTPREFIX << FragmentNumber << "[" << AtomCounter[i] << "]:";1015 //Log() << Verbose(0) << FRAGMENTPREFIX << FragmentNumber << "[" << AtomCounter[i] << "]:"; 1016 1016 Free(&FragmentNumber); 1017 1017 input.getline(filename, 1023); … … 1019 1019 for(int j=0;(j<AtomCounter[i]) && (!line.eof());j++) { 1020 1020 line >> KeySets[i][j]; 1021 // cout<< " " << KeySets[i][j];1022 } 1023 // cout<< endl;1021 //Log() << Verbose(0) << " " << KeySets[i][j]; 1022 } 1023 //Log() << Verbose(0) << endl; 1024 1024 } 1025 1025 input.close(); … … 1034 1034 int Counter; 1035 1035 1036 cout<< "Creating Fragment terms." << endl;1036 Log() << Verbose(0) << "Creating Fragment terms." << endl; 1037 1037 // scan through all to determine maximum order 1038 1038 Order=0; … … 1045 1045 Order = Counter; 1046 1046 } 1047 cout<< "Found Order is " << Order << "." << endl;1047 Log() << Verbose(0) << "Found Order is " << Order << "." << endl; 1048 1048 1049 1049 // scan through all to determine fragments per order … … 1059 1059 } 1060 1060 for(int i=0;i<Order;i++) 1061 cout<< "Found No. of Fragments of Order " << i+1 << " is " << FragmentsPerOrder[i] << "." << endl;1061 Log() << Verbose(0) << "Found No. of Fragments of Order " << i+1 << " is " << FragmentsPerOrder[i] << "." << endl; 1062 1062 1063 1063 // scan through all to gather indices to each order set … … 1075 1075 FragmentsPerOrder[Counter-1]++; 1076 1076 } 1077 cout<< "Printing OrderSet." << endl;1077 Log() << Verbose(0) << "Printing OrderSet." << endl; 1078 1078 for(int i=0;i<Order;i++) { 1079 1079 for (int j=0;j<FragmentsPerOrder[i];j++) { 1080 cout<< " " << OrderSet[i][j];1081 } 1082 cout<< endl;1083 } 1084 cout<< endl;1080 Log() << Verbose(0) << " " << OrderSet[i][j]; 1081 } 1082 Log() << Verbose(0) << endl; 1083 } 1084 Log() << Verbose(0) << endl; 1085 1085 1086 1086
Note:
See TracChangeset
for help on using the changeset viewer.
