Changeset db7e6d for src/atom_bondedparticle.cpp
- Timestamp:
- Oct 6, 2011, 4:06:10 PM (14 years ago)
- 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:
- 37b2575
- Parents:
- 7188b1
- git-author:
- Frederik Heber <heber@…> (09/01/11 16:25:34)
- git-committer:
- Frederik Heber <heber@…> (10/06/11 16:06:10)
- File:
-
- 1 edited
-
src/atom_bondedparticle.cpp (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/atom_bondedparticle.cpp
r7188b1 rdb7e6d 27 27 #include "CodePatterns/Verbose.hpp" 28 28 #include "element.hpp" 29 #include "WorldTime.hpp" 29 30 30 31 /** Constructor of class BondedParticle. … … 93 94 94 95 /** 95 * Adds a bond between this bonded particle and another. Does nothingif this96 * Adds a bond between this bonded particle and another. Returns present instance if this 96 97 * bond already exists. 97 98 * 98 99 * @param _step time step to access 99 * \param bonding partner 100 */ 101 void BondedParticle::addBond(const unsigned int _step, BondedParticle* Partner) { 102 if (IsBondedTo(_step, Partner)) { 103 return; 100 * @param bonding partner 101 * @return const reference to created bond or to already present bonds 102 */ 103 const bond * BondedParticle::addBond(const unsigned int _step, BondedParticle* Partner) 104 { 105 const BondList &bondlist = getListOfBondsAtStep(_step); 106 for (BondList::const_iterator runner = bondlist.begin(); 107 runner != bondlist.end(); 108 runner++) { 109 if ((*runner)->Contains(Partner)) 110 return *runner; 104 111 } 105 112 … … 107 114 RegisterBond(_step, newBond); 108 115 Partner->RegisterBond(_step, newBond); 116 117 return newBond; 118 } 119 120 /** Removes a bond for this atom. 121 * 122 * @param Binder bond to remove 123 */ 124 void BondedParticle::removeBond(bond * binder) 125 { 126 UnregisterBond(binder); 109 127 } 110 128 … … 115 133 bool BondedParticle::RegisterBond(const unsigned int _step, bond *Binder) 116 134 { 135 OBSERVE; 117 136 bool status = false; 118 137 if (Binder != NULL) { 119 138 if (Binder->Contains(this)) { 139 if (WorldTime::getTime() == _step) 140 NOTIFY(AtomObservable::BondsChanged); 120 141 //LOG(3,"INFO: Registering bond "<< *Binder << " with atom " << *this << " at step " << _step); 121 142 BondList& ListOfBonds = getListOfBondsAtStep(_step); … … 137 158 bool BondedParticle::UnregisterBond(bond *Binder) 138 159 { 160 OBSERVE; 139 161 bool status = false; 140 162 ASSERT(Binder != NULL, "BondedParticle::UnregisterBond() - Binder is NULL."); 141 163 const int step = ContainsBondAtStep(Binder); 142 164 if (step != -1) { 165 NOTIFY(AtomObservable::BondsChanged); 143 166 //LOG(3,"INFO: Unregistering bond "<< *Binder << " from list " << &ListOfBonds << " of atom " << *this << " at step " << step); 144 167 ListOfBonds[step].remove(Binder); … … 164 187 void BondedParticle::ClearBondsAtStep(const unsigned int _step) 165 188 { 189 OBSERVE; 190 if (WorldTime::getTime() == _step) 191 NOTIFY(AtomObservable::BondsChanged); 166 192 //LOG(3,"INFO: Clearing all bonds of " << *this << ": " << ListOfBonds[_step]); 167 193 for (BondList::iterator iter = (ListOfBonds[_step]).begin(); … … 178 204 * @return >=0 - first time step where bond appears, -1 - bond not present in lists 179 205 */ 180 int BondedParticle::ContainsBondAtStep(bond *Binder) 206 int BondedParticle::ContainsBondAtStep(bond *Binder) const 181 207 { 182 208 int step = -1; … … 205 231 int BondedParticle::CorrectBondDegree() 206 232 { 233 OBSERVE; 234 NOTIFY(AtomObservable::BondsChanged); 207 235 int NoBonds = 0; 208 236 int OtherNoBonds = 0;
Note:
See TracChangeset
for help on using the changeset viewer.
