- Timestamp:
- Jul 24, 2015, 4:44:34 PM (10 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:
- a58c16
- Parents:
- 1259df
- git-author:
- Frederik Heber <heber@…> (06/01/15 16:57:36)
- git-committer:
- Frederik Heber <heber@…> (07/24/15 16:44:34)
- Location:
- src
- Files:
-
- 53 edited
-
Actions/AtomAction/ChangeElementAction.cpp (modified) (4 diffs)
-
Actions/FillAction/FillRegularGridAction.cpp (modified) (1 diff)
-
Actions/FillAction/FillSurfaceAction.cpp (modified) (2 diffs)
-
Actions/FillAction/SuspendInMoleculeAction.cpp (modified) (2 diffs)
-
Actions/MoleculeAction/RemoveAction.cpp (modified) (1 diff)
-
Actions/SelectionAction/Atoms/AtomByIdAction.cpp (modified) (3 diffs)
-
Actions/SelectionAction/Atoms/AtomByOrderAction.cpp (modified) (3 diffs)
-
Actions/SelectionAction/Atoms/NotAtomByIdAction.cpp (modified) (3 diffs)
-
Actions/SelectionAction/Atoms/NotAtomByOrderAction.cpp (modified) (3 diffs)
-
Actions/TesselationAction/ConvexEnvelopeAction.cpp (modified) (1 diff)
-
Actions/WorldAction/RepeatBoxAction.cpp (modified) (5 diffs)
-
Actions/WorldAction/RepeatBoxAction.def (modified) (1 diff)
-
Analysis/analysis_bonds.cpp (modified) (1 diff)
-
Analysis/analysis_correlation.cpp (modified) (8 diffs)
-
Atom/AtomSet.hpp (modified) (3 diffs)
-
Atom/atom_bondedparticle.cpp (modified) (1 diff)
-
Atom/atom_bondedparticle.hpp (modified) (1 diff)
-
AtomIdSet.cpp (modified) (6 diffs)
-
AtomIdSet.hpp (modified) (2 diffs)
-
Bond/BondInfo.cpp (modified) (1 diff)
-
Descriptors/unittests/AtomDescriptorUnitTest.cpp (modified) (4 diffs)
-
Filling/unittests/ClusterUnitTest.cpp (modified) (3 diffs)
-
Fragmentation/Fragmentation.cpp (modified) (5 diffs)
-
Fragmentation/Graph.cpp (modified) (1 diff)
-
Fragmentation/Homology/HomologyGraph_getFromKeyset.cpp (modified) (3 diffs)
-
Graph/AdjacencyList.cpp (modified) (1 diff)
-
Graph/BuildInducedSubgraph.cpp (modified) (1 diff)
-
Graph/BuildInducedSubgraph.hpp (modified) (2 diffs)
-
Parameters/Specifics/Value_molecule.cpp (modified) (2 diffs)
-
Parameters/StreamOperators.hpp (modified) (4 diffs)
-
Parameters/Validators/Specific/AtomIdValidator.cpp (modified) (1 diff)
-
Parser/PdbParser.cpp (modified) (1 diff)
-
Parser/unittests/ParserTremoloUnitTest.cpp (modified) (3 diffs)
-
Tesselation/boundary.cpp (modified) (5 diffs)
-
UIElements/CommandLineUI/Query/AtomCommandLineQuery.cpp (modified) (1 diff)
-
UIElements/CommandLineUI/Query/AtomsCommandLineQuery.cpp (modified) (1 diff)
-
UIElements/CommandLineUI/Query/MoleculeCommandLineQuery.cpp (modified) (1 diff)
-
UIElements/Qt4/Query/AtomQtQuery.cpp (modified) (1 diff)
-
UIElements/Qt4/Query/MoleculeQtQuery.cpp (modified) (1 diff)
-
UIElements/TextUI/Query/AtomTextQuery.cpp (modified) (1 diff)
-
UIElements/TextUI/Query/AtomsTextQuery.cpp (modified) (2 diffs)
-
UIElements/TextUI/Query/MoleculeTextQuery.cpp (modified) (1 diff)
-
UIElements/TextUI/Query/MoleculesTextQuery.cpp (modified) (2 diffs)
-
UIElements/Views/Qt4/Qt3D/GLMoleculeObject_atom.cpp (modified) (6 diffs)
-
UIElements/Views/Qt4/Qt3D/GLMoleculeObject_bond.cpp (modified) (7 diffs)
-
UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.cpp (modified) (1 diff)
-
UIElements/Views/Qt4/Qt3D/GLWorldScene.cpp (modified) (2 diffs)
-
UIElements/Views/Qt4/QtFragmentList.cpp (modified) (1 diff)
-
molecule.cpp (modified) (9 diffs)
-
molecule.hpp (modified) (4 diffs)
-
molecule_geometry.cpp (modified) (3 diffs)
-
moleculelist.cpp (modified) (12 diffs)
-
unittests/AtomIdSetUnitTest.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/AtomAction/ChangeElementAction.cpp
r1259df rf01769 57 57 /** =========== define the function ====================== */ 58 58 ActionState::ptr AtomChangeElementAction::performCall() { 59 atom *first = NULL;60 molecule *mol = NULL;61 62 59 // create undo state 63 60 ElementMap Elements; … … 68 65 69 66 for (World::AtomSelectionIterator iter = World::getInstance().beginAtomSelection(); iter != World::getInstance().endAtomSelection(); ++iter) { 70 first = iter->second;67 atom *first = iter->second; 71 68 LOG(1, "Changing atom " << *first << " to element " << *params.elemental.get() << "."); 72 69 first->setType(params.elemental.get()); … … 77 74 ActionState::ptr AtomChangeElementAction::performUndo(ActionState::ptr _state) { 78 75 AtomChangeElementState *state = assert_cast<AtomChangeElementState*>(_state.get()); 79 atom *first = NULL;80 molecule *mol = NULL;81 82 76 for(ElementMap::const_iterator iter = state->Elements.begin(); iter != state->Elements.end(); ++iter) { 83 first = World::getInstance().getAtom(AtomById(iter->first));77 atom *first = World::getInstance().getAtom(AtomById(iter->first)); 84 78 first->setType(iter->second); 85 79 } … … 90 84 ActionState::ptr AtomChangeElementAction::performRedo(ActionState::ptr _state){ 91 85 AtomChangeElementState *state = assert_cast<AtomChangeElementState*>(_state.get()); 92 atom *first = NULL;93 molecule *mol = NULL;94 86 95 87 for(ElementMap::const_iterator iter = state->Elements.begin(); iter != state->Elements.end(); ++iter) { 96 first = World::getInstance().getAtom(AtomById(iter->first));88 atom *first = World::getInstance().getAtom(AtomById(iter->first)); 97 89 first->setType(state->params.elemental.get()); 98 90 } -
src/Actions/FillAction/FillRegularGridAction.cpp
r1259df rf01769 75 75 } 76 76 molecule *filler = *(molecules.begin()); 77 for(molecule::const_iterator iter = filler->begin(); iter != filler->end(); ++iter) 77 for(molecule::const_iterator iter = const_cast<const molecule *>(filler)->begin(); 78 iter != const_cast<const molecule *>(filler)->end(); ++iter) 78 79 movedatoms.push_back( AtomicInfo(*(*iter)) ); 79 80 LOG(1, "INFO: Chosen molecule has " << filler->size() << " atoms."); -
src/Actions/FillAction/FillSurfaceAction.cpp
r1259df rf01769 78 78 } 79 79 molecule *filler = *(molecules.begin()); 80 for(molecule::const_iterator iter = filler->begin(); iter != filler->end(); ++iter) 80 for(molecule::const_iterator iter = const_cast<const molecule *>(filler)->begin(); 81 iter != const_cast<const molecule *>(filler)->end(); ++iter) 81 82 movedatoms.push_back( AtomicInfo(*(*iter)) ); 82 83 LOG(1, "INFO: Chosen molecule has " << filler->size() << " atoms."); … … 87 88 // determine center with respect to alignment axis 88 89 Vector sum = zeroVec; 89 for (molecule::iterator it2=filler->begin();it2 !=filler->end();++it2) { 90 for (molecule::const_iterator it2=const_cast<const molecule *>(filler)->begin(); 91 it2 !=const_cast<const molecule *>(filler)->end();++it2) { 90 92 const Vector helper = (**it2).getPosition().partition(params.AlignedAxis.get()).second; 91 93 sum += helper; -
src/Actions/FillAction/SuspendInMoleculeAction.cpp
r1259df rf01769 122 122 filler = *(molecules.begin()); 123 123 } 124 for(molecule::const_iterator iter = filler->begin(); iter != filler->end(); ++iter) 124 for(molecule::const_iterator iter = const_cast<const molecule *>(filler)->begin(); 125 iter != const_cast<const molecule *>(filler)->end(); ++iter) 125 126 movedatoms.push_back( AtomicInfo(*(*iter)) ); 126 127 LOG(1, "INFO: Chosen molecule has " << filler->size() << " atoms."); … … 174 175 << fillermass << " atomicmassunit, and it's volume is " 175 176 << fillervolume << (IsAngstroem ? " angstrom" : " atomiclength") << "^3."); 176 const double solventdensity = fillermass / fillervolume;177 // const double solventdensity = fillermass / fillervolume; 177 178 178 179 /// solve cubic polynomial -
src/Actions/MoleculeAction/RemoveAction.cpp
r1259df rf01769 68 68 iter != molecules.end(); ++iter) { 69 69 std::vector<AtomicInfo> Walkers; 70 for (molecule::const_iterator atomiter = (*iter)->begin();71 atomiter != (*iter)->end(); ++atomiter) {70 for (molecule::const_iterator atomiter = const_cast<const molecule *>(*iter)->begin(); 71 atomiter != const_cast<const molecule *>(*iter)->end(); ++atomiter) { 72 72 Walkers.push_back(AtomicInfo(**atomiter)); 73 73 } -
src/Actions/SelectionAction/Atoms/AtomByIdAction.cpp
r1259df rf01769 65 65 undoatomids.reserve(atomids.size()); 66 66 for (atomids_t::const_iterator iter = atomids.begin(); iter != atomids.end(); ++iter) { 67 const atom *Walker = World::getInstance().getAtom(AtomById(*iter)); 67 const atom *Walker = const_cast<const World &>(World::getInstance()). 68 getAtom(AtomById(*iter)); 68 69 if (Walker != NULL) { 69 70 if (!World::getInstance().isSelected(Walker)) { … … 104 105 105 106 for (atomids_t::const_iterator iter = state->undoatomids.begin(); 106 iter != state->undoatomids.end(); ++iter) { 107 const atom *Walker = World::getInstance().getAtom(AtomById(*iter)); 108 World::getInstance().unselectAtom(Walker); 109 } 107 iter != state->undoatomids.end(); ++iter) 108 World::getInstance().unselectAllAtoms(AtomById(*iter)); 110 109 111 110 return ActionState::ptr(_state); … … 116 115 117 116 for (atomids_t::const_iterator iter = state->undoatomids.begin(); 118 iter != state->undoatomids.end(); ++iter) { 119 const atom *Walker = World::getInstance().getAtom(AtomById(*iter)); 120 World::getInstance().selectAtom(Walker); 121 } 117 iter != state->undoatomids.end(); ++iter) 118 World::getInstance().selectAllAtoms(AtomById(*iter)); 122 119 123 120 return ActionState::ptr(_state); -
src/Actions/SelectionAction/Atoms/AtomByOrderAction.cpp
r1259df rf01769 54 54 /** =========== define the function ====================== */ 55 55 ActionState::ptr SelectionAtomByOrderAction::performCall() { 56 const atom *Walker = World::getInstance().getAtom(AtomByOrder(params.order.get())); 56 const atom *Walker = const_cast<const World &>(World::getInstance()). 57 getAtom(AtomByOrder(params.order.get())); 57 58 if (Walker != NULL) { 58 59 if (!World::getInstance().isSelected(Walker)) { … … 73 74 SelectionAtomByOrderState *state = assert_cast<SelectionAtomByOrderState*>(_state.get()); 74 75 75 const atom *Walker = World::getInstance().getAtom(AtomById(state->WalkerId)); 76 World::getInstance().unselectAtom(Walker); 76 World::getInstance().unselectAllAtoms(AtomById(state->WalkerId)); 77 77 78 78 return ActionState::ptr(_state); … … 82 82 SelectionAtomByOrderState *state = assert_cast<SelectionAtomByOrderState*>(_state.get()); 83 83 84 const atom *Walker = World::getInstance().getAtom(AtomById(state->WalkerId)); 85 World::getInstance().selectAtom(Walker); 84 World::getInstance().selectAllAtoms(AtomById(state->WalkerId)); 86 85 87 86 return ActionState::ptr(_state); -
src/Actions/SelectionAction/Atoms/NotAtomByIdAction.cpp
r1259df rf01769 65 65 undoatomids.reserve(atomids.size()); 66 66 for (atomids_t::const_iterator iter = atomids.begin(); iter != atomids.end(); ++iter) { 67 const atom *Walker = World::getInstance().getAtom(AtomById(*iter)); 67 const atom *Walker = const_cast<const World &>(World::getInstance()). 68 getAtom(AtomById(*iter)); 68 69 if (Walker != NULL) { 69 70 if (World::getInstance().isSelected(Walker)) { … … 104 105 105 106 for (atomids_t::const_iterator iter = state->undoatomids.begin(); 106 iter != state->undoatomids.end(); ++iter) { 107 const atom *Walker = World::getInstance().getAtom(AtomById(*iter)); 108 World::getInstance().selectAtom(Walker); 109 } 107 iter != state->undoatomids.end(); ++iter) 108 World::getInstance().selectAllAtoms(AtomById(*iter)); 110 109 111 110 return ActionState::ptr(_state); … … 116 115 117 116 for (atomids_t::const_iterator iter = state->undoatomids.begin(); 118 iter != state->undoatomids.end(); ++iter) { 119 const atom *Walker = World::getInstance().getAtom(AtomById(*iter)); 120 World::getInstance().unselectAtom(Walker); 121 } 117 iter != state->undoatomids.end(); ++iter) 118 World::getInstance().unselectAllAtoms(AtomById(*iter)); 122 119 123 120 return ActionState::ptr(_state); -
src/Actions/SelectionAction/Atoms/NotAtomByOrderAction.cpp
r1259df rf01769 54 54 /** =========== define the function ====================== */ 55 55 ActionState::ptr SelectionNotAtomByOrderAction::performCall() { 56 const atom * Walker = World::getInstance().getAtom(AtomByOrder(params.order.get())); 56 const atom * Walker = const_cast<const World &>(World::getInstance()). 57 getAtom(AtomByOrder(params.order.get())); 57 58 if (Walker != NULL) { 58 59 if (World::getInstance().isSelected(Walker)) { … … 73 74 SelectionNotAtomByOrderState *state = assert_cast<SelectionNotAtomByOrderState*>(_state.get()); 74 75 75 const atom * Walker = World::getInstance().getAtom(AtomById(state->WalkerId)); 76 World::getInstance().selectAtom(Walker); 76 World::getInstance().selectAllAtoms(AtomById(state->WalkerId)); 77 77 78 78 return ActionState::ptr(_state); … … 82 82 SelectionNotAtomByOrderState *state = assert_cast<SelectionNotAtomByOrderState*>(_state.get()); 83 83 84 const atom * Walker = World::getInstance().getAtom(AtomById(state->WalkerId)); 85 World::getInstance().unselectAtom(Walker); 84 World::getInstance().unselectAllAtoms(AtomById(state->WalkerId)); 86 85 87 86 return ActionState::ptr(_state); -
src/Actions/TesselationAction/ConvexEnvelopeAction.cpp
r1259df rf01769 86 86 // we check whether all molecule's atoms are still inside 87 87 std::vector<std::string> outside_atoms; 88 for(molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) 88 for(molecule::const_iterator iter = const_cast<const molecule *>(mol)->begin(); 89 iter != const_cast<const molecule *>(mol)->end(); ++iter) 89 90 if (!TesselStruct->IsInnerPoint((*iter)->getPosition(), LCList)) 90 91 outside_atoms.push_back((*iter)->getName()); -
src/Actions/WorldAction/RepeatBoxAction.cpp
r1259df rf01769 63 63 void repeatMoleculesinDomain( 64 64 std::vector< unsigned int > Repeater, 65 const std::vector< constmolecule *> &AllMolecules)65 const std::vector<molecule *> &AllMolecules) 66 66 { 67 67 LOG(0, "STATUS: Repeating box " << Repeater << " times for (x,y,z) axis."); … … 95 95 if ((n[0] == 0) && (n[1] == 0) && (n[2] == 0)) 96 96 continue; 97 for (vector< constmolecule *>::const_iterator MolRunner = AllMolecules.begin(); MolRunner != AllMolecules.end(); ++MolRunner) {98 constmolecule * const mol = *MolRunner;97 for (vector<molecule *>::const_iterator MolRunner = AllMolecules.begin(); MolRunner != AllMolecules.end(); ++MolRunner) { 98 molecule * const mol = *MolRunner; 99 99 LOG(2, "DEBUG: Current mol is " << mol->name << "." << endl); 100 100 molecule * const newmol = mol->CopyMolecule(); … … 114 114 ActionState::ptr WorldRepeatBoxAction::performCall() { 115 115 DoLog(0) && (Log() << Verbose(0) << "Using all molecules." << endl); 116 std::vector<const molecule *> AllMolecules = 117 const_cast<const World &>(World::getInstance()).getAllMolecules(); 116 std::vector<molecule *> AllMolecules = World::getInstance().getAllMolecules(); 118 117 119 118 // prepare undo state 120 119 RealSpaceMatrix olddomain = World::getInstance().getDomain().getM(); 121 std::set< constmolecule *> oldmolecules;122 for(std::vector< constmolecule *>::const_iterator iter = AllMolecules.begin();120 std::set<molecule *> oldmolecules; 121 for(std::vector<molecule *>::const_iterator iter = AllMolecules.begin(); 123 122 iter != AllMolecules.end(); 124 123 ++iter) … … 136 135 ActionState::ptr WorldRepeatBoxAction::performUndo(ActionState::ptr _state) { 137 136 WorldRepeatBoxState *state = assert_cast<WorldRepeatBoxState*>(_state.get()); 138 MoleculeListClass *molecules = World::getInstance().getMolecules();139 137 140 138 // set old domain … … 159 157 WorldRepeatBoxState *state = assert_cast<WorldRepeatBoxState*>(_state.get()); 160 158 161 std::vector< constmolecule *> originalmolecules;162 for(std::set< constmolecule *>::const_iterator iter = state->oldmolecules.begin();159 std::vector<molecule *> originalmolecules; 160 for(std::set<molecule *>::const_iterator iter = state->oldmolecules.begin(); 163 161 iter != state->oldmolecules.end(); 164 162 ++iter) -
src/Actions/WorldAction/RepeatBoxAction.def
r1259df rf01769 28 28 (STLVectorValidator< std::vector< unsigned int > >(NDIM, NDIM)) 29 29 30 #define statetypes (RealSpaceMatrix)(std::set< constmolecule *>)30 #define statetypes (RealSpaceMatrix)(std::set< molecule *>) 31 31 #define statereferences (olddomain)(oldmolecules) 32 32 -
src/Analysis/analysis_bonds.cpp
r1259df rf01769 182 182 // go through every atom 183 183 typedef std::set<const molecule *> Moleculeset; 184 for(molecule::const_iterator Walker = (*MolWalker)->begin();185 Walker !=(*MolWalker)->end();184 for(molecule::const_iterator Walker = const_cast<const molecule *>(*MolWalker)->begin(); 185 Walker != const_cast<const molecule *>(*MolWalker)->end(); 186 186 ++Walker) { 187 187 // go through every oxygen -
src/Analysis/analysis_correlation.cpp
r1259df rf01769 155 155 std::map<atomId_t, Vector> ZeroVector; 156 156 BOOST_FOREACH(molecule *_mol, molecules) { 157 const Vector Dipole = getDipole(_mol->begin(), _mol->end()); 158 for(molecule::const_iterator iter = _mol->begin(); iter != _mol->end(); ++iter) 157 const Vector Dipole = 158 getDipole( 159 const_cast<const molecule *>(_mol)->begin(), 160 const_cast<const molecule *>(_mol)->end()); 161 for(molecule::const_iterator iter = const_cast<const molecule *>(_mol)->begin(); 162 iter != const_cast<const molecule *>(_mol)->end(); 163 ++iter) 159 164 ZeroVector[(*iter)->getId()] = Dipole; 160 165 LOG(2,"INFO: Zero alignment for molecule " << _mol->getId() << " is " << Dipole); … … 208 213 size_t Counter_rejections = 0; 209 214 BOOST_FOREACH(molecule *_mol, molecules) { 210 const Vector Dipole = getDipole(_mol->begin(), _mol->end()); 215 const Vector Dipole = 216 getDipole( 217 const_cast<const molecule *>(_mol)->begin(), 218 const_cast<const molecule *>(_mol)->end()); 211 219 LOG(3,"INFO: Dipole vector at time step " << timestep << " for for molecule " 212 220 << _mol->getId() << " is " << Dipole); 213 221 // check that all atoms are valid (zeroVector known) 214 molecule::const_iterator iter = _mol->begin();215 for(; iter != _mol->end(); ++iter) {222 molecule::const_iterator iter = const_cast<const molecule *>(_mol)->begin(); 223 for(; iter != const_cast<const molecule *>(_mol)->end(); ++iter) { 216 224 if (!ZeroVector.count((*iter)->getId())) 217 225 break; 218 226 } 219 if (iter != _mol->end()) {227 if (iter != const_cast<const molecule *>(_mol)->end()) { 220 228 ELOG(2, "Skipping molecule " << _mol->getName() << " as not all atoms have a valid zeroVector."); 221 229 ++Counter_rejections; 222 230 continue; 223 231 } else 224 iter = _mol->begin();232 iter = const_cast<const molecule *>(_mol)->begin(); 225 233 std::map<atomId_t, Vector>::const_iterator zeroValue = ZeroVector.find((*iter)->getId()); //due to iter is const 226 234 double angle = 0.; … … 281 289 MolWalker != molecules.end(); ++MolWalker) { 282 290 LOG(2, "INFO: Current molecule is " << (*MolWalker)->getId() << "."); 283 const Vector Dipole = getDipole((*MolWalker)->begin(), (*MolWalker)->end()); 291 const Vector Dipole = 292 getDipole( 293 const_cast<const molecule *>(*MolWalker)->begin(), 294 const_cast<const molecule *>(*MolWalker)->end()); 284 295 std::vector<molecule *>::const_iterator MolOtherWalker = MolWalker; 285 296 for (++MolOtherWalker; … … 287 298 ++MolOtherWalker) { 288 299 LOG(2, "INFO: Current other molecule is " << (*MolOtherWalker)->getId() << "."); 289 const Vector OtherDipole = getDipole((*MolOtherWalker)->begin(), (*MolOtherWalker)->end()); 300 const Vector OtherDipole = getDipole( 301 const_cast<const molecule *>(*MolOtherWalker)->begin(), 302 const_cast<const molecule *>(*MolOtherWalker)->end()); 290 303 const double angle = Dipole.Angle(OtherDipole) * (180./M_PI); 291 304 LOG(1, "Angle is " << angle << "."); … … 410 423 for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++) { 411 424 LOG(2, "Current molecule is " << *MolWalker << "."); 412 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) { 425 for (molecule::const_iterator iter = const_cast<const molecule *>(*MolWalker)->begin(); 426 iter != const_cast<const molecule *>(*MolWalker)->end(); 427 ++iter) { 413 428 LOG(3, "Current atom is " << **iter << "."); 414 429 for (vector<const element *>::const_iterator type = elements.begin(); type != elements.end(); ++type) … … 456 471 RealSpaceMatrix FullInverseMatrix = World::getInstance().getDomain().getMinv(); 457 472 LOG(2, "Current molecule is " << *MolWalker << "."); 458 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) { 473 for (molecule::const_iterator iter = const_cast<const molecule *>(*MolWalker)->begin(); 474 iter != const_cast<const molecule *>(*MolWalker)->end(); 475 ++iter) { 459 476 LOG(3, "Current atom is " << **iter << "."); 460 477 for (vector<const element *>::const_iterator type = elements.begin(); type != elements.end(); ++type) … … 509 526 if ((*MolWalker)->empty()) 510 527 LOG(2, "\t is empty."); 511 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) { 528 for (molecule::const_iterator iter = const_cast<const molecule *>(*MolWalker)->begin(); 529 iter != const_cast<const molecule *>(*MolWalker)->end(); 530 ++iter) { 512 531 LOG(3, "\tCurrent atom is " << *(*iter) << "."); 513 532 for (vector<const element *>::const_iterator type = elements.begin(); type != elements.end(); ++type) … … 566 585 RealSpaceMatrix FullInverseMatrix = World::getInstance().getDomain().getMinv(); 567 586 LOG(2, "Current molecule is " << *MolWalker << "."); 568 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) { 587 for (molecule::const_iterator iter = const_cast<const molecule *>(*MolWalker)->begin(); 588 iter != const_cast<const molecule *>(*MolWalker)->end(); 589 ++iter) { 569 590 LOG(3, "Current atom is " << **iter << "."); 570 591 for (vector<const element *>::const_iterator type = elements.begin(); type != elements.end(); ++type) -
src/Atom/AtomSet.hpp
r1259df rf01769 95 95 value(startValue) 96 96 {} 97 T operator+( AtomInfo *atom){97 T operator+(const AtomInfo *atom){ 98 98 return value + (atom->*f)(); 99 99 } … … 112 112 value(startValue) 113 113 {} 114 T operator+( AtomInfo *atom){114 T operator+(const AtomInfo *atom){ 115 115 const T temp = (atom->*f)(); 116 116 return value < temp ? temp : value; … … 131 131 value(startValue) 132 132 {} 133 T operator+( AtomInfo *atom){133 T operator+(const AtomInfo *atom){ 134 134 return value + (atom->*f)(step); 135 135 } -
src/Atom/atom_bondedparticle.cpp
r1259df rf01769 375 375 * \return true - bond exists, false - bond does not exist 376 376 */ 377 bool BondedParticle::IsBondedTo(const unsigned int _step, BondedParticle * const BondPartner) const377 bool BondedParticle::IsBondedTo(const unsigned int _step, const BondedParticle * const BondPartner) const 378 378 { 379 379 bool status = false; -
src/Atom/atom_bondedparticle.hpp
r1259df rf01769 51 51 void removeAllBonds(); 52 52 void removeAllBonds(const unsigned int _step); 53 bool IsBondedTo(const unsigned int _step, BondedParticle * const BondPartner) const;53 bool IsBondedTo(const unsigned int _step, const BondedParticle * const BondPartner) const; 54 54 void ClearBondsAtStep(const unsigned int _step); 55 55 int CountBonds() const; -
src/AtomIdSet.cpp
r1259df rf01769 49 49 } 50 50 51 const atom * FromIdToConstAtom::operator()(atomId_t id) const { 52 return const_cast<const World &>(World::getInstance()).getAtom(AtomById(id)); 53 } 54 51 55 /** Constructor for class AtomIdSet. 52 56 * … … 101 105 */ 102 106 AtomIdSet::const_iterator AtomIdSet::begin() const{ 103 return const_iterator(atoms.begin(), FromIdTo Atom());107 return const_iterator(atoms.begin(), FromIdToConstAtom()); 104 108 } 105 109 … … 117 121 */ 118 122 AtomIdSet::const_iterator AtomIdSet::end() const{ 119 return const_iterator(atoms.end(), FromIdTo Atom());123 return const_iterator(atoms.end(), FromIdToConstAtom()); 120 124 } 121 125 … … 176 180 AtomIdSet::const_iterator AtomIdSet::find(const atomId_t &id) const 177 181 { 178 return const_iterator(atoms.find(id), FromIdTo Atom());182 return const_iterator(atoms.find(id), FromIdToConstAtom()); 179 183 } 180 184 … … 223 227 AtomIdSet::const_iterator AtomIdSet::erase(const atom * const key) 224 228 { 225 const_iterator iter = find(key);226 if (iter != end()){229 const_iterator iter = const_cast<const AtomIdSet &>(*this).find(key); 230 if (iter != const_cast<const AtomIdSet &>(*this).end()){ 227 231 ++iter; 228 232 atoms.erase( key->getId() ); … … 243 247 atoms.erase( id ); 244 248 } 245 return iterator(iter, FromIdToAtom());246 } 249 return const_iterator(iter, FromIdToConstAtom()); 250 } -
src/AtomIdSet.hpp
r1259df rf01769 31 31 }; 32 32 33 struct FromIdToConstAtom : 34 public std::unary_function<const atom *, atomId_t> 35 { 36 const atom * operator()(atomId_t id) const; 37 }; 38 33 39 /** AtomIdSet is a set of atomic ids that however behave as a set of atoms. 34 40 * … … 41 47 typedef std::set<atomId_t> atomIdSet; 42 48 typedef boost::transform_iterator<FromIdToAtom, atomIdSet::iterator, atom *, atomId_t> iterator; 43 typedef boost::transform_iterator<FromIdTo Atom, atomIdSet::const_iterator, const atom *, atomId_t const &> const_iterator;49 typedef boost::transform_iterator<FromIdToConstAtom, atomIdSet::const_iterator, const atom *, atomId_t const &> const_iterator; 44 50 45 51 AtomIdSet(const atomIdSet &_atoms); -
src/Bond/BondInfo.cpp
r1259df rf01769 87 87 void BondInfo::RemoveBond() const 88 88 { 89 atom * leftatom = World::getInstance().getAtom(AtomById(leftid));90 atom * rightatom = World::getInstance().getAtom(AtomById(rightid));89 atom * const leftatom = World::getInstance().getAtom(AtomById(leftid)); 90 atom * const rightatom = World::getInstance().getAtom(AtomById(rightid)); 91 91 leftatom->removeBond(rightatom); 92 92 } -
src/Descriptors/unittests/AtomDescriptorUnitTest.cpp
r1259df rf01769 122 122 { 123 123 // test Atoms from boundaries and middle of the set 124 atom* testAtom; 125 testAtom = World::getInstance().getAtom(AtomById(atomIds[0])); 124 const atom* testAtom; 125 testAtom = const_cast<const World &>(World::getInstance()). 126 getAtom(AtomById(atomIds[0])); 126 127 CPPUNIT_ASSERT(testAtom); 127 128 CPPUNIT_ASSERT_EQUAL( atomIds[0], testAtom->getId()); 128 testAtom = World::getInstance().getAtom(AtomById(atomIds[ATOM_COUNT/2])); 129 testAtom = const_cast<const World &>(World::getInstance()). 130 getAtom(AtomById(atomIds[ATOM_COUNT/2])); 129 131 CPPUNIT_ASSERT(testAtom); 130 132 CPPUNIT_ASSERT_EQUAL( atomIds[ATOM_COUNT/2], testAtom->getId()); 131 testAtom = World::getInstance().getAtom(AtomById(atomIds[ATOM_COUNT-1])); 133 testAtom = const_cast<const World &>(World::getInstance()). 134 getAtom(AtomById(atomIds[ATOM_COUNT-1])); 132 135 CPPUNIT_ASSERT(testAtom); 133 136 CPPUNIT_ASSERT_EQUAL( atomIds[ATOM_COUNT-1], testAtom->getId()); … … 143 146 } 144 147 // test from outside of set 145 testAtom = World::getInstance().getAtom(AtomById(outsideId)); 148 testAtom = const_cast<const World &>(World::getInstance()). 149 getAtom(AtomById(outsideId)); 146 150 CPPUNIT_ASSERT(!testAtom); 147 151 } … … 172 176 void AtomDescriptorTest::AtomOrderTest() 173 177 { 174 atom* testAtom;178 const atom* testAtom; 175 179 176 180 // test in normal order: 1, 2, ... 177 181 for(int i=1;i<=ATOM_COUNT;++i){ 178 testAtom = World::getInstance().getAtom(AtomByOrder(i)); 182 testAtom = const_cast<const World &>(World::getInstance()). 183 getAtom(AtomByOrder(i)); 179 184 CPPUNIT_ASSERT_EQUAL( atomIds[i-1], testAtom->getId()); 180 185 } … … 182 187 // test in reverse order: -1, -2, ... 183 188 for(int i=1; i<= ATOM_COUNT;++i){ 184 testAtom = World::getInstance().getAtom(AtomByOrder(-i)); 189 testAtom = const_cast<const World &>(World::getInstance()). 190 getAtom(AtomByOrder(-i)); 185 191 CPPUNIT_ASSERT_EQUAL( atomIds[(int)ATOM_COUNT-i], testAtom->getId()); 186 192 } 187 193 188 194 // test from outside of set 189 testAtom = World::getInstance().getAtom(AtomByOrder(ATOM_COUNT+1)); 195 testAtom = const_cast<const World &>(World::getInstance()). 196 getAtom(AtomByOrder(ATOM_COUNT+1)); 190 197 CPPUNIT_ASSERT(!testAtom); 191 testAtom = World::getInstance().getAtom(AtomByOrder(-ATOM_COUNT-1)); 198 testAtom = const_cast<const World &>(World::getInstance()). 199 getAtom(AtomByOrder(-ATOM_COUNT-1)); 192 200 CPPUNIT_ASSERT(!testAtom); 193 201 } -
src/Filling/unittests/ClusterUnitTest.cpp
r1259df rf01769 120 120 // erase non-existing atom 121 121 const atomId_t falseId = _atomId+1; 122 CPPUNIT_ASSERT_EQUAL( (atom *)NULL, World::getInstance().getAtom(AtomById(falseId)) ); 122 CPPUNIT_ASSERT_EQUAL( 123 (const atom *)NULL, 124 const_cast<const World &>(World::getInstance()).getAtom(AtomById(falseId)) ); 123 125 #ifndef NDEBUG 124 126 std::cout << "The following Assertion is intended and does not present a failure of the test." << std::endl; … … 189 191 // insert non-existing atom 190 192 const atomId_t falseId = _atomId+1; 191 CPPUNIT_ASSERT_EQUAL( (atom *)NULL, World::getInstance().getAtom(AtomById(falseId)) ); 193 CPPUNIT_ASSERT_EQUAL( 194 (const atom *)NULL, 195 const_cast<const World &>(World::getInstance()).getAtom(AtomById(falseId)) ); 192 196 #ifndef NDEBUG 193 197 std::cout << "The following Assertion is intended and does not present a failure of the test." << std::endl; … … 299 303 // check for same position 300 304 atomId_t id = *(clonedCluster->getAtomIds().begin()); 301 const atom * const _atom = World::getInstance().getAtom(AtomById(id)); 305 const atom * const _atom = const_cast<const World &>(World::getInstance()). 306 getAtom(AtomById(id)); 302 307 CPPUNIT_ASSERT( _atom != NULL ); 303 308 CPPUNIT_ASSERT( (*cluster->getAtomRefs().begin())->getPosition() ==_atom->getPosition() ); -
src/Fragmentation/Fragmentation.cpp
r1259df rf01769 169 169 // ===== 2. create AtomMask that takes Saturation condition into account 170 170 AtomMask_t AtomMask(atomids); 171 for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) { 171 for (molecule::const_iterator iter = const_cast<const molecule *>(mol)->begin(); 172 iter != const_cast<const molecule *>(mol)->end(); 173 ++iter) { 172 174 // remove in hydrogen and we do saturate 173 175 if ((treatment == ExcludeHydrogen) && ((*iter)->getType()->getAtomicNumber() == 1)) // skip hydrogen … … 269 271 // Construct the complete KeySet which we need for topmost level only (but for all Roots) 270 272 KeySet CompleteMolecule; 271 for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) { 273 for (molecule::const_iterator iter = const_cast<const molecule *>(mol)->begin(); 274 iter != const_cast<const molecule *>(mol)->end(); 275 ++iter) { 272 276 CompleteMolecule.insert((*iter)->GetTrueFather()->getNr()); 273 277 } … … 353 357 int FragmentCount; 354 358 // get maximum bond degree 355 for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) { 359 for (molecule::const_iterator iter = const_cast<const molecule *>(mol)->begin(); 360 iter != const_cast<const molecule *>(mol)->end(); 361 ++iter) { 356 362 const BondList& ListOfBonds = (*iter)->getListOfBonds(); 357 363 c = (ListOfBonds.size() > c) ? ListOfBonds.size() : c; … … 442 448 output << "INFO: Writing OrderAtSite " << ORDERATSITEFILE << " ... "; 443 449 if (file.good()) { 444 for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) { 450 for (molecule::const_iterator iter = const_cast<const molecule *>(mol)->begin(); 451 iter != const_cast<const molecule *>(mol)->end(); 452 ++iter) { 445 453 file << (*iter)->getId() 446 454 << "\t" << (int)(*iter)->AdaptiveOrder … … 529 537 void Fragmentation::FillRootStackForSubgraphs(KeyStack &RootStack, const AtomMask_t &AtomMask) 530 538 { 531 for(molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) { 539 for(molecule::const_iterator iter = const_cast<const molecule *>(mol)->begin(); 540 iter != const_cast<const molecule *>(mol)->end(); 541 ++iter) { 532 542 const atom * const Father = (*iter)->GetTrueFather(); 533 543 if (AtomMask.isTrue(Father->getNr())) // apply mask -
src/Fragmentation/Graph.cpp
r1259df rf01769 265 265 keyiter != iter->first.end(); ++keyiter) { 266 266 const size_t globalid = *keyiter; 267 const atom *Walker = World::getInstance().getAtom(AtomById(globalid)); 267 const atom * const Walker = const_cast<const World &>(World::getInstance()). 268 getAtom(AtomById(globalid)); 268 269 if (Walker != NULL) { 269 270 if (Walker->getMolecule() != mol) { -
src/Fragmentation/Homology/HomologyGraph_getFromKeyset.cpp
r1259df rf01769 59 59 iter != keyset.end(); ++iter) { 60 60 // LOG(2, "DEBUG: Current global id is " << *iter << "."); 61 const atom *Walker = World::getInstance().getAtom(AtomById(*iter)); 61 const atom * const Walker = const_cast<const World &>(World::getInstance()). 62 getAtom(AtomById(*iter)); 62 63 if (Walker != NULL) { 63 64 size_t NoBonds = 0; … … 65 66 for (BondList::const_iterator bonditer = ListOfBonds.begin(); 66 67 bonditer != ListOfBonds.end(); ++bonditer) { 67 const atom * OtherWalker = (*bonditer)->GetOtherAtom(Walker);68 const atom * const OtherWalker = (*bonditer)->GetOtherAtom(Walker); 68 69 if (keyset.count(OtherWalker->getId())) 69 70 ++NoBonds; … … 89 90 iter != keyset.end(); ++iter) { 90 91 // LOG(2, "DEBUG: Current global id is " << *iter << "."); 91 const atom *Walker = World::getInstance().getAtom(AtomById(*iter)); 92 const atom * const Walker = const_cast<const World &>(World::getInstance()). 93 getAtom(AtomById(*iter)); 92 94 if (Walker != NULL) { 93 95 const BondList& ListOfBonds = Walker->getListOfBonds(); 94 96 for (BondList::const_iterator bonditer = ListOfBonds.begin(); 95 97 bonditer != ListOfBonds.end(); ++bonditer) { 96 const atom * OtherWalker = (*bonditer)->GetOtherAtom(Walker);98 const atom * const OtherWalker = (*bonditer)->GetOtherAtom(Walker); 97 99 // LOG(2, "DEBUG: Neighbor is " << OtherWalker->getId() << "."); 98 100 if ((keyset.count(OtherWalker->getId())) && (Walker->getId() < OtherWalker->getId())) { -
src/Graph/AdjacencyList.cpp
r1259df rf01769 129 129 ASSERT(WalkerId != (size_t)-1, 130 130 "AdjacencyList::CreateMap() - Walker has no id."); 131 const atom *Walker = World::getInstance().getAtom(AtomById(WalkerId)); 131 const atom * const Walker = const_cast<const World &>(World::getInstance()). 132 getAtom(AtomById(WalkerId)); 132 133 ASSERT( Walker != NULL, 133 134 "AdjacencyList::CreateMap() - Walker id "+toString(*iter) -
src/Graph/BuildInducedSubgraph.cpp
r1259df rf01769 46 46 47 47 48 BuildInducedSubgraph::BuildInducedSubgraph(molecule * const _Son, constmolecule * const _Father) :48 BuildInducedSubgraph::BuildInducedSubgraph(molecule * const _Son, molecule * const _Father) : 49 49 Son(_Son), 50 50 Father(_Father) -
src/Graph/BuildInducedSubgraph.hpp
r1259df rf01769 22 22 { 23 23 public: 24 BuildInducedSubgraph(molecule * const _Son, constmolecule * const _Father);24 BuildInducedSubgraph(molecule * const _Son, molecule * const _Father); 25 25 ~BuildInducedSubgraph(); 26 26 … … 39 39 std::map<atom *, atom*> ParentList; 40 40 molecule * const Son; 41 constmolecule * const Father;41 molecule * const Father; 42 42 43 43 void FillParentList(); -
src/Parameters/Specifics/Value_molecule.cpp
r1259df rf01769 42 42 #include "World.hpp" 43 43 44 static const molecule * FindMoleculeByName(const std::string &_name)45 {46 const molecule * _mol = NULL;47 const vector<const molecule *> molecules = const_cast<const World &>(World::getInstance()).48 getAllMolecules(MoleculeByName(_name));49 _mol = *molecules.begin();50 return _mol;51 }52 53 44 template <> 54 45 bool Value<const molecule *>::isValidAsString(const std::string &_value) const throw(ParameterValidatorException) 55 46 { 56 return ( FindMoleculeByName(_value) != NULL);47 return (const_cast<const World &>(World::getInstance()).getMolecule(MoleculeByName(_value)) != NULL); 57 48 } 58 49 … … 66 57 void Value<const molecule *>::setAsString(const std::string &_value) throw(ParameterException) 67 58 { 68 const molecule * temp = FindMoleculeByName(_value); 59 const molecule * temp = const_cast<const World &>(World::getInstance()). 60 getMolecule(MoleculeByName(_value)); 69 61 if (temp != NULL) 70 62 set(temp); -
src/Parameters/StreamOperators.hpp
r1259df rf01769 113 113 ConvertTo<unsigned int> converter; 114 114 const atomId_t temp_value = converter(line); 115 const atom *a = World::getInstance().getAtom(AtomById(temp_value)); 115 const atom * const a = const_cast<const World &>(World::getInstance()). 116 getAtom(AtomById(temp_value)); 116 117 ASSERT( a != NULL, 117 118 "operator>>(std::istream& ist, const atom* & m) - atom molecule id " … … 127 128 ConvertTo<unsigned int> converter; 128 129 const moleculeId_t temp_value = converter(line); 129 const molecule * mol = const_cast<const World &>(World::getInstance()).130 const molecule * const mol = const_cast<const World &>(World::getInstance()). 130 131 getMolecule(MoleculeById(temp_value)); 131 132 ASSERT( mol != NULL, … … 185 186 iter != tok.end(); ++iter) { 186 187 const atomId_t temp_value = converter(line); 187 const atom *a = World::getInstance().getAtom(AtomById(temp_value)); 188 const atom * const a = const_cast<const World &>(World::getInstance()). 189 getAtom(AtomById(temp_value)); 188 190 ASSERT( a != NULL, 189 191 "operator>>(std::istream& ist, std::vector<const atom*> & m) - invalid atom id " … … 205 207 iter != tok.end(); ++iter) { 206 208 const atomicNumber_t temp_value = converter(*iter); 207 const element * elem = World::getInstance().getPeriode()->FindElement(temp_value);209 const element * const elem = World::getInstance().getPeriode()->FindElement(temp_value); 208 210 ASSERT( elem != NULL, 209 211 "operator>>(std::istream& ist, std::vector<const element*> & m) - invalid atomic number " -
src/Parameters/Validators/Specific/AtomIdValidator.cpp
r1259df rf01769 43 43 bool AtomIdValidator::isValid(const atomId_t & _value) const 44 44 { 45 return ( World::getInstance().getAtom(AtomById(_value)) != NULL);45 return (const_cast<const World &>(World::getInstance()).getAtom(AtomById(_value)) != NULL); 46 46 } 47 47 -
src/Parser/PdbParser.cpp
r1259df rf01769 828 828 829 829 // add neighbours 830 atom * _atom = World::getInstance().getAtom(AtomById(getGlobalId(id)));830 atom * const _atom = World::getInstance().getAtom(AtomById(getGlobalId(id))); 831 831 LOG(2, "STATUS: Atom " << _atom->getId() << " gets " << ListOfNeighbors.size() << " more neighbours."); 832 832 for (std::list<size_t>::const_iterator iter = ListOfNeighbors.begin(); -
src/Parser/unittests/ParserTremoloUnitTest.cpp
r1259df rf01769 193 193 input << Tremolo_Atomdata2; 194 194 parser->load(&input); 195 CPPUNIT_ASSERT( World::getInstance().getAtom(AtomByType(1))->at(0) == 3.0);195 CPPUNIT_ASSERT(const_cast<const World &>(World::getInstance()).getAtom(AtomByType(1))->at(0) == 3.0); 196 196 input.clear(); 197 197 } … … 203 203 input << Tremolo_velocity; 204 204 parser->load(&input); 205 CPPUNIT_ASSERT( World::getInstance().getAtom(AtomByType(1))->getAtomicVelocity()[0] == 3.0);205 CPPUNIT_ASSERT(const_cast<const World &>(World::getInstance()).getAtom(AtomByType(1))->getAtomicVelocity()[0] == 3.0); 206 206 input.clear(); 207 207 } … … 215 215 216 216 CPPUNIT_ASSERT_EQUAL(3, World::getInstance().numAtoms()); 217 CPPUNIT_ASSERT( World::getInstance().getAtom(AtomByType(8))->218 IsBondedTo(WorldTime::getTime(), World::getInstance().getAtom(AtomByType(1))));217 CPPUNIT_ASSERT(const_cast<const World &>(World::getInstance()).getAtom(AtomByType(8))-> 218 IsBondedTo(WorldTime::getTime(), const_cast<const World &>(World::getInstance()).getAtom(AtomByType(1)))); 219 219 input.clear(); 220 220 } -
src/Tesselation/boundary.cpp
r1259df rf01769 173 173 * and looks at triples: if the middle has less a distance than the allowed maximum height of the triangle formed by the plane's 174 174 * center and first and last point in the triple, it is thrown out. 175 * 176 * \todo When storing const ptrs in tesselation structures, remove const_cast 177 * 175 178 * \param *out output stream for debugging 176 179 * \param *mol molecule structure representing the cluster … … 206 209 // 3b. construct set of all points, transformed into cylindrical system and with left and right neighbours 207 210 // Boundaries stores non-const TesselPoint ref, hence we need iterator here 208 for (molecule:: iterator iter = mol->begin(); iter != mol->end(); ++iter) {211 for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) { 209 212 ProjectedVector = (*iter)->getPosition() - (MolCenter); 210 213 ProjectedVector.ProjectOntoPlane(AxisVector); … … 222 225 } 223 226 LOG(1, "Inserting " << **iter << ": (r, alpha) = (" << radius << "," << angle << "): " << ProjectedVector); 224 BoundaryTestPair = BoundaryPoints[axis].insert(BoundariesPair(angle, TesselPointDistancePair (radius, (*iter)))); 227 BoundaryTestPair = BoundaryPoints[axis].insert( 228 BoundariesPair(angle, TesselPointDistancePair (radius, const_cast<atom *>(*iter)))); 225 229 if (!BoundaryTestPair.second) { // same point exists, check first r, then distance of original vectors to center of gravity 226 230 LOG(2, "Encountered two vectors whose projection onto axis " << axis << " is equal: "); … … 230 234 if ((ProjectedVectorNorm - BoundaryTestPair.first->second.first) > MYEPSILON) { 231 235 BoundaryTestPair.first->second.first = ProjectedVectorNorm; 232 BoundaryTestPair.first->second.second = (*iter);236 BoundaryTestPair.first->second.second = const_cast<atom *>(*iter); 233 237 LOG(2, "Keeping new vector due to larger projected distance " << ProjectedVectorNorm << "."); 234 238 } else if (fabs(ProjectedVectorNorm - BoundaryTestPair.first->second.first) < MYEPSILON) { … … 237 241 helper = BoundaryTestPair.first->second.second->getPosition() - (MolCenter); 238 242 if (helper.NormSquared() < oldhelperNorm) { 239 BoundaryTestPair.first->second.second = (*iter);243 BoundaryTestPair.first->second.second = const_cast<atom *>(*iter); 240 244 LOG(2, "Keeping new vector due to larger distance to molecule center " << helper.NormSquared() << "."); 241 245 } else { -
src/UIElements/CommandLineUI/Query/AtomCommandLineQuery.cpp
r1259df rf01769 64 64 return false; 65 65 } 66 temp = World::getInstance().getAtom(AtomById(IdxOfAtom));66 temp = const_cast<const World &>(World::getInstance()).getAtom(AtomById(IdxOfAtom)); 67 67 return true; 68 68 } -
src/UIElements/CommandLineUI/Query/AtomsCommandLineQuery.cpp
r1259df rf01769 61 61 const atom *temp_element; 62 62 for (std::vector<int>::iterator iter = IdxOfAtom.begin(); iter != IdxOfAtom.end(); ++iter) { 63 temp_element = World::getInstance().getAtom(AtomById(*iter));63 temp_element = const_cast<const World &>(World::getInstance()).getAtom(AtomById(*iter)); 64 64 if (temp_element) 65 65 temp.push_back(temp_element); -
src/UIElements/CommandLineUI/Query/MoleculeCommandLineQuery.cpp
r1259df rf01769 59 59 return false; 60 60 } 61 temp = World::getInstance().getMolecule(MoleculeById(IdxOfMol));61 temp = const_cast<const World &>(World::getInstance()).getMolecule(MoleculeById(IdxOfMol)); 62 62 return true; 63 63 } -
src/UIElements/Qt4/Query/AtomQtQuery.cpp
r1259df rf01769 73 73 QVariant data = inputBox->itemData(newIndex); 74 74 int idx = data.toInt(); 75 temp = World::getInstance().getAtom(AtomById(idx));75 temp = const_cast<const World &>(World::getInstance()).getAtom(AtomById(idx)); 76 76 dialog->update(); 77 77 } -
src/UIElements/Qt4/Query/MoleculeQtQuery.cpp
r1259df rf01769 78 78 QVariant data = inputBox->itemData(newIndex); 79 79 int idx = data.toInt(); 80 temp = World::getInstance().getMolecule(MoleculeById(idx));80 temp = const_cast<const World &>(World::getInstance()).getMolecule(MoleculeById(idx)); 81 81 dialog->update(); 82 82 } -
src/UIElements/TextUI/Query/AtomTextQuery.cpp
r1259df rf01769 66 66 } 67 67 68 temp = World::getInstance().getAtom(AtomById(idxOfAtom));68 temp = const_cast<const World &>(World::getInstance()).getAtom(AtomById(idxOfAtom)); 69 69 if(!temp && idxOfAtom!=-1){ 70 70 std::cout << "Invalid Atom Index" << idxOfAtom << std::endl; -
src/UIElements/TextUI/Query/AtomsTextQuery.cpp
r1259df rf01769 64 64 std::istringstream stream(std::string(iter, olditer)); 65 65 stream >> idxOfAtom; 66 temp_element = World::getInstance().getAtom(AtomById(idxOfAtom));66 temp_element = const_cast<const World &>(World::getInstance()).getAtom(AtomById(idxOfAtom)); 67 67 if(!temp_element && idxOfAtom!=-1){ 68 68 std::cout << "Invalid Atom Index" << idxOfAtom << std::endl; … … 76 76 std::istringstream stream(std::string(olditer, line.end())); 77 77 stream >> idxOfAtom; 78 temp_element = World::getInstance().getAtom(AtomById(idxOfAtom));78 temp_element = const_cast<const World &>(World::getInstance()).getAtom(AtomById(idxOfAtom)); 79 79 if(!temp_element && idxOfAtom!=-1) { 80 80 std::cout << "Invalid Atom Index" << idxOfAtom << std::endl; -
src/UIElements/TextUI/Query/MoleculeTextQuery.cpp
r1259df rf01769 67 67 } 68 68 69 temp = World::getInstance().getMolecule(MoleculeById(idxOfMol));69 temp = const_cast<const World &>(World::getInstance()).getMolecule(MoleculeById(idxOfMol)); 70 70 if(!temp && idxOfMol!=-1){ 71 71 std::cout << "Invalid Molecule Index" << std::endl; -
src/UIElements/TextUI/Query/MoleculesTextQuery.cpp
r1259df rf01769 64 64 std::istringstream stream(std::string(iter, olditer)); 65 65 stream >> idxOfMol; 66 temp_element = World::getInstance().getMolecule(MoleculeById(idxOfMol));66 temp_element = const_cast<const World &>(World::getInstance()).getMolecule(MoleculeById(idxOfMol)); 67 67 if(!temp_element && idxOfMol!=-1){ 68 68 std::cout << "Invalid Molecule Index" << idxOfMol << std::endl; … … 76 76 std::istringstream stream(std::string(olditer, line.end())); 77 77 stream >> idxOfMol; 78 temp_element = World::getInstance().getMolecule(MoleculeById(idxOfMol));78 temp_element = const_cast<const World &>(World::getInstance()).getMolecule(MoleculeById(idxOfMol)); 79 79 if(!temp_element && idxOfMol!=-1){ 80 80 std::cout << "Invalid Molecule Index" << idxOfMol << std::endl; -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_atom.cpp
r1259df rf01769 61 61 { 62 62 // sign on as observer (obtain non-const instance before) 63 const atom *_atom = World::getInstance().getAtom(AtomById(atomicid)); 63 const atom * const _atom = const_cast<const World &>(World::getInstance()). 64 getAtom(AtomById(atomicid)); 64 65 if (_atom != NULL) { 65 66 _atom->signOn(this, AtomObservable::IndexChanged); … … 82 83 GLMoleculeObject_atom::~GLMoleculeObject_atom() 83 84 { 84 const atom *_atom = World::getInstance().getAtom(AtomById(atomicid)); 85 const atom * const _atom = const_cast<const World &>(World::getInstance()). 86 getAtom(AtomById(atomicid)); 85 87 if (_atom != NULL){ 86 88 _atom->signOff(this, AtomObservable::IndexChanged); … … 102 104 void GLMoleculeObject_atom::resetPosition() 103 105 { 104 const atom *_atom = World::getInstance().getAtom(AtomById(atomicid)); 106 const atom * const _atom = const_cast<const World &>(World::getInstance()). 107 getAtom(AtomById(atomicid)); 105 108 if (_atom != NULL) { 106 109 const Vector Position = _atom->getPosition(); … … 116 119 { 117 120 size_t elementno = 0; 118 const atom *_atom = World::getInstance().getAtom(AtomById(atomicid)); 121 const atom * const _atom = const_cast<const World &>(World::getInstance()). 122 getAtom(AtomById(atomicid)); 119 123 const element *_type = NULL; 120 124 if (_atom != NULL) { … … 192 196 void GLMoleculeObject_atom::recieveNotification(Observable *publisher, Notification_ptr notification) 193 197 { 194 const atom *_atom = World::getInstance().getAtom(AtomById(atomicid)); 198 const atom * const _atom = const_cast<const World &>(World::getInstance()). 199 getAtom(AtomById(atomicid)); 195 200 if (publisher == dynamic_cast<const Observable*>(_atom)){ 196 201 // notofication from atom … … 212 217 case AtomObservable::BondsAdded: 213 218 { 214 const atom *_atom = World::getInstance().getAtom(AtomById(atomicid)); 219 const atom * const _atom = const_cast<const World &>(World::getInstance()). 220 getAtom(AtomById(atomicid)); 215 221 if (_atom != NULL) { 216 222 // make sure position is up-to-date -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_bond.cpp
r1259df rf01769 91 91 case left: 92 92 { 93 const atom *_rightatom = World::getInstance().getAtom(AtomById(rightatomId)); 93 const atom * const _rightatom = const_cast<const World &>(World::getInstance()). 94 getAtom(AtomById(rightatomId)); 94 95 if (_rightatom->getType() != NULL) { 95 96 elementno = _rightatom->getType()->getAtomicNumber(); … … 101 102 case right: 102 103 { 103 const atom *_leftatom = World::getInstance().getAtom(AtomById(leftatomId)); 104 const atom * const _leftatom = const_cast<const World &>(World::getInstance()). 105 getAtom(AtomById(leftatomId)); 104 106 if (_leftatom->getType() != NULL) { 105 107 elementno = _leftatom->getType()->getAtomicNumber(); … … 138 140 // from the AtomObservable itself 139 141 if (leftobservable_enabled) { 140 const atom *_leftatom = World::getInstance().getAtom(AtomById(leftatomId)); 142 const atom * const _leftatom = const_cast<const World &>(World::getInstance()). 143 getAtom(AtomById(leftatomId)); 141 144 if (_leftatom != NULL) { 142 145 _leftatom->signOff(this); … … 152 155 // from the AtomObservable itself 153 156 if (rightobservable_enabled) { 154 const atom *_rightatom = World::getInstance().getAtom(AtomById(rightatomId)); 157 const atom * const _rightatom = const_cast<const World &>(World::getInstance()). 158 getAtom(AtomById(rightatomId)); 155 159 if (_rightatom != NULL) { 156 160 _rightatom->signOff(this); … … 172 176 // from the AtomObservable itself 173 177 if (leftobservable_enabled) { 174 const atom *_leftatom = World::getInstance().getAtom(AtomById(leftatomId)); 178 const atom * const _leftatom = const_cast<const World &>(World::getInstance()). 179 getAtom(AtomById(leftatomId)); 175 180 if (_leftatom != NULL) { 176 181 _leftatom->signOff(this, AtomObservable::PositionChanged); … … 182 187 } 183 188 if (rightobservable_enabled) { 184 const atom *_rightatom = World::getInstance().getAtom(AtomById(rightatomId)); 189 const atom * const _rightatom = const_cast<const World &>(World::getInstance()). 190 getAtom(AtomById(rightatomId)); 185 191 if (_rightatom != NULL) { 186 192 _rightatom->signOff(this, AtomObservable::PositionChanged); … … 349 355 Vector Position; 350 356 Vector OtherPosition; 351 const atom *_leftatom = World::getInstance().getAtom(AtomById(leftatomId)); 357 const atom * const _leftatom = const_cast<const World &>(World::getInstance()). 358 getAtom(AtomById(leftatomId)); 352 359 Vector LeftPos = _leftatom->getPosition(); 353 const atom *_rightatom = World::getInstance().getAtom(AtomById(rightatomId)); 360 const atom * const _rightatom = const_cast<const World &>(World::getInstance()). 361 getAtom(AtomById(rightatomId)); 354 362 Vector RightPos = _rightatom->getPosition(); 355 363 switch (BondSide) { -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.cpp
r1259df rf01769 567 567 568 568 // add all bonds 569 const atom *Walker = World::getInstance().getAtom(AtomById(_id)); 569 const atom * const Walker = const_cast<const World &>(World::getInstance()). 570 getAtom(AtomById(_id)); 570 571 if (Walker != NULL) 571 572 addAtomBonds(Walker); -
src/UIElements/Views/Qt4/Qt3D/GLWorldScene.cpp
r1259df rf01769 143 143 { 144 144 LOG(3, "INFO: GLMoleculeObject_molecule - atom " << no << " has been clicked."); 145 const atom *Walker = World::getInstance().getAtom(AtomById(no)); 145 const atom * const Walker = const_cast<const World &>(World::getInstance()). 146 getAtom(AtomById(no)); 146 147 if (selectionMode == SelectAtom){ 147 148 if (!World::getInstance().isSelected(Walker)) … … 184 185 LOG(3, "INFO: GLWorldScene: Received signal atomInserted for atom "+toString(_id)+"."); 185 186 // find associated molecule 186 const atom *_atom = World::getInstance().getAtom(AtomById(_id)); 187 const atom * const _atom = const_cast<const World &>(World::getInstance()). 188 getAtom(AtomById(_id)); 187 189 if (_atom != NULL) { 188 190 const moleculeId_t molid = _atom->getMolecule()->getId(); -
src/UIElements/Views/Qt4/QtFragmentList.cpp
r1259df rf01769 133 133 indexiter != (*keyiter)->end(); 134 134 ++indexiter) { 135 const atom *_atom = World::getInstance().getAtom(AtomById(*indexiter)); 135 const atom * const _atom = const_cast<const World &>(World::getInstance()). 136 getAtom(AtomById(*indexiter)); 136 137 if (_atom != NULL) 137 138 formula.addElements(_atom->getElementNo(), 1); -
src/molecule.cpp
r1259df rf01769 242 242 NOTIFY(AtomRemoved); 243 243 } 244 const_iterator iter = find(key);245 if (iter != end()){244 const_iterator iter = const_cast<const molecule &>(*this).find(key); 245 if (iter != const_cast<const molecule &>(*this).end()){ 246 246 ++iter; 247 247 atomIds.erase( key->getId() ); … … 285 285 } 286 286 287 World::AtomComposite molecule::getAtomSet() const287 World::AtomComposite molecule::getAtomSet() 288 288 { 289 289 World::AtomComposite vector_of_atoms; 290 290 for (molecule::iterator iter = begin(); iter != end(); ++iter) 291 vector_of_atoms.push_back(*iter); 292 return vector_of_atoms; 293 } 294 295 World::ConstAtomComposite molecule::getAtomSet() const 296 { 297 World::ConstAtomComposite vector_of_atoms; 298 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) 291 299 vector_of_atoms.push_back(*iter); 292 300 return vector_of_atoms; … … 609 617 * \return copy of molecule 610 618 */ 611 molecule *molecule::CopyMolecule(const Vector &offset) const619 molecule *molecule::CopyMolecule(const Vector &offset) 612 620 { 613 621 molecule *copy = World::getInstance().createMolecule(); … … 622 630 623 631 // copy all bonds 624 for(const_iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner) { 632 for(const_iterator AtomRunner = const_cast<const molecule &>(*this).begin(); 633 AtomRunner != const_cast<const molecule &>(*this).end(); 634 ++AtomRunner) { 625 635 const BondList& ListOfBonds = (*AtomRunner)->getListOfBonds(); 626 636 for(BondList::const_iterator BondRunner = ListOfBonds.begin(); … … 676 686 * @param three vectors forming the matrix that defines the shape of the parallelpiped 677 687 */ 678 molecule* molecule::CopyMoleculeFromSubRegion(const Shape ®ion) const{688 molecule* molecule::CopyMoleculeFromSubRegion(const Shape ®ion) { 679 689 molecule *copy = World::getInstance().createMolecule(); 680 690 … … 689 699 690 700 // copy all bonds 691 for(molecule::const_iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner) { 701 for(molecule::const_iterator AtomRunner = const_cast<const molecule &>(*this).begin(); 702 AtomRunner != const_cast<const molecule &>(*this).end(); 703 ++AtomRunner) { 692 704 const BondList& ListOfBonds = (*AtomRunner)->getListOfBonds(); 693 705 for(BondList::const_iterator BondRunner = ListOfBonds.begin(); … … 821 833 * @return true - is member, false - is not 822 834 */ 823 bool molecule::isInMolecule(const atom * const _atom) 835 bool molecule::isInMolecule(const atom * const _atom) const 824 836 { 825 837 ASSERT(_atom->getMolecule() == this, … … 934 946 * \todo make this with a good sort O(n), not O(n^2) 935 947 */ 936 int * molecule::GetFatherSonAtomicMap( molecule *OtherMolecule)948 int * molecule::GetFatherSonAtomicMap(const molecule * const OtherMolecule) 937 949 { 938 950 LOG(3, "Begin of GetFatherAtomicMap."); … … 947 959 std::stringstream output; 948 960 output << "Map is "; 949 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) { 961 for (molecule::const_iterator iter = const_cast<const molecule &>(*this).begin(); 962 iter != const_cast<const molecule &>(*this).end(); 963 ++iter) { 950 964 if ((*iter)->getFather() == NULL) { 951 965 AtomicMap[(*iter)->getNr()] = -2; -
src/molecule.hpp
r1259df rf01769 141 141 virtual bool changeId(atomId_t newId); 142 142 143 World::AtomComposite getAtomSet() const; 143 World::AtomComposite getAtomSet(); 144 World::ConstAtomComposite getAtomSet() const; 144 145 145 146 // simply pass on all functions to AtomIdSet … … 287 288 atom * FindAtom(int Nr) const; 288 289 atom * AskAtom(std::string text); 289 bool isInMolecule(const atom * const _atom) ;290 bool isInMolecule(const atom * const _atom) const; 290 291 291 292 /// Count and change present atoms' coordination. … … 318 319 bond::ptr CopyBond(atom *left, atom *right, bond::ptr CopyBond); 319 320 320 molecule *CopyMolecule(const Vector &offset = zeroVec) const;321 molecule* CopyMoleculeFromSubRegion(const Shape&) const;321 molecule *CopyMolecule(const Vector &offset = zeroVec); 322 molecule* CopyMoleculeFromSubRegion(const Shape&); 322 323 323 324 /// Fragment molecule by two different approaches: … … 326 327 327 328 // Recognize doubly appearing molecules in a list of them 328 int * GetFatherSonAtomicMap( molecule *OtherMolecule);329 int * GetFatherSonAtomicMap(const molecule * const OtherMolecule); 329 330 bool FillBondStructureFromReference(const molecule * const reference, ListOfLocalAtoms_t &ListOfLocalAtoms, bool FreeList = false); 330 331 bool FillListOfLocalAtoms(ListOfLocalAtoms_t &ListOfLocalAtoms, const int GlobalAtomCount); -
src/molecule_geometry.cpp
r1259df rf01769 110 110 void molecule::CenterEdge() 111 111 { 112 const_iterator iter = begin();113 if (iter != end()) { //list not empty?112 const_iterator iter = const_cast<const molecule &>(*this).begin(); 113 if (iter != const_cast<const molecule &>(*this).end()) { //list not empty? 114 114 Vector min = (*begin())->getPosition(); 115 for (;iter != end(); ++iter) { // continue with second if present115 for (;iter != const_cast<const molecule &>(*this).end(); ++iter) { // continue with second if present 116 116 const Vector ¤tPos = (*iter)->getPosition(); 117 117 for (size_t i=0;i<NDIM;++i) … … 130 130 { 131 131 int Num = 0; 132 const_iterator iter = begin(); // start at first in list132 const_iterator iter = const_cast<const molecule &>(*this).begin(); // start at first in list 133 133 Vector Center; 134 134 135 135 Center.Zero(); 136 if (iter != end()) { //list not empty?137 for (; iter != end(); ++iter) { // continue with second if present136 if (iter != const_cast<const molecule &>(*this).end()) { //list not empty? 137 for (; iter != const_cast<const molecule &>(*this).end(); ++iter) { // continue with second if present 138 138 Num++; 139 139 Center += (*iter)->getPosition(); … … 353 353 Center.Zero(); 354 354 flag = true; 355 for (const_iterator iter = begin(); iter != end(); ++iter) { 355 for (const_iterator iter = const_cast<const molecule &>(*this).begin(); 356 iter != const_cast<const molecule &>(*this).end(); 357 ++iter) { 356 358 if ((treatment == IncludeHydrogen) || ((*iter)->getType()->getAtomicNumber() != 1)) { 357 359 Testvector = inversematrix * (*iter)->getPosition(); -
src/moleculelist.cpp
r1259df rf01769 129 129 //LOG(0, "Comparing fragment no. " << *(molecule **)a << " to " << *(molecule **)b << "."); 130 130 // Yes those types are awkward... but check it for yourself it checks out this way 131 molecule *const *mol1_ptr= static_cast<molecule *const *>(a);132 molecule *mol1 = *mol1_ptr;133 molecule *const *mol2_ptr= static_cast<molecule *const *>(b);134 molecule *mol2 = *mol2_ptr;131 const molecule *const *mol1_ptr= static_cast<molecule *const *>(a); 132 const molecule *mol1 = *mol1_ptr; 133 const molecule *const *mol2_ptr= static_cast<molecule *const *>(b); 134 const molecule *mol2 = *mol2_ptr; 135 135 if (mol1->getAtomCount() < mol2->getAtomCount()) { 136 136 return -1; … … 212 212 else { 213 213 Origin.Zero(); 214 for (MoleculeList:: iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++) {214 for (MoleculeList::const_iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++) { 215 215 // count atoms per element and determine size of bounding sphere 216 216 size=0.; 217 for (molecule::const_iterator iter = (*ListRunner)->begin(); iter != (*ListRunner)->end(); ++iter) { 217 const molecule *MolRunner = *ListRunner; 218 for (molecule::const_iterator iter = MolRunner->begin(); iter != MolRunner->end(); ++iter) { 218 219 counts[(*iter)->getType()->getAtomicNumber()]++; 219 220 if ((*iter)->DistanceSquared(Origin) > size) … … 221 222 } 222 223 // output Index, Name, number of atoms, chemical formula 223 (*out) << ( (*ListRunner)->ActiveFlag ? "*" : " ") << (*ListRunner)->IndexNr << "\t" << (*ListRunner)->name << "\t\t" << (*ListRunner)->getAtomCount() << "\t";224 (*out) << (MolRunner->ActiveFlag ? "*" : " ") << MolRunner->IndexNr << "\t" << MolRunner->name << "\t\t" << MolRunner->getAtomCount() << "\t"; 224 225 225 226 std::map<atomicNumber_t,unsigned int>::reverse_iterator iter; … … 229 230 } 230 231 // Center and size 231 Vector Center = (*ListRunner)->DetermineCenterOfAll();232 Vector Center = MolRunner->DetermineCenterOfAll(); 232 233 (*out) << "\t" << Center << "\t" << sqrt(size) << endl; 233 234 } … … 407 408 correction[k][j] = 0.; 408 409 // 2. take every hydrogen that is a saturated one 409 for (molecule::const_iterator iter = (*ListRunner)->begin(); iter != (*ListRunner)->end(); ++iter) { 410 const molecule *MolRunner = *ListRunner; 411 for (molecule::const_iterator iter = MolRunner->begin(); iter != MolRunner->end(); ++iter) { 410 412 //LOG(1, "(*iter): " << *(*iter) << " with first bond " << *((*iter)->getListOfBonds().begin()) << "."); 411 413 if (((*iter)->getType()->getAtomicNumber() == 1) && (((*iter)->getFather() == NULL) 412 414 || ((*iter)->getFather()->getType()->getAtomicNumber() != 1))) { // if it's a hydrogen 413 for (molecule::const_iterator runner = (*ListRunner)->begin(); runner != (*ListRunner)->end(); ++runner) {415 for (molecule::const_iterator runner = MolRunner->begin(); runner != MolRunner->end(); ++runner) { 414 416 //LOG(2, "Runner: " << *(*runner) << " with first bond " << *((*iter)->getListOfBonds().begin()) << "."); 415 417 // 3. take every other hydrogen that is the not the first and not bound to same bonding partner … … 420 422 distance = (*runner)->distance(*(*iter)); 421 423 //std::stringstream output; 422 //output << "Fragment " << (*ListRunner)->name << ": " << *(*runner) << "<= " << distance << "=>" << *(*iter) << ":";424 //output << "Fragment " << MolRunner->name << ": " << *(*runner) << "<= " << distance << "=>" << *(*iter) << ":"; 423 425 for (int k = 0; k < a; k++) { 424 426 for (int j = 0; j < b; j++) { … … 447 449 line.append("/"); 448 450 line += FRAGMENTPREFIX; 449 FragmentNumber = FixedDigitNumber(ListOfMolecules.size(), (*ListRunner)->IndexNr);451 FragmentNumber = FixedDigitNumber(ListOfMolecules.size(), MolRunner->IndexNr); 450 452 line += FragmentNumber; 451 453 delete[] (FragmentNumber); … … 506 508 for (MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++) { 507 509 periodentafel::const_iterator elemIter; 510 const molecule *MolRunner = *ListRunner; 508 511 for(elemIter=periode->begin();elemIter!=periode->end();++elemIter){ 509 if ( (*ListRunner)->hasElement((*elemIter).first)) { // if this element got atoms510 for(molecule:: iterator atomIter = (*ListRunner)->begin(); atomIter !=(*ListRunner)->end();++atomIter){512 if (MolRunner->hasElement((*elemIter).first)) { // if this element got atoms 513 for(molecule::const_iterator atomIter = MolRunner->begin(); atomIter !=MolRunner->end();++atomIter){ 511 514 if ((*atomIter)->getType()->getAtomicNumber() == (*elemIter).first) { 512 515 if (((*atomIter)->GetTrueFather() != NULL) && ((*atomIter)->GetTrueFather() != (*atomIter))) {// if there is a rea … … 557 560 for (MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++) { 558 561 // correct periodic 562 const molecule *MolRunner = *ListRunner; 559 563 if ((*ListRunner)->ScanForPeriodicCorrection()) { 560 564 count++; … … 565 569 std::stringstream output; 566 570 output << "Contained atoms: "; 567 for (molecule::const_iterator iter = (*ListRunner)->begin(); iter != (*ListRunner)->end(); ++iter) {571 for (molecule::const_iterator iter = MolRunner->begin(); iter != MolRunner->end(); ++iter) { 568 572 output << (*iter)->getName() << " "; 569 573 } … … 573 577 { 574 578 // // center on edge 575 // (*ListRunner)->CenterEdge(&BoxDimension);579 // MolRunner->CenterEdge(&BoxDimension); 576 580 // for (int k = 0; k < NDIM; k++) // if one edge is to small, set at least to 1 angstroem 577 581 // if (BoxDimension[k] < 1.) … … 588 592 // } 589 593 // World::getInstance().setDomain(cell_size); 590 // (*ListRunner)->Translate(&BoxDimension);594 // MolRunner->Translate(&BoxDimension); 591 595 592 596 // output file -
src/unittests/AtomIdSetUnitTest.cpp
r1259df rf01769 100 100 // const iterators 101 101 { 102 AtomIdSet::const_iterator beg_iter = atoms.begin();103 AtomIdSet::const_iterator end_iter = atoms.end();102 AtomIdSet::const_iterator beg_iter = const_cast<const AtomIdSet &>(atoms).begin(); 103 AtomIdSet::const_iterator end_iter = const_cast<const AtomIdSet &>(atoms).end(); 104 104 CPPUNIT_ASSERT( beg_iter == end_iter ); 105 105 } … … 110 110 111 111 { 112 AtomIdSet::const_iterator beg_iter = atoms.begin();113 AtomIdSet::const_iterator end_iter = atoms.end();112 AtomIdSet::const_iterator beg_iter = const_cast<const AtomIdSet &>(atoms).begin(); 113 AtomIdSet::const_iterator end_iter = const_cast<const AtomIdSet &>(atoms).end(); 114 114 CPPUNIT_ASSERT( beg_iter != end_iter ); 115 115 ++beg_iter; … … 137 137 // search for atom 138 138 atoms.insert(atomVector[0]); 139 CPPUNIT_ASSERT( atoms.find(atomVector[0]) == atoms.begin() );140 CPPUNIT_ASSERT( atoms.find(atomVector[0]) != atoms.end() );139 CPPUNIT_ASSERT( atoms.find(atomVector[0]) == const_cast<const AtomIdSet &>(atoms).begin() ); 140 CPPUNIT_ASSERT( atoms.find(atomVector[0]) != const_cast<const AtomIdSet &>(atoms).end() ); 141 141 atoms.erase(atomVector[0]); 142 142 143 143 // search for key 144 144 atoms.insert(atomVector[0]->getId()); 145 CPPUNIT_ASSERT( atoms.find(atomVector[0]->getId()) == atoms.begin() );146 CPPUNIT_ASSERT( atoms.find(atomVector[0]->getId()) != atoms.end() );145 CPPUNIT_ASSERT( atoms.find(atomVector[0]->getId()) == const_cast<const AtomIdSet &>(atoms).begin() ); 146 CPPUNIT_ASSERT( atoms.find(atomVector[0]->getId()) != const_cast<const AtomIdSet &>(atoms).end() ); 147 147 atoms.erase(atomVector[0]->getId()); 148 148 }
Note:
See TracChangeset
for help on using the changeset viewer.
