- Timestamp:
- Feb 3, 2011, 9:51:19 AM (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, 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:
- b25fa3
- Parents:
- cd7a87
- git-author:
- Frederik Heber <heber@…> (12/30/10 11:10:50)
- git-committer:
- Frederik Heber <heber@…> (02/03/11 09:51:19)
- Location:
- src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/AnalysisAction/DipoleAngularCorrelationAction.cpp
rcd7a87 r92e5cb 61 61 ASSERT(!params.periodic, "AnalysisDipoleAngularCorrelationAction() - periodic case not implemented."); 62 62 correlationmap = DipoleAngularCorrelation(molecules); 63 Output DipoleAngularCorrelation(&output, correlationmap);63 OutputCorrelationMap<DipoleAngularCorrelationMap>(&output, correlationmap, OutputDipoleAngularCorrelation_Header, OutputDipoleAngularCorrelation_Value); 64 64 binmap = BinData( correlationmap, params.BinWidth, params.BinStart, params.BinEnd ); 65 OutputCorrelation ( &binoutput, binmap);65 OutputCorrelationMap<BinPairMap> ( &binoutput, binmap, OutputCorrelation_Header, OutputCorrelation_Value ); 66 66 delete(binmap); 67 67 delete(correlationmap); -
src/Actions/AnalysisAction/PairCorrelationAction.cpp
rcd7a87 r92e5cb 62 62 else 63 63 correlationmap = PairCorrelation(molecules, params.elements); 64 Output PairCorrelation(&output, correlationmap);64 OutputCorrelationMap<PairCorrelationMap>(&output, correlationmap, OutputPairCorrelation_Header, OutputPairCorrelation_Value); 65 65 binmap = BinData( correlationmap, params.BinWidth, params.BinStart, params.BinEnd ); 66 OutputCorrelation ( &binoutput, binmap);66 OutputCorrelationMap<BinPairMap> ( &binoutput, binmap, OutputCorrelation_Header, OutputCorrelation_Value ); 67 67 delete(binmap); 68 68 delete(correlationmap); -
src/Actions/AnalysisAction/PointCorrelationAction.cpp
rcd7a87 r92e5cb 67 67 else 68 68 correlationmap = CorrelationToPoint(molecules, params.elements, ¶ms.Point); 69 OutputCorrelation ToPoint(&output, correlationmap);69 OutputCorrelationMap<CorrelationToPointMap>(&output, correlationmap, OutputCorrelationToPoint_Header, OutputCorrelationToPoint_Value); 70 70 binmap = BinData( correlationmap, params.BinWidth, params.BinStart, params.BinEnd ); 71 OutputCorrelation ( &binoutput, binmap);71 OutputCorrelationMap<BinPairMap> ( &binoutput, binmap, OutputCorrelation_Header, OutputCorrelation_Value ); 72 72 delete(binmap); 73 73 delete(correlationmap); -
src/Actions/AnalysisAction/SurfaceCorrelationAction.cpp
rcd7a87 r92e5cb 81 81 surfacemap = CorrelationToSurface( molecules, params.elements, TesselStruct, LCList); 82 82 delete LCList; 83 OutputCorrelation ToSurface(&output, surfacemap);83 OutputCorrelationMap<CorrelationToSurfaceMap>(&output, surfacemap, OutputCorrelationToSurface_Header, OutputCorrelationToSurface_Value); 84 84 // check whether radius was appropriate 85 85 { … … 90 90 } 91 91 binmap = BinData( surfacemap, params.BinWidth, params.BinStart, params.BinEnd ); 92 OutputCorrelation ( &binoutput, binmap);92 OutputCorrelationMap<BinPairMap> ( &binoutput, binmap, OutputCorrelation_Header, OutputCorrelation_Value ); 93 93 delete TesselStruct; // surfacemap contains refs to triangles! delete here, not earlier! 94 94 delete(binmap); -
src/analysis_correlation.cpp
rcd7a87 r92e5cb 108 108 outmap = new DipoleAngularCorrelationMap; 109 109 for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); 110 MolWalker != molecules.end(); ) {110 MolWalker != molecules.end(); ++MolWalker) { 111 111 DoLog(2) && (Log()<< Verbose(2) << "Current molecule is " 112 112 << (*MolWalker)->getId() << "." << endl); 113 113 const Vector Dipole = getDipole((*MolWalker)->begin(), (*MolWalker)->end()); 114 for (std::vector<molecule *>::const_iterator MolOtherWalker = ++MolWalker; 114 std::vector<molecule *>::const_iterator MolOtherWalker = MolWalker; 115 for (++MolOtherWalker; 115 116 MolOtherWalker != molecules.end(); 116 MolOtherWalker++) {117 ++MolOtherWalker) { 117 118 DoLog(2) && (Log() << Verbose(2) << "Current other molecule is " 118 119 << (*MolOtherWalker)->getId() << "." << endl); … … 469 470 int GetBin ( const double value, const double BinWidth, const double BinStart ) 470 471 { 471 Info FunctionInfo(__func__);472 //Info FunctionInfo(__func__); 472 473 int bin =(int) (floor((value - BinStart)/BinWidth)); 473 474 return (bin); … … 475 476 476 477 477 /** Prints correlation (double, int) pairs to file. 478 * \param *file file to write to 479 * \param *map map to write 480 */ 481 void OutputCorrelation( ofstream * const file, const BinPairMap * const map ) 482 { 483 Info FunctionInfo(__func__); 484 *file << "BinStart\tCount" << endl; 485 for (BinPairMap::const_iterator runner = map->begin(); runner != map->end(); ++runner) { 486 *file << setprecision(8) << runner->first << "\t" << runner->second << endl; 487 } 488 }; 489 490 /** Prints correlation (double, (atom*,atom*) ) pairs to file. 491 * \param *file file to write to 492 * \param *map map to write 493 */ 494 void OutputDipoleAngularCorrelation( ofstream * const file, const DipoleAngularCorrelationMap * const map ) 495 { 496 Info FunctionInfo(__func__); 497 *file << "BinStart\tMolecule1\tMolecule2" << endl; 498 for (DipoleAngularCorrelationMap::const_iterator runner = map->begin(); runner != map->end(); ++runner) { 499 *file << setprecision(8) << runner->first << "\t" << runner->second.first->getId() << "\t" << runner->second.second->getId() << endl; 500 } 501 }; 502 503 /** Prints correlation (double, (atom*,atom*) ) pairs to file. 504 * \param *file file to write to 505 * \param *map map to write 506 */ 507 void OutputPairCorrelation( ofstream * const file, const PairCorrelationMap * const map ) 508 { 509 Info FunctionInfo(__func__); 510 *file << "BinStart\tAtom1\tAtom2" << endl; 511 for (PairCorrelationMap::const_iterator runner = map->begin(); runner != map->end(); ++runner) { 512 *file << setprecision(8) << runner->first << "\t" << *(runner->second.first) << "\t" << *(runner->second.second) << endl; 513 } 514 }; 515 516 /** Prints correlation (double, int) pairs to file. 517 * \param *file file to write to 518 * \param *map map to write 519 */ 520 void OutputCorrelationToPoint( ofstream * const file, const CorrelationToPointMap * const map ) 521 { 522 Info FunctionInfo(__func__); 523 *file << "BinStart\tAtom::x[i]-point.x[i]" << endl; 524 for (CorrelationToPointMap::const_iterator runner = map->begin(); runner != map->end(); ++runner) { 525 *file << runner->first; 526 for (int i=0;i<NDIM;i++) 527 *file << "\t" << setprecision(8) << (runner->second.first->at(i) - runner->second.second->at(i)); 528 *file << endl; 529 } 530 }; 531 532 /** Prints correlation (double, int) pairs to file. 533 * \param *file file to write to 534 * \param *map map to write 535 */ 536 void OutputCorrelationToSurface( ofstream * const file, const CorrelationToSurfaceMap * const map ) 537 { 538 Info FunctionInfo(__func__); 539 *file << "BinStart\tTriangle" << endl; 540 if (!map->empty()) 541 for (CorrelationToSurfaceMap::const_iterator runner = map->begin(); runner != map->end(); ++runner) { 542 *file << setprecision(8) << runner->first << "\t"; 543 *file << *(runner->second.first) << "\t"; 544 *file << *(runner->second.second) << endl; 545 } 546 }; 547 478 /** Adds header part that is unique to BinPairMap. 479 * 480 * @param file stream to print to 481 */ 482 void OutputCorrelation_Header( ofstream * const file ) 483 { 484 *file << "\tCount"; 485 }; 486 487 /** Prints values stored in BinPairMap iterator. 488 * 489 * @param file stream to print to 490 * @param runner iterator pointing at values to print 491 */ 492 void OutputCorrelation_Value( ofstream * const file, BinPairMap::const_iterator &runner ) 493 { 494 *file << runner->second; 495 }; 496 497 498 /** Adds header part that is unique to DipoleAngularCorrelationMap. 499 * 500 * @param file stream to print to 501 */ 502 void OutputDipoleAngularCorrelation_Header( ofstream * const file ) 503 { 504 *file << "\tAtom1\tAtom2"; 505 }; 506 507 /** Prints values stored in DipoleAngularCorrelationMap iterator. 508 * 509 * @param file stream to print to 510 * @param runner iterator pointing at values to print 511 */ 512 void OutputDipoleAngularCorrelation_Value( ofstream * const file, DipoleAngularCorrelationMap::const_iterator &runner ) 513 { 514 *file << runner->second.first->getId() << "\t" << runner->second.second->getId(); 515 }; 516 517 518 /** Adds header part that is unique to PairCorrelationMap. 519 * 520 * @param file stream to print to 521 */ 522 void OutputPairCorrelation_Header( ofstream * const file ) 523 { 524 *file << "\tAtom1\tAtom2"; 525 }; 526 527 /** Prints values stored in PairCorrelationMap iterator. 528 * 529 * @param file stream to print to 530 * @param runner iterator pointing at values to print 531 */ 532 void OutputPairCorrelation_Value( ofstream * const file, PairCorrelationMap::const_iterator &runner ) 533 { 534 *file << *(runner->second.first) << "\t" << *(runner->second.second); 535 }; 536 537 538 /** Adds header part that is unique to CorrelationToPointMap. 539 * 540 * @param file stream to print to 541 */ 542 void OutputCorrelationToPoint_Header( ofstream * const file ) 543 { 544 *file << "\tAtom::x[i]-point.x[i]"; 545 }; 546 547 /** Prints values stored in CorrelationToPointMap iterator. 548 * 549 * @param file stream to print to 550 * @param runner iterator pointing at values to print 551 */ 552 void OutputCorrelationToPoint_Value( ofstream * const file, CorrelationToPointMap::const_iterator &runner ) 553 { 554 for (int i=0;i<NDIM;i++) 555 *file << "\t" << setprecision(8) << (runner->second.first->at(i) - runner->second.second->at(i)); 556 }; 557 558 559 /** Adds header part that is unique to CorrelationToSurfaceMap. 560 * 561 * @param file stream to print to 562 */ 563 void OutputCorrelationToSurface_Header( ofstream * const file ) 564 { 565 *file << "\tTriangle"; 566 }; 567 568 /** Prints values stored in CorrelationToSurfaceMap iterator. 569 * 570 * @param file stream to print to 571 * @param runner iterator pointing at values to print 572 */ 573 void OutputCorrelationToSurface_Value( ofstream * const file, CorrelationToSurfaceMap::const_iterator &runner ) 574 { 575 *file << *(runner->second.first) << "\t" << *(runner->second.second); 576 }; -
src/analysis_correlation.hpp
rcd7a87 r92e5cb 19 19 20 20 #include <cmath> 21 #include <iomanip> 21 22 #include <fstream> 22 23 … … 28 29 29 30 #include "atom.hpp" 31 #include "CodePatterns/Info.hpp" 32 #include "CodePatterns/Log.hpp" 30 33 #include "CodePatterns/Verbose.hpp" 31 34 … … 57 60 CorrelationToSurfaceMap *PeriodicCorrelationToSurface(std::vector<molecule *> &molecules, const std::vector<const element *> &elements, const Tesselation * const Surface, const LinkedCell *LC, const int ranges[NDIM] ); 58 61 int GetBin ( const double value, const double BinWidth, const double BinStart ); 59 void OutputCorrelation( ofstream * const file, const BinPairMap * const map ); 60 void OutputDipoleAngularCorrelation( ofstream * const file, const DipoleAngularCorrelationMap * const map ); 61 void OutputPairCorrelation( ofstream * const file, const PairCorrelationMap * const map ); 62 void OutputCorrelationToPoint( ofstream * const file, const CorrelationToPointMap * const map ); 63 void OutputCorrelationToSurface( ofstream * const file, const CorrelationToSurfaceMap * const map ); 64 62 void OutputCorrelation_Header( ofstream * const file ); 63 void OutputCorrelation_Value( ofstream * const file, BinPairMap::const_iterator &runner ); 64 void OutputDipoleAngularCorrelation_Header( ofstream * const file ); 65 void OutputDipoleAngularCorrelation_Value( ofstream * const file, DipoleAngularCorrelationMap::const_iterator &runner ); 66 void OutputPairCorrelation_Header( ofstream * const file ); 67 void OutputPairCorrelation_Value( ofstream * const file, PairCorrelationMap::const_iterator &runner ); 68 void OutputCorrelationToPoint_Header( ofstream * const file ); 69 void OutputCorrelationToPoint_Value( ofstream * const file, CorrelationToPointMap::const_iterator &runner ); 70 void OutputCorrelationToSurface_Header( ofstream * const file ); 71 void OutputCorrelationToSurface_Value( ofstream * const file, CorrelationToSurfaceMap::const_iterator &runner ); 65 72 66 73 /** Searches for lowest and highest value in a given map of doubles. … … 143 150 }; 144 151 152 /** Prints correlation map of template type to file. 153 * \param *file file to write to 154 * \param *map map to write 155 * \param (*header) pointer to function that adds specific part to header 156 * \param (*value) pointer to function that prints value from given iterator 157 */ 158 template <typename T> 159 void OutputCorrelationMap( 160 ofstream * const file, 161 const T * const map, 162 void (*header)( ofstream * const file), 163 void (*value)( ofstream * const file, typename T::const_iterator &runner) 164 ) 165 { 166 Info FunctionInfo(__func__); 167 *file << "BinStart\tBinCenter\tBinEnd"; 168 header(file); 169 *file << endl; 170 typename T::const_iterator advancer = map->begin(); 171 typename T::const_iterator runner = map->begin(); 172 if (advancer != map->end()) 173 advancer++; 174 for ( ;(advancer != map->end()) && (runner != map->end()); ++advancer, ++runner) { 175 *file << setprecision(8) 176 << runner->first << "\t" 177 << (advancer->first + runner->first)/2. << "\t" 178 << advancer->first << "\t"; 179 value(file, runner); 180 *file << endl; 181 } 182 if(runner != map->end()) { 183 *file << setprecision(8) << runner->first << "\t0\t0\t"; 184 value(file, runner); 185 *file << endl; 186 } 187 }; 188 189 145 190 #endif /* ANALYSIS_HPP_ */ -
src/unittests/AnalysisCorrelationToPointUnitTest.cpp
rcd7a87 r92e5cb 125 125 // put pair correlation into bins and check with no range 126 126 binmap = BinData( pointmap, 0.5, 0., 0. ); 127 OutputCorrelation ( (ofstream *)&cout, binmap);127 OutputCorrelationMap<BinPairMap> ( (ofstream *)&cout, binmap, OutputCorrelation_Header, OutputCorrelation_Value ); 128 128 CPPUNIT_ASSERT_EQUAL( (size_t)3, binmap->size() ); 129 129 tester = binmap->begin(); … … 138 138 // ... and check with [0., 2.] range 139 139 binmap = BinData( pointmap, 0.5, 0., 2. ); 140 OutputCorrelation ( (ofstream *)&cout, binmap);140 OutputCorrelationMap<BinPairMap> ( (ofstream *)&cout, binmap, OutputCorrelation_Header, OutputCorrelation_Value ); 141 141 CPPUNIT_ASSERT_EQUAL( (size_t)5, binmap->size() ); 142 142 tester = binmap->begin(); -
src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp
rcd7a87 r92e5cb 183 183 binmap = BinData( surfacemap, 0.5, 0., 0. ); 184 184 CPPUNIT_ASSERT_EQUAL( (size_t)1, binmap->size() ); 185 OutputCorrelation ( (ofstream *)&cout, binmap);185 OutputCorrelationMap<BinPairMap> ( (ofstream *)&cout, binmap, OutputCorrelation_Header, OutputCorrelation_Value ); 186 186 tester = binmap->begin(); 187 187 CPPUNIT_ASSERT_EQUAL( 0., tester->first );
Note:
See TracChangeset
for help on using the changeset viewer.