Changeset d88597 for molecuilder
- Timestamp:
 - May 8, 2008, 3:52:11 PM (18 years ago)
 - Children:
 - 461e93
 - Parents:
 - 2b79c3
 - Location:
 - molecuilder/src
 - Files:
 - 
      
- 3 edited
 
- 
          
  moleculelist.cpp (modified) (1 diff)
 - 
          
  molecules.cpp (modified) (4 diffs)
 - 
          
  molecules.hpp (modified) (1 diff)
 
 
Legend:
- Unmodified
 - Added
 - Removed
 
- 
      
molecuilder/src/moleculelist.cpp
r2b79c3 rd88597 503 503 if (FragmentList == NULL) { 504 504 KeySetCounter = Count(); 505 FragmentList = (Graph **) Malloc(sizeof(Graph *)*KeySetCounter, " molecule::FragmentMolecule - **BondFragments");505 FragmentList = (Graph **) Malloc(sizeof(Graph *)*KeySetCounter, "MoleculeLeafClass::AssignKeySetsToFragment - **FragmentList"); 506 506 for(int i=0;i<KeySetCounter;i++) 507 507 FragmentList[i] = NULL;  - 
      
molecuilder/src/molecules.cpp
r2b79c3 rd88597 2161 2161 }; 2162 2162 2163 /** Create a SortIndex to map from BFS labels to the sequence in which the atoms are given in the config file. 2164 * \param *out output stream for debugging 2165 * \param *&SortIndex Mapping array of size molecule::AtomCount 2166 * \return true - success, false - failure of SortIndex alloc 2167 */ 2168 bool molecule::CreateMappingLabelsToConfigSequence(ofstream *out, int *&SortIndex) 2169 { 2170 element *runner = elemente->start; 2171 int AtomNo = 0; 2172 atom *Walker = NULL; 2173 2174 if (SortIndex != NULL) { 2175 *out << Verbose(1) << "SortIndex is " << SortIndex << " and not NULL as expected." << endl; 2176 return false; 2177 } 2178 SortIndex = (int *) Malloc(sizeof(int)*AtomCount, "molecule::FragmentMolecule: *SortIndex"); 2179 for(int i=0;i<AtomCount;i++) 2180 SortIndex[i] = -1; 2181 while (runner->next != elemente->end) { // go through every element 2182 runner = runner->next; 2183 if (ElementsInMolecule[runner->Z]) { // if this element got atoms 2184 Walker = start; 2185 while (Walker->next != end) { // go through every atom of this element 2186 Walker = Walker->next; 2187 if (Walker->type->Z == runner->Z) // if this atom fits to element 2188 SortIndex[Walker->nr] = AtomNo++; 2189 } 2190 } 2191 } 2192 return true; 2193 }; 2194 2163 2195 /** Performs a many-body bond order analysis for a given bond order. 2164 2196 * -# parses adjacency, keysets and orderatsite files … … 2181 2213 { 2182 2214 MoleculeListClass *BondFragments = NULL; 2183 atom *Walker = NULL;2184 2215 int *SortIndex = NULL; 2185 element *runner = NULL;2186 int AtomNo;2187 2216 int MinimumRingSize; 2188 2217 int FragmentCounter; … … 2302 2331 // ===== 9. Save fragments' configuration and keyset files et al to disk === 2303 2332 if (BondFragments->NumberOfMolecules != 0) { 2304 // create a SortIndex to map from BFS labels to the sequence in which the atoms are given in the config file 2305 SortIndex = (int *) Malloc(sizeof(int)*AtomCount, "molecule::FragmentMolecule: *SortIndex"); 2306 for(int i=0;i<AtomCount;i++) 2307 SortIndex[i] = -1; 2308 runner = elemente->start; 2309 AtomNo = 0; 2310 while (runner->next != elemente->end) { // go through every element 2311 runner = runner->next; 2312 if (ElementsInMolecule[runner->Z]) { // if this element got atoms 2313 Walker = start; 2314 while (Walker->next != end) { // go through every atom of this element 2315 Walker = Walker->next; 2316 if (Walker->type->Z == runner->Z) // if this atom fits to element 2317 SortIndex[Walker->nr] = AtomNo++; 2318 } 2319 } 2320 } 2333 // create the SortIndex from BFS labels to order in the config file 2334 CreateMappingLabelsToConfigSequence(out, SortIndex); 2335 2321 2336 *out << Verbose(1) << "Writing " << BondFragments->NumberOfMolecules << " possible bond fragmentation configs" << endl; 2322 2337 if (BondFragments->OutputConfigForListOfFragments(out, configuration, SortIndex)) … … 2343 2358 *out << Verbose(1) << "Freeing bond memory" << endl; 2344 2359 delete(FragmentList); // remove bond molecule from memory 2345 FragmentList = NULL;2346 2360 Free((void **)&SortIndex, "molecule::FragmentMolecule: *SortIndex"); 2347 2361 } else  - 
      
molecuilder/src/molecules.hpp
r2b79c3 rd88597 348 348 bool StoreKeySetFile(ofstream *out, Graph &KeySetList, char *path); 349 349 bool StoreForcesFile(ofstream *out, MoleculeListClass *BondFragments, char *path, int *SortIndex); 350 bool CreateMappingLabelsToConfigSequence(ofstream *out, int *&SortIndex); 350 351 bool ScanBufferIntoKeySet(ofstream *out, char *buffer, KeySet &CurrentSet); 351 352 void BreadthFirstSearchAdd(ofstream *out, molecule *Mol, atom **&AddedAtomList, bond **&AddedBondList, atom *Root, bond *Bond, int BondOrder, bool IsAngstroem);  
  Note:
 See   TracChangeset
 for help on using the changeset viewer.
  