Changes in src/molecule_graph.cpp [1f1b23:e5ad5c]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/molecule_graph.cpp
r1f1b23 re5ad5c 147 147 for (LC->n[2] = 0; LC->n[2] < LC->N[2]; LC->n[2]++) { 148 148 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; 150 150 if (List != NULL) { 151 151 for (LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { 152 152 Walker = AtomMap[(*Runner)->nr]; 153 //Log() << Verbose(0) << "Current Atom is " << *Walker << "." << endl;153 // Log() << Verbose(0) << "Current Atom is " << *Walker << "." << endl; 154 154 // 3c. check for possible bond between each atom in this and every one in the 27 cells 155 155 for (n[0] = -1; n[0] <= 1; n[0]++) … … 157 157 for (n[2] = -1; n[2] <= 1; n[2]++) { 158 158 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; 160 160 if (OtherList != NULL) { 161 161 for (LinkedNodes::const_iterator OtherRunner = OtherList->begin(); OtherRunner != OtherList->end(); OtherRunner++) { 162 162 if ((*OtherRunner)->nr > Walker->nr) { 163 163 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; 165 167 (BG->*minmaxdistance)(Walker, OtherWalker, MinDistance, MaxDistance, IsAngstroem); 166 const double distance = OtherWalker->x.PeriodicDistanceSquared(&(Walker->x), cell_size);167 168 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 } 171 177 } 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; 173 179 } 174 180 } … … 926 932 break; // breaking here will not cause error! 927 933 } 928 if (i == vertex->ListOfBonds.size()) {934 if (i == vertex->ListOfBonds.size()) 929 935 eLog() << Verbose(0) << "Error: All Component entries are already occupied!" << endl; 930 performCriticalExit(); 931 } 932 } else { 936 } else 933 937 eLog() << Verbose(0) << "Error: Given vertex is NULL!" << endl; 934 performCriticalExit();935 }936 938 } 937 939 ; … … 992 994 Log() << Verbose(1) << "Saving adjacency list ... "; 993 995 if (AdjacencyFile != NULL) { 994 AdjacencyFile << "m\tn" << endl;995 996 ActOnAllAtoms(&atom::OutputAdjacency, &AdjacencyFile); 996 997 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 debugging1010 * \param *path path to file1011 * \return true - file written successfully, false - writing failed1012 */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();1026 998 Log() << Verbose(1) << "done." << endl; 1027 999 } else { … … 1147 1119 bool status = true; 1148 1120 if (ReferenceStack->IsEmpty()) { 1149 Log() << Verbose(1) << "ReferenceStack is empty!" << endl;1121 eLog() << Verbose(0) << "ReferenceStack is empty!" << endl; 1150 1122 return false; 1151 1123 }
Note:
See TracChangeset
for help on using the changeset viewer.