Changeset 17b3a5c for molecuilder/src/molecule_fragmentation.cpp
- Timestamp:
- Oct 9, 2009, 10:54:52 AM (16 years ago)
- Children:
- 3efb4a
- Parents:
- 70b7aa
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/molecule_fragmentation.cpp
r70b7aa r17b3a5c 6 6 */ 7 7 8 #include "atom.hpp" 9 #include "bond.hpp" 8 10 #include "config.hpp" 11 #include "element.hpp" 12 #include "helpers.hpp" 13 #include "lists.hpp" 9 14 #include "memoryallocator.hpp" 10 15 #include "molecule.hpp" 16 #include "periodentafel.hpp" 11 17 12 18 /************************************* Functions for class molecule *********************************/ … … 975 981 */ 976 982 977 /** Structure containing all values in power set combination generation.978 */979 struct UniqueFragments {980 config *configuration;981 atom *Root;982 Graph *Leaflet;983 KeySet *FragmentSet;984 int ANOVAOrder;985 int FragmentCounter;986 int CurrentIndex;987 double TEFactor;988 int *ShortestPathList;989 bool **UsedList;990 bond **BondsPerSPList;991 int *BondsPerSPCount;992 };993 994 983 /** From a given set of Bond sorted by Shortest Path distance, create all possible fragments of size \a SetDimension. 995 984 * -# loops over every possible combination (2^dimension of edge set) … … 1322 1311 }; 1323 1312 1324 //bool operator < (KeySet SubgraphA, KeySet SubgraphB)1325 //{1326 // return KeyCompare(SubgraphA, SubgraphB);1327 //};1328 1329 /** Checking whether KeySet is not already present in Graph, if so just adds factor.1330 * \param *out output stream for debugging1331 * \param &set KeySet to insert1332 * \param &graph Graph to insert into1333 * \param *counter pointer to unique fragment count1334 * \param factor energy factor for the fragment1335 */1336 inline void InsertFragmentIntoGraph(ofstream *out, struct UniqueFragments *Fragment)1337 {1338 GraphTestPair testGraphInsert;1339 1340 testGraphInsert = Fragment->Leaflet->insert(GraphPair (*Fragment->FragmentSet,pair<int,double>(Fragment->FragmentCounter,Fragment->TEFactor))); // store fragment number and current factor1341 if (testGraphInsert.second) {1342 *out << Verbose(2) << "KeySet " << Fragment->FragmentCounter << " successfully inserted." << endl;1343 Fragment->FragmentCounter++;1344 } else {1345 *out << Verbose(2) << "KeySet " << Fragment->FragmentCounter << " failed to insert, present fragment is " << ((*(testGraphInsert.first)).second).first << endl;1346 ((*(testGraphInsert.first)).second).second += Fragment->TEFactor; // increase the "created" counter1347 *out << Verbose(2) << "New factor is " << ((*(testGraphInsert.first)).second).second << "." << endl;1348 }1349 };1350 //void inline InsertIntoGraph(ofstream *out, KeyStack &stack, Graph &graph, int *counter, double factor)1351 //{1352 // // copy stack contents to set and call overloaded function again1353 // KeySet set;1354 // for(KeyStack::iterator runner = stack.begin(); runner != stack.begin(); runner++)1355 // set.insert((*runner));1356 // InsertIntoGraph(out, set, graph, counter, factor);1357 //};1358 1359 /** Inserts each KeySet in \a graph2 into \a graph1.1360 * \param *out output stream for debugging1361 * \param graph1 first (dest) graph1362 * \param graph2 second (source) graph1363 * \param *counter keyset counter that gets increased1364 */1365 inline void InsertGraphIntoGraph(ofstream *out, Graph &graph1, Graph &graph2, int *counter)1366 {1367 GraphTestPair testGraphInsert;1368 1369 for(Graph::iterator runner = graph2.begin(); runner != graph2.end(); runner++) {1370 testGraphInsert = graph1.insert(GraphPair ((*runner).first,pair<int,double>((*counter)++,((*runner).second).second))); // store fragment number and current factor1371 if (testGraphInsert.second) {1372 *out << Verbose(2) << "KeySet " << (*counter)-1 << " successfully inserted." << endl;1373 } else {1374 *out << Verbose(2) << "KeySet " << (*counter)-1 << " failed to insert, present fragment is " << ((*(testGraphInsert.first)).second).first << endl;1375 ((*(testGraphInsert.first)).second).second += (*runner).second.second;1376 *out << Verbose(2) << "New factor is " << (*(testGraphInsert.first)).second.second << "." << endl;1377 }1378 }1379 };1380 1381 1313 1382 1314 /** Performs BOSSANOVA decomposition at selected sites, increasing the cutoff by one at these sites.
Note:
See TracChangeset
for help on using the changeset viewer.