Ignore:
Timestamp:
Oct 17, 2009, 5:06:42 PM (16 years ago)
Author:
Frederik Heber <heber@…>
Children:
aec775
Parents:
d70bf6
Message:

Renamed and rewritten CreateAdjacencyList2().

  • rename CreateAdjacencyList2() -> CreateAdjacencyListFromDbondFile()
  • initially written by Christian Neuen who was at that time not familiar with all the functions already present. The code is now shortened and tighter.

Signed-off-by: Frederik Heber <heber@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/molecule_graph.cpp

    rd70bf6 rbee48d  
    2121 * We obtain an outside file with the indices of atoms which are bondmembers.
    2222 */
    23 void molecule::CreateAdjacencyList2(ofstream *out, ifstream *input)
     23void molecule::CreateAdjacencyListFromDbondFile(ofstream *out, ifstream *input)
    2424{
    2525
    2626  // 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);
    6551};
    6652
Note: See TracChangeset for help on using the changeset viewer.