Ignore:
Timestamp:
Nov 3, 2009, 2:34:02 PM (16 years ago)
Author:
Frederik Heber <heber@…>
Children:
c1b4a4
Parents:
5f9f8b
git-author:
Frederik Heber <heber@…> (11/03/09 14:27:15)
git-committer:
Frederik Heber <heber@…> (11/03/09 14:34:02)
Message:

Fixing not created adjacency list, partially fixing subgraph dissection in config::Load()

  • CreateAdjacencyList() was called with zero bonddistance.
  • this was due to max_distance not being initialised in the constructor to 0 and subsequently not set if Bond Length Table was not found.
  • new function SetMaxDistanceToMaxOfCovalentRadii() which sets the max_distance to twice the max of covalent radii of all elements.
  • config::Load() - atoms in copied molecule (by DepthFirstSearchAnalysis()) are made their own father (and originals are removed).
File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/config.cpp

    r5f9f8b r08b88b  
    10511051  } else {
    10521052    cout << Verbose(0) << "Bond length table loading failed." << endl;
     1053    BG->SetMaxDistanceToMaxOfCovalentRadii((ofstream *)&cout, periode);
    10531054  }
    10541055
    10551056  // 3. parse the molecule in
    10561057  LoadMolecule(mol, FileBuffer, periode, FastParsing);
    1057   mol->ActiveFlag = true;
    1058   MolList->insert(mol);
     1058  //mol->ActiveFlag = true;
     1059  //MolList->insert(mol);
    10591060
    10601061  // 4. dissect the molecule into connected subgraphs
    10611062  BG->ConstructBondGraph((ofstream *)&cout, mol);
     1063
     1064  // 5. scan for connected subgraphs
     1065  MoleculeLeafClass *Subgraphs = NULL;      // list of subgraphs from DFS analysis
     1066  class StackClass<bond *> *BackEdgeStack = NULL;
     1067  Subgraphs = mol->DepthFirstSearchAnalysis((ofstream *)&cout, BackEdgeStack);
     1068  delete(BackEdgeStack);
     1069
     1070  // 6. dissect
     1071  atom ***ListOfLocalAtoms = NULL;
     1072  int FragmentCounter = 0;
     1073  MoleculeLeafClass *MolecularWalker = Subgraphs;
     1074  atom *Walker = NULL;
     1075  while (MolecularWalker->next != NULL) {
     1076    MolecularWalker = MolecularWalker->next;
     1077    // fill the bond structure of the individually stored subgraphs (goes through whole chained list by itself)
     1078    MolecularWalker->FillBondStructureFromReference((ofstream *)&cout, mol, FragmentCounter, ListOfLocalAtoms, false);  // we don't want to keep the created ListOfLocalAtoms
     1079    FragmentCounter++;
     1080    MolecularWalker->Leaf->ActiveFlag = true;
     1081    Walker = MolecularWalker->Leaf->start;
     1082    while (Walker->next != MolecularWalker->Leaf->end) {
     1083      Walker = Walker->next;
     1084      Walker->father = Walker;
     1085    }
     1086    MolList->insert(MolecularWalker->Leaf);
     1087    MolecularWalker->Leaf = NULL; // don't remove molecule when deleting MolecularWalker
     1088    delete(MolecularWalker->previous);
     1089  }
     1090  delete(MolecularWalker);
     1091  for (int i=0;i<FragmentCounter;i++)
     1092    Free(&ListOfLocalAtoms[i]);
     1093  Free(&ListOfLocalAtoms);
     1094  cout << Verbose(1) << "I scanned " << FragmentCounter << " molecules." << endl;
     1095
     1096  // 6. free parsed in molecule
     1097  delete(mol);
    10621098
    10631099  delete(FileBuffer);
Note: See TracChangeset for help on using the changeset viewer.