diff --git a/modules/mol/base/src/atom_base.cc b/modules/mol/base/src/atom_base.cc index c818fbc1cec5ee0c0fa1be6fbb51eb59750133f0..a24ca3abb276770cebf67b00524e1ad4c401b970 100644 --- a/modules/mol/base/src/atom_base.cc +++ b/modules/mol/base/src/atom_base.cc @@ -240,5 +240,12 @@ unsigned long AtomBase::GetIndex() const return Impl()->GetIndex(); } +void AtomBase::SetIndex(const unsigned long index) +{ + this->CheckValidity(); + return impl_->SetIndex(index); +} + + }} // ns diff --git a/modules/mol/base/src/atom_base.hh b/modules/mol/base/src/atom_base.hh index 13795311560e4c81d46063156c75aa6459359131..4ddc13f2f46cea4c19c0e0372bb313b936d51386 100644 --- a/modules/mol/base/src/atom_base.hh +++ b/modules/mol/base/src/atom_base.hh @@ -141,6 +141,7 @@ public: void SetRadius(Real radius); + void SetIndex (const unsigned long index); const geom::Mat3& GetAnisou() const; diff --git a/modules/mol/base/src/coord_group.cc b/modules/mol/base/src/coord_group.cc index 5af231a559b8e07db90f6ec34d539aa238ed63ea..d02eecc2751e49fc66ac64579a102ce632615265 100644 --- a/modules/mol/base/src/coord_group.cc +++ b/modules/mol/base/src/coord_group.cc @@ -239,8 +239,12 @@ CoordGroupHandle CoordGroupHandle::Filter(const EntityView& selected, int first, indices.push_back(i->GetIndex()); } new_ent=CreateEntityFromView(selected, false); + //we have to correct the atom indices in the new entity + AtomHandleList new_atoms=new_ent.GetAtomList(); + for (int i=0,e=atoms.size();i!=e;++i){ + new_atoms[i].SetIndex(i); + } } - CoordGroupHandle filtered_cg=CreateCoordGroup(new_ent.GetAtomList()); std::vector<geom::Vec3> vecs(indices.size()); if (last==-1) last=this->GetFrameCount();