Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/analysis_correlation.cpp

    rb34306 ra67d19  
    3636
    3737  if (molecules->ListOfMolecules.empty()) {
    38     eLog() << Verbose(1) <<"No molecule given." << endl;
     38    DoeLog(1) && (eLog()<< Verbose(1) <<"No molecule given." << endl);
    3939    return outmap;
    4040  }
     
    4242  for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
    4343    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);
    4949        if ((type1 == NULL) || (Walker->type == type1)) {
    5050          for (MoleculeList::const_iterator MolOtherWalker = MolWalker; MolOtherWalker != molecules->ListOfMolecules.end(); MolOtherWalker++)
    5151            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);
    5353              atom *OtherWalker = (*MolOtherWalker)->start;
    5454              while (OtherWalker->next != (*MolOtherWalker)->end) { // only go up to Walker
    5555                OtherWalker = OtherWalker->next;
    56                 Log() << Verbose(3) << "Current otheratom is " << *OtherWalker << "." << endl;
     56                DoLog(3) && (Log() << Verbose(3) << "Current otheratom is " << *OtherWalker << "." << endl);
    5757                if (Walker->nr < OtherWalker->nr)
    5858                  if ((type2 == NULL) || (OtherWalker->type == type2)) {
     
    9292
    9393  if (molecules->ListOfMolecules.empty()) {
    94     eLog() << Verbose(1) <<"No molecule given." << endl;
     94    DoeLog(1) && (eLog()<< Verbose(1) <<"No molecule given." << endl);
    9595    return outmap;
    9696  }
     
    100100      double * FullMatrix = ReturnFullMatrixforSymmetric(World::get()->cell_size);
    101101      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);
    107107        if ((type1 == NULL) || (Walker->type == type1)) {
    108108          periodicX.CopyVector(Walker->node);
     
    117117                for (MoleculeList::const_iterator MolOtherWalker = MolWalker; MolOtherWalker != molecules->ListOfMolecules.end(); MolOtherWalker++)
    118118                  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);
    120120                    atom *OtherWalker = (*MolOtherWalker)->start;
    121121                    while (OtherWalker->next != (*MolOtherWalker)->end) { // only go up to Walker
    122122                      OtherWalker = OtherWalker->next;
    123                       Log() << Verbose(3) << "Current otheratom is " << *OtherWalker << "." << endl;
     123                      DoLog(3) && (Log() << Verbose(3) << "Current otheratom is " << *OtherWalker << "." << endl);
    124124                      if (Walker->nr < OtherWalker->nr)
    125125                        if ((type2 == NULL) || (OtherWalker->type == type2)) {
     
    164164
    165165  if (molecules->ListOfMolecules.empty()) {
    166     Log() << Verbose(1) <<"No molecule given." << endl;
     166    DoLog(1) && (Log() << Verbose(1) <<"No molecule given." << endl);
    167167    return outmap;
    168168  }
     
    170170  for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
    171171    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);
    177177        if ((type == NULL) || (Walker->type == type)) {
    178178          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);
    180180          outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> (Walker, point) ) );
    181181        }
     
    204204
    205205  if (molecules->ListOfMolecules.empty()) {
    206     Log() << Verbose(1) <<"No molecule given." << endl;
     206    DoLog(1) && (Log() << Verbose(1) <<"No molecule given." << endl);
    207207    return outmap;
    208208  }
     
    212212      double * FullMatrix = ReturnFullMatrixforSymmetric(World::get()->cell_size);
    213213      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);
    219219        if ((type == NULL) || (Walker->type == type)) {
    220220          periodicX.CopyVector(Walker->node);
     
    228228                checkX.MatrixMultiplication(FullMatrix);
    229229                distance = checkX.Distance(point);
    230                 Log() << Verbose(4) << "Current distance is " << distance << "." << endl;
     230                DoLog(4) && (Log() << Verbose(4) << "Current distance is " << distance << "." << endl);
    231231                outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> (Walker, point) ) );
    232232              }
     
    257257
    258258  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);
    260260    return outmap;
    261261  }
     
    263263  for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
    264264    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);
    266266      atom *Walker = (*MolWalker)->start;
    267267      while (Walker->next != (*MolWalker)->end) {
     
    276276      }
    277277    } 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);
    279279
    280280
     
    307307
    308308  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);
    310310    return outmap;
    311311  }
     
    317317      double * FullMatrix = ReturnFullMatrixforSymmetric(World::get()->cell_size);
    318318      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);
    324324        if ((type == NULL) || (Walker->type == type)) {
    325325          periodicX.CopyVector(Walker->node);
     
    333333                checkX.AddVector(&periodicX);
    334334                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();
    337338                if ((ShortestDistance == -1.) || (distance < ShortestDistance)) {
    338339                  ShortestDistance = distance;
     
    341342              }
    342343          // insert
    343           ShortestDistance = sqrt(ShortestDistance);
    344344          outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(ShortestDistance, pair<atom *, BoundaryTriangleSet*> (Walker, ShortestTriangle) ) );
    345345          //Log() << Verbose(1) << "INFO: Inserting " << Walker << " with distance " << ShortestDistance << " to " << *ShortestTriangle << "." << endl;
     
    353353};
    354354
    355 /** Returns the start of the bin for a given value.
     355/** Returns the index of the bin for a given value.
    356356 * \param value value whose bin to look for
    357357 * \param BinWidth width of bin
    358358 * \param BinStart first bin
    359359 */
    360 double GetBin ( 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);
     360int 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);
    365365};
    366366
Note: See TracChangeset for help on using the changeset viewer.