Ignore:
Timestamp:
Feb 24, 2011, 7:26:14 PM (15 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, Candidate_v1.7.0, Candidate_v1.7.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:
1e6249
Parents:
d557374
git-author:
Frederik Heber <heber@…> (02/24/11 14:32:36)
git-committer:
Frederik Heber <heber@…> (02/24/11 19:26:14)
Message:

BondedParticle::(Un)RegisterBond,AddBond,IsBondedTo with step.

  • adding, removing and checking of bonds at a desired time step.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/atom_bondedparticle.cpp

    rd557374 r073a9e4  
    103103 * bond already exists.
    104104 *
     105 * @param _step time step to access
    105106 * \param bonding partner
    106107 */
    107 void BondedParticle::addBond(BondedParticle* Partner) {
    108   if (IsBondedTo(Partner)) {
     108void BondedParticle::addBond(const unsigned int _step, BondedParticle* Partner) {
     109  if (IsBondedTo(_step, Partner)) {
    109110    return;
    110111  }
    111112
    112113  bond* newBond = new bond((atom*) this, (atom*) Partner, 1, 0);
    113   RegisterBond(newBond);
    114   Partner->RegisterBond(newBond);
     114  RegisterBond(_step, newBond);
     115  Partner->RegisterBond(_step, newBond);
    115116}
    116117
    117118/** Puts a given bond into atom::ListOfBonds.
     119 * @param _step time step to access
    118120 * \param *Binder bond to insert
    119121 */
    120 bool BondedParticle::RegisterBond(bond *Binder)
     122bool BondedParticle::RegisterBond(const unsigned int _step, bond *Binder)
    121123{
    122124  bool status = false;
     
    124126    if (Binder->Contains(this)) {
    125127      //LOG(3,"INFO: Registering bond "<< *Binder << " with atom " << *this << " at step " << _step);
    126       BondList& ListOfBonds = getListOfBonds();
     128      BondList& ListOfBonds = getListOfBondsAtStep(_step);
    127129      ListOfBonds.push_back(Binder);
    128130      status = true;
     
    245247
    246248/** Checks whether there is a bond between \a this atom and the given \a *BondPartner.
     249 * @param _step time step to access
    247250 * \param *BondPartner atom to check for
    248251 * \return true - bond exists, false - bond does not exist
    249252 */
    250 bool BondedParticle::IsBondedTo(BondedParticle * const BondPartner)
     253bool BondedParticle::IsBondedTo(const unsigned int _step, BondedParticle * const BondPartner) const
    251254{
    252255  bool status = false;
    253256
    254   const BondList& ListOfBonds = getListOfBonds();
    255   for (BondList::const_iterator runner = ListOfBonds.begin(); runner != ListOfBonds.end(); runner++) {
     257  const BondList& ListOfBonds = getListOfBondsAtStep(_step);
     258  for (BondList::const_iterator runner = ListOfBonds.begin();
     259      runner != ListOfBonds.end();
     260      runner++) {
    256261    status = status || ((*runner)->Contains(BondPartner));
    257262  }
Note: See TracChangeset for help on using the changeset viewer.