00001 //------------------------------------------------------------------------------ 00002 // This file is part of the OpenStructure project <www.openstructure.org> 00003 // 00004 // Copyright (C) 2008-2011 by the OpenStructure authors 00005 // 00006 // This library is free software; you can redistribute it and/or modify it under 00007 // the terms of the GNU Lesser General Public License as published by the Free 00008 // Software Foundation; either version 3.0 of the License, or (at your option) 00009 // any later version. 00010 // This library is distributed in the hope that it will be useful, but WITHOUT 00011 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00012 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00013 // details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public License 00016 // along with this library; if not, write to the Free Software Foundation, Inc., 00017 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 //------------------------------------------------------------------------------ 00019 #ifndef OST_TORSION_HANDLE_HH 00020 #define OST_TORSION_HANDLE_HH 00021 00022 #include <ost/mol/impl/torsion_impl_fw.hh> 00023 #include <ost//mol/atom_handle.hh> 00024 00025 #include <ost/mol/entity_visitor_fw.hh> 00026 00027 namespace ost { namespace mol { 00028 00044 class DLLEXPORT_OST_MOL TorsionHandle { 00045 public: 00047 TorsionHandle(); 00049 TorsionHandle(const impl::TorsionImplP& im); 00050 00052 00053 00054 00055 00056 00057 00058 00059 operator bool() const; 00062 bool IsValid() const; 00064 00066 void Apply(EntityVisitor& v); 00067 00068 const String& GetName() const; 00069 00071 00072 00073 AtomHandle GetFirst() const; 00075 AtomHandle GetSecond() const; 00077 AtomHandle GetThird() const; 00079 AtomHandle GetFourth() const; 00081 00084 Real GetAngle() const; 00086 geom::Vec3 GetPos() const; 00088 geom::Vec3 GetOriginalPos() const; 00089 00090 impl::TorsionImplP& Impl() { 00091 return impl_; 00092 } 00093 00094 const impl::TorsionImplP& Impl() const { 00095 return impl_; 00096 } 00097 protected: 00098 void CheckValidity() const; 00099 private: 00100 impl::TorsionImplP impl_; 00101 }; 00102 00103 Real DLLEXPORT_OST_MOL DihedralAngle(const AtomHandle& a1, 00104 const AtomHandle& a2, 00105 const AtomHandle& a3, 00106 const AtomHandle& a4); 00107 00108 DLLEXPORT_OST_MOL std::ostream& operator<<(std::ostream& os, 00109 const TorsionHandle& torsion); 00110 00111 }} // ns 00112 00113 #endif