Changes in src/analysis_correlation.cpp [b34306:a67d19]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/analysis_correlation.cpp
rb34306 ra67d19 36 36 37 37 if (molecules->ListOfMolecules.empty()) { 38 eLog() << Verbose(1) <<"No molecule given." << endl;38 DoeLog(1) && (eLog()<< Verbose(1) <<"No molecule given." << endl); 39 39 return outmap; 40 40 } … … 42 42 for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++) 43 43 if ((*MolWalker)->ActiveFlag) { 44 eLog() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;45 atom *Walker = (*MolWalker)->start; 46 while (Walker->next != (*MolWalker)->end) { 47 Walker = Walker->next; 48 Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl;44 DoeLog(2) && (eLog()<< Verbose(2) << "Current molecule is " << *MolWalker << "." << endl); 45 atom *Walker = (*MolWalker)->start; 46 while (Walker->next != (*MolWalker)->end) { 47 Walker = Walker->next; 48 DoLog(3) && (Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl); 49 49 if ((type1 == NULL) || (Walker->type == type1)) { 50 50 for (MoleculeList::const_iterator MolOtherWalker = MolWalker; MolOtherWalker != molecules->ListOfMolecules.end(); MolOtherWalker++) 51 51 if ((*MolOtherWalker)->ActiveFlag) { 52 Log() << Verbose(2) << "Current other molecule is " << *MolOtherWalker << "." << endl;52 DoLog(2) && (Log() << Verbose(2) << "Current other molecule is " << *MolOtherWalker << "." << endl); 53 53 atom *OtherWalker = (*MolOtherWalker)->start; 54 54 while (OtherWalker->next != (*MolOtherWalker)->end) { // only go up to Walker 55 55 OtherWalker = OtherWalker->next; 56 Log() << Verbose(3) << "Current otheratom is " << *OtherWalker << "." << endl;56 DoLog(3) && (Log() << Verbose(3) << "Current otheratom is " << *OtherWalker << "." << endl); 57 57 if (Walker->nr < OtherWalker->nr) 58 58 if ((type2 == NULL) || (OtherWalker->type == type2)) { … … 92 92 93 93 if (molecules->ListOfMolecules.empty()) { 94 eLog() << Verbose(1) <<"No molecule given." << endl;94 DoeLog(1) && (eLog()<< Verbose(1) <<"No molecule given." << endl); 95 95 return outmap; 96 96 } … … 100 100 double * FullMatrix = ReturnFullMatrixforSymmetric(World::get()->cell_size); 101 101 double * FullInverseMatrix = InverseMatrix(FullMatrix); 102 eLog() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;103 atom *Walker = (*MolWalker)->start; 104 while (Walker->next != (*MolWalker)->end) { 105 Walker = Walker->next; 106 Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl;102 DoeLog(2) && (eLog()<< Verbose(2) << "Current molecule is " << *MolWalker << "." << endl); 103 atom *Walker = (*MolWalker)->start; 104 while (Walker->next != (*MolWalker)->end) { 105 Walker = Walker->next; 106 DoLog(3) && (Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl); 107 107 if ((type1 == NULL) || (Walker->type == type1)) { 108 108 periodicX.CopyVector(Walker->node); … … 117 117 for (MoleculeList::const_iterator MolOtherWalker = MolWalker; MolOtherWalker != molecules->ListOfMolecules.end(); MolOtherWalker++) 118 118 if ((*MolOtherWalker)->ActiveFlag) { 119 Log() << Verbose(2) << "Current other molecule is " << *MolOtherWalker << "." << endl;119 DoLog(2) && (Log() << Verbose(2) << "Current other molecule is " << *MolOtherWalker << "." << endl); 120 120 atom *OtherWalker = (*MolOtherWalker)->start; 121 121 while (OtherWalker->next != (*MolOtherWalker)->end) { // only go up to Walker 122 122 OtherWalker = OtherWalker->next; 123 Log() << Verbose(3) << "Current otheratom is " << *OtherWalker << "." << endl;123 DoLog(3) && (Log() << Verbose(3) << "Current otheratom is " << *OtherWalker << "." << endl); 124 124 if (Walker->nr < OtherWalker->nr) 125 125 if ((type2 == NULL) || (OtherWalker->type == type2)) { … … 164 164 165 165 if (molecules->ListOfMolecules.empty()) { 166 Log() << Verbose(1) <<"No molecule given." << endl;166 DoLog(1) && (Log() << Verbose(1) <<"No molecule given." << endl); 167 167 return outmap; 168 168 } … … 170 170 for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++) 171 171 if ((*MolWalker)->ActiveFlag) { 172 Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;173 atom *Walker = (*MolWalker)->start; 174 while (Walker->next != (*MolWalker)->end) { 175 Walker = Walker->next; 176 Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl;172 DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl); 173 atom *Walker = (*MolWalker)->start; 174 while (Walker->next != (*MolWalker)->end) { 175 Walker = Walker->next; 176 DoLog(3) && (Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl); 177 177 if ((type == NULL) || (Walker->type == type)) { 178 178 distance = Walker->node->PeriodicDistance(point, World::get()->cell_size); 179 Log() << Verbose(4) << "Current distance is " << distance << "." << endl;179 DoLog(4) && (Log() << Verbose(4) << "Current distance is " << distance << "." << endl); 180 180 outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> (Walker, point) ) ); 181 181 } … … 204 204 205 205 if (molecules->ListOfMolecules.empty()) { 206 Log() << Verbose(1) <<"No molecule given." << endl;206 DoLog(1) && (Log() << Verbose(1) <<"No molecule given." << endl); 207 207 return outmap; 208 208 } … … 212 212 double * FullMatrix = ReturnFullMatrixforSymmetric(World::get()->cell_size); 213 213 double * FullInverseMatrix = InverseMatrix(FullMatrix); 214 Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;215 atom *Walker = (*MolWalker)->start; 216 while (Walker->next != (*MolWalker)->end) { 217 Walker = Walker->next; 218 Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl;214 DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl); 215 atom *Walker = (*MolWalker)->start; 216 while (Walker->next != (*MolWalker)->end) { 217 Walker = Walker->next; 218 DoLog(3) && (Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl); 219 219 if ((type == NULL) || (Walker->type == type)) { 220 220 periodicX.CopyVector(Walker->node); … … 228 228 checkX.MatrixMultiplication(FullMatrix); 229 229 distance = checkX.Distance(point); 230 Log() << Verbose(4) << "Current distance is " << distance << "." << endl;230 DoLog(4) && (Log() << Verbose(4) << "Current distance is " << distance << "." << endl); 231 231 outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> (Walker, point) ) ); 232 232 } … … 257 257 258 258 if ((Surface == NULL) || (LC == NULL) || (molecules->ListOfMolecules.empty())) { 259 eLog() << Verbose(1) <<"No Tesselation, no LinkedCell or no molecule given." << endl;259 DoeLog(1) && (eLog()<< Verbose(1) <<"No Tesselation, no LinkedCell or no molecule given." << endl); 260 260 return outmap; 261 261 } … … 263 263 for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++) 264 264 if ((*MolWalker)->ActiveFlag) { 265 Log() << Verbose(1) << "Current molecule is " << (*MolWalker)->name << "." << endl;265 DoLog(1) && (Log() << Verbose(1) << "Current molecule is " << (*MolWalker)->name << "." << endl); 266 266 atom *Walker = (*MolWalker)->start; 267 267 while (Walker->next != (*MolWalker)->end) { … … 276 276 } 277 277 } else 278 Log() << Verbose(1) << "molecule " << (*MolWalker)->name << " is not active." << endl;278 DoLog(1) && (Log() << Verbose(1) << "molecule " << (*MolWalker)->name << " is not active." << endl); 279 279 280 280 … … 307 307 308 308 if ((Surface == NULL) || (LC == NULL) || (molecules->ListOfMolecules.empty())) { 309 Log() << Verbose(1) <<"No Tesselation, no LinkedCell or no molecule given." << endl;309 DoLog(1) && (Log() << Verbose(1) <<"No Tesselation, no LinkedCell or no molecule given." << endl); 310 310 return outmap; 311 311 } … … 317 317 double * FullMatrix = ReturnFullMatrixforSymmetric(World::get()->cell_size); 318 318 double * FullInverseMatrix = InverseMatrix(FullMatrix); 319 Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;320 atom *Walker = (*MolWalker)->start; 321 while (Walker->next != (*MolWalker)->end) { 322 Walker = Walker->next; 323 Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl;319 DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl); 320 atom *Walker = (*MolWalker)->start; 321 while (Walker->next != (*MolWalker)->end) { 322 Walker = Walker->next; 323 DoLog(3) && (Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl); 324 324 if ((type == NULL) || (Walker->type == type)) { 325 325 periodicX.CopyVector(Walker->node); … … 333 333 checkX.AddVector(&periodicX); 334 334 checkX.MatrixMultiplication(FullMatrix); 335 triangle = Surface->FindClosestTriangleToVector(&checkX, LC); 336 distance = Surface->GetDistanceSquaredToTriangle(checkX, triangle); 335 TriangleIntersectionList Intersections(&checkX,Surface,LC); 336 distance = Intersections.GetSmallestDistance(); 337 triangle = Intersections.GetClosestTriangle(); 337 338 if ((ShortestDistance == -1.) || (distance < ShortestDistance)) { 338 339 ShortestDistance = distance; … … 341 342 } 342 343 // insert 343 ShortestDistance = sqrt(ShortestDistance);344 344 outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(ShortestDistance, pair<atom *, BoundaryTriangleSet*> (Walker, ShortestTriangle) ) ); 345 345 //Log() << Verbose(1) << "INFO: Inserting " << Walker << " with distance " << ShortestDistance << " to " << *ShortestTriangle << "." << endl; … … 353 353 }; 354 354 355 /** Returns the startof the bin for a given value.355 /** Returns the index of the bin for a given value. 356 356 * \param value value whose bin to look for 357 357 * \param BinWidth width of bin 358 358 * \param BinStart first bin 359 359 */ 360 doubleGetBin ( const double value, const double BinWidth, const double BinStart )361 { 362 Info FunctionInfo(__func__); 363 double bin =(double) (floor((value - BinStart)/BinWidth));364 return (bin *BinWidth+BinStart);360 int GetBin ( const double value, const double BinWidth, const double BinStart ) 361 { 362 Info FunctionInfo(__func__); 363 int bin =(int) (floor((value - BinStart)/BinWidth)); 364 return (bin); 365 365 }; 366 366
Note:
See TracChangeset
for help on using the changeset viewer.