Changeset 6a3c83
- Timestamp:
- Apr 6, 2012, 11:46:15 AM (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:
- 760c4c
- Parents:
- d25bec
- git-author:
- Frederik Heber <heber@…> (04/06/12 09:57:43)
- git-committer:
- Frederik Heber <heber@…> (04/06/12 11:46:15)
- Location:
- src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/molecule.cpp
rd25bec r6a3c83 67 67 last_atom(0) 68 68 { 69 // add specific channels 70 Channels *OurChannel = new Channels; 71 NotificationChannels.insert( std::make_pair( this, OurChannel) ); 72 for (size_t type = 0; type < (size_t)NotificationType_MAX; ++type) 73 OurChannel->addChannel(type); 69 74 70 75 strcpy(name,World::getInstance().getDefaultName().c_str()); … … 107 112 void molecule::setName(const std::string _name){ 108 113 OBSERVE; 114 NOTIFY(MoleculeNameChanged); 109 115 cout << "Set name of molecule " << getId() << " to " << _name << endl; 110 116 strncpy(name,_name.c_str(),MAXSTRINGSIZE); … … 114 120 OBSERVE; 115 121 if(atomIdPool.reserveId(newNr)){ 122 NOTIFY(AtomNrChanged); 116 123 if (oldNr != -1) // -1 is reserved and indicates no number 117 124 atomIdPool.releaseId(oldNr); … … 172 179 { 173 180 OBSERVE; 181 NOTIFY(AtomRemoved); 174 182 const_iterator iter = loc; 175 183 ++iter; 176 184 atom * const _atom = const_cast<atom *>(*loc); 177 185 atomIds.erase( _atom->getId() ); 186 { 187 NOTIFY(AtomNrChanged); 188 atomIdPool.releaseId(_atom->getNr()); 189 _atom->setNr(-1); 190 } 178 191 formula-=_atom->getType(); 179 192 _atom->removeFromMolecule(); … … 184 197 { 185 198 OBSERVE; 199 NOTIFY(AtomRemoved); 186 200 const_iterator iter = find(key); 187 201 if (iter != end()){ 188 202 ++iter; 189 203 atomIds.erase( key->getId() ); 190 atomIdPool.releaseId(key->getNr()); 191 key->setNr(-1); 204 { 205 NOTIFY(AtomNrChanged); 206 atomIdPool.releaseId(key->getNr()); 207 key->setNr(-1); 208 } 192 209 formula-=key->getType(); 193 210 key->removeFromMolecule(); … … 199 216 { 200 217 OBSERVE; 218 NOTIFY(AtomInserted); 201 219 std::pair<iterator,bool> res = atomIds.insert(key->getId()); 202 220 if (res.second) { // push atom if went well 221 NOTIFY(AtomNrChanged); 203 222 key->setNr(atomIdPool.getNextId()); 204 223 setAtomName(key); … … 232 251 bool molecule::AddAtom(atom *pointer) 233 252 { 234 OBSERVE;235 253 if (pointer != NULL) { 236 254 insert(pointer); … … 248 266 { 249 267 atom *retval = NULL; 250 OBSERVE;251 268 if (pointer != NULL) { 252 269 atom *walker = pointer->clone(); … … 298 315 // Info info(__func__); 299 316 bool AllWentWell = true; // flag gathering the boolean return value of molecule::AddAtom and other functions, as return value on exit 300 OBSERVE;301 317 double bondlength; // bond length of the bond to be replaced/cut 302 318 double bondangle; // bond angle of the bond to be replaced/cut … … 656 672 bond * molecule::AddBond(atom *atom1, atom *atom2, int degree) 657 673 { 658 OBSERVE;659 674 bond *Binder = NULL; 660 675 … … 748 763 { 749 764 ASSERT(pointer, "Null pointer passed to molecule::RemoveAtom()."); 750 OBSERVE;751 765 RemoveBonds(pointer); 752 766 pointer->removeFromMolecule(); -
src/molecule.hpp
rd25bec r6a3c83 92 92 molecule(); 93 93 virtual ~molecule(); 94 95 public: 96 97 /******* Notifications *******/ 98 99 //!> enumeration of present notification types: only insertion/removal of atoms or molecules 100 enum NotificationType { 101 AtomInserted, 102 AtomRemoved, 103 AtomNrChanged, 104 MoleculeNameChanged, 105 NotificationType_MAX 106 }; 94 107 95 108 public:
Note:
See TracChangeset
for help on using the changeset viewer.