Changeset 8e1f901 for src/molecule.cpp
- Timestamp:
- Mar 30, 2012, 9:16:31 AM (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, 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:
- c67ff9
- Parents:
- 5e6534
- git-author:
- Frederik Heber <heber@…> (03/21/12 11:41:02)
- git-committer:
- Frederik Heber <heber@…> (03/30/12 09:16:31)
- File:
-
- 1 edited
-
src/molecule.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/molecule.cpp
r5e6534 r8e1f901 165 165 /************************** Access to the List of Atoms ****************/ 166 166 167 168 molecule::iterator molecule::begin(){169 return iterator(atomIds.begin(), FromIdToAtom());170 }171 172 molecule::const_iterator molecule::begin() const{173 return const_iterator(atomIds.begin(), FromIdToAtom());174 }175 176 molecule::iterator molecule::end(){177 return iterator(atomIds.end(), FromIdToAtom());178 }179 180 molecule::const_iterator molecule::end() const{181 return const_iterator(atomIds.end(), FromIdToAtom());182 }183 184 bool molecule::empty() const185 {186 return (atomIds.empty());187 }188 189 size_t molecule::size() const190 {191 size_t counter = 0;192 for (const_iterator iter = begin(); iter != end (); ++iter)193 counter++;194 return counter;195 }196 197 167 molecule::const_iterator molecule::erase( const_iterator loc ) 198 168 { … … 222 192 } 223 193 224 molecule::const_iterator molecule::find ( atom * key ) const225 {226 return const_iterator(atomIds.find(key->getId()), FromIdToAtom());227 }228 229 194 pair<molecule::iterator,bool> molecule::insert ( atom * const key ) 230 195 { 231 196 OBSERVE; 232 pair<atomIdSet::iterator,bool> res = atomIds.insert(key->getId());197 std::pair<iterator,bool> res = atomIds.insert(key->getId()); 233 198 if (res.second) { // push atom if went well 234 199 key->setNr(atomIdPool.getNextId()); 235 200 setAtomName(key); 236 201 formula+=key->getType(); 237 return pair<iterator,bool>(iterator(res.first, FromIdToAtom()),res.second);202 return res; 238 203 } else { 239 204 return pair<iterator,bool>(end(),res.second); … … 256 221 { 257 222 World::AtomComposite vector_of_atoms; 258 // std::copy(MyIter(atomIds.begin(), FromIdToAtom()),259 // MyIter(atomIds.end(), FromIdToAtom()),260 // vector_of_atoms.begin());261 // for (MyIter iter = MyIter(atomIds.begin(), FromIdToAtom());262 // iter != MyIter(atomIds.end(), FromIdToAtom());263 // ++iter)264 223 for (molecule::iterator iter = begin(); iter != end(); ++iter) 265 224 vector_of_atoms.push_back(*iter); … … 851 810 "molecule::isInMolecule() - atom is not designated to be in molecule '" 852 811 +toString(this->getName())+"'."); 853 molecule:: atomIdSet::const_iterator iter = atomIds.find(_atom->getId());812 molecule::const_iterator iter = atomIds.find(_atom->getId()); 854 813 return (iter != atomIds.end()); 855 814 }
Note:
See TracChangeset
for help on using the changeset viewer.
