Changeset 87f6c9 for src


Ignore:
Timestamp:
May 8, 2008, 3:39:36 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:
bf46da
Parents:
da5355
Message:

new function MoleculeLeafClass::TranslateIndicesToGlobalIDs() used in molecule::FragmentMolecule()

MoleculeLeafClass::TranslateIndicesToGlobalIDs() abstractizes translation of local atom::nr returned by BOSSANOVA per fragment into one list of global indices that can be used to store fragment configs and globally valid keyset file

Location:
src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/moleculelist.cpp

    rda5355 r87f6c9  
    540540};
    541541
     542/** Translate list into global numbers (i.e. ones that are valid in "this" molecule, not in MolecularWalker->Leaf)
     543 * \param *out output stream for debugging
     544 * \param **FragmentList Graph with local numbers per fragment
     545 * \param &FragmentCounter counts the fragments as we move along the list
     546 * \param &TotalNumberOfKeySets global key set counter
     547 * \param &TotalGraph Graph to be filled with global numbers
     548 */
     549void MoleculeLeafClass::TranslateIndicesToGlobalIDs(ofstream *out, Graph **FragmentList, int &FragmentCounter, int &TotalNumberOfKeySets, Graph &TotalGraph)
     550{
     551  KeySet *TempSet = new KeySet;
     552  for(Graph::iterator runner = FragmentList[FragmentCounter]->begin(); runner != FragmentList[FragmentCounter]->end(); runner++) {
     553    for(KeySet::iterator sprinter = (*runner).first.begin(); sprinter != (*runner).first.end(); sprinter++)
     554      TempSet->insert((Leaf->FindAtom(*sprinter))->GetTrueFather()->nr);
     555    TotalGraph.insert(GraphPair(*TempSet, pair<int,double>(TotalNumberOfKeySets++, (*runner).second.second)));
     556    TempSet->clear();
     557  }
     558  delete(TempSet);
     559  if (next != NULL)
     560    next->TranslateIndicesToGlobalIDs(out, FragmentList, ++FragmentCounter, TotalNumberOfKeySets, TotalGraph);
     561  FragmentCounter--;
     562};
     563
    542564/** Simply counts the number of items in the list, from given MoleculeLeafClass.
    543565 * \return number of items
  • src/molecules.cpp

    rda5355 r87f6c9  
    22732273
    22742274  // ===== 8a. translate list into global numbers (i.e. ones that are valid in "this" molecule, not in MolecularWalker->Leaf)
    2275   MolecularWalker = Subgraphs;
    2276   FragmentCounter = 0;
    2277   while (MolecularWalker->next != NULL) {
    2278     MolecularWalker = MolecularWalker->next;
    2279     KeySet *TempSet = new KeySet;
    2280     for(Graph::iterator runner = FragmentList[FragmentCounter]->begin(); runner != FragmentList[FragmentCounter]->end(); runner++) {
    2281       for(KeySet::iterator sprinter = (*runner).first.begin(); sprinter != (*runner).first.end(); sprinter++)
    2282         TempSet->insert((MolecularWalker->Leaf->FindAtom(*sprinter))->GetTrueFather()->nr);
    2283       TotalGraph.insert(GraphPair(*TempSet, pair<int,double>(TotalNumberOfKeySets++, (*runner).second.second)));
    2284       TempSet->clear();
    2285     }
    2286     delete(TempSet);
    2287     delete(FragmentList[FragmentCounter]);
    2288     FragmentCounter++;
    2289   }
    2290   Free((void **)&FragmentList, "molecule::FragmentMolecule - **FragmentList");
     2275  Subgraphs->next->TranslateIndicesToGlobalIDs(out, FragmentList, (FragmentCounter = 0), TotalNumberOfKeySets, TotalGraph);
     2276 
    22912277  // free subgraph memory again
    22922278  delete(ParsedFragmentList);
     2279  FragmentCounter = 0;
    22932280  if (Subgraphs != NULL) {
    22942281    while (Subgraphs->next != NULL) {
    22952282      Subgraphs = Subgraphs->next;
     2283      delete(FragmentList[FragmentCounter++]);
    22962284      delete(Subgraphs->previous);
    22972285    }
    22982286    delete(Subgraphs);
    22992287  }
     2288  Free((void **)&FragmentList, "molecule::FragmentMolecule - **FragmentList");
    23002289
    23012290  // ===== 8b. gather keyset lists (graphs) from all subgraphs and transform into MoleculeListClass =====
  • src/molecules.hpp

    rda5355 r87f6c9  
    414414  bool AssignKeySetsToFragment(ofstream *out, molecule *reference, Graph *KeySetList, atom ***&ListOfLocalAtoms, Graph **&FragmentList, int &FragmentCounter, bool FreeList = false);
    415415  bool FillListOfLocalAtoms(ofstream *out, atom ***&ListOfLocalAtoms, int &FragmentCounter, int GlobalAtomCount, bool &FreeList);
     416  void TranslateIndicesToGlobalIDs(ofstream *out, Graph **FragmentList, int &FragmentCounter, int &TotalNumberOfKeySets, Graph &TotalGraph);
    416417  int Count() const;
    417418};
Note: See TracChangeset for help on using the changeset viewer.