OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
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 
68  EntityHandle GetEntity() const;
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 
90  void ApplyTransform(const geom::Transform& tf);
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
Handle to atom datatype.
Definition: atom_handle.hh:37
float GetStartTime() const
Definition: coord_source.hh:63
Protein or molecule.
ImageStateConstModOPAlgorithm< TransformFnc > Transform
boost::shared_ptr< CoordSource > CoordSourcePtr
Definition: coord_source.hh:37
T Extract(const info::InfoGroup &g, const String &n)
Convenience function to extract a value from an item.
Definition: info_item.hh:128
float GetFrameDelta() const
Definition: coord_source.hh:59
boost::shared_ptr< CoordFrame > CoordFramePtr
Definition: coord_frame.hh:206
basic and essential transformation class, including translation, rotation and center of rotation ...
Definition: transform.hh:39
void SetStartTime(float t)
Definition: coord_source.hh:64
Three dimensional vector class, using Real precision.
Definition: vec3.hh:43
#define DLLEXPORT_OST_MOL
std::vector< AtomHandle > AtomHandleList
void SetFrameDelta(float d)
Definition: coord_source.hh:60
coordinate source
Definition: coord_source.hh:46
unsigned int uint
Definition: base.hh:29