Changeset 55240c4 for src/molecule.cpp
- Timestamp:
- Jun 21, 2010, 7:56:00 AM (16 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, Candidate_v1.7.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:
- 2f40c0e
- Parents:
- 1b2d30 (diff), da3024e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 edited
-
src/molecule.cpp (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/molecule.cpp
r1b2d30 r55240c4 4 4 * 5 5 */ 6 7 #include "Helpers/MemDebug.hpp" 6 8 7 9 #include <cstring> … … 35 37 * Initialises molecule list with correctly referenced start and end, and sets molecule::last_atom to zero. 36 38 */ 37 molecule::molecule(const periodentafel * const teil) : elemente(teil),38 MDSteps(0),39 BondCount(0), ElementCount(0), NoNonHydrogen(0), NoNonBonds(0), NoCyclicBonds(0), BondDistance(0.),40 ActiveFlag(false), IndexNr(-1),41 formula(this,boost::bind(&molecule::calcFormula,this) ),42 AtomCount(this,boost::bind(&molecule::doCountAtoms,this) ), last_atom(0), InternalPointer(begin())39 molecule::molecule(const periodentafel * const teil) : 40 Observable("molecule"), 41 elemente(teil), MDSteps(0), BondCount(0), ElementCount(0), NoNonHydrogen(0), NoNonBonds(0), 42 NoCyclicBonds(0), BondDistance(0.), ActiveFlag(false), IndexNr(-1), 43 formula(this,boost::bind(&molecule::calcFormula,this),"formula"), 44 AtomCount(this,boost::bind(&molecule::doCountAtoms,this),"AtomCount"), last_atom(0), InternalPointer(atoms.begin()) 43 45 { 44 46 … … 143 145 molecule::const_iterator iter = loc; 144 146 iter--; 145 atoms.erase( loc ); 147 atom* atom = *loc; 148 atomIds.erase( atom->getId() ); 149 atoms.remove( atom ); 150 atom->removeFromMolecule(); 146 151 return iter; 147 152 } 148 153 149 molecule::const_iterator molecule::erase( atom * &key )154 molecule::const_iterator molecule::erase( atom * key ) 150 155 { 151 156 cout << "trying to erase atom" << endl; 152 157 molecule::const_iterator iter = find(key); 153 158 if (iter != end()){ 154 // remove this position and step forward (post-increment) 155 atoms.erase( iter++ ); 159 atomIds.erase( key->getId() ); 160 atoms.remove( key ); 161 key->removeFromMolecule(); 156 162 } 157 163 return iter; 158 164 } 159 165 160 molecule::const_iterator molecule::find ( atom *& key ) const 161 { 162 return atoms.find( key ); 166 molecule::const_iterator molecule::find ( atom * key ) const 167 { 168 molecule::const_iterator iter; 169 for (molecule::const_iterator Runner = begin(); Runner != end(); ++Runner) { 170 if (*Runner == key) 171 return molecule::const_iterator(Runner); 172 } 173 return molecule::const_iterator(atoms.end()); 163 174 } 164 175 165 176 pair<molecule::iterator,bool> molecule::insert ( atom * const key ) 166 177 { 167 pair<atomSet::iterator,bool> res = atoms.insert(key); 168 return pair<iterator,bool>(iterator(res.first,this),res.second); 178 pair<atomIdSet::iterator,bool> res = atomIds.insert(key->getId()); 179 if (res.second) { // push atom if went well 180 atoms.push_back(key); 181 return pair<iterator,bool>(molecule::iterator(--end()),res.second); 182 } else { 183 return pair<iterator,bool>(molecule::iterator(end()),res.second); 184 } 185 } 186 187 bool molecule::containsAtom(atom* key){ 188 return (find(key) != end()); 169 189 } 170 190 … … 192 212 } 193 213 insert(pointer); 214 pointer->setMolecule(this); 194 215 } 195 216 return true; … … 657 678 bond * molecule::AddBond(atom *atom1, atom *atom2, int degree) 658 679 { 680 OBSERVE; 659 681 bond *Binder = NULL; 660 682 … … 780 802 for (molecule::iterator iter = begin(); !empty(); iter = begin()) 781 803 erase(iter); 804 return empty(); 782 805 }; 783 806 … … 1000 1023 configuration.MaxPsiDouble /= 2; 1001 1024 configuration.PsiType = (configuration.PsiMaxNoDown == configuration.PsiMaxNoUp) ? 0 : 1; 1002 if ((configuration.PsiType == 1) && (configuration.ProcPEPsi < 2) ) {1025 if ((configuration.PsiType == 1) && (configuration.ProcPEPsi < 2) && ((configuration.PsiMaxNoDown != 1) || (configuration.PsiMaxNoUp != 0))) { 1003 1026 configuration.ProcPEGamma /= 2; 1004 1027 configuration.ProcPEPsi *= 2; … … 1007 1030 configuration.ProcPEPsi = 1; 1008 1031 } 1009 configuration.InitMaxMinStopStep = configuration.MaxMinStopStep = configuration.MaxPsiDouble; 1032 cout << configuration.PsiMaxNoDown << ">" << configuration.PsiMaxNoUp << endl; 1033 if (configuration.PsiMaxNoDown > configuration.PsiMaxNoUp) { 1034 configuration.InitMaxMinStopStep = configuration.MaxMinStopStep = configuration.PsiMaxNoDown; 1035 cout << configuration.PsiMaxNoDown << " " << configuration.InitMaxMinStopStep << endl; 1036 } else { 1037 configuration.InitMaxMinStopStep = configuration.MaxMinStopStep = configuration.PsiMaxNoUp; 1038 cout << configuration.PsiMaxNoUp << " " << configuration.InitMaxMinStopStep << endl; 1039 } 1010 1040 }; 1011 1041
Note:
See TracChangeset
for help on using the changeset viewer.
