Changeset 15c75f8 for src/molecule.cpp


Ignore:
Timestamp:
Nov 5, 2014, 9:41:13 PM (11 years ago)
Author:
Frederik Heber <heber@…>
Parents:
7b38d3
git-author:
Frederik Heber <heber@…> (11/05/14 20:49:45)
git-committer:
Frederik Heber <heber@…> (11/05/14 21:41:13)
Message:

molecule has a lastchangedatom member variable now.

  • FIX: molecule::getBoundingSphere() did not check for no atoms.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified src/molecule.cpp

    r7b38d3 r15c75f8  
    146146  OBSERVE;
    147147  if(atomIdPool.reserveId(newNr)){
     148    _lastchangedatom = target;
    148149    NOTIFY(AtomNrChanged);
    149150    if (oldNr != -1)  // -1 is reserved and indicates no number
     
    207208{
    208209  OBSERVE;
    209   NOTIFY(AtomRemoved);
    210210  const_iterator iter = loc;
    211211  ++iter;
    212212  atom * const _atom = const_cast<atom *>(*loc);
     213  {
     214    _lastchangedatom = _atom;
     215    NOTIFY(AtomRemoved);
     216  }
    213217  atomIds.erase( _atom->getId() );
    214218  {
     
    226230{
    227231  OBSERVE;
    228   NOTIFY(AtomRemoved);
     232  {
     233    _lastchangedatom = key;
     234    NOTIFY(AtomRemoved);
     235  }
    229236  const_iterator iter = find(key);
    230237  if (iter != end()){
     
    247254  OBSERVE;
    248255  NOTIFY(AtomInserted);
     256  _lastchangedatom = key;
    249257  std::pair<iterator,bool> res = atomIds.insert(key->getId());
    250258  if (res.second) { // push atom if went well
     
    974982    for(const_iterator iter = begin(); iter != end(); ++iter)
    975983      center += (*iter)->getPosition();
    976     center *= 1./(double)size();
     984    if (begin() != end())
     985      center *= 1./(double)size();
    977986    for(const_iterator iter = begin(); iter != end(); ++iter) {
    978987      const Vector &position = (*iter)->getPosition();
Note: See TracChangeset for help on using the changeset viewer.