Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DunbrackConstraint.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/pack/dunbrack/DunbrackConstraint.cc
11 /// @brief
12 /// @author James Thompson
13 
14 // Unit headers
17 
18 
19 #include <core/id/AtomID.hh>
24 
25 #include <basic/Tracer.hh>
26 // AUTO-REMOVED #include <basic/options/option.hh>
27 
28 #include <utility/vector1.hh>
29 
30 
31 namespace core {
32 namespace pack {
33 namespace dunbrack {
34 
35 static basic::Tracer TR("core.pack.dunbrack.DunbrackConstraint");
36 
39 
42  return new DunbrackConstraint;
43 }
44 
46 {
47  return "Dunbrack";
48 }
49 
51  Constraint( core::scoring::dunbrack_constraint ),
52  bonus_( 0 ),
53  seqpos_( 0 ),
54  rot_vec_pos_( 0 ),
55  rot_bin_( 0 )
56 {}
57 
59 
62  return "Dunbrack";
63 }
64 
65 Size
67  return atom_ids_.size();
68 }
69 
70 id::AtomID const &
71 DunbrackConstraint::atom( Size const index ) const {
72  return atom_ids_[index];
73 }
74 
77  return new DunbrackConstraint( *this );
78 }
79 
80 // Calculates a score for this constraint using XYZ_Func, and puts the
81 // UNWEIGHTED score into emap. Although the current set of weights currently is
82 // provided, Constraint objects should put unweighted scores into emap.
83 void
85  scoring::constraints::XYZ_Func const & xyz_func,
86  scoring::EnergyMap const & weights,
87  scoring::EnergyMap & emap
88 ) const {
89  if ( weights[ this->score_type() ] == 0 ) return; // what's the point?
90 
91  conformation::Residue const & rsd( xyz_func.residue(seqpos_) );
92 
95  // don't try to restrain angles that don't exist
96  if ( rot.size() > rot_vec_pos_ ) return;
97  if ( rot[ rot_vec_pos_ ] == rot_bin_ ) {
98  emap[ this->score_type() ] += bonus_;
99  }
100 }
101 
102 void
104  AtomID const & ,//atom,
106  Vector & ,//F1,
107  Vector & ,//F2,
108  scoring::EnergyMap const & //weights
109 ) const {
110  // Do nothing.
111  // Derivative of this restraint is effectively zero (because it's constant
112  // within each rotamer well), so we just "add zero" to F1 and F2.
113  // APL Note: these derivatives will be wrong for phi and psi, since a change in phi or psi
114  // will cause a change in the energy of the lowest rotamer in a well. This ought to be fixed.
115 }
116 
117 void DunbrackConstraint::show( std::ostream & out ) const {
118  out << type() << " " << seqpos_
119  << " " << rot_vec_pos_ << " " << rot_bin_
120  << " " << bonus_;
121  out << std::endl;
122 }
123 
124 /// @brief Format should look like:
125 /// Dunbrack seqpos_ rot_vec_pos_ rot_bin_ bonus_
127  std::istream & in,
128  pose::Pose const & /* pose */,
129  scoring::constraints::FuncFactory const & /* func_factory */
130 ) {
131  in >> seqpos_ >> rot_vec_pos_ >> rot_bin_ >> bonus_;
132  if ( seqpos_ == 0 || rot_vec_pos_ == 0 || rot_bin_ == 0 || bonus_ == 0 ) {
133  in.setstate( std::ios_base::failbit );
134  }
135 }
136 
137 } // namespace constraints
138 } // namespace scoring
139 } // namespace core