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