Changeset 958457 for src


Ignore:
Timestamp:
Jul 28, 2008, 1:45:43 PM (17 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:
b61043
Parents:
390248
Message:

CheckOrderAtSite: BUGFIX - Added MinimumRingSize to parameter list, as otherwise infinite loop

If FragmentBOSSANOVA checks for remaining below MinimumRingSize per atom, CheckOrderAtSite however does not and fills AtomMask with values for atoms not to be included, we end up with an endless loop. Hence, MinimumRingSize is given as an additional parameter and CheckOrderAtSite checks for it for adaptive and for global increase (for stepwise we don't have the loop problem and FragmentBOSSANOVA will do the right thing).

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/molecules.cpp

    r390248 r958457  
    23672367};
    23682368
    2369 /** Checks whether the OrderAtSite is still bewloe \a Order at some site.
     2369/** Checks whether the OrderAtSite is still below \a Order at some site.
    23702370 * \param *out output stream for debugging
    23712371 * \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
    23722372 * \param *GlobalKeySetList list of keysets with global ids (valid in "this" molecule) needed for adaptive increase
    23732373 * \param Order desired Order if positive, desired exponent in threshold criteria if negative (0 is single-step)
     2374 * \param *MinimumRingSize array of max. possible order to avoid loops
    23742375 * \param *path path to ENERGYPERFRAGMENT file (may be NULL if Order is non-negative)
    23752376 * \return true - needs further fragmentation, false - does not need fragmentation
    23762377 */
    2377 bool molecule::CheckOrderAtSite(ofstream *out, bool *AtomMask, Graph *GlobalKeySetList, int Order, char *path)
     2378bool molecule::CheckOrderAtSite(ofstream *out, bool *AtomMask, Graph *GlobalKeySetList, int Order, int *MinimumRingSize, char *path)
    23782379{
    23792380  atom *Walker = start;
     
    24662467      for(map<double, pair<int,int> >::iterator runner = FinalRootCandidates.upper_bound(pow(10.,Order)); runner != FinalRootCandidates.end(); runner++) {
    24672468        No = (*runner).second.first;
    2468         *out << Verbose(2) << "Root " << No << " is still above threshold (10^{" << Order <<"}: " << runner->first << ", setting entry " << No << " of Atom mask to true." << endl;
    2469         AtomMask[No] = true;
    2470         status = true;
     2469        Walker = FindAtom(No);
     2470        if (Walker->AdaptiveOrder < MinimumRingSize[Walker->nr]) {
     2471          *out << Verbose(2) << "Root " << No << " is still above threshold (10^{" << Order <<"}: " << runner->first << ", setting entry " << No << " of Atom mask to true." << endl;
     2472          AtomMask[No] = true;
     2473          status = true;
     2474        } else
     2475          *out << Verbose(2) << "Root " << No << " is still above threshold (10^{" << Order <<"}: " << runner->first << ", however MinimumRingSize of " << MinimumRingSize[Walker->nr] << " does not allow further adaptive increase." << endl;
    24712476      }
    24722477      // close and done
     
    24962501      {
    24972502        AtomMask[Walker->nr] = true;  // include all (non-hydrogen) atoms
    2498         if ((Order != 0) && (Walker->AdaptiveOrder < Order))
     2503        if ((Order != 0) && (Walker->AdaptiveOrder < Order) && (Walker->AdaptiveOrder < MinimumRingSize[Walker->nr]))
    24992504          status = true;
    25002505      }
     
    26242629  KeyStack *RootStack = new KeyStack[Subgraphs->next->Count()];
    26252630  AtomMask = new bool[AtomCount+1];
    2626   while (CheckOrderAtSite(out, AtomMask, ParsedFragmentList, Order, configuration->configpath)) {
     2631  while (CheckOrderAtSite(out, AtomMask, ParsedFragmentList, Order, MinimumRingSize, configuration->configpath)) {
    26272632    AtomMask[AtomCount] = true;   // last plus one entry is used as marker that we have been through this loop once already in CheckOrderAtSite()
    26282633    // ===== 6b. fill RootStack for each subgraph (second adaptivity check) =====
     
    39743979  // with the order along the cells as this: 5433222211111111 for BondOrder 5 needing 16=pow(2,5-1) cells (only we use bit-shifting which is faster)
    39753980  RootNr = 0;   // counts through the roots in RootStack
    3976   while (RootNr < UpgradeCount) {
     3981  while ((RootNr < UpgradeCount) && (!RootStack.empty())) {
    39773982    RootKeyNr = RootStack.front();
    39783983    RootStack.pop_front();
    39793984    Walker = FindAtom(RootKeyNr);
    39803985    // check cyclic lengths
    3981     if ((MinimumRingSize[Walker->GetTrueFather()->nr] != -1) && (Walker->GetTrueFather()->AdaptiveOrder+1 >= MinimumRingSize[Walker->GetTrueFather()->nr])) {
     3986    if ((MinimumRingSize[Walker->GetTrueFather()->nr] != -1) && (Walker->GetTrueFather()->AdaptiveOrder+1 > MinimumRingSize[Walker->GetTrueFather()->nr])) {
    39823987      *out << Verbose(0) << "Bond order " << Walker->GetTrueFather()->AdaptiveOrder << " of Root " << *Walker << " greater than or equal to Minimum Ring size of " << MinimumRingSize << " found is not allowed." << endl;
    39833988    } else {
  • src/molecules.hpp

    r390248 r958457  
    242242  /// Fragment molecule by two different approaches:
    243243  void FragmentMolecule(ofstream *out, int Order, config *configuration);
    244   bool CheckOrderAtSite(ofstream *out, bool *AtomMask, Graph *GlobalKeySetList, int Order, char *path = NULL);
     244  bool CheckOrderAtSite(ofstream *out, bool *AtomMask, Graph *GlobalKeySetList, int Order, int *MinimumRingSize, char *path = NULL);
    245245  bool StoreAdjacencyToFile(ofstream *out, char *path);
    246246  bool CheckAdjacencyFileAgainstMolecule(ofstream *out, char *path, atom **ListOfAtoms);
Note: See TracChangeset for help on using the changeset viewer.