Changeset a7a087
- Timestamp:
- Aug 12, 2010, 4:31:02 PM (15 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:
- faa1c9
- Parents:
- 51769f
- Location:
- src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/World.cpp
r51769f ra7a087 208 208 atoms.erase(oldId); 209 209 atoms.insert(pair<atomId_t,atom*>(newId,target)); 210 return true; 211 } 212 else{ 213 return false; 214 } 215 } 216 } 217 218 bool World::changeMoleculeId(moleculeId_t oldId, moleculeId_t newId, molecule* target){ 219 OBSERVE; 220 // in case this call did not originate from inside the atom, we redirect it, 221 // to also let it know that it has changed 222 if(!target){ 223 target = molecules[oldId]; 224 ASSERT(target,"Molecule with that ID not found"); 225 return target->changeId(newId); 226 } 227 else{ 228 if(reserveMoleculeId(newId)){ 229 molecules.erase(oldId); 230 molecules.insert(pair<moleculeId_t,molecule*>(newId,target)); 210 231 return true; 211 232 } -
src/World.hpp
r51769f ra7a087 219 219 220 220 /** 221 * used when changing an molecule Id. 222 * Unless you are calling this method from inside an moleucle don't fiddle with the third parameter. 223 * 224 * Return value indicates wether the change could be done or not. 225 */ 226 bool changeMoleculeId(moleculeId_t oldId, moleculeId_t newId, molecule* target=0); 227 228 /** 221 229 * Produces a process that calls a function on all Atoms matching a given descriptor. The process is not 222 230 * called at this time, so it can be passed around, stored inside menuItems etc. -
src/molecule.cpp
r51769f ra7a087 89 89 strncpy(name,_name.c_str(),MAXSTRINGSIZE); 90 90 } 91 92 bool molecule::changeId(moleculeId_t newId){ 93 // first we move ourselves in the world 94 // the world lets us know if that succeeded 95 if(World::getInstance().changeMoleculeId(id,newId,this)){ 96 id = newId; 97 return true; 98 } 99 else{ 100 return false; 101 } 102 } 103 91 104 92 105 moleculeId_t molecule::getId(){ -
src/molecule.hpp
r51769f ra7a087 141 141 bool hasElement(const std::string&) const; 142 142 143 virtual bool changeId(atomId_t newId); 143 144 144 145 iterator begin();
Note:
See TracChangeset
for help on using the changeset viewer.