Changeset 270bdf
- 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, 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:
- 97445f
- Parents:
- 9b3262b
- git-author:
- Frederik Heber <heber@…> (06/01/15 07:22:29)
- git-committer:
- Frederik Heber <heber@…> (07/24/15 16:44:34)
- Location:
- src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/AtomAction/ChangeElementAction.cpp
r9b3262b r270bdf 70 70 first = iter->second; 71 71 LOG(1, "Changing atom " << *first << " to element " << *params.elemental.get() << "."); 72 mol = first->getMolecule();73 first->removeFromMolecule(); // remove atom74 72 first->setType(params.elemental.get()); 75 mol->AddAtom(first); // add atom to ensure correctness of formula76 73 } 77 74 return ActionState::ptr(UndoState); … … 85 82 for(ElementMap::const_iterator iter = state->Elements.begin(); iter != state->Elements.end(); ++iter) { 86 83 first = World::getInstance().getAtom(AtomById(iter->first)); 87 mol = first->getMolecule();88 first->removeFromMolecule(); // remove atom89 84 first->setType(iter->second); 90 mol->AddAtom(first); // add atom to ensure correctness of formula91 85 } 92 86 … … 101 95 for(ElementMap::const_iterator iter = state->Elements.begin(); iter != state->Elements.end(); ++iter) { 102 96 first = World::getInstance().getAtom(AtomById(iter->first)); 103 mol = first->getMolecule();104 first->removeFromMolecule(); // remove atom105 97 first->setType(state->params.elemental.get()); 106 mol->AddAtom(first); // add atom to ensure correctness of formula107 98 } 108 99 -
src/Actions/AtomAction/SaturateAction.cpp
r9b3262b r270bdf 67 67 68 68 // if atom is attached to molecule, add hydrogens there, too 69 molecule * mol = _atom->getMolecule();70 if ( mol== NULL) {69 molecule * mol = NULL; 70 if (_atom->getMolecule() == NULL) { 71 71 mol = World::getInstance().createMolecule(); 72 72 mol->AddAtom(_atom); 73 } else { 74 mol = World::getInstance().getMolecule(MoleculeById(_atom->getMolecule()->getId())); 73 75 } 76 ASSERT( mol != NULL, 77 "ChangeElementAction::performCall() - mol is still NULL." ); 74 78 75 79 // add the hydrogens -
src/Actions/FragmentationAction/FragmentationAction.cpp
r9b3262b r270bdf 40 40 #include "CodePatterns/Log.hpp" 41 41 #include "Descriptors/AtomSelectionDescriptor.hpp" 42 #include "Descriptors/MoleculeIdDescriptor.hpp" 42 43 #include "Fragmentation/Exporters/ExportGraph_ToFiles.hpp" 43 44 #include "Fragmentation/Exporters/ExportGraph_ToJobs.hpp" … … 95 96 96 97 // go through all atoms, note down their molecules and group them 97 typedef std::multimap< molecule *, atom *> clusters_t;98 typedef std::multimap<const molecule *, atom *> clusters_t; 98 99 typedef std::vector<atomId_t> atomids_t; 99 100 atomids_t atomids; … … 105 106 } 106 107 { 107 std::vector< molecule *> molecules;108 std::vector<const molecule *> molecules; 108 109 molecules.insert( molecules.end(), MapKeyIterator<clusters_t::const_iterator>(clusters.begin()), 109 110 MapKeyIterator<clusters_t::const_iterator>(clusters.end()) ); … … 149 150 iter = advanceiter) { 150 151 // get iterator to past last atom in this molecule 151 molecule * mol = iter->first;152 const molecule * mol = iter->first; 152 153 advanceiter = clusters.upper_bound(mol); 153 154 … … 161 162 << " atoms, out of " << mol->getAtomCount() << "."); 162 163 const enum HydrogenTreatment treatment = params.HowtoTreatHydrogen.get() ? ExcludeHydrogen : IncludeHydrogen; 163 Fragmentation Fragmenter(mol, *FileChecker, treatment); 164 molecule * non_const_mol = World::getInstance().getMolecule(MoleculeById(mol->getId())); 165 Fragmentation Fragmenter(non_const_mol, *FileChecker, treatment); 164 166 165 167 // perform fragmentation -
src/Atom/CopyAtoms/CopyAtoms_withBonds.cpp
r9b3262b r270bdf 42 42 #include "CodePatterns/Assert.hpp" 43 43 #include "CodePatterns/Log.hpp" 44 #include "Descriptors/MoleculeIdDescriptor.hpp" 44 45 #include "molecule.hpp" 45 46 #include "WorldTime.hpp" … … 93 94 original_iter != _atoms.end(); ++original_iter) { 94 95 const atom * const _atom = *original_iter; 95 molecule * const mol = _atom->getMolecule();96 const molecule * const mol = _atom->getMolecule(); 96 97 if (mol != NULL) { 97 98 ASSERT( LookupMap.count(_atom), 98 99 "CopyAtoms_withBonds::operator() - atom "+toString(_atom)+" not found in LookupMap."); 99 mol->AddAtom(LookupMap[_atom]); 100 molecule * non_const_mol = World::getInstance().getMolecule(MoleculeById(mol->getId())); 101 non_const_mol->AddAtom(LookupMap[_atom]); 100 102 } 101 103 } -
src/Atom/atom.cpp
r9b3262b r270bdf 304 304 } 305 305 306 molecule* atom::getMolecule() const {306 const molecule* atom::getMolecule() const { 307 307 return mol; 308 308 } -
src/Atom/atom.hpp
r9b3262b r270bdf 193 193 * \return containing molecule 194 194 */ 195 molecule* getMolecule() const;195 const molecule* getMolecule() const; 196 196 197 197 /** Erases the atom in atom::mol's list of atoms and sets it to zero. -
src/Descriptors/MoleculeOfAtomSelectionDescriptor.cpp
r9b3262b r270bdf 35 35 #include "CodePatterns/MemDebug.hpp" 36 36 37 #include "Descriptors/MoleculeIdDescriptor.hpp" 37 38 #include "Descriptors/MoleculeOfAtomSelectionDescriptor.hpp" 38 39 #include "Descriptors/MoleculeOfAtomSelectionDescriptor_impl.hpp" … … 62 63 iter != set.end_internal(); 63 64 ++iter) { 64 if (iter->second->getMolecule()) 65 return iter->second->getMolecule(); 65 if (iter->second->getMolecule()) { 66 return World::getInstance().getMolecule(MoleculeById(iter->second->getMolecule()->getId())); 67 } 66 68 } 67 69 return 0; … … 77 79 ++iter) { 78 80 if (iter->second->getMolecule()) { 79 inserter = temp.insert( iter->second->getMolecule() ); 81 molecule * const _mol = 82 World::getInstance().getMolecule( 83 MoleculeById(iter->second->getMolecule()->getId())); 84 inserter = temp.insert( _mol ); 80 85 if (inserter.second) 81 res.push_back( iter->second->getMolecule());86 res.push_back(_mol); 82 87 } 83 88 } -
src/Fragmentation/Interfragmenter.cpp
r9b3262b r270bdf 103 103 /// go through linked cell and get all neighboring atoms up to Rcut 104 104 Vector center; 105 molecule *_mol = (*atoms.begin())->getMolecule();105 const molecule *_mol = (*atoms.begin())->getMolecule(); 106 106 for (AtomIdSet::const_iterator iter = atoms.begin(); 107 107 iter != atoms.end(); ++iter) { -
src/World.cpp
r9b3262b r270bdf 360 360 } 361 361 // check if it's the last atom 362 molecule *_mol = atom->getMolecule();362 molecule *_mol = const_cast<molecule *>(atom->getMolecule()); 363 363 if ((_mol == NULL) || (_mol->getAtomCount() > 1)) 364 364 _mol = NULL; … … 764 764 NOTIFY(SelectionChanged); 765 765 ASSERT(_atom,"Invalid atom pointer in selection of MoleculeOfAtom"); 766 molecule *mol=_atom->getMolecule();766 const molecule *mol=_atom->getMolecule(); 767 767 // the atom might not be part of a molecule 768 768 if(mol){ … … 805 805 NOTIFY(SelectionChanged); 806 806 ASSERT(_atom,"Invalid atom pointer in selection of MoleculeOfAtom"); 807 molecule *mol=_atom->getMolecule();807 const molecule *mol=_atom->getMolecule(); 808 808 // the atom might not be part of a molecule 809 809 if(mol){
Note:
See TracChangeset
for help on using the changeset viewer.