Changeset 342fbc9 for molecuilder/src


Ignore:
Timestamp:
Apr 20, 2010, 9:21:51 AM (15 years ago)
Author:
Frederik Heber <heber@…>
Children:
086db0
Parents:
adff53
Message:

BUGFIXES: LinkedCell::SetIndexToNode() had wrong boundaries in zero case, LinkedCell::GetPointsInsideSphere() took only half the right radius

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/linkedcell.cpp

    radff53 r342fbc9  
    280280 * \param *lower lower bounds
    281281 * \param *upper upper bounds
     282 * \param step how deep to check the neighbouring cells (i.e. number of layers to check)
    282283 */
    283284void LinkedCell::GetNeighbourBounds(int lower[NDIM], int upper[NDIM], int step) const
    284285{
    285286  for (int i=0;i<NDIM;i++) {
    286     lower[i] = 0;
     287    lower[i] = n[i];
    287288    for (int s=step; s>0;--s)
    288289      if ((n[i]-s) >= 0) {
     
    290291        break;
    291292      }
    292     upper[i] = 0;
     293    upper[i] = n[i];
    293294    for (int s=step; s>0;--s)
    294295      if ((n[i]+s) < N[i]) {
     
    296297        break;
    297298      }
    298     //Log() << Verbose(0) << " [" << lower[i] << "," << upper[i] << "] ";
    299     // check for this axis whether the point is outside of our grid
    300     if (n[i] < 0)
    301       upper[i] = lower[i];
    302     if (n[i] > N[i])
    303       lower[i] = upper[i];
    304 
    305299    //Log() << Verbose(0) << "axis " << i << " has bounds [" << lower[i] << "," << upper[i] << "]" << endl;
    306300  }
     
    401395  // set index of LC to center of sphere
    402396  const double dist = SetClosestIndexToOutsideVector(center);
    403   if (dist > radius) {
     397  if (dist > 2.*radius) {
    404398    DoeLog(1) && (eLog()<< Verbose(1) << "Vector " << *center << " is too far away from any atom in LinkedCell's bounding box." << endl);
    405399    return TesselList;
    406   }
     400  } else
     401    Log() << Verbose(1) << "Distance of closest cell to center of sphere with radius " << radius << " is " << dist << "." << endl;
    407402
    408403  // gather all neighbours first, then look who fulfills distance criteria
    409   NeighbourList = GetallNeighbours(radius-dist);
     404  NeighbourList = GetallNeighbours(2.*radius-dist);
     405  //Log() << Verbose(1) << "I found " << NeighbourList->size() << " neighbours to check." << endl;
    410406  if (NeighbourList != NULL) {
    411407    for (LinkedNodes::const_iterator Runner = NeighbourList->begin(); Runner != NeighbourList->end(); Runner++) {
    412408      Walker = *Runner;
     409      //Log() << Verbose(1) << "Current neighbour is at " << *Walker->node << "." << endl;
    413410      if ((center->DistanceSquared(Walker->node) - radiusSquared) < MYEPSILON) {
    414411        TesselList->push_back(Walker);
Note: See TracChangeset for help on using the changeset viewer.