Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AngleConstraint.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 /// @file
11 /// @brief
12 
13 #ifndef INCLUDED_core_scoring_constraints_AngleConstraint_hh
14 #define INCLUDED_core_scoring_constraints_AngleConstraint_hh
15 
17 
19 
21 // AUTO-REMOVED #include <core/scoring/constraints/XYZ_Func.hh>
25 #include <core/pose/Pose.fwd.hh>
26 #include <core/id/AtomID.fwd.hh>
27 
28 #include <core/id/AtomID.hh>
29 #include <utility/vector1.hh>
30 
31 
32 namespace core {
33 namespace scoring {
34 namespace constraints {
35 
36 /// @brief An Angular Constraint.
37 class AngleConstraint : public Constraint {
38 public:
39 
40  virtual std::string type() const {
41  return "Angle";
42  }
43 
44  virtual ConstraintOP clone() const {
45  return new AngleConstraint( atom1_, atom2_, atom3_, func_, score_type() );
46  }
47 
48  /// @brief read in constraint defiinition
49  void read_def( std::istream & data, pose::Pose const & pose, FuncFactory const & func_factory );
50 
51  /// @brief Copies the data from this Constraint into a new object and returns an OP
52  /// atoms are mapped to atoms with the same name in dest pose ( e.g. for switch from centroid to fullatom )
53  /// if a sequence_mapping is present it is used to map residue numbers .. NULL = identity mapping
54  /// to the new object. Intended to be implemented by derived classes.
56  pose::Pose const & src,
57  pose::Pose const & dest,
58  id::SequenceMappingCOP map = NULL
59  ) const;
60 
61 
62  /// @brief possibility to compare constraint according to data
63  /// and not just pointers
64  bool operator == ( Constraint const & other ) const;
65 
66  using Constraint::score;
67 
68  /// @brief compute score
69  Real
70  score(
71  Vector const & xyz1,
72  Vector const & xyz2,
73  Vector const & xyz3
74  ) const;
75 
76  /// @brief compute score
77  void
78  score( XYZ_Func const & xyz, EnergyMap const &, EnergyMap & emap ) const;
79 
80  /// @brief compute atom deriv
81  void
82  fill_f1_f2(
83  AtomID const & atom,
84  XYZ_Func const & xyz,
85  Vector & F1,
86  Vector & F2,
87  EnergyMap const & weights
88  ) const;
89 
90  /// @brief Constructor
92  AtomID const & a1,
93  AtomID const & a2,
94  AtomID const & a3,
95  FuncOP func_in, // we take ownership of this guy
96  ScoreType scotype = angle_constraint
97  ):
98  Constraint( scotype ),
99  atom1_(a1),
100  atom2_(a2),
101  atom3_(a3),
102  func_( func_in )
103  {}
104 
105  /// @brief Constructor without atom IDs -- if you create an AngleConstraint with
106  /// this constructor, you must never call its score( XYZFunc ) method! Dangerous and stupid!
108  FuncOP func_in,
109  ScoreType scoretype = angle_constraint
110  ):
111  Constraint( scoretype ),
112  func_( func_in )
113  {}
114 
115 
116  /// @brief number of atoms --- always 3 for angles
117  Size
118  natoms() const
119  {
120  return 3;
121  }
122 
123  virtual
125  remap_resid( core::id::SequenceMapping const &seqmap ) const;
126 
127  /// @brief return AtomID for atom 1,2,3
128  AtomID const &
129  atom( Size const n ) const;
130 
131  /// @brief output violation of constraint to out - returns 1 if violated ( i.e., func.show_violations() > 0 )
132  Size show_violations( std::ostream& out, pose::Pose const& pose, Size verbose_level, core::Real threshold = 1 ) const;
133 
134  virtual void show(std::ostream& out ) const;
135 
136  void show_def( std::ostream& out, pose::Pose const& pose ) const;
137 
138  virtual Func const& get_func() const {
139  return *func_;
140  }
141 
142 
143 //private: /*functions*/
144 
145 public:
146  /// Previously private member functions made public so that in the absence of atom_ids,
147  /// these functions could still be called externally.
148 
149  /// @brief evaluate func at theta
150  Real
151  func( Real const theta ) const
152  {
153  return func_->func( theta );
154  }
155 
156  /// @brief evaluate dfunc at theta
157  Real
158  dfunc( Real const theta ) const
159  {
160  return func_->dfunc( theta );
161  }
162 
163  static
164  void
166  Vector const & p1,
167  Vector const & p2,
168  Vector const & p3,
169  Vector & f1,
170  Vector & f2
171  );
172 
173 
174  static
175  void
176  helper(
177  Vector const & M,
178  Vector const & w,
179  Vector & F1,
180  Vector & F2
181  );
182 
183 
184  void
185  p1_deriv(
186  Vector const & p1,
187  Vector const & p2,
188  Vector const & p3,
189  Vector & F1,
190  Vector & F2
191  ) const;
192 
193 
194  void
195  p2_deriv(
196  Vector const & p1,
197  Vector const & p2,
198  Vector const & p3,
199  Vector & F1,
200  Vector & F2
201  ) const;
202 
203 private:
204  // data
207 };
208 
209 } // constraints
210 } // scoring
211 } // core
212 
213 #endif