Ignore:
Timestamp:
Jan 26, 2010, 12:52:31 PM (16 years ago)
Author:
Frederik Heber <heber@…>
Children:
8d0b25, d34341
Parents:
551a58
Message:

GetDistanceToSurface() separated, filling now with water instead of boron, DissectMoleculeIntoConnectedSubgraphs() now working on list of molecules instead of single one.

Signed-off-by: Frederik Heber <heber@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/analysis_correlation.cpp

    r551a58 r478683  
    308308  }
    309309  outmap = new CorrelationToSurfaceMap;
     310  double ShortestDistance = 0.;
     311  BoundaryTriangleSet *ShortestTriangle = NULL;
    310312  for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
    311313    if ((*MolWalker)->ActiveFlag) {
     
    321323          periodicX.MatrixMultiplication(FullInverseMatrix);  // x now in [0,1)^3
    322324          // go through every range in xyz and get distance
     325          ShortestDistance = -1.;
    323326          for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++)
    324327            for (n[1]=-ranges[1]; n[1] <= ranges[1]; n[1]++)
     
    327330                checkX.AddVector(&periodicX);
    328331                checkX.MatrixMultiplication(FullMatrix);
    329                 triangle = Surface->FindClosestTriangleToVector(&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;
    333337                }
    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;
    335343        }
    336344      }
     
    406414  *file << "# BinStart\tTriangle" << endl;
    407415  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.