Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ResidueTypeConstraint.cc
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 core/scoring/constraints/ResidueTypeConstraint.cc
11 ///
12 /// @brief
13 /// @author Sarel Fleishman
14 
15 
17 
19 //#include <core/io/pdb/pose_io.hh> -- REALLY?
20 // AUTO-REMOVED #include <basic/options/option.hh>
21 // AUTO-REMOVED #include <basic/options/keys/OptionKeys.hh>
23 // AUTO-REMOVED #include <core/scoring/constraints/ConstraintSet.hh>
24 #include <basic/Tracer.hh>
25 
27 #include <core/pose/util.hh>
30 #include <utility/vector1.hh>
31 
32 //Auto Headers
33 #include <core/pose/Pose.hh>
34 
35 namespace core {
36 namespace scoring {
37 namespace constraints {
38 
39 
40 static basic::Tracer TR("core.scoring.constraints.ResidueTypeConstraint");
41 
43  Constraint( core::scoring::res_type_constraint )
44 {}
45 
47  core::pose::Pose const & pose,
48  Size seqpos,
49  core::Real favor_native_bonus
50 ):
51  Constraint( core::scoring::res_type_constraint ),
52  seqpos_( seqpos ),
53  rsd_type_name3_( pose.residue_type( seqpos ).name3() ),
54  favor_native_bonus_( favor_native_bonus )
55 {}
56 
57 
59  core::pose::Pose const &, //pose,
60  Size seqpos,
61  std::string AAname,
62  core::Real favor_native_bonus
63 ):
64  Constraint( core::scoring::res_type_constraint ),
65  seqpos_( seqpos ),
66  rsd_type_name3_( AAname ),
67  favor_native_bonus_( favor_native_bonus )
68 {}
69 
71  Size seqpos,
72  std::string aa_in,
73  std::string name3_in,
74  core::Real bonus_in
75 ):
76  Constraint( core::scoring::res_type_constraint ),
77  seqpos_( seqpos ),
78  AAname( aa_in ),
79  rsd_type_name3_( name3_in ),
80  favor_native_bonus_( bonus_in )
81 {}
82 
83 
85 
88 {
89  return ConstraintOP( new ResidueTypeConstraint( *this ) );
90 }
91 
94  utility::vector1< core::Size > pos_list(1, seqpos_); // length 1 containing "all" seqpos_ values
95  return pos_list;
96 }
97 
98 void
99 ResidueTypeConstraint::show( std::ostream & out ) const {
100  out << "ResidueTypeConstraint; ";
101  out << "seqpos: " << seqpos_;
102  out << "; AAname: "<< AAname;
103  out << "; rsd_type_name3: "<< rsd_type_name3_;
104  out << "; favor_native_bonus: "<< favor_native_bonus_;
105 }
106 
109 {
110  core::Size newseqpos = seqmap[ seqpos_ ];
111  if ( newseqpos != 0 ) {
113  } else {
114  return NULL;
115  }
116 }
117 
118 bool
120 {
121  if( !dynamic_cast< ResidueTypeConstraint const * > ( &other_cst ) ) return false;
122 
123  ResidueTypeConstraint const & other( static_cast< ResidueTypeConstraint const & > (other_cst) );
124 
125  if( seqpos_ != other.seqpos_ ) return false;
126  if( AAname != other.AAname ) return false;
127  if( rsd_type_name3_ != other.rsd_type_name3_ ) return false;
128  if( favor_native_bonus_ != other.favor_native_bonus_ ) return false;
129  if( this->score_type() != other.score_type() ) return false;
130 
131  return true;
132 }
133 
136 
137  core::Size newseqpos = seqpos_;
138  if ( smap ) {
139  newseqpos = (*smap)[ seqpos_ ];
140  if( newseqpos == 0 ) return NULL;
141  }
142 
144 }
145 
146 
147 // Calculates a score for this constraint using XYZ_Func, and puts the UNWEIGHTED score into
148 // emap. Although the current set of weights currently is provided, Constraint objects
149 // should put unweighted scores into emap.
150 void
151 ResidueTypeConstraint::score( XYZ_Func const & xyz_func, EnergyMap const & weights, EnergyMap & emap ) const
152 {
153  Real const weight(weights[ this->score_type() ] );
154  if( weight == 0 ) return; // what's the point?
155 
156  conformation::Residue const & rsd( xyz_func.residue(seqpos_) );
157  if( rsd.type().name3() == rsd_type_name3_ )
158  emap[ this->score_type() ] -= favor_native_bonus_;
159  // no match, don't adjust score
160 }
161 
162 
163 void
165  AtomID const & ,//atom,
166  XYZ_Func const &,
167  Vector & ,//F1,
168  Vector & ,//F2,
169  EnergyMap const & //weights
170 ) const
171 {
172  // Do nothing.
173  // Derivative of this restraint is effectively zero
174  // so we just "add zero" to F1 and F2.
175 }
176 
177 } // namespace constraints
178 } // namespace scoring
179 } // namespace core