/* * Project: MoleCuilder * Description: creates and alters molecular systems * Copyright (C) 2010-2011 University of Bonn. All rights reserved. * Please see the LICENSE file or "Copyright notice" in builder.cpp for details. */ /* * fragmentation_helpers.cpp * * Created on: Oct 18, 2011 * Author: heber */ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include "CodePatterns/MemDebug.hpp" #include "fragmentation_helpers.hpp" #include #include "CodePatterns/Log.hpp" #include "atom.hpp" #include "Bond/bond.hpp" #include "Element/element.hpp" #include "Fragmentation/AdaptivityMap.hpp" #include "Fragmentation/Graph.hpp" #include "Fragmentation/KeySet.hpp" #include "Helpers/defs.hpp" #include "Helpers/helpers.hpp" #include "molecule.hpp" using namespace std; /** print atom mask for debugging. * \param *out output stream for debugging * \param *AtomMask defines true/false per global Atom::Nr to mask in/out each nuclear site, used to activate given number of site to increment order adaptively * \param AtomCount number of entries in \a *AtomMask */ void PrintAtomMask(bool *AtomMask, int AtomCount) { std::stringstream output; output << " "; for(int i=0;isize(); } StartNr = RootStack.back(); do { RootKeyNr = RootStack.front(); RootStack.pop_front(); Walker = mol->FindAtom(RootKeyNr); NumLevels = 1 << (Walker->AdaptiveOrder - 1); for(int i=0;igetNr()); RootNr++; } while (RootKeyNr != StartNr); return counter; }; /** Free's memory allocated for all KeySets from all orders. * \param *out output stream for debugging * \param ***FragmentLowerOrdersList * \param &RootStack stack with all root candidates (unequal to each atom in complete molecule if adaptive scheme is applied) * \param *mol molecule with atoms and bonds */ void FreeAllOrdersList(Graph ***FragmentLowerOrdersList, KeyStack &RootStack, molecule *mol) { LOG(1, "Free'ing the lists of all orders per order."); int RootNr = 0; int RootKeyNr = 0; int NumLevels = 0; atom *Walker = NULL; while (!RootStack.empty()) { RootKeyNr = RootStack.front(); RootStack.pop_front(); Walker = mol->FindAtom(RootKeyNr); NumLevels = 1 << (Walker->AdaptiveOrder - 1); for(int i=0;i