diff --git a/modules/mol/base/pymod/export_entity.cc b/modules/mol/base/pymod/export_entity.cc index c46f07284aab3eec978e25d4d87c265d39133939..6fda49c793342259e0d3ab5078716d3dda8c0a5e 100644 --- a/modules/mol/base/pymod/export_entity.cc +++ b/modules/mol/base/pymod/export_entity.cc @@ -147,6 +147,7 @@ void export_Entity() .def("GetMass", &EntityHandle::GetMass) .def("GetCenterOfMass", &EntityHandle::GetCenterOfMass) .def("GetCenterOfAtoms", &EntityHandle::GetCenterOfAtoms) + .def("GetAtomPosList", &EntityHandle::GetAtomPosList) .def("GetGeometricCenter", geom_center<EntityHandle>) .add_property("geometric_center", geom_center<EntityHandle>) diff --git a/modules/mol/base/src/entity_handle.cc b/modules/mol/base/src/entity_handle.cc index e975132ea84a50c5ea7fb76026cff894645b6920..63145be7e22f3f03cafbbc7d08ba0c71c12a9aa8 100644 --- a/modules/mol/base/src/entity_handle.cc +++ b/modules/mol/base/src/entity_handle.cc @@ -362,6 +362,11 @@ AtomHandleList EntityHandle::GetAtomList() const return atoms; } +geom::Vec3List EntityHandle::GetAtomPosList() const { + this->CheckValidity(); + return Impl()->GetAtomPosList(); +} + EntityHandle EntityHandle::GetHandle() const { return *this; diff --git a/modules/mol/base/src/entity_handle.hh b/modules/mol/base/src/entity_handle.hh index 0fcadee77d9e68b69048b7c346d3d3c266919fd0..67b2a847e4ab4050d9dfd9043e9fa3ab46ae0bd6 100644 --- a/modules/mol/base/src/entity_handle.hh +++ b/modules/mol/base/src/entity_handle.hh @@ -280,6 +280,9 @@ public: /// \sa #AtomsBegin, #AtomsEnd AtomHandleList GetAtomList() const; + /// \brief get complete list of atom positions + geom::Vec3List GetAtomPosList() const; + /// \brief Get editor for external coordinate system to manipulate atom /// positions /// \sa editors diff --git a/modules/mol/base/src/impl/entity_impl.cc b/modules/mol/base/src/impl/entity_impl.cc index daf9c7c1fbcc33970c7acf316c12a69f786b8ffb..f2fbd6d817529edf879b9438f8f71c37d84b56d7 100644 --- a/modules/mol/base/src/impl/entity_impl.cc +++ b/modules/mol/base/src/impl/entity_impl.cc @@ -307,6 +307,15 @@ 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; for (ChainImplList::const_iterator i=chain_list_.begin(), diff --git a/modules/mol/base/src/impl/entity_impl.hh b/modules/mol/base/src/impl/entity_impl.hh index dd88fb32575437e74bb95bc8e7df90c26976b4aa..8d8e530172e9f8160a212bdf7cb48522d75119b1 100644 --- a/modules/mol/base/src/impl/entity_impl.hh +++ b/modules/mol/base/src/impl/entity_impl.hh @@ -93,7 +93,7 @@ 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;