Changeset b5c53d for src/analysis_correlation.cpp
- Timestamp:
- Aug 9, 2010, 6:33:29 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:
- 353e82
- Parents:
- 458447 (diff), e588312 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/analysis_correlation.cpp
r458447 rb5c53d 33 33 * \return Map of doubles with values the pair of the two atoms. 34 34 */ 35 PairCorrelationMap *PairCorrelation(std::vector<molecule *> &molecules, const std::vector< element *> &elements)35 PairCorrelationMap *PairCorrelation(std::vector<molecule *> &molecules, const std::vector<const element *> &elements) 36 36 { 37 37 Info FunctionInfo(__func__); … … 48 48 49 49 // create all possible pairs of elements 50 set <pair< element *,element *> > PairsOfElements;50 set <pair<const element *,const element *> > PairsOfElements; 51 51 if (elements.size() >= 2) { 52 for (vector< element *>::const_iterator type1 = elements.begin(); type1 != elements.end(); ++type1)53 for (vector< element *>::const_iterator type2 = elements.begin(); type2 != elements.end(); ++type2)52 for (vector<const element *>::const_iterator type1 = elements.begin(); type1 != elements.end(); ++type1) 53 for (vector<const element *>::const_iterator type2 = elements.begin(); type2 != elements.end(); ++type2) 54 54 if (type1 != type2) { 55 PairsOfElements.insert( pair<element *, element*>(*type1,*type2) );56 DoLog(1) && (Log() << Verbose(1) << "Creating element pair " << (*type1)->symbol << " and " << (*type2)->symbol<< "." << endl);55 PairsOfElements.insert( make_pair(*type1,*type2) ); 56 DoLog(1) && (Log() << Verbose(1) << "Creating element pair " << *(*type1) << " and " << *(*type2) << "." << endl); 57 57 } 58 58 } else if (elements.size() == 1) { // one to all are valid 59 element *elemental = *elements.begin();60 PairsOfElements.insert( pair< element *, element*>(elemental,(element *)NULL) );61 PairsOfElements.insert( pair< element *, element*>((element *)NULL,elemental) );59 const element *elemental = *elements.begin(); 60 PairsOfElements.insert( pair<const element *,const element*>(elemental,0) ); 61 PairsOfElements.insert( pair<const element *,const element*>(0,elemental) ); 62 62 } else { // all elements valid 63 63 PairsOfElements.insert( pair<element *, element*>((element *)NULL, (element *)NULL) ); … … 74 74 DoLog(3) && (Log() << Verbose(3) << "Current otheratom is " << **runner << "." << endl); 75 75 if ((*iter)->getId() < (*runner)->getId()){ 76 for (set <pair< element *,element *> >::iterator PairRunner = PairsOfElements.begin(); PairRunner != PairsOfElements.end(); ++PairRunner)76 for (set <pair<const element *, const element *> >::iterator PairRunner = PairsOfElements.begin(); PairRunner != PairsOfElements.end(); ++PairRunner) 77 77 if ((PairRunner->first == (**iter).getType()) && (PairRunner->second == (**runner).getType())) { 78 78 distance = domain.periodicDistance((*iter)->getPosition(),(*runner)->getPosition()); … … 95 95 * \return Map of doubles with values the pair of the two atoms. 96 96 */ 97 PairCorrelationMap *PeriodicPairCorrelation(std::vector<molecule *> &molecules, const std::vector< element *> &elements, const int ranges[NDIM] )97 PairCorrelationMap *PeriodicPairCorrelation(std::vector<molecule *> &molecules, const std::vector<const element *> &elements, const int ranges[NDIM] ) 98 98 { 99 99 Info FunctionInfo(__func__); … … 115 115 116 116 // create all possible pairs of elements 117 set <pair< element *,element *> > PairsOfElements;117 set <pair<const element *,const element *> > PairsOfElements; 118 118 if (elements.size() >= 2) { 119 for (vector< element *>::const_iterator type1 = elements.begin(); type1 != elements.end(); ++type1)120 for (vector< element *>::const_iterator type2 = elements.begin(); type2 != elements.end(); ++type2)119 for (vector<const element *>::const_iterator type1 = elements.begin(); type1 != elements.end(); ++type1) 120 for (vector<const element *>::const_iterator type2 = elements.begin(); type2 != elements.end(); ++type2) 121 121 if (type1 != type2) { 122 PairsOfElements.insert( pair<element *, element*>(*type1,*type2) );123 DoLog(1) && (Log() << Verbose(1) << "Creating element pair " << (*type1)->symbol << " and " << (*type2)->symbol<< "." << endl);122 PairsOfElements.insert( make_pair(*type1,*type2) ); 123 DoLog(1) && (Log() << Verbose(1) << "Creating element pair " << *(*type1) << " and " << *(*type2) << "." << endl); 124 124 } 125 125 } else if (elements.size() == 1) { // one to all are valid 126 element *elemental = *elements.begin();127 PairsOfElements.insert( pair< element *, element*>(elemental,(element *)NULL) );128 PairsOfElements.insert( pair< element *, element*>((element *)NULL,elemental) );126 const element *elemental = *elements.begin(); 127 PairsOfElements.insert( pair<const element *,const element*>(elemental,0) ); 128 PairsOfElements.insert( pair<const element *,const element*>(0,elemental) ); 129 129 } else { // all elements valid 130 130 PairsOfElements.insert( pair<element *, element*>((element *)NULL, (element *)NULL) ); … … 149 149 DoLog(3) && (Log() << Verbose(3) << "Current otheratom is " << **runner << "." << endl); 150 150 if ((*iter)->getId() < (*runner)->getId()){ 151 for (set <pair< element *,element *> >::iterator PairRunner = PairsOfElements.begin(); PairRunner != PairsOfElements.end(); ++PairRunner)151 for (set <pair<const element *,const element *> >::iterator PairRunner = PairsOfElements.begin(); PairRunner != PairsOfElements.end(); ++PairRunner) 152 152 if ((PairRunner->first == (**iter).getType()) && (PairRunner->second == (**runner).getType())) { 153 153 periodicOtherX = FullInverseMatrix * ((*runner)->getPosition()); // x now in [0,1)^3 … … 178 178 * \return Map of dobules with values as pairs of atom and the vector 179 179 */ 180 CorrelationToPointMap *CorrelationToPoint(std::vector<molecule *> &molecules, const std::vector< element *> &elements, const Vector *point )180 CorrelationToPointMap *CorrelationToPoint(std::vector<molecule *> &molecules, const std::vector<const element *> &elements, const Vector *point ) 181 181 { 182 182 Info FunctionInfo(__func__); … … 196 196 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) { 197 197 DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl); 198 for (vector< element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)198 for (vector<const element *>::const_iterator type = elements.begin(); type != elements.end(); ++type) 199 199 if ((*type == NULL) || ((*iter)->getType() == *type)) { 200 200 distance = domain.periodicDistance((*iter)->getPosition(),*point); … … 215 215 * \return Map of dobules with values as pairs of atom and the vector 216 216 */ 217 CorrelationToPointMap *PeriodicCorrelationToPoint(std::vector<molecule *> &molecules, const std::vector< element *> &elements, const Vector *point, const int ranges[NDIM] )217 CorrelationToPointMap *PeriodicCorrelationToPoint(std::vector<molecule *> &molecules, const std::vector<const element *> &elements, const Vector *point, const int ranges[NDIM] ) 218 218 { 219 219 Info FunctionInfo(__func__); … … 237 237 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) { 238 238 DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl); 239 for (vector< element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)239 for (vector<const element *>::const_iterator type = elements.begin(); type != elements.end(); ++type) 240 240 if ((*type == NULL) || ((*iter)->getType() == *type)) { 241 241 periodicX = FullInverseMatrix * ((*iter)->getPosition()); // x now in [0,1)^3 … … 263 263 * \return Map of doubles with values as pairs of atom and the BoundaryTriangleSet that's closest 264 264 */ 265 CorrelationToSurfaceMap *CorrelationToSurface(std::vector<molecule *> &molecules, const std::vector< element *> &elements, const Tesselation * const Surface, const LinkedCell *LC )265 CorrelationToSurfaceMap *CorrelationToSurface(std::vector<molecule *> &molecules, const std::vector<const element *> &elements, const Tesselation * const Surface, const LinkedCell *LC ) 266 266 { 267 267 Info FunctionInfo(__func__); … … 284 284 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) { 285 285 DoLog(3) && (Log() << Verbose(3) << "\tCurrent atom is " << *(*iter) << "." << endl); 286 for (vector< element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)286 for (vector<const element *>::const_iterator type = elements.begin(); type != elements.end(); ++type) 287 287 if ((*type == NULL) || ((*iter)->getType() == *type)) { 288 288 TriangleIntersectionList Intersections((*iter)->getPosition(),Surface,LC); … … 309 309 * \return Map of doubles with values as pairs of atom and the BoundaryTriangleSet that's closest 310 310 */ 311 CorrelationToSurfaceMap *PeriodicCorrelationToSurface(std::vector<molecule *> &molecules, const std::vector< element *> &elements, const Tesselation * const Surface, const LinkedCell *LC, const int ranges[NDIM] )311 CorrelationToSurfaceMap *PeriodicCorrelationToSurface(std::vector<molecule *> &molecules, const std::vector<const element *> &elements, const Tesselation * const Surface, const LinkedCell *LC, const int ranges[NDIM] ) 312 312 { 313 313 Info FunctionInfo(__func__); … … 335 335 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) { 336 336 DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl); 337 for (vector< element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)337 for (vector<const element *>::const_iterator type = elements.begin(); type != elements.end(); ++type) 338 338 if ((*type == NULL) || ((*iter)->getType() == *type)) { 339 339 periodicX = FullInverseMatrix * ((*iter)->getPosition()); // x now in [0,1)^3
Note:
See TracChangeset
for help on using the changeset viewer.