Changeset bee48d for molecuilder/src/molecule_graph.cpp
- Timestamp:
- Oct 17, 2009, 5:06:42 PM (16 years ago)
- Children:
- aec775
- Parents:
- d70bf6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/molecule_graph.cpp
rd70bf6 rbee48d 21 21 * We obtain an outside file with the indices of atoms which are bondmembers. 22 22 */ 23 void molecule::CreateAdjacencyList 2(ofstream *out, ifstream *input)23 void molecule::CreateAdjacencyListFromDbondFile(ofstream *out, ifstream *input) 24 24 { 25 25 26 26 // 1 We will parse bonds out of the dbond file created by tremolo. 27 int atom1, atom2, temp; 28 atom *Walker, *OtherWalker; 29 30 if (!input) 31 { 32 cout << Verbose(1) << "Opening silica failed \n"; 33 }; 34 35 *input >> ws >> atom1; 36 *input >> ws >> atom2; 37 cout << Verbose(1) << "Scanning file\n"; 38 while (!input->eof()) // Check whether we read everything already 39 { 40 *input >> ws >> atom1; 41 *input >> ws >> atom2; 42 if(atom2<atom1) //Sort indices of atoms in order 43 { 44 temp=atom1; 45 atom1=atom2; 46 atom2=temp; 47 }; 48 49 Walker=start; 50 while(Walker-> nr != atom1) // Find atom corresponding to first index 51 { 52 Walker = Walker->next; 53 }; 54 OtherWalker = Walker->next; 55 while(OtherWalker->nr != atom2) // Find atom corresponding to second index 56 { 57 OtherWalker= OtherWalker->next; 58 }; 59 AddBond(Walker, OtherWalker); //Add the bond between the two atoms with respective indices. 60 61 } 62 63 CreateListOfBondsPerAtom(out); 64 27 int atom1, atom2; 28 atom *Walker, *OtherWalker; 29 30 if (!input) 31 { 32 cout << Verbose(1) << "Opening silica failed \n"; 33 }; 34 35 *input >> ws >> atom1; 36 *input >> ws >> atom2; 37 cout << Verbose(1) << "Scanning file\n"; 38 while (!input->eof()) // Check whether we read everything already 39 { 40 *input >> ws >> atom1; 41 *input >> ws >> atom2; 42 43 if(atom2<atom1) //Sort indices of atoms in order 44 flip(atom1, atom2); 45 Walker=FindAtom(atom1); 46 OtherWalker=FindAtom(atom2); 47 AddBond(Walker, OtherWalker); //Add the bond between the two atoms with respective indices. 48 } 49 50 CreateListOfBondsPerAtom(out); 65 51 }; 66 52
Note:
See TracChangeset
for help on using the changeset viewer.