Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/molecule.cpp

    r274d45 rf8e486  
    4242  NoCyclicBonds(0), BondDistance(0.),  ActiveFlag(false), IndexNr(-1),
    4343  formula(this,boost::bind(&molecule::calcFormula,this),"formula"),
    44   AtomCount(this,boost::bind(&molecule::doCountAtoms,this),"AtomCount"), last_atom(0),  InternalPointer(atoms.begin())
     44  AtomCount(this,boost::bind(&molecule::doCountAtoms,this),"AtomCount"), last_atom(0),  InternalPointer(begin())
    4545{
    4646
     
    4848  for(int i=MAX_ELEMENTS;i--;)
    4949    ElementsInMolecule[i] = 0;
    50   strcpy(name,World::getInstance().getDefaultName().c_str());
     50  strcpy(name,World::getInstance().getDefaultName());
    5151};
    5252
     
    146146  iter--;
    147147  atom* atom = *loc;
    148   atomIds.erase( atom->getId() );
    149   atoms.remove( atom );
     148  atoms.erase( loc );
    150149  atom->removeFromMolecule();
    151150  return iter;
     
    157156  molecule::const_iterator iter = find(key);
    158157  if (iter != end()){
    159     atomIds.erase( key->getId() );
    160     atoms.remove( key );
     158    atoms.erase( iter++ );
    161159    key->removeFromMolecule();
    162160  }
     
    166164molecule::const_iterator molecule::find ( atom * key ) const
    167165{
    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());
     166  return atoms.find( key );
    174167}
    175168
    176169pair<molecule::iterator,bool> molecule::insert ( atom * const key )
    177170{
    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   }
     171  pair<atomSet::iterator,bool> res = atoms.insert(key);
     172  return pair<iterator,bool>(iterator(res.first,this),res.second);
    185173}
    186174
    187175bool molecule::containsAtom(atom* key){
    188   return (find(key) != end());
     176  return atoms.count(key);
    189177}
    190178
     
    802790  for (molecule::iterator iter = begin(); !empty(); iter = begin())
    803791      erase(iter);
    804   return empty();
    805792};
    806793
     
    10231010  configuration.MaxPsiDouble /= 2;
    10241011  configuration.PsiType = (configuration.PsiMaxNoDown == configuration.PsiMaxNoUp) ? 0 : 1;
    1025   if ((configuration.PsiType == 1) && (configuration.ProcPEPsi < 2) && ((configuration.PsiMaxNoDown != 1) || (configuration.PsiMaxNoUp != 0))) {
     1012  if ((configuration.PsiType == 1) && (configuration.ProcPEPsi < 2)) {
    10261013    configuration.ProcPEGamma /= 2;
    10271014    configuration.ProcPEPsi *= 2;
     
    10301017    configuration.ProcPEPsi = 1;
    10311018  }
    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   }
     1019  configuration.InitMaxMinStopStep = configuration.MaxMinStopStep = configuration.MaxPsiDouble;
    10401020};
    10411021
Note: See TracChangeset for help on using the changeset viewer.