Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AtomPairConstraint.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_AtomPairConstraint_hh
14 #define INCLUDED_core_scoring_constraints_AtomPairConstraint_hh
15 
17 
20 // AUTO-REMOVED #include <core/scoring/constraints/XYZ_Func.hh>
23 // AUTO-REMOVED #include <core/scoring/EnergyMap.hh>
24 #include <core/pose/Pose.fwd.hh>
25 #include <core/id/AtomID.hh>
26 
27 #include <utility/vector1.hh>
28 
29 
30 
31 // C++ Headers
32 //#include <cstdlib>
33 //#include <iostream>
34 //#include <map>
35 //#include <utility>
36 
37 
38 namespace core {
39 namespace scoring {
40 namespace constraints {
41 
42 
43 ///
44 
46 public:
47 
48  // default c-tor
50 
51  ///c-tor
53  AtomID const & a1,
54  AtomID const & a2,
55  FuncOP func,
57  ):
58  Constraint( scoretype ),
59  atom1_(a1),
60  atom2_(a2),
61  func_( func )
62  {}
63 
64  virtual ConstraintOP clone() const {
65  return new AtomPairConstraint( atom1_, atom2_, func_, score_type() );
66  }
67 
68  ///
69  virtual
71  return new AtomPairConstraint( atom1_, atom2_, func, score_type() );
72  }
73 
74 
75  /// @brief Copies the data from this Constraint into a new object and returns an OP
76  /// atoms are mapped to atoms with the same name in dest pose ( e.g. for switch from centroid to fullatom )
77  /// if a sequence_mapping is present it is used to map residue numbers .. NULL = identity mapping
78  /// to the new object. Intended to be implemented by derived classes.
80  pose::Pose const & src,
81  pose::Pose const & dest,
82  id::SequenceMappingCOP map = NULL
83  ) const;
84 
85  /// @brief possibility to compare constraint according to data
86  /// and not just pointers
87  bool operator == ( Constraint const & other ) const;
88 
89  using Constraint::score;
90 
91  ///
92  Real
93  score(
94  Vector const & xyz1,
95  Vector const & xyz2
96  ) const;
97 
98  ///
99  void
100  score( XYZ_Func const & xyz, EnergyMap const &, EnergyMap & emap ) const;
101 
102  Real score( pose::Pose const& pose ) const {
103  return func_->func( dist( pose ) );
104  }
105 
106  // atom deriv
107  virtual
108  void
109  fill_f1_f2(
110  AtomID const & atom,
111  XYZ_Func const & xyz,
112  Vector & F1,
113  Vector & F2,
114  EnergyMap const & weights
115  ) const;
116 
117  std::string type() const {
118  return "AtomPair";
119  }
120 
121  ///
122  Size
123  natoms() const
124  {
125  return 2;
126  }
127 
128  virtual
130  remap_resid( core::id::SequenceMapping const &seqmap ) const;
131 
132  ///
133  AtomID const &
134  atom( Size const n ) const
135  {
136  switch( n ) {
137  case 1:
138  return atom1_;
139  case 2:
140  return atom2_;
141  default:
142  utility_exit_with_message( "AtomPairConstraint::atom() bad argument" );
143  }
144  return atom1_;
145  }
146 
147  void show( std::ostream& out ) const;
148  void show_def( std::ostream& out, pose::Pose const& pose ) const;
149 
150  void read_def( std::istream& in, pose::Pose const& pose, FuncFactory const& func_factory );
151  // //@brief set constraint such that the pose doesn't violate it.
152  // virtual void steal( pose::Pose& );
153  virtual
154  Real dist( pose::Pose const& pose ) const;
155 
156  Real dist( core::conformation::Conformation const& conformation ) const;
157 
158  virtual
159  Real dist( XYZ_Func const & xyz ) const;
160 
161  virtual Size show_violations( std::ostream& out, pose::Pose const& pose, Size verbose_level, Real threshold = 1 ) const;
162 
163  virtual Func const& get_func() const {
164  return *func_;
165  }
166 
167  virtual
169 
170 
171 private:
172  // functions
173  Real
174  func( Real const theta ) const
175  {
176  return func_->func( theta );
177  }
178 
179  // deriv
180  Real
181  dfunc( Real const theta ) const
182  {
183  return func_->dfunc( theta );
184  }
185 
186 protected:
187  // data -- write accessed by NamedAtomPairConstraint
188  mutable AtomID atom1_, atom2_;
190 }; // class AtomPairConstraint
191 
192 } // constraints
193 } // scoring
194 } // core
195 
196 #endif