Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AmbiguousNMRDistanceConstraint.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_AmbiguousNMRDistanceConstraint_hh
14 #define INCLUDED_core_scoring_constraints_AmbiguousNMRDistanceConstraint_hh
15 
17 
20 // AUTO-REMOVED #include <core/scoring/constraints/XYZ_Func.hh>
21 
23 // AUTO-REMOVED #include <core/scoring/EnergyMap.hh>
24 #include <core/pose/Pose.fwd.hh>
27 #include <core/id/AtomID.hh>
28 #include <core/id/NamedAtomID.hh>
29 #include <core/chemical/AA.hh>
30 
31 #include <utility/vector1.hh>
32 
33 
34 
35 // C++ Headers
36 //#include <cstdlib>
37 //#include <iostream>
38 //#include <map>
39 //#include <utility>
40 
41 
42 namespace core {
43 namespace scoring {
44 namespace constraints {
45 
46 
47 ///
48 
50 public:
52  ///c-tor
54  Atoms const & a1,
55  Atoms const & a2,
56  FuncOP func,
58  ):
59  Constraint( scoretype ),
60  atoms1_(a1),
61  atoms2_(a2),
62  func_( func )
63  {}
64 
66  id::NamedAtomID const & a1, //digests names like "QG1"
67  id::NamedAtomID const & a2,
68  core::pose::Pose const&,
69  FuncOP func,
71  );
72 
75  func_( NULL )
76  {}
77 
78  virtual ConstraintOP clone() const {
80  }
81 
82  ///
83  virtual
86  }
87 
88 
89  /// @brief Copies the data from this Constraint into a new object and returns an OP
90  /// atoms are mapped to atoms with the same name in dest pose ( e.g. for switch from centroid to fullatom )
91  /// if a sequence_mapping is present it is used to map residue numbers .. NULL = identity mapping
92  /// to the new object. Intended to be implemented by derived classes.
93  virtual ConstraintOP remapped_clone( pose::Pose const& src, pose::Pose const& dest, id::SequenceMappingCOP map=NULL ) const;
94 
95  ///returns AtomPairConstraint or AmbigousNMRDistanceConstraint (e.g. for GLY HA1-HA2 ... )
96  ConstraintOP map_to_CEN( pose::Pose const& src, pose::Pose const& centroid, core::Size& nr_mapped, std::string const& map_atom ) const;
97 
98  ///
99  void
100  score( XYZ_Func const & xyz, EnergyMap const &, EnergyMap & emap ) const;
101 
102  ///
103  core::Real
104  inv_dist6( XYZ_Func const & xyz ) const;
105 
106 
107  // atom deriv
108  virtual 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 "AmbiguousNMRDistance";
119  }
120 
121  ///
122  Size
123  natoms() const
124  {
125  return atoms1_.size() + atoms2_.size();
126  }
127 
128  ///
129  Size
130  natoms( core::Size i ) const
131  {
132  return i==1 ? atoms1_.size() : atoms2_.size();
133  }
134 
135  Size
136  multiplicity() const {
137  return atoms1_.size()*atoms2_.size();
138  }
139 
140  ///@brief return residue number: i=1,2
141  Size
142  resid( core::Size i ) const {
143  return i == 1 ? atoms1_[ 1 ].rsd() : atoms2_[ 1 ].rsd();
144  }
145 
146  virtual
148  remap_resid( core::id::SequenceMapping const &seqmap ) const;
149 
150  ///
151  AtomID const &
152  atom( Size const n ) const
153  {
154  if ( n > natoms() ) {
155  utility_exit_with_message( "AmbiguousNMRDistanceConstraint::atom() bad argument" );
156  }
157  if ( n <= atoms1_.size() ) {
158  return atoms1_[ n ];
159  } else return atoms2_[ n - atoms1_.size() ];
160  }
161 
162  void show( std::ostream& out ) const;
163  void show_def( std::ostream& out, pose::Pose const& pose ) const;
164 
165  void read_def( std::istream& in, pose::Pose const& pose, FuncFactory const& func_factory );
166  // //@brief set constraint such that the pose doesn't violate it.
167  // virtual void steal( pose::Pose& );
168 
169  Real dist( pose::Pose const & pose ) const;
170  Real dist( XYZ_Func const & xyz ) const;
171 
172 
173  //Real inv_dist6( conformation::Conformation const& pose ) const;
174  // ^^^^ Undefined, commenting out to make PyRosetta compile.
175 
176  using Constraint::score;
177 
178  Real score( pose::Pose const& pose ) const {
179  return func_->func( dist( pose ) );
180  }
181 
182  virtual Size show_violations( std::ostream& out, pose::Pose const& pose, Size verbose_level, Real threshold = 1 ) const;
183 
184  virtual Func const& get_func() const {
185  return *func_;
186  }
187 
188  virtual
190 
191 private:
192  // functions
193  Real
194  func( Real const theta ) const
195  {
196  return func_->func( theta );
197  }
198 
199  // deriv
200  Real
201  dfunc( Real const theta ) const
202  {
203  return func_->dfunc( theta );
204  }
205 
206 protected:
207  // data -- write accessed by NamedAmbiguousNMRDistanceConstraint
208 
211 }; // class AmbiguousNMRDistanceConstraint
212 
215 
216 } // constraints
217 } // scoring
218 } // core
219 
220 #endif