Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Rose.hh
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 // vi: set ts=2 noet:
3 //
4 // (c) Copyright Rosetta Commons Member Institutions.
5 // (c) This file is part of the Rosetta software suite and is made available under license.
6 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9 
10 #ifndef INCLUDED_protocols_sic_dock_Rose_hh
11 #define INCLUDED_protocols_sic_dock_Rose_hh
12 
14 
15 #include <platform/types.hh>
16 #include <utility/vector1.hh>
18 #include <core/pose/Pose.fwd.hh>
20 #include <numeric/xyzTransform.hh>
21 
22 
23 namespace protocols {
24 namespace sic_dock {
25 
26 class Rose {
27 public:
35  typedef numeric::xyzTransform<Real> X;
38  typedef X const XC;
39  typedef M const MC;
40  typedef V const VC;
41  typedef X const & XCR;
42  typedef M const & MCR;
43  typedef V const & VCR;
44  typedef Rose const & RCR;
45 
48  X x;
49 
50  Rose(PoseCOP p);
51  Rose(PoseCOP p, sic_dock::PoseCoordPickMode const & coord_picker );
52  Rose(PoseCOP p, core::id::AtomID_Map<Real> const & clash_atoms );
53 
54  inline
55  Rose(RCR r, XCR x_in) : p(r.p), h(r.h), x(x_in) {}
56 
57  virtual ~Rose() {}
58 
59  inline bool clashes (VCR point) const { return h->clash(~x*point); }
60  bool clashes (RCR other) const;
61  Size contacts(RCR other) const;
62 
63  friend inline bool operator==( RCR a, RCR b ){ return ( a.p==b.p && a.h==b.h && a.x.distance_squared(b.x) <= 0.000001 ); }
64  friend inline bool operator!=( RCR a, RCR b ){ return ( a.p!=b.p || a.h!=b.h || a.x.distance_squared(b.x) > 0.000001 ); }
65 
66  // friend inline Rose operator +( RCR a, VCR b ){ return Rose( a, a.x+b ); }
67  inline Rose operator +(VCR b ){ return Rose( *this, x+b ); } // Refactoring to make it PyRosetta friendly
68 
69  // friend inline Rose operator +( VCR a, RCR b ){ return Rose( b, a +b.x ); }
70 
71  //friend inline Rose operator -( RCR a, VCR b ){ return Rose( a, a.x-b ); }
72  inline Rose operator -( VCR b ){ return Rose( *this, x-b ); } // Refactoring to make it PyRosetta friendly
73 
74  //friend inline Rose operator *( RCR a, XCR b ){ return Rose( a, a.x*b ); }
75  inline Rose operator *( XCR b ){ return Rose( *this, x*b ); } // Refactoring to make it PyRosetta friendly
76 
77  //friend inline Rose operator *( RCR a, MCR b ){ return Rose( a, a.x*b ); }
78  inline Rose operator *( MCR b ){ return Rose( *this, x*b ); } // Refactoring to make it PyRosetta friendly
79 
80  // friend inline Rose operator -( VCR a, RCR b ){ return Rose( b, a -b.x ); }
81  friend inline Rose operator *( XCR a, RCR b ){ return Rose( b, a *b.x ); }
82  friend inline Rose operator *( MCR a, RCR b ){ return Rose( b, a *b.x ); }
83 
84  // friend inline Rose operator /( RCR a, XCR b ){ return Rose( a, a.x/b ); }
85  // friend inline Rose operator /( XCR a, RCR b ){ return Rose( b, a /b.x ); }
86 
87  inline XC res_anchor(Size const & ir) const { return x*X( p->xyz(AID(1,ir)), p->xyz(AID(2,ir)), p->xyz(AID(3,ir)) ); }
88  inline XC n_anchor() const { return res_anchor( 1 ); }
89  inline XC c_anchor() const { return res_anchor(p->n_residue()); }
90  inline void align_n(XCR a){ x = a * ~X( p->xyz(AID(1, 1 )), p->xyz(AID(2, 1 )), p->xyz(AID(3, 1 )) ); }
91  inline void align_c(XCR a){ x = a * ~X( p->xyz(AID(1,p->n_residue())), p->xyz(AID(2,p->n_residue())), p->xyz(AID(3,p->n_residue())) ); }
92 
93  void dump_pdb(std::ostream & out ) const;
94  void dump_pdb(std::string const & fname) const;
95  void dump_minimal_pdb(std::ostream & out, char chain='R');
96 
97  PoseCOP pose() const;
98 
99  //////////////// debug //////////////////
100  bool clashes_naive(RCR other) const;
101  Size contacts_naive(RCR other) const;
102 };
103 
104 
105 
106 } // namespace sic_dock
107 } // namespace protocols
108 
109 #endif