Changeset 99752a


Ignore:
Timestamp:
Mar 2, 2011, 9:53:07 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:
53d6b2
Parents:
c6123b
git-author:
Frederik Heber <heber@…> (02/25/11 15:40:39)
git-committer:
Frederik Heber <heber@…> (03/02/11 21:53:07)
Message:

Moved FillBondStructureFromReference from MoleculeLeafClass to molecule.

Location:
src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/FragmentationAction/DepthFirstSearchAction.cpp

    rc6123b r99752a  
    5858      Subgraphs = Subgraphs->next;
    5959      ListOfAtoms = NULL;
    60       Subgraphs->FillBondStructureFromReference(mol, ListOfAtoms, false);  // we want to keep the created ListOfLocalAtoms
     60      Subgraphs->Leaf->FillBondStructureFromReference(mol, ListOfAtoms, false);  // we want to keep the created ListOfLocalAtoms
    6161      LocalBackEdgeStack = new std::deque<bond *>; // no need to have it Subgraphs->Leaf->BondCount size
    6262      Subgraphs->Leaf->PickLocalBackEdges(ListOfAtoms, BackEdgeStack, LocalBackEdgeStack);
  • src/Actions/FragmentationAction/SubgraphDissectionAction.cpp

    rc6123b r99752a  
    124124      while (MoleculeWalker->next != NULL) {
    125125        ListOfAtoms = NULL;
    126         MoleculeWalker->FillBondStructureFromReference(mol, ListOfAtoms, true);  // we want to keep the created ListOfLocalAtoms
     126        MoleculeWalker->Leaf->FillBondStructureFromReference(mol, ListOfAtoms, true);  // we want to keep the created ListOfLocalAtoms
    127127        molecules->insert(MoleculeWalker->Leaf);
    128128        MoleculeWalker = MoleculeWalker->next;
     
    130130      molecules->insert(MoleculeWalker->Leaf);
    131131      ListOfAtoms = NULL;
    132       MoleculeWalker->FillBondStructureFromReference(mol, ListOfAtoms, true);  // we want to keep the created ListOfLocalAtoms
     132      MoleculeWalker->Leaf->FillBondStructureFromReference(mol, ListOfAtoms, true);  // we want to keep the created ListOfLocalAtoms
    133133    }
    134134
  • src/molecule.hpp

    rc6123b r99752a  
    184184
    185185  /// Initialising routines in fragmentation
    186   void CreateAdjacencyListFromDbondFile(ifstream *output,unsigned int skiplines,int id_offset);
    187186  void OutputBondsList() const;
    188187  void CyclicBondAnalysis() const;
     
    228227  // Recognize doubly appearing molecules in a list of them
    229228  int * GetFatherSonAtomicMap(molecule *OtherMolecule);
     229  bool FillBondStructureFromReference(const molecule * const reference, atom **&ListOfLocalAtoms, bool FreeList = false);
    230230  bool FillListOfLocalAtoms(atom **&ListOfLocalAtoms, const int GlobalAtomCount);
    231231
     
    300300
    301301  bool AddLeaf(molecule *ptr, MoleculeLeafClass *Previous);
    302   bool FillBondStructureFromReference(const molecule * const reference, atom **&ListOfLocalAtoms, bool FreeList = false);
    303302  bool FillRootStackForSubgraphs(KeyStack *&RootStack, bool *AtomMask, int &FragmentCounter);
    304303  bool AssignKeySetsToFragment(molecule *reference, Graph *KeySetList, atom ***&ListOfLocalAtoms, Graph **&FragmentList, int &FragmentCounter, bool FreeList = false);
  • src/molecule_fragmentation.cpp

    rc6123b r99752a  
    685685    // fill the bond structure of the individually stored subgraphs
    686686    ListOfAtoms = NULL;
    687     MolecularWalker->FillBondStructureFromReference(this, ListOfAtoms, false);  // we want to keep the created ListOfLocalAtoms
     687    MolecularWalker->Leaf->FillBondStructureFromReference(this, ListOfAtoms, false);  // we want to keep the created ListOfLocalAtoms
    688688    DoLog(0) && (Log() << Verbose(0) << "Analysing the cycles of subgraph " << MolecularWalker->Leaf << " with nr. " << FragmentCounter << "." << endl);
    689689    LocalBackEdgeStack = new std::deque<bond *>; // (MolecularWalker->Leaf->BondCount);
  • src/molecule_graph.cpp

    rc6123b r99752a  
    7272
    7373/************************************* Functions for class molecule *********************************/
     74
     75/** Fills the bond structure of this chain list subgraphs that are derived from a complete \a *reference molecule.
     76 * Calls this routine in each MoleculeLeafClass::next subgraph if it's not NULL.
     77 * \param *reference reference molecule with the bond structure to be copied
     78 * \param **&ListOfLocalAtoms Lookup table for this subgraph and index of each atom in \a *reference, may be NULL on start, then it is filled
     79 * \param FreeList true - ***ListOfLocalAtoms is free'd before return, false - it is not
     80 * \return true - success, false - failure
     81 */
     82bool molecule::FillBondStructureFromReference(const molecule * const reference, atom **&ListOfLocalAtoms, bool FreeList)
     83{
     84  atom *OtherWalker = NULL;
     85  atom *Father = NULL;
     86  bool status = true;
     87  int AtomNo;
     88
     89  DoLog(1) && (Log() << Verbose(1) << "Begin of FillBondStructureFromReference." << endl);
     90  // fill ListOfLocalAtoms if NULL was given
     91  if (!FillListOfLocalAtoms(ListOfLocalAtoms, reference->getAtomCount())) {
     92    DoLog(1) && (Log() << Verbose(1) << "Filling of ListOfLocalAtoms failed." << endl);
     93    return false;
     94  }
     95
     96  if (status) {
     97    DoLog(1) && (Log() << Verbose(1) << "Creating adjacency list for molecule " << getName() << "." << endl);
     98    // remove every bond from the list
     99    for_each(begin(), end(),
     100        boost::bind(&BondedParticle::ClearBondsAtStep,_1,WorldTime::getTime()));
     101
     102
     103    for(molecule::const_iterator iter = begin(); iter != end(); ++iter) {
     104      Father = (*iter)->GetTrueFather();
     105      AtomNo = Father->getNr(); // global id of the current walker
     106      const BondList& ListOfBonds = Father->getListOfBonds();
     107      for (BondList::const_iterator Runner = ListOfBonds.begin();
     108          Runner != ListOfBonds.end();
     109          ++Runner) {
     110        OtherWalker = ListOfLocalAtoms[(*Runner)->GetOtherAtom((*iter)->GetTrueFather())->getNr()]; // local copy of current bond partner of walker
     111        if (OtherWalker != NULL) {
     112          if (OtherWalker->getNr() > (*iter)->getNr())
     113            AddBond((*iter), OtherWalker, (*Runner)->BondDegree);
     114        } else {
     115          DoLog(1) && (Log() << Verbose(1) << "OtherWalker = ListOfLocalAtoms[" << (*Runner)->GetOtherAtom((*iter)->GetTrueFather())->getNr() << "] is NULL!" << endl);
     116          status = false;
     117        }
     118      }
     119    }
     120  }
     121
     122  if ((FreeList) && (ListOfLocalAtoms != NULL)) {
     123    // free the index lookup list
     124    delete[](ListOfLocalAtoms);
     125  }
     126  DoLog(1) && (Log() << Verbose(1) << "End of FillBondStructureFromReference." << endl);
     127  return status;
     128};
    74129
    75130/** Checks for presence of bonds within atom list.
  • src/moleculelist.cpp

    rc6123b r99752a  
    777777};
    778778
    779 /** Fills the bond structure of this chain list subgraphs that are derived from a complete \a *reference molecule.
    780  * Calls this routine in each MoleculeLeafClass::next subgraph if it's not NULL.
    781  * \param *out output stream for debugging
    782  * \param *reference reference molecule with the bond structure to be copied
    783  * \param **&ListOfLocalAtoms Lookup table for this subgraph and index of each atom in \a *reference, may be NULL on start, then it is filled
    784  * \param FreeList true - ***ListOfLocalAtoms is free'd before return, false - it is not
    785  * \return true - success, false - failure
    786  */
    787 bool MoleculeLeafClass::FillBondStructureFromReference(const molecule * const reference, atom **&ListOfLocalAtoms, bool FreeList)
    788 {
    789   atom *OtherWalker = NULL;
    790   atom *Father = NULL;
    791   bool status = true;
    792   int AtomNo;
    793 
    794   DoLog(1) && (Log() << Verbose(1) << "Begin of FillBondStructureFromReference." << endl);
    795   // fill ListOfLocalAtoms if NULL was given
    796   if (!Leaf->FillListOfLocalAtoms(ListOfLocalAtoms, reference->getAtomCount())) {
    797     DoLog(1) && (Log() << Verbose(1) << "Filling of ListOfLocalAtoms failed." << endl);
    798     return false;
    799   }
    800 
    801   if (status) {
    802     DoLog(1) && (Log() << Verbose(1) << "Creating adjacency list for subgraph " << Leaf << "." << endl);
    803     // remove every bond from the list
    804     for_each(Leaf->begin(), Leaf->end(),
    805         boost::bind(&BondedParticle::ClearBondsAtStep,_1,WorldTime::getTime()));
    806 
    807 
    808     for(molecule::const_iterator iter = Leaf->begin(); iter != Leaf->end(); ++iter) {
    809       Father = (*iter)->GetTrueFather();
    810       AtomNo = Father->getNr(); // global id of the current walker
    811       const BondList& ListOfBonds = Father->getListOfBonds();
    812       for (BondList::const_iterator Runner = ListOfBonds.begin();
    813           Runner != ListOfBonds.end();
    814           ++Runner) {
    815         OtherWalker = ListOfLocalAtoms[(*Runner)->GetOtherAtom((*iter)->GetTrueFather())->getNr()]; // local copy of current bond partner of walker
    816         if (OtherWalker != NULL) {
    817           if (OtherWalker->getNr() > (*iter)->getNr())
    818             Leaf->AddBond((*iter), OtherWalker, (*Runner)->BondDegree);
    819         } else {
    820           DoLog(1) && (Log() << Verbose(1) << "OtherWalker = ListOfLocalAtoms[" << (*Runner)->GetOtherAtom((*iter)->GetTrueFather())->getNr() << "] is NULL!" << endl);
    821           status = false;
    822         }
    823       }
    824     }
    825   }
    826 
    827   if ((FreeList) && (ListOfLocalAtoms != NULL)) {
    828     // free the index lookup list
    829     delete[](ListOfLocalAtoms);
    830   }
    831   DoLog(1) && (Log() << Verbose(1) << "End of FillBondStructureFromReference." << endl);
    832   return status;
    833 };
    834 
    835779/** Fills the root stack for sites to be used as root in fragmentation depending on order or adaptivity criteria
    836780 * Again, as in \sa FillBondStructureFromReference steps recursively through each Leaf in this chain list of molecule's.
Note: See TracChangeset for help on using the changeset viewer.