Changeset 0b05147


Ignore:
Timestamp:
May 9, 2008, 2:38:27 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:
98b1d2
Parents:
fc850d
Message:

CyclicStructureAnalysis(): forget to check whether we actually have found rings or not (only then MinimumRingSize needs to be checked for non-set neighbours also)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/molecules.cpp

    rfc850d r0b05147  
    17351735    }
    17361736  }
    1737   // go over all atoms
    1738   Root = start;
    1739   while(Root->next != end) {
    1740     Root = Root->next;
     1737  if (MinRingSize != -1) {
     1738    // go over all atoms
     1739    Root = start;
     1740    while(Root->next != end) {
     1741      Root = Root->next;
     1742     
     1743      if (MinimumRingSize[Root->GetTrueFather()->nr] == AtomCount) { // check whether MinimumRingSize is set, if not BFS to next where it is
     1744        ShortestPathList[Walker->nr] = 0;
     1745        BFSStack->ClearStack();  // start with empty BFS stack
     1746        BFSStack->Push(Walker);
     1747        TouchedStack->Push(Walker);
     1748        //*out << Verbose(1) << "---------------------------------------------------------------------------------------------------------" << endl;
     1749        OtherAtom = Walker;
     1750        while ((Walker != Root) && (OtherAtom != NULL)) {  // look for Root
     1751          Walker = BFSStack->PopFirst();
     1752          //*out << Verbose(2) << "Current Walker is " << *Walker << ", we look for SP to Root " << *Root << "." << endl;
     1753          for(int i=0;i<NumberOfBondsPerAtom[Walker->nr];i++) {
     1754            Binder = ListOfBondsPerAtom[Walker->nr][i];
     1755            if (Binder != BackEdge) { // only walk along DFS spanning tree (otherwise we always find SP of one being backedge Binder)
     1756              OtherAtom = Binder->GetOtherAtom(Walker);
     1757              //*out << Verbose(2) << "Current OtherAtom is: " << OtherAtom->Name << " for bond " << *Binder << "." << endl;
     1758              if (ColorList[OtherAtom->nr] == white) {
     1759                TouchedStack->Push(OtherAtom);
     1760                ColorList[OtherAtom->nr] = lightgray;
     1761                PredecessorList[OtherAtom->nr] = Walker;  // Walker is the predecessor
     1762                ShortestPathList[OtherAtom->nr] = ShortestPathList[Walker->nr]+1;
     1763                //*out << Verbose(2) << "Coloring OtherAtom " << OtherAtom->Name << " lightgray, its predecessor is " << Walker->Name << " and its Shortest Path is " << ShortestPathList[OtherAtom->nr] << " egde(s) long." << endl;
     1764                if (MinimumRingSize[OtherAtom->GetTrueFather()->nr] != AtomCount) { // if the other atom is connected to a ring
     1765                  MinimumRingSize[Root->GetTrueFather()->nr] = ShortestPathList[OtherAtom->nr]+MinimumRingSize[OtherAtom->GetTrueFather()->nr];
     1766                  OtherAtom = NULL; //break;
     1767                  break;
     1768                } else
     1769                  BFSStack->Push(OtherAtom);
     1770              } else {
     1771                //*out << Verbose(3) << "Not Adding, has already been visited." << endl;
     1772              }
     1773            } else {
     1774              //*out << Verbose(3) << "Not Visiting, is a back edge." << endl;
     1775            }
     1776          }
     1777          ColorList[Walker->nr] = black;
     1778          //*out << Verbose(1) << "Coloring Walker " << Walker->Name << " black." << endl;
     1779        }
    17411780   
    1742     if (MinimumRingSize[Root->GetTrueFather()->nr] == AtomCount) { // check whether MinimumRingSize is set, if not BFS to next where it is
    1743       ShortestPathList[Walker->nr] = 0;
    1744       BFSStack->ClearStack();  // start with empty BFS stack
    1745       BFSStack->Push(Walker);
    1746       TouchedStack->Push(Walker);
    1747       //*out << Verbose(1) << "---------------------------------------------------------------------------------------------------------" << endl;
    1748       OtherAtom = Walker;
    1749       while ((Walker != Root) && (OtherAtom != NULL)) {  // look for Root
    1750         Walker = BFSStack->PopFirst();
    1751         //*out << Verbose(2) << "Current Walker is " << *Walker << ", we look for SP to Root " << *Root << "." << endl;
    1752         for(int i=0;i<NumberOfBondsPerAtom[Walker->nr];i++) {
    1753           Binder = ListOfBondsPerAtom[Walker->nr][i];
    1754           if (Binder != BackEdge) { // only walk along DFS spanning tree (otherwise we always find SP of one being backedge Binder)
    1755             OtherAtom = Binder->GetOtherAtom(Walker);
    1756             //*out << Verbose(2) << "Current OtherAtom is: " << OtherAtom->Name << " for bond " << *Binder << "." << endl;
    1757             if (ColorList[OtherAtom->nr] == white) {
    1758               TouchedStack->Push(OtherAtom);
    1759               ColorList[OtherAtom->nr] = lightgray;
    1760               PredecessorList[OtherAtom->nr] = Walker;  // Walker is the predecessor
    1761               ShortestPathList[OtherAtom->nr] = ShortestPathList[Walker->nr]+1;
    1762               //*out << Verbose(2) << "Coloring OtherAtom " << OtherAtom->Name << " lightgray, its predecessor is " << Walker->Name << " and its Shortest Path is " << ShortestPathList[OtherAtom->nr] << " egde(s) long." << endl;
    1763               if (MinimumRingSize[OtherAtom->GetTrueFather()->nr] != AtomCount) { // if the other atom is connected to a ring
    1764                 MinimumRingSize[Root->GetTrueFather()->nr] = ShortestPathList[OtherAtom->nr]+MinimumRingSize[OtherAtom->GetTrueFather()->nr];
    1765                 OtherAtom = NULL; //break;
    1766                 break;
    1767               } else
    1768                 BFSStack->Push(OtherAtom);
    1769             } else {
    1770               //*out << Verbose(3) << "Not Adding, has already been visited." << endl;
    1771             }
    1772           } else {
    1773             //*out << Verbose(3) << "Not Visiting, is a back edge." << endl;
    1774           }
     1781        // now clean the lists
     1782        while (!TouchedStack->IsEmpty()){
     1783          Walker = TouchedStack->PopFirst();
     1784          PredecessorList[Walker->nr] = NULL;
     1785          ShortestPathList[Walker->nr] = -1;
     1786          ColorList[Walker->nr] = white;
    17751787        }
    1776         ColorList[Walker->nr] = black;
    1777         //*out << Verbose(1) << "Coloring Walker " << Walker->Name << " black." << endl;
    1778       }
    1779 
    1780       // now clean the lists
    1781       while (!TouchedStack->IsEmpty()){
    1782         Walker = TouchedStack->PopFirst();
    1783         PredecessorList[Walker->nr] = NULL;
    1784         ShortestPathList[Walker->nr] = -1;
    1785         ColorList[Walker->nr] = white;
    1786       }
    1787     }
    1788     *out << Verbose(1) << "Minimum ring size of " << *Root << " is " << MinimumRingSize[Root->GetTrueFather()->nr] << "." << endl;
    1789   }
    1790  
    1791        
    1792   if (MinRingSize != -1)
     1788      }
     1789      *out << Verbose(1) << "Minimum ring size of " << *Root << " is " << MinimumRingSize[Root->GetTrueFather()->nr] << "." << endl;
     1790    }
    17931791    *out << Verbose(1) << "Minimum ring size is " << MinRingSize << ", over " << NumCycles << " cycles total." << endl;
    1794   else
     1792  } else
    17951793    *out << Verbose(1) << "No rings were detected in the molecular structure." << endl;
    17961794
Note: See TracChangeset for help on using the changeset viewer.