OpenStructure
torsion_handle.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-2011 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_TORSION_HANDLE_HH
20 #define OST_TORSION_HANDLE_HH
21 
23 #include <ost//mol/atom_handle.hh>
24 
26 
27 namespace ost { namespace mol {
28 
45 public:
47  TorsionHandle();
50 
52 
53 
54 
55 
56 
57 
58 
59  operator bool() const;
62  bool IsValid() const;
64 
66  void Apply(EntityVisitor& v);
67 
68  const String& GetName() const;
69 
71 
72 
73  AtomHandle GetFirst() const;
75  AtomHandle GetSecond() const;
77  AtomHandle GetThird() const;
79  AtomHandle GetFourth() const;
81 
84  Real GetAngle() const;
86  geom::Vec3 GetPos() const;
88  geom::Vec3 GetOriginalPos() const;
89 
97  void SetAngle(Real a, bool up=true);
98 
100  void RotateAngle(Real angle, bool up=true);
101 
103  return impl_;
104  }
105 
106  const impl::TorsionImplP& Impl() const {
107  return impl_;
108  }
109 protected:
110  void CheckValidity() const;
111 private:
112  impl::TorsionImplP impl_;
113 };
114 
115 Real DLLEXPORT_OST_MOL DihedralAngle(const AtomHandle& a1,
116  const AtomHandle& a2,
117  const AtomHandle& a3,
118  const AtomHandle& a4);
119 
120 DLLEXPORT_OST_MOL std::ostream& operator<<(std::ostream& os,
121  const TorsionHandle& torsion);
122 
123 }} // ns
124 
125 #endif