Skip to content
Snippets Groups Projects
Commit 894bc7ad authored by BIOPZ-Johner Niklaus's avatar BIOPZ-Johner Niklaus
Browse files

Added function to set the unit cell size of a frame in a CoordGroup

parent c1c194ce
No related branches found
No related tags found
No related merge requests found
...@@ -58,6 +58,7 @@ void export_CoordGroup() ...@@ -58,6 +58,7 @@ void export_CoordGroup()
.add_property("frame_count",&CoordGroupHandle::GetFrameCount) .add_property("frame_count",&CoordGroupHandle::GetFrameCount)
.def("GetFramePositions",&CoordGroupHandle::GetFramePositions) .def("GetFramePositions",&CoordGroupHandle::GetFramePositions)
.def("SetFramePositions",&CoordGroupHandle::SetFramePositions) .def("SetFramePositions",&CoordGroupHandle::SetFramePositions)
.def("SetFrameCellSize",&CoordGroupHandle::SetFrameCellSize)
.def("SetAtomPos",&CoordGroupHandle::SetAtomPos) .def("SetAtomPos",&CoordGroupHandle::SetAtomPos)
.def("GetAtomPos",&CoordGroupHandle::GetAtomPos) .def("GetAtomPos",&CoordGroupHandle::GetAtomPos)
.def("CopyFrame",&CoordGroupHandle::CopyFrame) .def("CopyFrame",&CoordGroupHandle::CopyFrame)
......
...@@ -91,6 +91,16 @@ void CoordGroupHandle::SetStartTime(float t) ...@@ -91,6 +91,16 @@ void CoordGroupHandle::SetStartTime(float t)
source_->SetStartTime(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, void CoordGroupHandle::SetFramePositions(uint frame,
const geom::Vec3List& clist) const geom::Vec3List& clist)
{ {
......
...@@ -71,6 +71,9 @@ public: ...@@ -71,6 +71,9 @@ public:
/// initial atomlist /// initial atomlist
void SetFramePositions(uint frame, const geom::Vec3List& clist); 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 /// \brief get the positions of all the atoms in the given frame
geom::Vec3List GetFramePositions(uint frame); geom::Vec3List GetFramePositions(uint frame);
......
...@@ -82,6 +82,12 @@ void CoordSource::Capture() ...@@ -82,6 +82,12 @@ void CoordSource::Capture()
this->AddFrame(coords); 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) void CoordSource::SetFramePositions(uint frame, const std::vector<geom::Vec3>& clist)
{ {
CoordFrame& fp=*(GetFrame(frame)); CoordFrame& fp=*(GetFrame(frame));
......
...@@ -81,6 +81,7 @@ public: ...@@ -81,6 +81,7 @@ public:
void CaptureInto(int pos); void CaptureInto(int pos);
void Capture(uint f); void Capture(uint f);
void SetFramePositions(uint frame, const std::vector<geom::Vec3>& clist); 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) = 0;
virtual void AddFrame(const std::vector<geom::Vec3>& coords,const geom::Vec3& cell_size,const geom::Vec3& cell_angles) = 0; virtual void AddFrame(const std::vector<geom::Vec3>& coords,const geom::Vec3& cell_size,const geom::Vec3& cell_angles) = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment