Changeset 04b6f9 for src/analysis_correlation.cpp
- Timestamp:
- Jan 27, 2010, 2:36:09 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:
- 2ededc2
- Parents:
- 1ca488f (diff), 244a84 (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
-
src/analysis_correlation.cpp (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/analysis_correlation.cpp
r1ca488f r04b6f9 10 10 #include "analysis_correlation.hpp" 11 11 #include "element.hpp" 12 #include "info.hpp" 12 13 #include "log.hpp" 13 14 #include "molecule.hpp" … … 28 29 PairCorrelationMap *PairCorrelation(MoleculeListClass * const &molecules, const element * const type1, const element * const type2 ) 29 30 { 31 Info FunctionInfo(__func__); 30 32 PairCorrelationMap *outmap = NULL; 31 33 double distance = 0.; … … 77 79 PairCorrelationMap *PeriodicPairCorrelation(MoleculeListClass * const &molecules, const element * const type1, const element * const type2, const int ranges[NDIM] ) 78 80 { 81 Info FunctionInfo(__func__); 79 82 PairCorrelationMap *outmap = NULL; 80 83 double distance = 0.; … … 154 157 CorrelationToPointMap *CorrelationToPoint(MoleculeListClass * const &molecules, const element * const type, const Vector *point ) 155 158 { 159 Info FunctionInfo(__func__); 156 160 CorrelationToPointMap *outmap = NULL; 157 161 double distance = 0.; … … 190 194 CorrelationToPointMap *PeriodicCorrelationToPoint(MoleculeListClass * const &molecules, const element * const type, const Vector *point, const int ranges[NDIM] ) 191 195 { 196 Info FunctionInfo(__func__); 192 197 CorrelationToPointMap *outmap = NULL; 193 198 double distance = 0.; … … 243 248 CorrelationToSurfaceMap *CorrelationToSurface(MoleculeListClass * const &molecules, const element * const type, const Tesselation * const Surface, const LinkedCell *LC ) 244 249 { 250 Info FunctionInfo(__func__); 245 251 CorrelationToSurfaceMap *outmap = NULL; 246 252 double distance = 0; … … 261 267 Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl; 262 268 if ((type == NULL) || (Walker->type == type)) { 263 triangle = Surface->FindClosestTriangleTo Point(Walker->node, LC );269 triangle = Surface->FindClosestTriangleToVector(Walker->node, LC ); 264 270 if (triangle != NULL) { 265 271 distance = DistanceToTrianglePlane(Walker->node, triangle); … … 288 294 CorrelationToSurfaceMap *PeriodicCorrelationToSurface(MoleculeListClass * const &molecules, const element * const type, const Tesselation * const Surface, const LinkedCell *LC, const int ranges[NDIM] ) 289 295 { 296 Info FunctionInfo(__func__); 290 297 CorrelationToSurfaceMap *outmap = NULL; 291 298 double distance = 0; … … 301 308 } 302 309 outmap = new CorrelationToSurfaceMap; 310 double ShortestDistance = 0.; 311 BoundaryTriangleSet *ShortestTriangle = NULL; 303 312 for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++) 304 313 if ((*MolWalker)->ActiveFlag) { … … 314 323 periodicX.MatrixMultiplication(FullInverseMatrix); // x now in [0,1)^3 315 324 // go through every range in xyz and get distance 325 ShortestDistance = -1.; 316 326 for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++) 317 327 for (n[1]=-ranges[1]; n[1] <= ranges[1]; n[1]++) … … 320 330 checkX.AddVector(&periodicX); 321 331 checkX.MatrixMultiplication(FullMatrix); 322 triangle = Surface->FindClosestTriangleToPoint(&checkX, LC ); 323 if (triangle != NULL) { 324 distance = DistanceToTrianglePlane(&checkX, triangle); 325 outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(distance, pair<atom *, BoundaryTriangleSet*> (Walker, triangle) ) ); 332 triangle = Surface->FindClosestTriangleToVector(&checkX, LC); 333 distance = Surface->GetDistanceSquaredToTriangle(checkX, triangle); 334 if ((ShortestDistance == -1.) || (distance < ShortestDistance)) { 335 ShortestDistance = distance; 336 ShortestTriangle = triangle; 326 337 } 327 } 338 } 339 // insert 340 ShortestDistance = sqrt(ShortestDistance); 341 outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(ShortestDistance, pair<atom *, BoundaryTriangleSet*> (Walker, ShortestTriangle) ) ); 342 //Log() << Verbose(1) << "INFO: Inserting " << Walker << " with distance " << ShortestDistance << " to " << *ShortestTriangle << "." << endl; 328 343 } 329 344 } … … 342 357 double GetBin ( const double value, const double BinWidth, const double BinStart ) 343 358 { 359 Info FunctionInfo(__func__); 344 360 double bin =(double) (floor((value - BinStart)/BinWidth)); 345 361 return (bin*BinWidth+BinStart); … … 353 369 void OutputCorrelation( ofstream * const file, const BinPairMap * const map ) 354 370 { 371 Info FunctionInfo(__func__); 355 372 *file << "# BinStart\tCount" << endl; 356 373 for (BinPairMap::const_iterator runner = map->begin(); runner != map->end(); ++runner) { … … 365 382 void OutputPairCorrelation( ofstream * const file, const PairCorrelationMap * const map ) 366 383 { 384 Info FunctionInfo(__func__); 367 385 *file << "# BinStart\tAtom1\tAtom2" << endl; 368 386 for (PairCorrelationMap::const_iterator runner = map->begin(); runner != map->end(); ++runner) { … … 377 395 void OutputCorrelationToPoint( ofstream * const file, const CorrelationToPointMap * const map ) 378 396 { 397 Info FunctionInfo(__func__); 379 398 *file << "# BinStart\tAtom::x[i]-point.x[i]" << endl; 380 399 for (CorrelationToPointMap::const_iterator runner = map->begin(); runner != map->end(); ++runner) { … … 392 411 void OutputCorrelationToSurface( ofstream * const file, const CorrelationToSurfaceMap * const map ) 393 412 { 413 Info FunctionInfo(__func__); 394 414 *file << "# BinStart\tTriangle" << endl; 395 415 for (CorrelationToSurfaceMap::const_iterator runner = map->begin(); runner != map->end(); ++runner) { 396 *file << runner->first << "\t" << *(runner->second. second) << endl;397 } 398 }; 399 416 *file << runner->first << "\t" << *(runner->second.first) << "\t" << *(runner->second.second) << endl; 417 } 418 }; 419
Note:
See TracChangeset
for help on using the changeset viewer.
