From 38205f47d14974d7d4f1fbd0a31dd0ff9c3fcc2c Mon Sep 17 00:00:00 2001 From: Niklaus Johner <nij2003@med.cornell.edu> Date: Mon, 21 May 2012 11:02:11 -0400 Subject: [PATCH] Fixed bug in EntityHandle::GetAtomPosList The order of the positions didn't match the order of atoms in the AtomList. --- modules/mol/base/src/entity_handle.cc | 9 ++++++++- modules/mol/base/src/impl/entity_impl.cc | 8 -------- modules/mol/base/src/impl/entity_impl.hh | 1 - 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/modules/mol/base/src/entity_handle.cc b/modules/mol/base/src/entity_handle.cc index 63145be7e..0abad5ede 100644 --- a/modules/mol/base/src/entity_handle.cc +++ b/modules/mol/base/src/entity_handle.cc @@ -364,7 +364,14 @@ AtomHandleList EntityHandle::GetAtomList() const geom::Vec3List EntityHandle::GetAtomPosList() const { this->CheckValidity(); - return Impl()->GetAtomPosList(); + geom::Vec3List atom_pos_list; + atom_pos_list.reserve(this->GetAtomCount()); + AtomHandleList atom_list=this->GetAtomList(); + for (AtomHandleList::const_iterator a=atom_list.begin(), e=atom_list.end(); a!=e; ++a) { + atom_pos_list.push_back(a->GetPos()); + } + return atom_pos_list; + //return Impl()->GetAtomPosList(); } EntityHandle EntityHandle::GetHandle() const diff --git a/modules/mol/base/src/impl/entity_impl.cc b/modules/mol/base/src/impl/entity_impl.cc index f2fbd6d81..6942ce00f 100644 --- a/modules/mol/base/src/impl/entity_impl.cc +++ b/modules/mol/base/src/impl/entity_impl.cc @@ -307,14 +307,6 @@ geom::Vec3 EntityImpl::GetCenterOfMass() const { return center; } -geom::Vec3List EntityImpl::GetAtomPosList() const { - geom::Vec3List atom_pos_list; - atom_pos_list.reserve(this->GetAtomCount()); - for(AtomImplMap::const_iterator it = atom_map_.begin();it!=atom_map_.end();++it) { - atom_pos_list.push_back(it->second->TransformedPos()); - } - return atom_pos_list; -} Real EntityImpl::GetMass() const { double mass=0.0; diff --git a/modules/mol/base/src/impl/entity_impl.hh b/modules/mol/base/src/impl/entity_impl.hh index 8d8e53017..d1d1ca050 100644 --- a/modules/mol/base/src/impl/entity_impl.hh +++ b/modules/mol/base/src/impl/entity_impl.hh @@ -93,7 +93,6 @@ public: Real GetMass() const; geom::Vec3 GetCenterOfMass() const; geom::Vec3 GetCenterOfAtoms() const; - geom::Vec3List GetAtomPosList() const; /// \brief returns the axis-aligned bounding box of the entity geom::AlignedCuboid GetBounds() const; -- GitLab