diff --git a/modules/mol/base/pymod/export_coord_group.cc b/modules/mol/base/pymod/export_coord_group.cc index 790337cb10ab46202599675d7dbae0b2ae3fd3b7..46a435ad4aaee3391d063a519d7e8cc705c84926 100644 --- a/modules/mol/base/pymod/export_coord_group.cc +++ b/modules/mol/base/pymod/export_coord_group.cc @@ -58,6 +58,7 @@ void export_CoordGroup() .add_property("frame_count",&CoordGroupHandle::GetFrameCount) .def("GetFramePositions",&CoordGroupHandle::GetFramePositions) .def("SetFramePositions",&CoordGroupHandle::SetFramePositions) + .def("SetFrameCellSize",&CoordGroupHandle::SetFrameCellSize) .def("SetAtomPos",&CoordGroupHandle::SetAtomPos) .def("GetAtomPos",&CoordGroupHandle::GetAtomPos) .def("CopyFrame",&CoordGroupHandle::CopyFrame) diff --git a/modules/mol/base/src/coord_group.cc b/modules/mol/base/src/coord_group.cc index 49c9f45128b7e61e7175a3844bd41f54bf65c08e..53f31d9aedc7191dd361047ffaef5f4c7bec1c98 100644 --- a/modules/mol/base/src/coord_group.cc +++ b/modules/mol/base/src/coord_group.cc @@ -91,6 +91,16 @@ void CoordGroupHandle::SetStartTime(float t) source_->SetStartTime(t); } +void CoordGroupHandle::SetFrameCellSize(uint frame, const geom::Vec3& size) +{ + this->CheckValidity(); + if (source_->IsMutable()) { + source_->SetFrameCellSize(frame, size); + } else { + throw IntegrityError("Can't add set frame cell size in immutable CoordGroup"); + } +} + void CoordGroupHandle::SetFramePositions(uint frame, const geom::Vec3List& clist) { diff --git a/modules/mol/base/src/coord_group.hh b/modules/mol/base/src/coord_group.hh index d72cf12e7e46f2a34c7751d359e9d416043d440c..edce072cb3b9b1cef2d7651b3cc3ffb8416533db 100644 --- a/modules/mol/base/src/coord_group.hh +++ b/modules/mol/base/src/coord_group.hh @@ -71,6 +71,9 @@ public: /// initial atomlist void SetFramePositions(uint frame, const geom::Vec3List& clist); + /// \brief set cell size for the given frame + void SetFrameCellSize(uint frame, const geom::Vec3& size); + /// \brief get the positions of all the atoms in the given frame geom::Vec3List GetFramePositions(uint frame); diff --git a/modules/mol/base/src/coord_source.cc b/modules/mol/base/src/coord_source.cc index 8d07abb40aeadbae49d768a51a564f94f6db21d0..f3c0e13c9c83cc273feb7ff596b4d3e684091120 100644 --- a/modules/mol/base/src/coord_source.cc +++ b/modules/mol/base/src/coord_source.cc @@ -82,6 +82,12 @@ void CoordSource::Capture() this->AddFrame(coords); } +void CoordSource::SetFrameCellSize(uint frame, const geom::Vec3& size) +{ + CoordFrame& fp=*(GetFrame(frame)); + fp.SetCellSize(size); +} + void CoordSource::SetFramePositions(uint frame, const std::vector<geom::Vec3>& clist) { CoordFrame& fp=*(GetFrame(frame)); diff --git a/modules/mol/base/src/coord_source.hh b/modules/mol/base/src/coord_source.hh index 7c3ce96a2532063f4b7f2473947098e4a852a815..b58e3e98cf64290ffd4e36b9f2934b128cc8811f 100644 --- a/modules/mol/base/src/coord_source.hh +++ b/modules/mol/base/src/coord_source.hh @@ -81,6 +81,7 @@ public: void CaptureInto(int pos); void Capture(uint f); void SetFramePositions(uint frame, const std::vector<geom::Vec3>& clist); + void SetFrameCellSize(uint frame, const geom::Vec3& size); virtual void AddFrame(const std::vector<geom::Vec3>& coords) = 0; virtual void AddFrame(const std::vector<geom::Vec3>& coords,const geom::Vec3& cell_size,const geom::Vec3& cell_angles) = 0;