- Timestamp:
- Jul 25, 2010, 9:43:56 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:
- a8a010
- Parents:
- 521bbf
- Location:
- src
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/AnalysisAction/PairCorrelationAction.cpp
r521bbf re65de8 41 41 Dialog *dialog = UIFactory::getInstance().makeDialog(); 42 42 43 dialog->queryElement ("elements", ValueStorage::getInstance().getDescription("elements"));43 dialog->queryElements("elements", ValueStorage::getInstance().getDescription("elements")); 44 44 dialog->queryDouble("bin-start", ValueStorage::getInstance().getDescription("bin-start")); 45 45 dialog->queryDouble("bin-width", ValueStorage::getInstance().getDescription("bin-width")); … … 67 67 Vector Point; 68 68 BinPairMap *binmap = NULL; 69 MoleculeListClass *molecules = World::getInstance().getMolecules();70 69 71 70 // obtain information … … 82 81 binoutput.open(binoutputname.c_str()); 83 82 PairCorrelationMap *correlationmap = NULL; 83 std::vector<molecule*> molecules = World::getInstance().getSelectedMolecules(); 84 84 if (periodic) 85 correlationmap = PeriodicPairCorrelation( World::getInstance().getMolecules(), elements, ranges);85 correlationmap = PeriodicPairCorrelation(molecules, elements, ranges); 86 86 else 87 correlationmap = PairCorrelation( World::getInstance().getMolecules(), elements);87 correlationmap = PairCorrelation(molecules, elements); 88 88 OutputPairCorrelation(&output, correlationmap); 89 89 binmap = BinData( correlationmap, BinWidth, BinStart, BinEnd ); -
src/Actions/AnalysisAction/PointCorrelationAction.cpp
r521bbf re65de8 42 42 43 43 dialog->queryVector("position", false, ValueStorage::getInstance().getDescription("position")); 44 dialog->queryElement ("elements", ValueStorage::getInstance().getDescription("elements"));44 dialog->queryElements("elements", ValueStorage::getInstance().getDescription("elements")); 45 45 dialog->queryDouble("bin-start", ValueStorage::getInstance().getDescription("bin-start")); 46 46 dialog->queryDouble("bin-width", ValueStorage::getInstance().getDescription("bin-width")); … … 68 68 Vector Point; 69 69 BinPairMap *binmap = NULL; 70 MoleculeListClass *molecules = World::getInstance().getMolecules();71 70 72 71 // obtain information … … 85 84 cout << "Point to correlate to is " << Point << endl; 86 85 CorrelationToPointMap *correlationmap = NULL; 86 for(std::vector< element *>::iterator iter = elements.begin(); iter != elements.end(); ++iter) 87 cout << "element is " << (*iter)->symbol << endl; 88 std::vector<molecule*> molecules = World::getInstance().getSelectedMolecules(); 87 89 if (periodic) 88 90 correlationmap = PeriodicCorrelationToPoint(molecules, elements, &Point, ranges); -
src/Actions/AnalysisAction/SurfaceCorrelationAction.cpp
r521bbf re65de8 42 42 43 43 dialog->queryMolecule("molecule-by-id", ValueStorage::getInstance().getDescription("molecule-by-id")); 44 dialog->queryElement ("elements", ValueStorage::getInstance().getDescription("elements"));44 dialog->queryElements("elements", ValueStorage::getInstance().getDescription("elements")); 45 45 dialog->queryDouble("bin-start", ValueStorage::getInstance().getDescription("bin-start")); 46 46 dialog->queryDouble("bin-width", ValueStorage::getInstance().getDescription("bin-width")); … … 68 68 Vector Point; 69 69 BinPairMap *binmap = NULL; 70 MoleculeListClass *molecules = World::getInstance().getMolecules();71 70 72 71 // obtain information … … 97 96 const LinkedCell *LCList = NULL; 98 97 // find biggest molecule 99 int counter = molecules->ListOfMolecules.size(); 100 bool *Actives = new bool[counter]; 101 counter = 0; 102 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) { 103 Actives[counter++] = (*BigFinder)->ActiveFlag; 104 (*BigFinder)->ActiveFlag = (*BigFinder == Boundary) ? false : true; 105 } 98 std::vector<molecule*> molecules = World::getInstance().getSelectedMolecules(); 99 int counter = molecules.size(); 106 100 LCList = new LinkedCell(Boundary, LCWidth); 107 101 FindNonConvexBorder(Boundary, TesselStruct, LCList, radius, NULL); … … 113 107 delete LCList; 114 108 OutputCorrelationToSurface(&output, surfacemap); 115 // re-set ActiveFlag116 counter = 0;117 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) {118 (*BigFinder)->ActiveFlag = Actives[counter++];119 }120 delete[] Actives;121 109 // check whether radius was appropriate 122 110 { -
src/Actions/MapOfActions.cpp
r521bbf re65de8 196 196 DescriptionMap["output"] = "write output files"; 197 197 DescriptionMap["set-output"] = "specify output formats"; 198 DescriptionMap["pair-correlation"] = "pair correlation analysis between two elements , element and point or element and surface";198 DescriptionMap["pair-correlation"] = "pair correlation analysis between two elements"; 199 199 DescriptionMap["parse-xyz"] = "parse xyz file into World"; 200 DescriptionMap["point-correlation"] = "pair correlation analysis between element and point"; 200 201 DescriptionMap["principal-axis-system"] = "calculate the principal axis system of the specified molecule"; 201 202 DescriptionMap["remove-atom"] = "remove a specified atom"; … … 211 212 DescriptionMap["set-output"] = "specify output formats"; 212 213 DescriptionMap["subgraph-dissect"] = "dissect the molecular system into molecules representing disconnected subgraphs"; 214 DescriptionMap["surface-correlation"] = "pair correlation analysis between element and surface"; 213 215 DescriptionMap["suspend-in-water"] = "suspend the given molecule in water such that in the domain the mean density is as specified"; 214 216 DescriptionMap["translate-mol"] = "translate molecule by given vector"; … … 234 236 DescriptionMap["MaxDistance"] = "maximum distance in space"; 235 237 DescriptionMap["molecule-by-id"] = "index of a molecule"; 236 DescriptionMap["molecule-by-name"] = "name of a molecule";237 238 DescriptionMap["nonconvex-file"] = "filename of the non-convex envelope"; 238 239 DescriptionMap["order"] = "order of a discretization, dissection, ..."; … … 271 272 ShortFormMap["nonconvex-envelope"] = "N"; 272 273 // ShortFormMap["output"] = "o"; 273 ShortFormMap["pair-correlation"] = "C";274 // ShortFormMap["pair-correlation"] = "C"; 274 275 ShortFormMap["parse-xyz"] = "p"; 275 276 ShortFormMap["remove-atom"] = "r"; … … 312 313 TypeMap["output"] = &typeid(void); 313 314 TypeMap["parse-xyz"] = &typeid(std::string); 314 TypeMap["pair-correlation"] = &typeid(std::string); 315 TypeMap["pair-correlation"] = &typeid(void); 316 TypeMap["point-correlation"] = &typeid(void); 315 317 TypeMap["principal-axis-system"] = &typeid(molecule); 316 318 TypeMap["remove-atom"] = &typeid(void); … … 325 327 TypeMap["set-output"] = &typeid(std::vector<std::string>); 326 328 TypeMap["subgraph-dissect"] = &typeid(void); 329 TypeMap["surface-correlation"] = &typeid(void); 327 330 TypeMap["suspend-in-water"] = &typeid(double); 328 331 TypeMap["translate-mol"] = &typeid(VectorValue); … … 346 349 TypeMap["lengths"] = &typeid(VectorValue); 347 350 TypeMap["MaxDistance"] = &typeid(double); 351 TypeMap["molecule-by-id"] = &typeid(molecule); 348 352 TypeMap["nonconvex-file"] = &typeid(std::string); 349 353 TypeMap["order"] = &typeid(int); … … 382 386 CurrentValue["bin-width"] = "0.5"; 383 387 CurrentValue["fastparsing"] = "0"; 384 CurrentValue["atom-by-id"] = "-1";385 CurrentValue["molecule-by-id"] = "-1";386 388 CurrentValue["periodic"] = "0"; 387 389 … … 399 401 MenuContainsActionMap.insert( pair<std::string, std::string> ("analysis", "molecular-volume") ); 400 402 MenuContainsActionMap.insert( pair<std::string, std::string> ("analysis", "pair-correlation") ); 403 MenuContainsActionMap.insert( pair<std::string, std::string> ("analysis", "point-correlation") ); 404 MenuContainsActionMap.insert( pair<std::string, std::string> ("analysis", "surface-correlation") ); 401 405 MenuContainsActionMap.insert( pair<std::string, std::string> ("analysis", "principal-axis-system") ); 402 406 … … 478 482 generic.insert("pair-correlation"); 479 483 generic.insert("parse-xyz"); 484 generic.insert("point-correlation"); 480 485 // generic.insert("principal-axis-system"); 481 486 generic.insert("remove-atom"); … … 494 499 generic.insert("set-output"); 495 500 generic.insert("subgraph-dissect"); 501 generic.insert("surface-correlation"); 496 502 generic.insert("suspend-in-water"); 497 503 generic.insert("translate-mol"); … … 522 528 hidden.insert("lengths"); 523 529 hidden.insert("MaxDistance"); 530 hidden.insert("molecule-by-id"); 524 531 hidden.insert("nonconvex-file"); 525 532 hidden.insert("order"); … … 624 631 CurrentValue.erase(name); 625 632 while (!stream.fail()) { 626 stream >> atomID ;633 stream >> atomID >> ws; 627 634 Walker = World::getInstance().getAtom(AtomById(atomID)); 628 635 if (Walker != NULL) 629 636 _T.push_back(Walker); 637 atomID = -1; 638 Walker = NULL; 630 639 } 631 640 } else … … 643 652 CurrentValue.erase(name); 644 653 while (!stream.fail()) { 645 stream >> Z ;654 stream >> Z >> ws; 646 655 elemental = World::getInstance().getPeriode()->FindElement(Z); 647 656 if (elemental != NULL) 648 657 _T.push_back(elemental); 658 Z = -1; 649 659 } 650 660 } else … … 662 672 CurrentValue.erase(name); 663 673 while (!stream.fail()) { 664 stream >> molID ;674 stream >> molID >> ws; 665 675 mol = World::getInstance().getMolecule(MoleculeById(molID)); 666 676 if (mol != NULL) 667 677 _T.push_back(mol); 678 molID = -1; 679 mol = NULL; 668 680 } 669 681 } else … … 842 854 for (set<string>::iterator OptionRunner = ListRunner->first->begin(); OptionRunner != ListRunner->first->end(); ++OptionRunner) { 843 855 if (hasValue(*OptionRunner)) { 844 DoLog( 0) && (Log() << Verbose(0) << "Adding option " << *OptionRunner << " with type " << TypeMap[*OptionRunner]->name() << " to CommandLineParser." << endl);856 DoLog(1) && (Log() << Verbose(1) << "Adding option " << *OptionRunner << " with type " << TypeMap[*OptionRunner]->name() << " to CommandLineParser." << endl); 845 857 switch(TypeEnumMap[TypeMap[*OptionRunner]]) { 846 858 default: -
src/analysis_correlation.cpp
r521bbf re65de8 28 28 /** Calculates the pair correlation between given elements. 29 29 * Note given element order is unimportant (i.e. g(Si, O) === g(O, Si)) 30 * \param *molecules list of molecules structure30 * \param *molecules vector of molecules 31 31 * \param &elements vector of elements to correlate 32 32 * \return Map of doubles with values the pair of the two atoms. 33 33 */ 34 PairCorrelationMap *PairCorrelation( MoleculeListClass * const&molecules, const std::vector<element *> &elements)34 PairCorrelationMap *PairCorrelation(std::vector<molecule *> &molecules, const std::vector<element *> &elements) 35 35 { 36 36 Info FunctionInfo(__func__); … … 39 39 Box &domain = World::getInstance().getDomain(); 40 40 41 if (molecules ->ListOfMolecules.empty()) {41 if (molecules.empty()) { 42 42 DoeLog(1) && (eLog()<< Verbose(1) <<"No molecule given." << endl); 43 43 return outmap; 44 44 } 45 for ( MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)45 for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++) 46 46 (*MolWalker)->doCountAtoms(); 47 47 … … 64 64 65 65 outmap = new PairCorrelationMap; 66 for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++){ 67 if ((*MolWalker)->ActiveFlag) { 68 DoeLog(2) && (eLog()<< Verbose(2) << "Current molecule is " << *MolWalker << "." << endl); 69 eLog() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl; 70 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) { 71 DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl); 72 for (MoleculeList::const_iterator MolOtherWalker = MolWalker; MolOtherWalker != molecules->ListOfMolecules.end(); MolOtherWalker++){ 73 if ((*MolOtherWalker)->ActiveFlag) { 74 DoLog(2) && (Log() << Verbose(2) << "Current other molecule is " << *MolOtherWalker << "." << endl); 75 for (molecule::const_iterator runner = (*MolOtherWalker)->begin(); runner != (*MolOtherWalker)->end(); ++runner) { 76 DoLog(3) && (Log() << Verbose(3) << "Current otheratom is " << **runner << "." << endl); 77 if ((*iter)->getId() < (*runner)->getId()){ 78 for (set <pair<element *, element *> >::iterator PairRunner = PairsOfElements.begin(); PairRunner != PairsOfElements.end(); ++PairRunner) 79 if ((PairRunner->first == (**iter).type) && (PairRunner->second == (**runner).type)) { 80 distance = domain.periodicDistance(*(*iter)->node,*(*runner)->node); 81 //Log() << Verbose(1) <<"Inserting " << *(*iter) << " and " << *(*runner) << endl; 82 outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> ((*iter), (*runner)) ) ); 83 } 66 for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++){ 67 DoLog(2) && (Log()<< Verbose(2) << "Current molecule is " << *MolWalker << "." << endl); 68 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) { 69 DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl); 70 for (std::vector<molecule *>::const_iterator MolOtherWalker = MolWalker; MolOtherWalker != molecules.end(); MolOtherWalker++){ 71 DoLog(2) && (Log() << Verbose(2) << "Current other molecule is " << *MolOtherWalker << "." << endl); 72 for (molecule::const_iterator runner = (*MolOtherWalker)->begin(); runner != (*MolOtherWalker)->end(); ++runner) { 73 DoLog(3) && (Log() << Verbose(3) << "Current otheratom is " << **runner << "." << endl); 74 if ((*iter)->getId() < (*runner)->getId()){ 75 for (set <pair<element *, element *> >::iterator PairRunner = PairsOfElements.begin(); PairRunner != PairsOfElements.end(); ++PairRunner) 76 if ((PairRunner->first == (**iter).type) && (PairRunner->second == (**runner).type)) { 77 distance = domain.periodicDistance(*(*iter)->node,*(*runner)->node); 78 //Log() << Verbose(1) <<"Inserting " << *(*iter) << " and " << *(*runner) << endl; 79 outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> ((*iter), (*runner)) ) ); 84 80 } 85 }86 81 } 87 82 } … … 99 94 * \return Map of doubles with values the pair of the two atoms. 100 95 */ 101 PairCorrelationMap *PeriodicPairCorrelation( MoleculeListClass * const&molecules, const std::vector<element *> &elements, const int ranges[NDIM] )96 PairCorrelationMap *PeriodicPairCorrelation(std::vector<molecule *> &molecules, const std::vector<element *> &elements, const int ranges[NDIM] ) 102 97 { 103 98 Info FunctionInfo(__func__); … … 111 106 Vector periodicOtherX; 112 107 113 if (molecules ->ListOfMolecules.empty()) {108 if (molecules.empty()) { 114 109 DoeLog(1) && (eLog()<< Verbose(1) <<"No molecule given." << endl); 115 110 return outmap; 116 111 } 117 for ( MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)112 for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++) 118 113 (*MolWalker)->doCountAtoms(); 119 114 … … 136 131 137 132 outmap = new PairCorrelationMap; 138 for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++){ 139 if ((*MolWalker)->ActiveFlag) { 140 Matrix FullMatrix = World::getInstance().getDomain().getM(); 141 Matrix FullInverseMatrix = World::getInstance().getDomain().getMinv(); 142 DoeLog(2) && (eLog()<< Verbose(2) << "Current molecule is " << *MolWalker << "." << endl); 143 eLog() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl; 144 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) { 145 DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl); 146 periodicX = FullInverseMatrix * (*(*iter)->node); // x now in [0,1)^3 147 // go through every range in xyz and get distance 148 for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++) 149 for (n[1]=-ranges[1]; n[1] <= ranges[1]; n[1]++) 150 for (n[2]=-ranges[2]; n[2] <= ranges[2]; n[2]++) { 151 checkX = FullMatrix * (Vector(n[0], n[1], n[2]) + periodicX); 152 for (MoleculeList::const_iterator MolOtherWalker = MolWalker; MolOtherWalker != molecules->ListOfMolecules.end(); MolOtherWalker++){ 153 if ((*MolOtherWalker)->ActiveFlag) { 154 DoLog(2) && (Log() << Verbose(2) << "Current other molecule is " << *MolOtherWalker << "." << endl); 155 for (molecule::const_iterator runner = (*MolOtherWalker)->begin(); runner != (*MolOtherWalker)->end(); ++runner) { 156 DoLog(3) && (Log() << Verbose(3) << "Current otheratom is " << **runner << "." << endl); 157 if ((*iter)->getId() < (*runner)->getId()){ 158 for (set <pair<element *, element *> >::iterator PairRunner = PairsOfElements.begin(); PairRunner != PairsOfElements.end(); ++PairRunner) 159 if ((PairRunner->first == (**iter).type) && (PairRunner->second == (**runner).type)) { 160 periodicOtherX = FullInverseMatrix * (*(*runner)->node); // x now in [0,1)^3 161 // go through every range in xyz and get distance 162 for (Othern[0]=-ranges[0]; Othern[0] <= ranges[0]; Othern[0]++) 163 for (Othern[1]=-ranges[1]; Othern[1] <= ranges[1]; Othern[1]++) 164 for (Othern[2]=-ranges[2]; Othern[2] <= ranges[2]; Othern[2]++) { 165 checkOtherX = FullMatrix * (Vector(Othern[0], Othern[1], Othern[2]) + periodicOtherX); 166 distance = checkX.distance(checkOtherX); 167 //Log() << Verbose(1) <<"Inserting " << *(*iter) << " and " << *(*runner) << endl; 168 outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> ((*iter), (*runner)) ) ); 169 } 170 } 133 for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++){ 134 Matrix FullMatrix = World::getInstance().getDomain().getM(); 135 Matrix FullInverseMatrix = World::getInstance().getDomain().getMinv(); 136 DoLog(2) && (Log()<< Verbose(2) << "Current molecule is " << *MolWalker << "." << endl); 137 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) { 138 DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl); 139 periodicX = FullInverseMatrix * (*(*iter)->node); // x now in [0,1)^3 140 // go through every range in xyz and get distance 141 for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++) 142 for (n[1]=-ranges[1]; n[1] <= ranges[1]; n[1]++) 143 for (n[2]=-ranges[2]; n[2] <= ranges[2]; n[2]++) { 144 checkX = FullMatrix * (Vector(n[0], n[1], n[2]) + periodicX); 145 for (std::vector<molecule *>::const_iterator MolOtherWalker = MolWalker; MolOtherWalker != molecules.end(); MolOtherWalker++){ 146 DoLog(2) && (Log() << Verbose(2) << "Current other molecule is " << *MolOtherWalker << "." << endl); 147 for (molecule::const_iterator runner = (*MolOtherWalker)->begin(); runner != (*MolOtherWalker)->end(); ++runner) { 148 DoLog(3) && (Log() << Verbose(3) << "Current otheratom is " << **runner << "." << endl); 149 if ((*iter)->getId() < (*runner)->getId()){ 150 for (set <pair<element *, element *> >::iterator PairRunner = PairsOfElements.begin(); PairRunner != PairsOfElements.end(); ++PairRunner) 151 if ((PairRunner->first == (**iter).type) && (PairRunner->second == (**runner).type)) { 152 periodicOtherX = FullInverseMatrix * (*(*runner)->node); // x now in [0,1)^3 153 // go through every range in xyz and get distance 154 for (Othern[0]=-ranges[0]; Othern[0] <= ranges[0]; Othern[0]++) 155 for (Othern[1]=-ranges[1]; Othern[1] <= ranges[1]; Othern[1]++) 156 for (Othern[2]=-ranges[2]; Othern[2] <= ranges[2]; Othern[2]++) { 157 checkOtherX = FullMatrix * (Vector(Othern[0], Othern[1], Othern[2]) + periodicOtherX); 158 distance = checkX.distance(checkOtherX); 159 //Log() << Verbose(1) <<"Inserting " << *(*iter) << " and " << *(*runner) << endl; 160 outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> ((*iter), (*runner)) ) ); 161 } 162 } 171 163 } 172 164 } 173 165 } 174 }175 }176 166 } 177 167 } … … 187 177 * \return Map of dobules with values as pairs of atom and the vector 188 178 */ 189 CorrelationToPointMap *CorrelationToPoint( MoleculeListClass * const&molecules, const std::vector<element *> &elements, const Vector *point )179 CorrelationToPointMap *CorrelationToPoint(std::vector<molecule *> &molecules, const std::vector<element *> &elements, const Vector *point ) 190 180 { 191 181 Info FunctionInfo(__func__); … … 194 184 Box &domain = World::getInstance().getDomain(); 195 185 196 if (molecules ->ListOfMolecules.empty()) {186 if (molecules.empty()) { 197 187 DoLog(1) && (Log() << Verbose(1) <<"No molecule given." << endl); 198 188 return outmap; 199 189 } 200 for ( MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)190 for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++) 201 191 (*MolWalker)->doCountAtoms(); 202 192 outmap = new CorrelationToPointMap; 203 for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++) 204 if ((*MolWalker)->ActiveFlag) { 205 DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl); 206 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) { 207 DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl); 208 for (vector<element *>::const_iterator type = elements.begin(); type != elements.end(); ++type) 209 if ((*type == NULL) || ((*iter)->type == *type)) { 210 distance = domain.periodicDistance(*(*iter)->node,*point); 211 DoLog(4) && (Log() << Verbose(4) << "Current distance is " << distance << "." << endl); 212 outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> ((*iter), point) ) ); 213 } 214 } 215 } 193 for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++) { 194 DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl); 195 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) { 196 DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl); 197 for (vector<element *>::const_iterator type = elements.begin(); type != elements.end(); ++type) 198 if ((*type == NULL) || ((*iter)->type == *type)) { 199 distance = domain.periodicDistance(*(*iter)->node,*point); 200 DoLog(4) && (Log() << Verbose(4) << "Current distance is " << distance << "." << endl); 201 outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> ((*iter), point) ) ); 202 } 203 } 204 } 216 205 217 206 return outmap; … … 225 214 * \return Map of dobules with values as pairs of atom and the vector 226 215 */ 227 CorrelationToPointMap *PeriodicCorrelationToPoint( MoleculeListClass * const&molecules, const std::vector<element *> &elements, const Vector *point, const int ranges[NDIM] )216 CorrelationToPointMap *PeriodicCorrelationToPoint(std::vector<molecule *> &molecules, const std::vector<element *> &elements, const Vector *point, const int ranges[NDIM] ) 228 217 { 229 218 Info FunctionInfo(__func__); … … 234 223 Vector checkX; 235 224 236 if (molecules ->ListOfMolecules.empty()) {225 if (molecules.empty()) { 237 226 DoLog(1) && (Log() << Verbose(1) <<"No molecule given." << endl); 238 227 return outmap; 239 228 } 240 for ( MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)229 for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++) 241 230 (*MolWalker)->doCountAtoms(); 242 231 outmap = new CorrelationToPointMap; 243 for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++) 244 if ((*MolWalker)->ActiveFlag) { 245 Matrix FullMatrix = World::getInstance().getDomain().getM(); 246 Matrix FullInverseMatrix = World::getInstance().getDomain().getMinv(); 247 DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl); 248 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) { 249 DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl); 250 for (vector<element *>::const_iterator type = elements.begin(); type != elements.end(); ++type) 251 if ((*type == NULL) || ((*iter)->type == *type)) { 252 periodicX = FullInverseMatrix * (*(*iter)->node); // x now in [0,1)^3 253 // go through every range in xyz and get distance 254 for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++) 255 for (n[1]=-ranges[1]; n[1] <= ranges[1]; n[1]++) 256 for (n[2]=-ranges[2]; n[2] <= ranges[2]; n[2]++) { 257 checkX = FullMatrix * (Vector(n[0], n[1], n[2]) + periodicX); 258 distance = checkX.distance(*point); 259 DoLog(4) && (Log() << Verbose(4) << "Current distance is " << distance << "." << endl); 260 outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> (*iter, point) ) ); 261 } 262 } 263 } 264 } 232 for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++) { 233 Matrix FullMatrix = World::getInstance().getDomain().getM(); 234 Matrix FullInverseMatrix = World::getInstance().getDomain().getMinv(); 235 DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl); 236 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) { 237 DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl); 238 for (vector<element *>::const_iterator type = elements.begin(); type != elements.end(); ++type) 239 if ((*type == NULL) || ((*iter)->type == *type)) { 240 periodicX = FullInverseMatrix * (*(*iter)->node); // x now in [0,1)^3 241 // go through every range in xyz and get distance 242 for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++) 243 for (n[1]=-ranges[1]; n[1] <= ranges[1]; n[1]++) 244 for (n[2]=-ranges[2]; n[2] <= ranges[2]; n[2]++) { 245 checkX = FullMatrix * (Vector(n[0], n[1], n[2]) + periodicX); 246 distance = checkX.distance(*point); 247 DoLog(4) && (Log() << Verbose(4) << "Current distance is " << distance << "." << endl); 248 outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> (*iter, point) ) ); 249 } 250 } 251 } 252 } 265 253 266 254 return outmap; … … 274 262 * \return Map of doubles with values as pairs of atom and the BoundaryTriangleSet that's closest 275 263 */ 276 CorrelationToSurfaceMap *CorrelationToSurface( MoleculeListClass * const&molecules, const std::vector<element *> &elements, const Tesselation * const Surface, const LinkedCell *LC )264 CorrelationToSurfaceMap *CorrelationToSurface(std::vector<molecule *> &molecules, const std::vector<element *> &elements, const Tesselation * const Surface, const LinkedCell *LC ) 277 265 { 278 266 Info FunctionInfo(__func__); … … 282 270 Vector centroid; 283 271 284 if ((Surface == NULL) || (LC == NULL) || (molecules ->ListOfMolecules.empty())) {272 if ((Surface == NULL) || (LC == NULL) || (molecules.empty())) { 285 273 DoeLog(1) && (eLog()<< Verbose(1) <<"No Tesselation, no LinkedCell or no molecule given." << endl); 286 274 return outmap; 287 275 } 288 for ( MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)276 for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++) 289 277 (*MolWalker)->doCountAtoms(); 290 278 outmap = new CorrelationToSurfaceMap; 291 for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++) 292 if ((*MolWalker)->ActiveFlag) { 293 DoLog(1) && (Log() << Verbose(1) << "Current molecule is " << (*MolWalker)->name << "." << endl); 294 if ((*MolWalker)->empty()) 295 DoLog(1) && (1) && (Log() << Verbose(1) << "\t is empty." << endl); 296 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) { 297 DoLog(1) && (Log() << Verbose(1) << "\tCurrent atom is " << *(*iter) << "." << endl); 298 for (vector<element *>::const_iterator type = elements.begin(); type != elements.end(); ++type) 299 if ((*type == NULL) || ((*iter)->type == *type)) { 300 TriangleIntersectionList Intersections((*iter)->node,Surface,LC); 301 distance = Intersections.GetSmallestDistance(); 302 triangle = Intersections.GetClosestTriangle(); 303 outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(distance, pair<atom *, BoundaryTriangleSet*> ((*iter), triangle) ) ); 304 } 305 } 306 } else { 307 DoLog(1) && (Log() << Verbose(1) << "molecule " << (*MolWalker)->name << " is not active." << endl); 308 } 279 for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++) { 280 DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << (*MolWalker)->name << "." << endl); 281 if ((*MolWalker)->empty()) 282 DoLog(2) && (2) && (Log() << Verbose(2) << "\t is empty." << endl); 283 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) { 284 DoLog(3) && (Log() << Verbose(3) << "\tCurrent atom is " << *(*iter) << "." << endl); 285 for (vector<element *>::const_iterator type = elements.begin(); type != elements.end(); ++type) 286 if ((*type == NULL) || ((*iter)->type == *type)) { 287 TriangleIntersectionList Intersections((*iter)->node,Surface,LC); 288 distance = Intersections.GetSmallestDistance(); 289 triangle = Intersections.GetClosestTriangle(); 290 outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(distance, pair<atom *, BoundaryTriangleSet*> ((*iter), triangle) ) ); 291 } 292 } 293 } 309 294 310 295 return outmap; … … 323 308 * \return Map of doubles with values as pairs of atom and the BoundaryTriangleSet that's closest 324 309 */ 325 CorrelationToSurfaceMap *PeriodicCorrelationToSurface( MoleculeListClass * const&molecules, const std::vector<element *> &elements, const Tesselation * const Surface, const LinkedCell *LC, const int ranges[NDIM] )310 CorrelationToSurfaceMap *PeriodicCorrelationToSurface(std::vector<molecule *> &molecules, const std::vector<element *> &elements, const Tesselation * const Surface, const LinkedCell *LC, const int ranges[NDIM] ) 326 311 { 327 312 Info FunctionInfo(__func__); … … 334 319 Vector checkX; 335 320 336 if ((Surface == NULL) || (LC == NULL) || (molecules ->ListOfMolecules.empty())) {321 if ((Surface == NULL) || (LC == NULL) || (molecules.empty())) { 337 322 DoLog(1) && (Log() << Verbose(1) <<"No Tesselation, no LinkedCell or no molecule given." << endl); 338 323 return outmap; 339 324 } 340 for ( MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)325 for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++) 341 326 (*MolWalker)->doCountAtoms(); 342 327 outmap = new CorrelationToSurfaceMap; 343 328 double ShortestDistance = 0.; 344 329 BoundaryTriangleSet *ShortestTriangle = NULL; 345 for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++) 346 if ((*MolWalker)->ActiveFlag) { 347 Matrix FullMatrix = World::getInstance().getDomain().getM(); 348 Matrix FullInverseMatrix = World::getInstance().getDomain().getMinv(); 349 DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl); 350 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) { 351 DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl); 352 for (vector<element *>::const_iterator type = elements.begin(); type != elements.end(); ++type) 353 if ((*type == NULL) || ((*iter)->type == *type)) { 354 periodicX = FullInverseMatrix * (*(*iter)->node); // x now in [0,1)^3 355 // go through every range in xyz and get distance 356 ShortestDistance = -1.; 357 for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++) 358 for (n[1]=-ranges[1]; n[1] <= ranges[1]; n[1]++) 359 for (n[2]=-ranges[2]; n[2] <= ranges[2]; n[2]++) { 360 checkX = FullMatrix * (Vector(n[0], n[1], n[2]) + periodicX); 361 TriangleIntersectionList Intersections(&checkX,Surface,LC); 362 distance = Intersections.GetSmallestDistance(); 363 triangle = Intersections.GetClosestTriangle(); 364 if ((ShortestDistance == -1.) || (distance < ShortestDistance)) { 365 ShortestDistance = distance; 366 ShortestTriangle = triangle; 367 } 330 for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++) { 331 Matrix FullMatrix = World::getInstance().getDomain().getM(); 332 Matrix FullInverseMatrix = World::getInstance().getDomain().getMinv(); 333 DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl); 334 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) { 335 DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl); 336 for (vector<element *>::const_iterator type = elements.begin(); type != elements.end(); ++type) 337 if ((*type == NULL) || ((*iter)->type == *type)) { 338 periodicX = FullInverseMatrix * (*(*iter)->node); // x now in [0,1)^3 339 // go through every range in xyz and get distance 340 ShortestDistance = -1.; 341 for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++) 342 for (n[1]=-ranges[1]; n[1] <= ranges[1]; n[1]++) 343 for (n[2]=-ranges[2]; n[2] <= ranges[2]; n[2]++) { 344 checkX = FullMatrix * (Vector(n[0], n[1], n[2]) + periodicX); 345 TriangleIntersectionList Intersections(&checkX,Surface,LC); 346 distance = Intersections.GetSmallestDistance(); 347 triangle = Intersections.GetClosestTriangle(); 348 if ((ShortestDistance == -1.) || (distance < ShortestDistance)) { 349 ShortestDistance = distance; 350 ShortestTriangle = triangle; 368 351 } 369 // insert 370 outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(ShortestDistance, pair<atom *, BoundaryTriangleSet*> (*iter, ShortestTriangle) ) ); 371 //Log() << Verbose(1) << "INFO: Inserting " << Walker << " with distance " << ShortestDistance << " to " << *ShortestTriangle << "." << endl; 372 } 373 } 374 } 352 } 353 // insert 354 outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(ShortestDistance, pair<atom *, BoundaryTriangleSet*> (*iter, ShortestTriangle) ) ); 355 //Log() << Verbose(1) << "INFO: Inserting " << Walker << " with distance " << ShortestDistance << " to " << *ShortestTriangle << "." << endl; 356 } 357 } 358 } 375 359 376 360 return outmap; -
src/analysis_correlation.hpp
r521bbf re65de8 22 22 // STL headers 23 23 #include <map> 24 #include <vector> 24 25 25 26 #include "defs.hpp" … … 33 34 class element; 34 35 class LinkedCell; 35 class MoleculeListClass;36 36 class Tesselation; 37 37 class Vector; … … 46 46 /********************************************** declarations *******************************/ 47 47 48 PairCorrelationMap *PairCorrelation( MoleculeListClass * const&molecules, const std::vector<element *> &elements);49 CorrelationToPointMap *CorrelationToPoint( MoleculeListClass * const&molecules, const std::vector<element *> &elements, const Vector *point );50 CorrelationToSurfaceMap *CorrelationToSurface( MoleculeListClass * const&molecules, const std::vector<element *> &elements, const Tesselation * const Surface, const LinkedCell *LC );51 PairCorrelationMap *PeriodicPairCorrelation( MoleculeListClass * const&molecules, const std::vector<element *> &elements, const int ranges[NDIM] );52 CorrelationToPointMap *PeriodicCorrelationToPoint( MoleculeListClass * const&molecules, const std::vector<element *> &elements, const Vector *point, const int ranges[NDIM] );53 CorrelationToSurfaceMap *PeriodicCorrelationToSurface( MoleculeListClass * const&molecules, const std::vector<element *> &elements, const Tesselation * const Surface, const LinkedCell *LC, const int ranges[NDIM] );48 PairCorrelationMap *PairCorrelation(std::vector<molecule *> &molecules, const std::vector<element *> &elements); 49 CorrelationToPointMap *CorrelationToPoint(std::vector<molecule *> &molecules, const std::vector<element *> &elements, const Vector *point ); 50 CorrelationToSurfaceMap *CorrelationToSurface(std::vector<molecule *> &molecules, const std::vector<element *> &elements, const Tesselation * const Surface, const LinkedCell *LC ); 51 PairCorrelationMap *PeriodicPairCorrelation(std::vector<molecule *> &molecules, const std::vector<element *> &elements, const int ranges[NDIM] ); 52 CorrelationToPointMap *PeriodicCorrelationToPoint(std::vector<molecule *> &molecules, const std::vector<element *> &elements, const Vector *point, const int ranges[NDIM] ); 53 CorrelationToSurfaceMap *PeriodicCorrelationToSurface(std::vector<molecule *> &molecules, const std::vector<element *> &elements, const Tesselation * const Surface, const LinkedCell *LC, const int ranges[NDIM] ); 54 54 int GetBin ( const double value, const double BinWidth, const double BinStart ); 55 55 void OutputCorrelation( ofstream * const file, const BinPairMap * const map ); -
src/unittests/AnalysisCorrelationToPointUnitTest.cpp
r521bbf re65de8 16 16 #include "analysis_correlation.hpp" 17 17 #include "AnalysisCorrelationToPointUnitTest.hpp" 18 19 #include "Descriptors/MoleculeDescriptor.hpp" 18 20 19 21 #include "atom.hpp" … … 38 40 39 41 // init private all pointers to zero 40 TestList = NULL;41 42 TestMolecule = NULL; 42 43 pointmap = NULL; … … 71 72 CPPUNIT_ASSERT_EQUAL( TestMolecule->getAtomCount(), 4 ); 72 73 73 TestList = World::getInstance().getMolecules();74 TestList->insert(TestMolecule);75 74 TestMolecule->ActiveFlag = true; 76 75 … … 79 78 80 79 // init maps 81 pointmap = CorrelationToPoint( (MoleculeListClass * const)TestList, elements, (const Vector *)point ); 80 World::getInstance().selectAllMolecules(AllMolecules()); 81 allMolecules = World::getInstance().getSelectedMolecules(); 82 CPPUNIT_ASSERT_EQUAL( (size_t) 1, allMolecules.size()); 83 pointmap = CorrelationToPoint( allMolecules, elements, (const Vector *)point ); 82 84 binmap = NULL; 83 85 -
src/unittests/AnalysisCorrelationToPointUnitTest.hpp
r521bbf re65de8 35 35 private: 36 36 37 MoleculeListClass *TestList;37 std::vector<molecule *> allMolecules; 38 38 molecule *TestMolecule; 39 39 element *hydrogen; -
src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp
r521bbf re65de8 16 16 #include "analysis_correlation.hpp" 17 17 #include "AnalysisCorrelationToSurfaceUnitTest.hpp" 18 19 #include "Descriptors/MoleculeDescriptor.hpp" 18 20 19 21 #include "atom.hpp" … … 45 47 46 48 // init private all pointers to zero 47 TestList = NULL;48 49 TestSurfaceMolecule = NULL; 49 50 surfacemap = NULL; … … 83 84 CPPUNIT_ASSERT_EQUAL( TestSurfaceMolecule->getAtomCount(), 4 ); 84 85 85 TestList = World::getInstance().getMolecules();86 86 TestSurfaceMolecule->ActiveFlag = true; 87 TestList->insert(TestSurfaceMolecule);88 87 89 88 // init tesselation and linked cell … … 116 115 TestSurfaceMolecule->AddAtom(Walker); 117 116 118 TestSurfaceMolecule->ActiveFlag = true; 119 TestList->insert(TestSurfaceMolecule); 117 World::getInstance().selectAllMolecules(AllMolecules()); 118 allMolecules = World::getInstance().getSelectedMolecules(); 119 CPPUNIT_ASSERT_EQUAL( (size_t) 2, allMolecules.size()); 120 120 121 121 // init maps … … 146 146 { 147 147 CPPUNIT_ASSERT_EQUAL( 4, TestSurfaceMolecule->getAtomCount() ); 148 CPPUNIT_ASSERT_EQUAL( (size_t)2, TestList->ListOfMolecules.size() );148 CPPUNIT_ASSERT_EQUAL( (size_t)2, allMolecules.size() ); 149 149 CPPUNIT_ASSERT_EQUAL( (size_t)4, Surface->PointsOnBoundary.size() ); 150 150 CPPUNIT_ASSERT_EQUAL( (size_t)6, Surface->LinesOnBoundary.size() ); … … 156 156 // do the pair correlation 157 157 elements.push_back(hydrogen); 158 surfacemap = CorrelationToSurface( TestList, elements, Surface, LC );158 surfacemap = CorrelationToSurface( allMolecules, elements, Surface, LC ); 159 159 // OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap ); 160 160 CPPUNIT_ASSERT( surfacemap != NULL ); … … 166 166 BinPairMap::iterator tester; 167 167 elements.push_back(hydrogen); 168 surfacemap = CorrelationToSurface( TestList, elements, Surface, LC );168 surfacemap = CorrelationToSurface( allMolecules, elements, Surface, LC ); 169 169 // put pair correlation into bins and check with no range 170 170 // OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap ); … … 182 182 BinPairMap::iterator tester; 183 183 elements.push_back(hydrogen); 184 surfacemap = CorrelationToSurface( TestList, elements, Surface, LC );184 surfacemap = CorrelationToSurface( allMolecules, elements, Surface, LC ); 185 185 // OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap ); 186 186 // ... and check with [0., 2.] range … … 201 201 BinPairMap::iterator tester; 202 202 elements.push_back(carbon); 203 surfacemap = CorrelationToSurface( TestList, elements, Surface, LC );203 surfacemap = CorrelationToSurface( allMolecules, elements, Surface, LC ); 204 204 // OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap ); 205 205 // put pair correlation into bins and check with no range … … 221 221 BinPairMap::iterator tester; 222 222 elements.push_back(carbon); 223 surfacemap = CorrelationToSurface( TestList, elements, Surface, LC );223 surfacemap = CorrelationToSurface( allMolecules, elements, Surface, LC ); 224 224 // OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap ); 225 225 // ... and check with [0., 2.] range -
src/unittests/AnalysisCorrelationToSurfaceUnitTest.hpp
r521bbf re65de8 43 43 private: 44 44 45 MoleculeListClass *TestList;45 std::vector<molecule *> allMolecules; 46 46 molecule *TestSurfaceMolecule; 47 47 element *hydrogen; -
src/unittests/AnalysisPairCorrelationUnitTest.cpp
r521bbf re65de8 16 16 #include "analysis_correlation.hpp" 17 17 #include "AnalysisPairCorrelationUnitTest.hpp" 18 19 #include "Descriptors/MoleculeDescriptor.hpp" 18 20 19 21 #include "World.hpp" … … 42 44 43 45 // init private all pointers to zero 44 TestList = NULL;45 46 TestMolecule = NULL; 46 47 correlationmap = NULL; … … 76 77 CPPUNIT_ASSERT_EQUAL( TestMolecule->getAtomCount(), 4 ); 77 78 78 TestList = World::getInstance().getMolecules();79 TestMolecule->ActiveFlag = true;80 TestList->insert(TestMolecule);81 82 79 // init maps 83 correlationmap = PairCorrelation( TestList, elements); 80 World::getInstance().selectAllMolecules(AllMolecules()); 81 allMolecules = World::getInstance().getSelectedMolecules(); 82 CPPUNIT_ASSERT_EQUAL( (size_t) 1, allMolecules.size()); 83 correlationmap = PairCorrelation( allMolecules, elements); 84 84 binmap = NULL; 85 85 -
src/unittests/AnalysisPairCorrelationUnitTest.hpp
r521bbf re65de8 35 35 private: 36 36 37 MoleculeListClass *TestList;37 std::vector<molecule *> allMolecules; 38 38 molecule *TestMolecule; 39 39 element *hydrogen;
Note:
See TracChangeset
for help on using the changeset viewer.