Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/molecule_graph.cpp

    r1f1b23 re5ad5c  
    147147        for (LC->n[2] = 0; LC->n[2] < LC->N[2]; LC->n[2]++) {
    148148          const LinkedNodes *List = LC->GetCurrentCell();
    149           //Log() << Verbose(2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << " containing " << List->size() << " points." << endl;
     149//          Log() << Verbose(2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << " containing " << List->size() << " points." << endl;
    150150          if (List != NULL) {
    151151            for (LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
    152152              Walker = AtomMap[(*Runner)->nr];
    153               //Log() << Verbose(0) << "Current Atom is " << *Walker << "." << endl;
     153//              Log() << Verbose(0) << "Current Atom is " << *Walker << "." << endl;
    154154              // 3c. check for possible bond between each atom in this and every one in the 27 cells
    155155              for (n[0] = -1; n[0] <= 1; n[0]++)
     
    157157                  for (n[2] = -1; n[2] <= 1; n[2]++) {
    158158                    const LinkedNodes *OtherList = LC->GetRelativeToCurrentCell(n);
    159                     //Log() << Verbose(2) << "Current relative cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << " containing " << List->size() << " points." << endl;
     159//                    Log() << Verbose(2) << "Current relative cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << " containing " << List->size() << " points." << endl;
    160160                    if (OtherList != NULL) {
    161161                      for (LinkedNodes::const_iterator OtherRunner = OtherList->begin(); OtherRunner != OtherList->end(); OtherRunner++) {
    162162                        if ((*OtherRunner)->nr > Walker->nr) {
    163163                          OtherWalker = AtomMap[(*OtherRunner)->nr];
    164                           //Log() << Verbose(1) << "Checking distance " << OtherWalker->x.PeriodicDistanceSquared(&(Walker->x), cell_size) << " against typical bond length of " << bonddistance*bonddistance << "." << endl;
     164//                          Log() << Verbose(0) << "Current other Atom is " << *OtherWalker << "." << endl;
     165                          const double distance = OtherWalker->x.PeriodicDistanceSquared(&(Walker->x), cell_size);
     166//                          Log() << Verbose(1) << "Checking distance " << distance << " against typical bond length of " << bonddistance*bonddistance << "." << endl;
    165167                          (BG->*minmaxdistance)(Walker, OtherWalker, MinDistance, MaxDistance, IsAngstroem);
    166                           const double distance = OtherWalker->x.PeriodicDistanceSquared(&(Walker->x), cell_size);
    167168                          const bool status = (distance <= MaxDistance * MaxDistance) && (distance >= MinDistance * MinDistance);
    168                           if ((OtherWalker->father->nr > Walker->father->nr) && (status)) { // create bond if distance is smaller
    169                             //Log() << Verbose(1) << "Adding Bond between " << *Walker << " and " << *OtherWalker << " in distance " << sqrt(distance) << "." << endl;
    170                             AddBond(Walker->father, OtherWalker->father, 1); // also increases molecule::BondCount
     169//                          Log() << Verbose(1) << "MinDistance is " << MinDistance << " and MaxDistance is " << MaxDistance << "." << endl;
     170                          if (OtherWalker->father->nr > Walker->father->nr) {
     171                            if (status) { // create bond if distance is smaller
     172//                              Log() << Verbose(1) << "Adding Bond between " << *Walker << " and " << *OtherWalker << " in distance " << sqrt(distance) << "." << endl;
     173                              AddBond(Walker->father, OtherWalker->father, 1); // also increases molecule::BondCount
     174                            } else {
     175//                              Log() << Verbose(1) << "Not Adding: distance too great." << endl;
     176                            }
    171177                          } else {
    172                             //Log() << Verbose(1) << "Not Adding: Wrong label order or distance too great." << endl;
     178//                            Log() << Verbose(1) << "Not Adding: Wrong order of labels." << endl;
    173179                          }
    174180                        }
     
    926932        break; // breaking here will not cause error!
    927933    }
    928     if (i == vertex->ListOfBonds.size()) {
     934    if (i == vertex->ListOfBonds.size())
    929935      eLog() << Verbose(0) << "Error: All Component entries are already occupied!" << endl;
    930       performCriticalExit();
    931     }
    932   } else {
     936  } else
    933937    eLog() << Verbose(0) << "Error: Given vertex is NULL!" << endl;
    934     performCriticalExit();
    935   }
    936938}
    937939;
     
    992994  Log() << Verbose(1) << "Saving adjacency list ... ";
    993995  if (AdjacencyFile != NULL) {
    994     AdjacencyFile << "m\tn" << endl;
    995996    ActOnAllAtoms(&atom::OutputAdjacency, &AdjacencyFile);
    996997    AdjacencyFile.close();
    997     Log() << Verbose(1) << "done." << endl;
    998   } else {
    999     Log() << Verbose(1) << "failed to open file " << line.str() << "." << endl;
    1000     status = false;
    1001   }
    1002 
    1003   return status;
    1004 }
    1005 ;
    1006 
    1007 /** Storing the bond structure of a molecule to file.
    1008  * Simply stores Atom::nr and then the Atom::nr of all bond partners, one per line.
    1009  * \param *out output stream for debugging
    1010  * \param *path path to file
    1011  * \return true - file written successfully, false - writing failed
    1012  */
    1013 bool molecule::StoreBondsToFile(char *path)
    1014 {
    1015   ofstream BondFile;
    1016   stringstream line;
    1017   bool status = true;
    1018 
    1019   line << path << "/" << FRAGMENTPREFIX << ADJACENCYFILE;
    1020   BondFile.open(line.str().c_str(), ios::out);
    1021   Log() << Verbose(1) << "Saving adjacency list ... ";
    1022   if (BondFile != NULL) {
    1023     BondFile << "m\tn" << endl;
    1024     ActOnAllAtoms(&atom::OutputBonds, &BondFile);
    1025     BondFile.close();
    1026998    Log() << Verbose(1) << "done." << endl;
    1027999  } else {
     
    11471119  bool status = true;
    11481120  if (ReferenceStack->IsEmpty()) {
    1149     Log() << Verbose(1) << "ReferenceStack is empty!" << endl;
     1121    eLog() << Verbose(0) << "ReferenceStack is empty!" << endl;
    11501122    return false;
    11511123  }
Note: See TracChangeset for help on using the changeset viewer.