OpenStructure
coord_source.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2020 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_MOL_COORD_SOURCE_HH
20 #define OST_MOL_COORD_SOURCE_HH
21 
22 /*
23  Author: Marco Biasini
24  */
25 #include <boost/shared_ptr.hpp>
26 #include <ost/mol/module_config.hh>
27 #include <ost/mol/coord_frame.hh>
28 #include <ost/mol/entity_handle.hh>
29 
30 namespace geom {
31  // we should really have fw headers...
32  class Transform;
33 }
34 
35 namespace ost { namespace mol {
36 
37 class CoordSource;
38 
39 typedef boost::shared_ptr<CoordSource> CoordSourcePtr;
40 
47 public:
48  CoordSource(const AtomHandleList& atoms);
49 
50  virtual ~CoordSource() {}
51 
52  virtual uint GetFrameCount() const =0;
53 
54  virtual CoordFramePtr GetFrame(uint frame_id) const = 0;
55 
56  CoordSourcePtr Extract(int start=0, int stop=-1, int step=1);
57 
58  // time in ps between frames
59  float GetFrameDelta() const {return delta_;}
60  void SetFrameDelta(float d) {delta_=d;}
61 
62  // start time in ps
63  float GetStartTime() const {return start_time_;}
64  void SetStartTime(float t) {start_time_=t;}
65 
66  int GetAtomCount() const;
67 
69 
70  const AtomHandleList& GetAtomList() const;
71 
72  void SetAtomPos(uint frame, AtomHandle atom, const geom::Vec3& pos);
73 
74  geom::Vec3 GetAtomPos(uint frame, AtomHandle atom) const;
75 
77  void CopyFrame(uint frame);
78  bool IsMutable() const;
79 
80  void Capture();
81  void CaptureInto(int pos);
82  void Capture(uint f);
83  void SetFramePositions(uint frame, const std::vector<geom::Vec3>& clist);
84  void SetFrameCellSize(uint frame, const geom::Vec3& size);
85 
86  virtual void AddFrame(const std::vector<geom::Vec3>& coords) = 0;
87  virtual void AddFrame(const std::vector<geom::Vec3>& coords,const geom::Vec3& cell_size,const geom::Vec3& cell_angles) = 0;
88  virtual void InsertFrame(int pos, const std::vector<geom::Vec3>& coords) = 0;
89 
91 
92 protected:
93  void SetMutable(bool flag);
94 private:
95  AtomHandleList atoms_;
96  EntityHandle entity_;
97  bool mutable_;
98  std::map<long,uint> atom_dict_;
99  float delta_,start_time_;
100 };
101 
102 }}
103 
104 #endif
basic and essential transformation class, including translation, rotation and center of rotation
Definition: transform.hh:39
Three dimensional vector class, using Real precision.
Definition: vec3.hh:48
Handle to atom datatype.
Definition: atom_handle.hh:37
coordinate source
Definition: coord_source.hh:46
CoordSourcePtr Extract(int start=0, int stop=-1, int step=1)
void SetMutable(bool flag)
geom::Vec3 GetAtomPos(uint frame, AtomHandle atom) const
void SetFrameCellSize(uint frame, const geom::Vec3 &size)
void CaptureInto(int pos)
void SetFrameDelta(float d)
Definition: coord_source.hh:60
virtual void AddFrame(const std::vector< geom::Vec3 > &coords)=0
void SetFramePositions(uint frame, const std::vector< geom::Vec3 > &clist)
void Capture(uint f)
CoordSource(const AtomHandleList &atoms)
EntityHandle GetEntity() const
float GetFrameDelta() const
Definition: coord_source.hh:59
int GetAtomCount() const
virtual void InsertFrame(int pos, const std::vector< geom::Vec3 > &coords)=0
void SetStartTime(float t)
Definition: coord_source.hh:64
float GetStartTime() const
Definition: coord_source.hh:63
void CopyFrame(uint frame)
assign the coordinates in the given frame to the atoms
const AtomHandleList & GetAtomList() const
void ApplyTransform(const geom::Transform &tf)
virtual void AddFrame(const std::vector< geom::Vec3 > &coords, const geom::Vec3 &cell_size, const geom::Vec3 &cell_angles)=0
void SetAtomPos(uint frame, AtomHandle atom, const geom::Vec3 &pos)
virtual uint GetFrameCount() const =0
virtual CoordFramePtr GetFrame(uint frame_id) const =0
bool IsMutable() const
Protein or molecule.
unsigned int uint
Definition: base.hh:29
#define DLLEXPORT_OST_MOL
def stop()
Definition: init.py:140
ImageStateConstModOPAlgorithm< TransformFnc > Transform
std::vector< AtomHandle > AtomHandleList
boost::shared_ptr< CoordSource > CoordSourcePtr
Definition: coord_source.hh:37
boost::shared_ptr< CoordFrame > CoordFramePtr
Definition: coord_frame.hh:206
Definition: base.dox:1