Changes in src/analysis_correlation.cpp [790807:bd61b41]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/analysis_correlation.cpp
r790807 rbd61b41 267 267 Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl; 268 268 if ((type == NULL) || (Walker->type == type)) { 269 triangle = Surface->FindClosestTriangleTo Vector(Walker->node, LC );269 triangle = Surface->FindClosestTriangleToPoint(Walker->node, LC ); 270 270 if (triangle != NULL) { 271 271 distance = DistanceToTrianglePlane(Walker->node, triangle); … … 308 308 } 309 309 outmap = new CorrelationToSurfaceMap; 310 double ShortestDistance = 0.;311 BoundaryTriangleSet *ShortestTriangle = NULL;312 310 for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++) 313 311 if ((*MolWalker)->ActiveFlag) { … … 323 321 periodicX.MatrixMultiplication(FullInverseMatrix); // x now in [0,1)^3 324 322 // go through every range in xyz and get distance 325 ShortestDistance = -1.;326 323 for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++) 327 324 for (n[1]=-ranges[1]; n[1] <= ranges[1]; n[1]++) … … 330 327 checkX.AddVector(&periodicX); 331 328 checkX.MatrixMultiplication(FullMatrix); 332 triangle = Surface->FindClosestTriangleToVector(&checkX, LC); 333 distance = Surface->GetDistanceSquaredToTriangle(checkX, triangle); 334 if ((ShortestDistance == -1.) || (distance < ShortestDistance)) { 335 ShortestDistance = distance; 336 ShortestTriangle = triangle; 329 triangle = Surface->FindClosestTriangleToPoint(&checkX, LC ); 330 if (triangle != NULL) { 331 distance = DistanceToTrianglePlane(&checkX, triangle); 332 outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(distance, pair<atom *, BoundaryTriangleSet*> (Walker, triangle) ) ); 337 333 } 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; 334 } 343 335 } 344 336 } … … 350 342 }; 351 343 352 /** Returns the startof the bin for a given value.344 /** Returns the index of the bin for a given value. 353 345 * \param value value whose bin to look for 354 346 * \param BinWidth width of bin 355 347 * \param BinStart first bin 356 348 */ 357 doubleGetBin ( const double value, const double BinWidth, const double BinStart )358 { 359 Info FunctionInfo(__func__); 360 double bin =(double) (floor((value - BinStart)/BinWidth));361 return (bin *BinWidth+BinStart);349 int GetBin ( const double value, const double BinWidth, const double BinStart ) 350 { 351 Info FunctionInfo(__func__); 352 int bin =(int) (floor((value - BinStart)/BinWidth)); 353 return (bin); 362 354 }; 363 355 … … 370 362 { 371 363 Info FunctionInfo(__func__); 372 *file << " BinStart\tCount" << endl;364 *file << "# BinStart\tCount" << endl; 373 365 for (BinPairMap::const_iterator runner = map->begin(); runner != map->end(); ++runner) { 374 366 *file << runner->first << "\t" << runner->second << endl; … … 383 375 { 384 376 Info FunctionInfo(__func__); 385 *file << " BinStart\tAtom1\tAtom2" << endl;377 *file << "# BinStart\tAtom1\tAtom2" << endl; 386 378 for (PairCorrelationMap::const_iterator runner = map->begin(); runner != map->end(); ++runner) { 387 379 *file << runner->first << "\t" << *(runner->second.first) << "\t" << *(runner->second.second) << endl; … … 396 388 { 397 389 Info FunctionInfo(__func__); 398 *file << " BinStart\tAtom::x[i]-point.x[i]" << endl;390 *file << "# BinStart\tAtom::x[i]-point.x[i]" << endl; 399 391 for (CorrelationToPointMap::const_iterator runner = map->begin(); runner != map->end(); ++runner) { 400 392 *file << runner->first; … … 412 404 { 413 405 Info FunctionInfo(__func__); 414 *file << " BinStart\tTriangle" << endl;406 *file << "# BinStart\tTriangle" << endl; 415 407 for (CorrelationToSurfaceMap::const_iterator runner = map->begin(); runner != map->end(); ++runner) { 416 *file << runner->first << "\t" << *(runner->second. first) << "\t" << *(runner->second.second) << endl;417 } 418 }; 419 408 *file << runner->first << "\t" << *(runner->second.second) << endl; 409 } 410 }; 411
Note:
See TracChangeset
for help on using the changeset viewer.