From cc919347050afb8424a8f7dddd7d450ef0e45a2f Mon Sep 17 00:00:00 2001 From: Niklaus Johner <nij2003@med.cornell.edu> Date: Mon, 13 Feb 2012 14:56:55 -0500 Subject: [PATCH] CoordGroupHandle::GetFramePositions This function allows to extract the list of positions of all the atoms in a given frame I also added the export for it and for CoordGroupHandle::AddFrame --- modules/mol/base/pymod/export_coord_group.cc | 2 ++ modules/mol/base/src/coord_group.cc | 8 ++++++++ modules/mol/base/src/coord_group.hh | 3 +++ 3 files changed, 13 insertions(+) diff --git a/modules/mol/base/pymod/export_coord_group.cc b/modules/mol/base/pymod/export_coord_group.cc index c6f30e8f5..fa3a06132 100644 --- a/modules/mol/base/pymod/export_coord_group.cc +++ b/modules/mol/base/pymod/export_coord_group.cc @@ -47,7 +47,9 @@ void export_CoordGroup() .def("GetEntity",&CoordGroupHandle::GetEntity) .def("GetAtomCount",&CoordGroupHandle::GetAtomCount) .def("AddFrames", &CoordGroupHandle::AddFrames) + .def("AddFrame", &CoordGroupHandle::AddFrame) .def("GetFrameCount",&CoordGroupHandle::GetFrameCount) + .def("GetFramePositions",&CoordGroupHandle::GetFramePositions) .def("SetFramePositions",&CoordGroupHandle::SetFramePositions) .def("SetAtomPos",&CoordGroupHandle::SetAtomPos) .def("GetAtomPos",&CoordGroupHandle::GetAtomPos) diff --git a/modules/mol/base/src/coord_group.cc b/modules/mol/base/src/coord_group.cc index 47622e901..127c82463 100644 --- a/modules/mol/base/src/coord_group.cc +++ b/modules/mol/base/src/coord_group.cc @@ -73,6 +73,14 @@ void CoordGroupHandle::SetFramePositions(uint frame, //source_->SetFramePositions(frame, clist); } + +geom::Vec3List CoordGroupHandle::GetFramePositions(uint frame) + { + this->CheckValidity(); + return *(this->GetFrame(frame)); + } + + void CoordGroupHandle::CopyFrame(uint frame) { this->CheckValidity(); diff --git a/modules/mol/base/src/coord_group.hh b/modules/mol/base/src/coord_group.hh index 57701931b..22a829dd6 100644 --- a/modules/mol/base/src/coord_group.hh +++ b/modules/mol/base/src/coord_group.hh @@ -52,6 +52,9 @@ public: /// initial atomlist void SetFramePositions(uint frame, const std::vector<geom::Vec3>& clist); + /// \brief get the positions of all the atoms in the given frame + geom::Vec3List GetFramePositions(uint frame); + /// \brief copy atom positions of given frame to stored atoms in entity void CopyFrame(uint frame); -- GitLab