- Timestamp:
- Oct 6, 2011, 4:06:10 PM (13 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, 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)
- Location:
- src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/GraphAction/CreateAdjacencyAction.cpp
r7188b1 rdb7e6d 141 141 if (status) { // create bond if distance is smaller 142 142 // Log() << Verbose(1) << "Adding Bond between " << *Walker << " and " << *OtherWalker << " in distance " << sqrt(distance) << "." << endl; 143 bond * const Binder = new bond(Walker->father, OtherWalker->father, 1); 143 //const bond * Binder = 144 Walker->father->addBond(WorldTime::getTime(), OtherWalker->father); 144 145 BondCount++; 145 Walker->father->RegisterBond(WorldTime::getTime(),Binder);146 OtherWalker->father->RegisterBond(WorldTime::getTime(),Binder);147 146 } else { 148 147 // Log() << Verbose(1) << "Not Adding: distance too great." << endl; -
src/Bond/bond.cpp
r7188b1 rdb7e6d 63 63 // remove this node from the list structure 64 64 if (leftatom != NULL) 65 leftatom-> UnregisterBond(this);65 leftatom->removeBond(this); 66 66 // there might be self-bonds 67 67 if ((leftatom != rightatom) && (rightatom != NULL)) 68 rightatom-> UnregisterBond(this);68 rightatom->removeBond(this); 69 69 }; 70 70 … … 94 94 * \return true if it is either bond::leftatom or bond::rightatom, false otherwise 95 95 */ 96 bool bond::Contains(const ParticleInfo * const ptr) 96 bool bond::Contains(const ParticleInfo * const ptr) const 97 97 { 98 98 return ((leftatom == ptr) || (rightatom == ptr)); … … 103 103 * \return true if it is either bond::leftatom or bond::rightatom, false otherwise 104 104 */ 105 bool bond::Contains(const int number) 105 bool bond::Contains(const int number) const 106 106 { 107 107 return ((leftatom->getNr() == number) || (rightatom->getNr() == number)); -
src/Bond/bond.hpp
r7188b1 rdb7e6d 44 44 atom * GetOtherAtom(const ParticleInfo * const Atom) const; 45 45 46 bool Contains(const ParticleInfo * const ptr) ;47 bool Contains(const int nr) ;46 bool Contains(const ParticleInfo * const ptr) const; 47 bool Contains(const int nr) const; 48 48 double GetDistance() const; 49 49 double GetDistanceSquared() const; -
src/Graph/BondGraph.cpp
r7188b1 rdb7e6d 199 199 if (status) { // create bond if distance is smaller 200 200 LOG(1, "ACCEPT: Adding Bond between " << *Walker << " and " << *OtherWalker << " in distance " << sqrt(distance) << "."); 201 bond * Binder = new bond(Walker->father, OtherWalker->father, 1); 202 Walker->father->RegisterBond(WorldTime::getTime(), Binder); 203 OtherWalker->father->RegisterBond(WorldTime::getTime(), Binder); 201 //const bond * Binder = 202 Walker->father->addBond(WorldTime::getTime(), OtherWalker->father); 204 203 BondCount++; 205 204 } else { -
src/Graph/BondGraph.hpp
r7188b1 rdb7e6d 230 230 231 231 LOG(3, "INFO: Creating bond between atoms " << atom1 << " and " << atom2 << "."); 232 bond * const Binder = new bond(Walker, OtherWalker, 1); 233 Walker->RegisterBond(WorldTime::getTime(), Binder); 234 OtherWalker->RegisterBond(WorldTime::getTime(), Binder); 232 //const bond * Binder = 233 Walker->addBond(WorldTime::getTime(), OtherWalker); 235 234 bondcounter++; 236 235 } -
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; -
src/atom_bondedparticle.hpp
r7188b1 rdb7e6d 37 37 virtual ~BondedParticle(); 38 38 39 void addBond(const unsigned int _step, BondedParticle* Partner); 40 bool RegisterBond(const unsigned int _step, bond *Binder); 41 bool UnregisterBond(bond *Binder); 39 const bond * addBond(const unsigned int _step, BondedParticle* Partner); 40 void removeBond(bond *binder); 42 41 bool IsBondedTo(const unsigned int _step, BondedParticle * const BondPartner) const; 43 void UnregisterAllBond(const unsigned int _step);44 42 void ClearBondsAtStep(const unsigned int _step); 45 43 int CountBonds() const; … … 52 50 std::ostream & operator << (std::ostream &ost) const; 53 51 54 private: 55 int ContainsBondAtStep(bond *Binder); 52 protected: 53 bool RegisterBond(const unsigned int _step, bond *Binder); 54 bool UnregisterBond(bond *Binder); 55 void UnregisterAllBond(const unsigned int _step); 56 57 int ContainsBondAtStep(bond *Binder) const; 56 58 57 59 };
Note:
See TracChangeset
for help on using the changeset viewer.