Changeset df793a for src/builder.cpp


Ignore:
Timestamp:
Oct 9, 2008, 6:27:56 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:
ad85c2
Parents:
ba4432
Message:

BUGFIXES: CyclicStructureAnalysis() now compatible to disconnected subgraphs, AssignKeySetsToFragment() and FillBondStructureFromReference() memory cleanup corrected

+ molecule::DepthFirstSearchAnalysis() now just returns BackEdgeStack, not MinimumRingSize. CyclicStructureAnalysis() is called during FragmentMolecule(), after subgraphs bonds list have been filled by FillBondStructureFromReference().
+ new function molecule::PickLocalBackEdges(), as the BackEdgeStack returned by DepthFirstSearchAnalysis() co
ntains only global bonds, not the local ones for the subgraph, we have to step through it and pick the right
ones out.
+ molecule::FragmentMolecule() now calls molecule::CyclicStructureAnalysis() separately for each subgraph, along with a BackEdgeStack filled by PickLocalBackEdges(), and allocates&initialises MinimumRingSize array. Als
o AssignKeySetsToFragment() frees the LocalListOfAtoms now (FreeList=true), now longer after the following wh
ile
+ molecule::CyclicStructureAnalysis() takes a local BackEdgeStack and analysis the subgraphs cycles, returnin
g minimum ring size
+ MoleculeLeafClass::AssignKeySetsToFragment() now frees memory for ListOfLocalAtoms when FreeList is set. BUGFIX: test of first key was testing against ..->nr != -1. However, LocalListOfAtoms was not even initialised correctly to NULL, hence ...->nr pointed in some cases to nowhere. Now it test atom* against NULL.
+ MoleculeLeafClass::FillBondStructureFromReference() now frees memory for ListOfLocalAtoms when FreeList is set correctly (only free initial pointer when FragmentCounter == 0, also it was decreased not before but after freeing, hence we free'd the wrong list). Also, father replaced by GetTrueFather() (makes the function moregenerally useable, was not a bug).
+ ParseCommandLineOptions() option 'D': adapted to changes in DepthFirstSearchAnalysis() in a similar manner
to FragmentMolecule()
+ molecule::CountCyclicBonds() adapted but does not perform CyclicStructureAnalysis()
+ molecule::CreateAdjacencyList() counts the bonds that could not be brought to covalently corrected degree (i.e. the remaining ionic atoms)
+ molecule::CreateListOfBondsPerAtom() prints atom names and number, which is helpful as name contains global

and number contains local number (helped in finding above bugs)

+ CreateFatherLookupTable(): BUGFIX: LookupTable was not initialised to NULL (see above)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/builder.cpp

    rba4432 rdf793a  
    953953                cout << Verbose(1) << "Depth-First-Search Analysis." << endl;
    954954                MoleculeLeafClass *Subgraphs = NULL;      // list of subgraphs from DFS analysis
    955                 int *MinimumRingSize = NULL;
     955                int *MinimumRingSize = new int[mol->AtomCount];
     956                atom ***ListOfLocalAtoms = NULL;
     957                int FragmentCounter = 0;
     958                class StackClass<bond *> *BackEdgeStack = NULL;
     959                class StackClass<bond *> *LocalBackEdgeStack = NULL;
    956960                mol->CreateAdjacencyList((ofstream *)&cout, atof(argv[argptr]), configuration.GetIsAngstroem());
    957961                mol->CreateListOfBondsPerAtom((ofstream *)&cout);
    958                 Subgraphs = mol->DepthFirstSearchAnalysis((ofstream *)&cout, MinimumRingSize);
    959                 delete[](MinimumRingSize);
     962                Subgraphs = mol->DepthFirstSearchAnalysis((ofstream *)&cout, BackEdgeStack);
    960963                if (Subgraphs != NULL) {
     964                  Subgraphs->next->FillBondStructureFromReference((ofstream *)&cout, mol, (FragmentCounter = 0), ListOfLocalAtoms, false);  // we want to keep the created ListOfLocalAtoms
    961965                  while (Subgraphs->next != NULL) {
    962966                    Subgraphs = Subgraphs->next;
     967                    LocalBackEdgeStack = new StackClass<bond *> (Subgraphs->Leaf->BondCount);
     968                    Subgraphs->Leaf->PickLocalBackEdges((ofstream *)&cout, ListOfLocalAtoms[FragmentCounter++], BackEdgeStack, LocalBackEdgeStack);
     969                    Subgraphs->Leaf->CyclicStructureAnalysis((ofstream *)&cout, BackEdgeStack, MinimumRingSize);
     970                    delete(LocalBackEdgeStack);
    963971                    delete(Subgraphs->previous);
    964972                  }
    965973                  delete(Subgraphs);
     974                  for (int i=0;i<FragmentCounter;i++)
     975                    Free((void **)&ListOfLocalAtoms[FragmentCounter], "ParseCommandLineOptions: **ListOfLocalAtoms[]");
     976                  Free((void **)&ListOfLocalAtoms, "ParseCommandLineOptions: ***ListOfLocalAtoms");
    966977                }
     978                delete(BackEdgeStack);
     979                delete[](MinimumRingSize);
    967980              }
    968981              argptr+=1;
     
    12551268  int Z;
    12561269  int j, axis, count, faktor;
    1257   int *MinimumRingSize = NULL;
     1270  clock_t start,end;
     1271//  int *MinimumRingSize = NULL;
    12581272  MoleculeLeafClass *Subgraphs = NULL;
    1259   clock_t start,end;
     1273//  class StackClass<bond *> *BackEdgeStack = NULL;
    12601274  element **Elements;
    12611275  Vector **vectors;
     
    14231437       
    14241438      case 'o': // create the connection matrix
    1425         cout << Verbose(0) << "What's the maximum bond distance: ";
    1426         cin >> tmp1;
    1427         start = clock();
    1428         mol->CreateAdjacencyList((ofstream *)&cout, tmp1, configuration.GetIsAngstroem());
    1429         //mol->CreateListOfBondsPerAtom((ofstream *)&cout);
    1430         Subgraphs = mol->DepthFirstSearchAnalysis((ofstream *)&cout, MinimumRingSize);
    1431         while (Subgraphs->next != NULL) {
    1432           Subgraphs = Subgraphs->next;
    1433           delete(Subgraphs->previous);
     1439        {
     1440          cout << Verbose(0) << "What's the maximum bond distance: ";
     1441          cin >> tmp1;
     1442          start = clock();
     1443          mol->CreateAdjacencyList((ofstream *)&cout, tmp1, configuration.GetIsAngstroem());
     1444          mol->CreateListOfBondsPerAtom((ofstream *)&cout);
     1445//          Subgraphs = mol->DepthFirstSearchAnalysis((ofstream *)&cout, BackEdgeStack);
     1446//          while (Subgraphs->next != NULL) {
     1447//            Subgraphs = Subgraphs->next;
     1448//            Subgraphs->Leaf->CyclicStructureAnalysis((ofstream *)&cout, BackEdgeStack, MinimumRingSize);
     1449//            delete(Subgraphs->previous);
     1450//          }
     1451//          delete(Subgraphs);    // we don't need the list here, so free everything
     1452//          delete[](MinimumRingSize);
     1453//          Subgraphs = NULL;
     1454          end = clock();
     1455          cout << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl;
    14341456        }
    1435         delete(Subgraphs);    // we don't need the list here, so free everything
    1436         delete[](MinimumRingSize);
    1437         Subgraphs = NULL;
    1438         end = clock();
    1439         cout << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl;
    14401457        break;
    14411458       
Note: See TracChangeset for help on using the changeset viewer.