Changeset 07a47e


Ignore:
Timestamp:
Oct 26, 2011, 3:02:53 PM (14 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
Children:
41d023
Parents:
99b0dc
Message:

Replaced enable/disable-hydrogen by internal switch.

Files:
1 added
20 edited

Legend:

Unmodified
Added
Removed
  • configure.ac

    r99b0dc r07a47e  
    164164AC_CHECK_LIB(gsl, gsl_blas_dnrm2, , [AC_MSG_ERROR(["No working BLAS found for GSL, stopping."])])
    165165
    166 # add replacement/saturation hydrogen or not
    167 AC_ARG_ENABLE([hydrogen],AS_HELP_STRING([--enable-hydrogen],[Adding saturation hydrogen (default is yes)]),
    168               [enable_hydrogen=$enableval], [enable_hydrogen=yes])
    169 if test x"$enable_hydrogen" = xyes; then
    170   AC_DEFINE(ADDHYDROGEN,1, ["Adding saturation hydrogen"])
    171   AC_SUBST(ADDHYDROGEN)
    172 fi
    173 
    174166# use CppUnit TestRunner or not
    175167AC_ARG_ENABLE([ecut],AS_HELP_STRING([--enable-ecut],[Use ECut TestRunnerClient (default is no)]),
  • src/Actions/FragmentationAction/FragmentationAction.cpp

    r99b0dc r07a47e  
    2626#include "CodePatterns/Verbose.hpp"
    2727#include "Fragmentation/Fragmentation.hpp"
     28#include "Fragmentation/HydrogenSaturation_enum.hpp"
    2829#include "Graph/DepthFirstSearchAnalysis.hpp"
    2930#include "molecule.hpp"
     
    6364    start = clock();
    6465    if (mol->hasBondStructure()) {
    65       Fragmentation Fragmenter(mol);
     66      Fragmentation Fragmenter(mol, params.DoSaturation ? DoSaturate : DontSaturate);
    6667      Fragmenter.setOutputTypes(params.types);
    6768      ExitFlag = Fragmenter.FragmentMolecule(params.order, params.prefix, DFS);
  • src/Actions/FragmentationAction/FragmentationAction.def

    r99b0dc r07a47e  
    1313// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    1414// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    15 #define paramtypes (std::string)(double)(int)(std::vector<std::string>)
    16 #define paramtokens ("fragment-molecule")("distance")("order")("output-types")
    17 #define paramdescriptions ("prefix of each fragment file")("distance in space")("order of a discretization, dissection, ...")("type(s) of parsers that output fragment config files")
    18 #define paramdefaults (NODEFAULT)(NODEFAULT)(NODEFAULT)("pcp tremolo xyz")
    19 #define paramreferences (prefix)(distance)(order)(types)
     15#define paramtypes (std::string)(double)(int)(bool)(std::vector<std::string>)
     16#define paramtokens ("fragment-molecule")("distance")("order")("DoSaturate")("output-types")
     17#define paramdescriptions ("prefix of each fragment file")("distance in space")("order of a discretization, dissection, ...")("do saturate dangling bonds with hydrogen")("type(s) of parsers that output fragment config files")
     18#define paramdefaults (NODEFAULT)(NODEFAULT)(NODEFAULT)("1")("pcp tremolo xyz")
     19#define paramreferences (prefix)(distance)(order)(DoSaturation)(types)
    2020
    2121#undef statetypes
  • src/Actions/GraphAction/DepthFirstSearchAction.cpp

    r99b0dc r07a47e  
    2525#include "CodePatterns/Log.hpp"
    2626#include "CodePatterns/Verbose.hpp"
     27#include "Fragmentation/HydrogenSaturation_enum.hpp"
    2728#include "Graph/CyclicStructureAnalysis.hpp"
    2829#include "Graph/DepthFirstSearchAnalysis.hpp"
     
    6364      LocalBackEdgeStack = new std::deque<bond *>; // no need to have it Subgraphs->Leaf->BondCount size
    6465      DFS.PickLocalBackEdges(ListOfAtoms, LocalBackEdgeStack);
    65       CyclicStructureAnalysis CycleAnalysis;
     66      CyclicStructureAnalysis CycleAnalysis(params.DoSaturation ? DoSaturate : DontSaturate);
    6667      CycleAnalysis(LocalBackEdgeStack);
    6768      delete(LocalBackEdgeStack);
  • src/Actions/GraphAction/DepthFirstSearchAction.def

    r99b0dc r07a47e  
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    1313// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    14 #define paramtypes (double)
    15 #define paramtokens ("depth-first-search")
    16 #define paramdescriptions ("maximum distance to look for neighbors")
    17 #undef paramdefaults
    18 #define paramreferences (distance)
     14#define paramtypes (double)(bool)
     15#define paramtokens ("depth-first-search")("DoSaturate")
     16#define paramdescriptions ("maximum distance to look for neighbors")("whether to treat hydrogen special or not")
     17#define paramdefaults (NODEFAULT)("1")
     18#define paramreferences (distance)(DoSaturation)
    1919
    2020#undef statetypes
  • src/Fragmentation/BondsPerShortestPath.cpp

    r99b0dc r07a47e  
    101101 * \param _RootKeyNr index of root node
    102102 * \param RestrictedKeySet Restricted vertex set to use in context of molecule
    103  */
    104 void BondsPerShortestPath::FillSPListandLabelVertices(int _RootKeyNr, KeySet &RestrictedKeySet)
     103 * \param saturation this tells whether to treat hydrogen special or not.
     104 */
     105void BondsPerShortestPath::FillSPListandLabelVertices(int _RootKeyNr, KeySet &RestrictedKeySet, const enum HydrogenSaturation saturation)
    105106{
    106107  // Actually, we should construct a spanning tree vom the root atom and select all edges therefrom and put them into
     
    146147        OtherWalker = (*Runner)->GetOtherAtom(Walker);
    147148        if ((RestrictedKeySet.find(OtherWalker->getNr()) != RestrictedKeySet.end())
    148   #ifdef ADDHYDROGEN
    149          && (OtherWalker->getType()->getAtomicNumber() != 1)
    150   #endif
    151                                                               ) {  // skip hydrogens and restrict to fragment
     149            // skip hydrogens if desired and restrict to fragment
     150            && ((saturation == DontSaturate) || (OtherWalker->getType()->getAtomicNumber() != 1))) {
    152151          DoLog(2) && (Log() << Verbose(2) << "Current partner is " << *OtherWalker << " with nr " << OtherWalker->getNr() << " in bond " << *(*Runner) << "." << endl);
    153152          // set the label if not set (and push on root stack as well)
  • src/Fragmentation/BondsPerShortestPath.hpp

    r99b0dc r07a47e  
    1313#include <config.h>
    1414#endif
     15
     16#include "Fragmentation/HydrogenSaturation_enum.hpp"
    1517
    1618#include <list>
     
    3133  void SetSPList(atom *_Root);
    3234  void ResetSPList();
    33   void FillSPListandLabelVertices(int _RootKeyNr, KeySet &RestrictedKeySet);
     35  void FillSPListandLabelVertices(int _RootKeyNr, KeySet &RestrictedKeySet, const enum HydrogenSaturation saturation);
    3436  void OutputSPList();
    3537  int CountNumbersInBondsList();
  • src/Fragmentation/Fragmentation.cpp

    r99b0dc r07a47e  
    4545/** Constructor of class Fragmentation.
    4646 *
    47  */
    48 Fragmentation::Fragmentation(molecule *_mol) :
    49   mol(_mol)
     47 * \param _mol molecule for internal use (looking up atoms)
     48 * \param _saturation whether to treat hydrogen special and saturate dangling bonds or not
     49 */
     50Fragmentation::Fragmentation(molecule *_mol, const enum HydrogenSaturation _saturation) :
     51  mol(_mol),
     52  saturation(_saturation)
    5053{}
    5154
     
    9093
    9194  DoLog(0) && (Log() << Verbose(0) << endl);
    92 #ifdef ADDHYDROGEN
    93   DoLog(0) && (Log() << Verbose(0) << "I will treat hydrogen special and saturate dangling bonds with it." << endl);
    94 #else
    95   DoLog(0) && (Log() << Verbose(0) << "Hydrogen is treated just like the rest of the lot." << endl);
    96 #endif
     95  switch (saturation) {
     96    case DoSaturate:
     97      DoLog(0) && (Log() << Verbose(0) << "I will treat hydrogen special and saturate dangling bonds with it." << endl);
     98      break;
     99    case DontSaturate:
     100      DoLog(0) && (Log() << Verbose(0) << "Hydrogen is treated just like the rest of the lot." << endl);
     101      break;
     102    default:
     103      ASSERT(0, "Fragmentation::FragmentMolecule() - there is a saturation setting which I have no idea about.");
     104      break;
     105  }
    97106
    98107  // ++++++++++++++++++++++++++++ INITIAL STUFF: Bond structure analysis, file parsing, ... ++++++++++++++++++++++++++++++++++++++++++
     
    151160    AtomMask[mol->getAtomCount()] = true;   // last plus one entry is used as marker that we have been through this loop once already in CheckOrderAtSite()
    152161    // ===== 6b. fill RootStack for each subgraph (second adaptivity check) =====
    153     Subgraphs->next->FillRootStackForSubgraphs(RootStack, AtomMask, (FragmentCounter = 0));
     162    Subgraphs->next->FillRootStackForSubgraphs(RootStack, AtomMask, (FragmentCounter = 0), saturation);
    154163
    155164    // ===== 7. fill the bond fragment list =====
     
    359368      FragmentLowerOrdersList[RootNr][0] = new Graph;
    360369      FragmentSearch.PrepareForPowersetGeneration(1., FragmentLowerOrdersList[RootNr][0], Walker);
    361       NumMoleculesOfOrder[RootNr] = PSG(CompleteMolecule);
     370      NumMoleculesOfOrder[RootNr] = PSG(CompleteMolecule, saturation);
    362371
    363372      // output resulting number
     
    487496      DoeLog(2) && (eLog()<< Verbose(2) << "Unable to parse file, incrementing all." << endl);
    488497      for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    489     #ifdef ADDHYDROGEN
    490         if ((*iter)->getType()->getAtomicNumber() != 1) // skip hydrogen
    491     #endif
     498        if ((saturation == DontSaturate) || ((*iter)->getType()->getAtomicNumber() != 1)) // skip hydrogen
    492499        {
    493500          AtomMask[(*iter)->getNr()] = true;  // include all (non-hydrogen) atoms
     
    502509  } else { // global increase of Bond Order
    503510    for(molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    504   #ifdef ADDHYDROGEN
    505       if ((*iter)->getType()->getAtomicNumber() != 1) // skip hydrogen
    506   #endif
     511      if ((saturation == DontSaturate) || ((*iter)->getType()->getAtomicNumber() != 1)) // skip hydrogen
    507512      {
    508513        AtomMask[(*iter)->getNr()] = true;  // include all (non-hydrogen) atoms
     
    670675  atom *FatherOfRunner = NULL;
    671676
    672 #ifdef ADDHYDROGEN
    673   molecule::const_iterator runner;
    674 #endif
    675677  // we increment the iter just before skipping the hydrogen
    676678  for (molecule::const_iterator iter = Leaf->begin(); iter != Leaf->end();) {
     
    700702        } else {
    701703//          Log() << Verbose(0) << ", who has no son in this fragment molecule." << endl;
    702 #ifdef ADDHYDROGEN
    703704          //Log() << Verbose(3) << "Adding Hydrogen to " << (*iter)->Name << " and a bond in between." << endl;
    704           if(!Leaf->AddHydrogenReplacementAtom((*BondRunner), (*iter), FatherOfRunner, OtherFather, IsAngstroem))
    705             exit(1);
    706 #endif
     705          if (saturation == DoSaturate)
     706            if (!Leaf->AddHydrogenReplacementAtom((*BondRunner), (*iter), FatherOfRunner, OtherFather, IsAngstroem))
     707              exit(1);
    707708          //NumBonds[(*iter)->getNr()] += Binder->BondDegree;
    708709        }
     
    715716    }
    716717    ++iter;
    717 #ifdef ADDHYDROGEN
    718     while ((iter != Leaf->end()) && ((*iter)->getType()->getAtomicNumber() == 1)){ // skip added hydrogen
    719       iter++;
    720     }
    721 #endif
     718    if (saturation == DoSaturate) {
     719      while ((iter != Leaf->end()) && ((*iter)->getType()->getAtomicNumber() == 1)){ // skip added hydrogen
     720        iter++;
     721      }
     722    }
    722723  }
    723724};
  • src/Fragmentation/Fragmentation.hpp

    r99b0dc r07a47e  
    1818#include "Graph/DepthFirstSearchAnalysis.hpp"
    1919
     20#include "Fragmentation/HydrogenSaturation_enum.hpp"
    2021#include "Fragmentation/fragmentation_helpers.hpp"
    2122
     
    3132{
    3233public:
    33   Fragmentation(molecule *_mol);
     34  Fragmentation(molecule *_mol, const enum HydrogenSaturation _saturation);
    3435  ~Fragmentation();
    3536
     
    5859  //!> pointer to molecule that is fragmented
    5960  molecule *mol;
     61  //!> whether to saturate dangling bonds with hydrogen and hence treat hydrogen special
     62  const enum HydrogenSaturation saturation;
    6063  //!> list of parser types for which a configuration file per fragment is stored
    6164  std::vector<std::string> typelist;
  • src/Fragmentation/PowerSetGenerator.cpp

    r99b0dc r07a47e  
    172172 * with SP of 2, then those with SP of 3, then those with SP of 4 and so on.
    173173 * \param RestrictedKeySet Restricted vertex set to use in context of molecule
     174 * \param saturation whether to treat hydrogen special or not
    174175 * \return number of inserted fragments
    175176 * \note ShortestPathList in FragmentSearch structure is probably due to NumberOfAtomsSPLevel and SP not needed anymore
    176177 */
    177 int PowerSetGenerator::operator()(KeySet &RestrictedKeySet)
     178int PowerSetGenerator::operator()(KeySet &RestrictedKeySet, const enum HydrogenSaturation saturation)
    178179{
    179180  int Counter = FragmentSearch->FragmentCounter; // mark current value of counter
     
    185186
    186187  // do a BFS search to fill the SP lists and label the found vertices
    187   BondsPerSPList.FillSPListandLabelVertices(FragmentSearch->getRoot()->GetTrueFather()->getNr(), RestrictedKeySet);
     188  BondsPerSPList.FillSPListandLabelVertices(FragmentSearch->getRoot()->GetTrueFather()->getNr(), RestrictedKeySet, saturation);
    188189
    189190  // outputting all list for debugging
  • src/Fragmentation/PowerSetGenerator.hpp

    r99b0dc r07a47e  
    1818
    1919#include "Fragmentation/BondsPerShortestPath.hpp"
     20#include "Fragmentation/HydrogenSaturation_enum.hpp"
    2021
    2122class bond;
     
    2930
    3031  void SPFragmentGenerator(int RootDistance, std::vector<bond *> &BondsSet, int SetDimension, int SubOrder);
    31   int operator()(KeySet &RestrictedKeySet);
     32  int operator()(KeySet &RestrictedKeySet, const enum HydrogenSaturation saturation);
    3233  void RemoveAllTouchedFromSnakeStack(int verbosity, KeySet *FragmentSet, int *&TouchedList, int &TouchedIndex);
    3334  int FillBondsList(std::vector<bond *> &BondsList, std::list<bond *>::const_iterator SetFirst, std::list<bond *>::const_iterator SetLast, int *&TouchedList, int TouchedIndex);
  • src/Graph/BreadthFirstSearchAdd.cpp

    r99b0dc r07a47e  
    3232
    3333
    34 BreadthFirstSearchAdd::BreadthFirstSearchAdd(atom *&_Root, int _BondOrder, bool _IsAngstroem) :
     34BreadthFirstSearchAdd::BreadthFirstSearchAdd(atom *&_Root, int _BondOrder, bool _IsAngstroem, const enum HydrogenSaturation _saturation) :
    3535  BondOrder(_BondOrder),
    3636  Root(_Root),
     37  saturation(_saturation),
    3738  IsAngstroem(_IsAngstroem)
    3839{
     
    100101        AddedBondList[Binder] = Mol->CopyBond(AddedAtomList[Walker->getNr()], AddedAtomList[OtherAtom->getNr()], Binder);
    101102      } else {
    102 #ifdef ADDHYDROGEN
    103         if (!Mol->AddHydrogenReplacementAtom(Binder, AddedAtomList[Walker->getNr()], Walker, OtherAtom, IsAngstroem))
    104         exit(1);
    105 #endif
     103        if (saturation == DoSaturate)
     104          if (!Mol->AddHydrogenReplacementAtom(Binder, AddedAtomList[Walker->getNr()], Walker, OtherAtom, IsAngstroem))
     105            exit(1);
    106106      }
    107107    }
     
    118118      AddedBondList[Binder] = Mol->CopyBond(AddedAtomList[Walker->getNr()], AddedAtomList[OtherAtom->getNr()], Binder);
    119119    } else { // if it's root bond it has to broken (otherwise we would not create the fragments)
    120 #ifdef ADDHYDROGEN
    121       if(!Mol->AddHydrogenReplacementAtom(Binder, AddedAtomList[Walker->getNr()], Walker, OtherAtom, IsAngstroem))
    122       exit(1);
    123 #endif
     120      if (saturation == DoSaturate)
     121        if(!Mol->AddHydrogenReplacementAtom(Binder, AddedAtomList[Walker->getNr()], Walker, OtherAtom, IsAngstroem))
     122          exit(1);
    124123    }
    125124  }
  • src/Graph/BreadthFirstSearchAdd.hpp

    r99b0dc r07a47e  
    1818
    1919#include "Bond/GraphEdge.hpp"
     20#include "Fragmentation/HydrogenSaturation_enum.hpp"
    2021#include "Helpers/defs.hpp"
    2122#include "types.hpp"
     
    2829{
    2930public:
    30   BreadthFirstSearchAdd(atom *&_Root, int _BondOrder, bool _IsAngstroem);
     31  BreadthFirstSearchAdd(atom *&_Root, int _BondOrder, bool _IsAngstroem, const enum HydrogenSaturation _saturation);
    3132  ~BreadthFirstSearchAdd();
    3233
     
    7172  std::map<bond *, bond *> AddedBondList; //!< maps from father bond to son
    7273
     74  //!> whether to treat hydrogen special or not
     75  const enum HydrogenSaturation saturation;
     76
     77  //!> is angstroem our unit of length
    7378  bool IsAngstroem;
    7479};
  • src/Graph/CyclicStructureAnalysis.cpp

    r99b0dc r07a47e  
    3131#include "molecule.hpp"
    3232
    33 CyclicStructureAnalysis::CyclicStructureAnalysis()
     33CyclicStructureAnalysis::CyclicStructureAnalysis(const enum HydrogenSaturation _saturation) :
     34  saturation(_saturation)
    3435{}
    3536
     
    101102      if ((*Runner) != BackEdge) { // only walk along DFS spanning tree (otherwise we always find SP of one being backedge Binder)
    102103        OtherAtom = (*Runner)->GetOtherAtom(Walker);
    103 #ifdef ADDHYDROGEN
    104         if (OtherAtom->getType()->getAtomicNumber() != 1) {
    105 #endif
    106         LOG(2, "INFO: Current OtherAtom is: " << OtherAtom->getName() << " for bond " << *(*Runner) << "." << endl);
    107         if (ColorList[OtherAtom->getNr()] == GraphEdge::white) {
    108           TouchedStack.push_front(OtherAtom);
    109           ColorList[OtherAtom->getNr()] = GraphEdge::lightgray;
    110           PredecessorList[OtherAtom->getNr()] = Walker; // Walker is the predecessor
    111           ShortestPathList[OtherAtom->getNr()] = ShortestPathList[Walker->getNr()] + 1;
    112           LOG(2, "INFO: Coloring OtherAtom " << OtherAtom->getName() << " lightgray, its predecessor is " << Walker->getName() << " and its Shortest Path is " << ShortestPathList[OtherAtom->getNr()] << " egde(s) long." << endl);
    113           //if (ShortestPathList[OtherAtom->getNr()] < MinimumRingSize[Walker->GetTrueFather()->getNr()]) { // Check for maximum distance
    114           LOG(3, "ACCEPT: Putting OtherAtom into queue." << endl);
    115           BFSStack.push_front(OtherAtom);
    116           //}
     104        if ((saturation == DontSaturate) || (OtherAtom->getType()->getAtomicNumber() != 1)) {
     105          LOG(2, "INFO: Current OtherAtom is: " << OtherAtom->getName() << " for bond " << *(*Runner) << "." << endl);
     106          if (ColorList[OtherAtom->getNr()] == GraphEdge::white) {
     107            TouchedStack.push_front(OtherAtom);
     108            ColorList[OtherAtom->getNr()] = GraphEdge::lightgray;
     109            PredecessorList[OtherAtom->getNr()] = Walker; // Walker is the predecessor
     110            ShortestPathList[OtherAtom->getNr()] = ShortestPathList[Walker->getNr()] + 1;
     111            LOG(2, "INFO: Coloring OtherAtom " << OtherAtom->getName() << " lightgray, its predecessor is " << Walker->getName() << " and its Shortest Path is " << ShortestPathList[OtherAtom->getNr()] << " egde(s) long." << endl);
     112            //if (ShortestPathList[OtherAtom->getNr()] < MinimumRingSize[Walker->GetTrueFather()->getNr()]) { // Check for maximum distance
     113            LOG(3, "ACCEPT: Putting OtherAtom into queue." << endl);
     114            BFSStack.push_front(OtherAtom);
     115            //}
     116          } else {
     117            LOG(3, "REJECT: Not Adding, has already been visited." << endl);
     118          }
     119          if (OtherAtom == Root)
     120            break;
    117121        } else {
    118           LOG(3, "REJECT: Not Adding, has already been visited." << endl);
     122          LOG(2, "INFO: Skipping hydrogen atom " << *OtherAtom << "." << endl);
     123          ColorList[OtherAtom->getNr()] = GraphEdge::black;
    119124        }
    120         if (OtherAtom == Root)
    121           break;
    122 #ifdef ADDHYDROGEN
    123       } else {
    124         LOG(2, "INFO: Skipping hydrogen atom " << *OtherAtom << "." << endl);
    125         ColorList[OtherAtom->getNr()] = GraphEdge::black;
    126       }
    127 #endif
    128125      } else {
    129126        LOG(2, "REJECT: Bond " << *(*Runner) << " not Visiting, is the back edge." << endl);
  • src/Graph/CyclicStructureAnalysis.hpp

    r99b0dc r07a47e  
    1818
    1919#include "Bond/GraphEdge.hpp"
     20#include "Fragmentation/HydrogenSaturation_enum.hpp"
    2021#include "Helpers/defs.hpp"
    2122#include "types.hpp"
     
    2829{
    2930public:
    30   CyclicStructureAnalysis();
     31  explicit CyclicStructureAnalysis(const enum HydrogenSaturation _saturation);
    3132  ~CyclicStructureAnalysis();
    3233
     
    5859  atom *Root;
    5960
     61  //!> whether to treat hydrogen special or not
     62  const enum HydrogenSaturation saturation;
     63
    6064  bool BackStepping;
    6165  int CurrentGraphNr;
  • src/MoleculeLeafClass.cpp

    r99b0dc r07a47e  
    105105 * \param *AtomMask defines true/false per global Atom::Nr to mask in/out each nuclear site
    106106 * \param &FragmentCounter counts through the fragments in this MoleculeLeafClass
     107 * \param saturation whether to treat hydrogen special or not
    107108 * \return true - stack is non-empty, fragmentation necessary, false - stack is empty, no more sites to update
    108109 */
    109 bool MoleculeLeafClass::FillRootStackForSubgraphs(KeyStack *&RootStack, bool *AtomMask, int &FragmentCounter)
     110bool MoleculeLeafClass::FillRootStackForSubgraphs(KeyStack *&RootStack, bool *AtomMask, int &FragmentCounter, const enum HydrogenSaturation saturation)
    110111{
    111112  atom *Father = NULL;
     
    118119        Father = (*iter)->GetTrueFather();
    119120        if (AtomMask[Father->getNr()]) // apply mask
    120 #ifdef ADDHYDROGEN
    121           if ((*iter)->getType()->getAtomicNumber() != 1) // skip hydrogen
    122 #endif
    123           RootStack[FragmentCounter].push_front((*iter)->getNr());
     121          if ((saturation == DontSaturate) || ((*iter)->getType()->getAtomicNumber() != 1)) // skip hydrogen
     122            RootStack[FragmentCounter].push_front((*iter)->getNr());
    124123      }
    125124      if (next != NULL)
    126         next->FillRootStackForSubgraphs(RootStack, AtomMask, ++FragmentCounter);
     125        next->FillRootStackForSubgraphs(RootStack, AtomMask, ++FragmentCounter, saturation);
    127126    } else {
    128127      DoLog(1) && (Log() << Verbose(1) << "Rootstack[" << FragmentCounter << "] is NULL." << endl);
  • src/MoleculeLeafClass.hpp

    r99b0dc r07a47e  
    1414
    1515#include "Fragmentation/fragmentation_helpers.hpp"
     16#include "Fragmentation/HydrogenSaturation_enum.hpp"
    1617
    1718class atom;
     
    3738
    3839  bool AddLeaf(molecule *ptr, MoleculeLeafClass *Previous);
    39   bool FillRootStackForSubgraphs(KeyStack *&RootStack, bool *AtomMask, int &FragmentCounter);
     40  bool FillRootStackForSubgraphs(KeyStack *&RootStack, bool *AtomMask, int &FragmentCounter, const enum HydrogenSaturation saturation);
    4041  bool AssignKeySetsToFragment(molecule *reference, Graph *KeySetList, atom ***&ListOfLocalAtoms, Graph **&FragmentList, int &FragmentCounter, bool FreeList = false);
    4142  void TranslateIndicesToGlobalIDs(Graph **FragmentList, int &FragmentCounter, int &TotalNumberOfKeySets, Graph &TotalGraph);
  • src/molecule.hpp

    r99b0dc r07a47e  
    2727#include "CodePatterns/ObservedIterator.hpp"
    2828#include "CodePatterns/Cacheable.hpp"
     29#include "Fragmentation/HydrogenSaturation_enum.hpp"
    2930#include "Helpers/defs.hpp"
    3031#include "Formula.hpp"
     
    186187  void Align(Vector *n);
    187188  void Scale(const double ** const factor);
    188   void DeterminePeriodicCenter(Vector &center);
     189  void DeterminePeriodicCenter(Vector &center, const enum HydrogenSaturation _saturation = DoSaturate);
    189190  Vector * DetermineCenterOfGravity() const;
    190191  Vector * DetermineCenterOfAll() const;
  • src/molecule_geometry.cpp

    r99b0dc r07a47e  
    363363/** Determines center of molecule (yet not considering atom masses).
    364364 * \param center reference to return vector
    365  */
    366 void molecule::DeterminePeriodicCenter(Vector &center)
     365 * \param saturation whether to treat hydrogen special or not
     366 */
     367void molecule::DeterminePeriodicCenter(Vector &center, const enum HydrogenSaturation saturation)
    367368{
    368369  const RealSpaceMatrix &matrix = World::getInstance().getDomain().getM();
     
    378379    flag = true;
    379380    for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    380 #ifdef ADDHYDROGEN
    381       if ((*iter)->getType()->getAtomicNumber() != 1) {
    382 #endif
     381      if ((saturation == DontSaturate) || ((*iter)->getType()->getAtomicNumber() != 1)) {
    383382        Testvector = inversematrix * (*iter)->getPosition();
    384383        Translationvector.Zero();
     
    406405        Center += Testvector;
    407406        Log() << Verbose(1) << "vector is: " << Testvector << endl;
    408 #ifdef ADDHYDROGEN
    409         // now also change all hydrogens
    410         for (BondList::const_iterator Runner = ListOfBonds.begin();
    411             Runner != ListOfBonds.end();
    412             ++Runner) {
    413           if ((*Runner)->GetOtherAtom((*iter))->getType()->getAtomicNumber() == 1) {
    414             Testvector = inversematrix * (*Runner)->GetOtherAtom((*iter))->getPosition();
    415             Testvector += Translationvector;
    416             Testvector *= matrix;
    417             Center += Testvector;
    418             Log() << Verbose(1) << "Hydrogen vector is: " << Testvector << endl;
     407        if (saturation == DoSaturate) {
     408          // now also change all hydrogens
     409          for (BondList::const_iterator Runner = ListOfBonds.begin();
     410              Runner != ListOfBonds.end();
     411              ++Runner) {
     412            if ((*Runner)->GetOtherAtom((*iter))->getType()->getAtomicNumber() == 1) {
     413              Testvector = inversematrix * (*Runner)->GetOtherAtom((*iter))->getPosition();
     414              Testvector += Translationvector;
     415              Testvector *= matrix;
     416              Center += Testvector;
     417              Log() << Verbose(1) << "Hydrogen vector is: " << Testvector << endl;
     418            }
    419419          }
    420420        }
    421421      }
    422 #endif
    423422    }
    424423  } while (!flag);
  • src/moleculelist.cpp

    r99b0dc r07a47e  
    521521  ofstream outputFragment;
    522522  std::string FragmentName;
    523   char PathBackup[MAXSTRINGSIZE];
    524523  bool result = true;
    525524  bool intermediateResult = true;
    526525  Vector BoxDimension;
    527526  char *FragmentNumber = NULL;
    528   char *path = NULL;
    529527  int FragmentCounter = 0;
    530528  ofstream output;
Note: See TracChangeset for help on using the changeset viewer.