Changes in src/molecule.cpp [f8e486:274d45]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/molecule.cpp ¶
rf8e486 r274d45 42 42 NoCyclicBonds(0), BondDistance(0.), ActiveFlag(false), IndexNr(-1), 43 43 formula(this,boost::bind(&molecule::calcFormula,this),"formula"), 44 AtomCount(this,boost::bind(&molecule::doCountAtoms,this),"AtomCount"), last_atom(0), InternalPointer( begin())44 AtomCount(this,boost::bind(&molecule::doCountAtoms,this),"AtomCount"), last_atom(0), InternalPointer(atoms.begin()) 45 45 { 46 46 … … 48 48 for(int i=MAX_ELEMENTS;i--;) 49 49 ElementsInMolecule[i] = 0; 50 strcpy(name,World::getInstance().getDefaultName() );50 strcpy(name,World::getInstance().getDefaultName().c_str()); 51 51 }; 52 52 … … 146 146 iter--; 147 147 atom* atom = *loc; 148 atoms.erase( loc ); 148 atomIds.erase( atom->getId() ); 149 atoms.remove( atom ); 149 150 atom->removeFromMolecule(); 150 151 return iter; … … 156 157 molecule::const_iterator iter = find(key); 157 158 if (iter != end()){ 158 atoms.erase( iter++ ); 159 atomIds.erase( key->getId() ); 160 atoms.remove( key ); 159 161 key->removeFromMolecule(); 160 162 } … … 164 166 molecule::const_iterator molecule::find ( atom * key ) const 165 167 { 166 return atoms.find( key ); 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()); 167 174 } 168 175 169 176 pair<molecule::iterator,bool> molecule::insert ( atom * const key ) 170 177 { 171 pair<atomSet::iterator,bool> res = atoms.insert(key); 172 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 } 173 185 } 174 186 175 187 bool molecule::containsAtom(atom* key){ 176 return atoms.count(key);188 return (find(key) != end()); 177 189 } 178 190 … … 790 802 for (molecule::iterator iter = begin(); !empty(); iter = begin()) 791 803 erase(iter); 804 return empty(); 792 805 }; 793 806 … … 1010 1023 configuration.MaxPsiDouble /= 2; 1011 1024 configuration.PsiType = (configuration.PsiMaxNoDown == configuration.PsiMaxNoUp) ? 0 : 1; 1012 if ((configuration.PsiType == 1) && (configuration.ProcPEPsi < 2) ) {1025 if ((configuration.PsiType == 1) && (configuration.ProcPEPsi < 2) && ((configuration.PsiMaxNoDown != 1) || (configuration.PsiMaxNoUp != 0))) { 1013 1026 configuration.ProcPEGamma /= 2; 1014 1027 configuration.ProcPEPsi *= 2; … … 1017 1030 configuration.ProcPEPsi = 1; 1018 1031 } 1019 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 } 1020 1040 }; 1021 1041
Note:
See TracChangeset
for help on using the changeset viewer.