Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BigBinConstraint.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
11 /// @brief
12 
13 // Unit headers
15 
16 // Package headers
21 
22 // Project headers
24 #include <core/pose/Pose.hh>
25 
28 
29 #include <numeric/trig.functions.hh>
30 #include <numeric/conversions.hh>
31 
32 #include <utility/exit.hh>
33 #include <ObjexxFCL/string.functions.hh>
34 
35 #include <utility/vector1.hh>
36 
37 
38 // C++ Headers
39 
40 namespace core {
41 namespace scoring {
42 namespace constraints {
43 
44 /// @brief one line definition "BigBin res_number bin_char sdev"
46  std::istream & in,
47  core::pose::Pose const & pose,
48  FuncFactory const & /*func_factory*/
49 ) {
50  my_csts_.clear();
51 
52  using core::id::AtomID;
53  using numeric::conversions::radians;
54  AtomID C0, N1, CA1, C1, N2, CA2;
55 
56  std::string dummy;
57  in >> dummy >> res_ >> bin_ >> sdev_;
58 
59  //chu skip the rest of line since this is a single line defintion.
60  while( in.good() && (in.get() != '\n') ) {}
61 
62  if ( res_ > 1 && res_ < pose.total_residue() - 1 ) {
63  C0_ = AtomID(pose.residue_type(res_ - 1).atom_index("C" ), res_ - 1);
64  N1_ = AtomID(pose.residue_type(res_ ).atom_index("N" ), res_ );
65  CA1_ = AtomID(pose.residue_type(res_ ).atom_index("CA"), res_ );
66  C1_ = AtomID(pose.residue_type(res_ ).atom_index("C" ), res_ );
67  N2_ = AtomID(pose.residue_type(res_ + 1).atom_index("N" ), res_ + 1);
68  CA2_ = AtomID(pose.residue_type(res_ + 1).atom_index("CA"), res_ + 1);
69  }
70 
71  Real const two_pi( 6.283185 );
72  Real omega_lower_ = radians( -175.0 );
73  Real omega_upper_ = radians( 175.0 );
74 
75  using ObjexxFCL::string_of;
76 
77  if ( bin_ == 'O' ) {
78  omega_lower_ = radians( -10.0 );
79  omega_upper_ = radians( 10.0 );
80  } else {
81  Real psi_upper_( 0.0 ), psi_lower_( 0.0 );
82  Real phi_upper_( 0.0 ), phi_lower_( 0.0 );
83  if ( bin_ == 'G' ) {
84  phi_lower_ = radians( 0.0 );
85  phi_upper_ = radians( 180.0 );
86  psi_lower_ = radians( -100.0 );
87  psi_upper_ = radians( 100.0 );
88  } else if ( bin_ == 'E' ) {
89  phi_lower_ = radians( 0.0 );
90  phi_upper_ = radians( 180.0 );
91  psi_lower_ = radians( 100.0 );
92  psi_upper_ = radians( -90.0 );
93  } else if ( bin_ == 'A' ) {
94  phi_lower_ = radians( -180.0 );
95  phi_upper_ = radians( 0.0 );
96  psi_lower_ = radians( -50.0 );
97  psi_upper_ = radians( -30.0 );
98  } else if ( bin_ == 'B') {
99  phi_lower_ = radians( -180.0 );
100  phi_upper_ = radians( 0.0 );
101  psi_lower_ = radians( 100.0 );
102  psi_upper_ = radians( 175.0 );
103  } else {
104  utility_exit_with_message(
105  "Error: don't recognize bin " + string_of(bin_) + "!"
106  );
107  }
108 
109  FuncOP phi_func( new PeriodicBoundFunc(
110  phi_lower_, phi_upper_, sdev_, "phi_" + string_of(bin_), two_pi
111  ) );
112  FuncOP psi_func( new PeriodicBoundFunc(
113  psi_lower_, psi_upper_, sdev_, "psi_" + string_of(bin_), two_pi
114  ) );
115  FuncOP omega_func( new PeriodicBoundFunc(
116  omega_lower_, omega_upper_, sdev_, "omega_" + string_of(bin_), two_pi
117  ) );
118 
119  ConstraintOP phi_cst(
120  new DihedralConstraint( C0_, N1_, CA1_, C1_, phi_func )
121  );
122  ConstraintOP psi_cst(
123  new DihedralConstraint( N1_, CA1_, C1_, N2_, psi_func )
124  );
125  ConstraintOP omega_cst(
126  new DihedralConstraint( CA1_, C1_, N2_, CA2_, omega_func )
127  );
128 
129  my_csts_.push_back( phi_cst );
130  my_csts_.push_back( psi_cst );
131  my_csts_.push_back( omega_cst );
132  }
133 }
134 
135 void BigBinConstraint::show( std::ostream & out ) const {
136  out << res_ << ' ' << bin_ << ' ' << sdev_ << std::endl;
137 }
138 
139 /////////////////////////////////////////////////////////////////////////////
140 void
142  XYZ_Func const & xyz, EnergyMap const & weights, EnergyMap & emap
143 ) const {
144  using utility::vector1;
146  for ( iter it = my_csts_.begin(), end = my_csts_.end(); it != end; ++it ) {
147  (*it)->score( xyz, weights, emap );
148  }
149 }
150 
151 void
153  AtomID const & id,
154  XYZ_Func const & xyz,
155  Vector & F1,
156  Vector & F2,
157  EnergyMap const & weights
158 ) const {
159  // call fill_f1_f2 on my_csts_
160  using utility::vector1;
162  for ( iter it = my_csts_.begin(), end = my_csts_.end(); it != end; ++it ) {
163  (*it)->fill_f1_f2( id, xyz, F1, F2, weights );
164  }
165 }
166 
167 } // constraints
168 } // scoring
169 } // core