Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
NatbiasHelixPairPotential.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 ./src/protocols/fldsgn/potentials/sspot/NatbiasHelixPairPotential.cc
11 /// @brief calss for helix-pairing potential
12 /// @author Nobuyasu Koga ( nobuyasu@uw.edu )
13 
14 // Unit header
16 
17 // Package headers
18 
19 // Project headers
20 // AUTO-REMOVED #include <core/pose/Pose.hh>
23 #include <numeric/numeric.functions.hh>
24 #include <basic/Tracer.hh>
25 
26 #include <utility/vector1.hh>
27 
28 
29 static basic::Tracer TR("protocols.fldsgn.potentials.sspot.NatbiasHelixPairPotential", basic::t_info);
30 
31 namespace protocols {
32 namespace fldsgn {
33 namespace potentials {
34 namespace sspot {
35 
36 /// @Brief default constructor
38  hpairset_( NULL )
39 {
40  set_params();
41 }
42 
43 
44 /// @brief value constructor
46  hpairset_( hpairset )
47 {
48  set_params();
49 }
50 
51 /// @brief set parmeters
52 void
54 {
55  bend_angle_ = 20.0;
56 
57  dist_wts_ = 0.5;
58  mid_dist_ = 15.0;
59  dist_sigma2_ = 7.5;
60 
61  angle_wts_ = 0.5;
62  cross_angle_ = 45.0;
63  angle_sigma2_ = 20.0;
64 }
65 
66 /// @brief copy constructor
68  ReferenceCount(),
69  bend_angle_( src.bend_angle_ ),
70  dist_wts_( src.dist_wts_ ),
71  mid_dist_( src.mid_dist_ ),
72  dist_sigma2_( src.dist_sigma2_ ),
73  angle_wts_( src.angle_wts_ ),
74  cross_angle_( src.cross_angle_ ),
75  angle_sigma2_( src.angle_sigma2_ ),
76  hpairset_( src.hpairset_ )
77 {}
78 
79 
80 /// @brief default destructor
82 {}
83 
84 /// @brief set HelixPairingSet
85 void
87 {
88  hpairset_ = hpairset;
89 }
90 
91 /// @brief set parameters for distance score between mid points of helices
92 void
94 {
95  dist_wts_ = w;
96  mid_dist_ = d;
97  dist_sigma2_ = s;
98 }
99 
100 /// @brief set parameters for angle score of helix pair
101 void
103 {
104  angle_wts_ = w;
105  cross_angle_ = d;
106  angle_sigma2_ = s;
107 }
108 
109 /// @brief show parameters
110 void
112 {
113  TR << "HH_dist, wts, dist, sigma2 " << dist_wts_ << " " << mid_dist_ << " " << dist_sigma2_ << std::endl;
114  TR << "HH_angle, wts, dist, sigma2 " << angle_wts_ << " " << cross_angle_ << " " << angle_sigma2_ << std::endl;
115 }
116 
117 /// @brief
118 void
120 {
121  if( ! hpairset_ ) {
122  TR << "No helix pairings to be calculated. ";
123  return;
124  }
125 
126  Size nhpairs = hpairset_->helix_pairings().size();
127  SS_Info2_OP ssinfo = new SS_Info2( pose );
128  utility::vector1< Real > hh_scores( nhpairs, 0.0 );
129 
130  Real hh_score( 0.0 );
131  score( ssinfo, hh_score );
132 
133  Size num( 0 );
134  HelixPairings const & hpairs = hpairset_->helix_pairings();
135  TR << "name distance cross_angle align_angle score " << std::endl;
136  for( HelixPairings::const_iterator it=hpairs.begin(), ite=hpairs.end() ; it != ite; ++it ) {
137  num++;
138  HelixPairing const & hpair( **it );
139  TR << hpair << " " << hh_scores_[ num ] << std::endl;
140  }
141 
142 } // show
143 
144 
145 /// @brief
146 void
147 NatbiasHelixPairPotential::score( SS_Info2_COP const ss_info, Real & hh_score ) const
148 {
152 
153  if( ! hpairset_ ) {
154  return;
155  }
156 
157  // calc geometry
158  hpairset_->calc_geometry( ss_info );
159 
160  // helices for checking bend of them
161  Helices const & helices( ss_info->helices() );
162 
163  // take helix pairings
164  HelixPairings const & hpairs = hpairset_->helix_pairings();
165 
166  Real asigma = 2*angle_sigma2_;
167  Real dsigma = 2*dist_sigma2_;
168 
169  Size num( 0 );
170 
171  hh_scores_.resize( hpairset_->helix_pairings().size() );
172  for( HelixPairings::const_iterator it=hpairs.begin(), ite=hpairs.end(); it != ite; ++it ) {
173 
174  num++;
175  hh_scores_[ num ] = 0.0;
176  HelixPairing const & hpair( **it );
177 
178  // check bending of helix and give high penalty if helix bend is big
179  if ( helices[ hpair.h1() ]->bend() > bend_angle_ ) hh_scores_[ num ] += 10.0;
180  if ( helices[ hpair.h2() ]->bend() > bend_angle_ ) hh_scores_[ num ] += 10.0;
181 
182  if ( hpair.dist() <= mid_dist_ ) {
183 
184  // Edist = -wd if ( d < d0 )
185  hh_scores_[ num ] += -dist_wts_;
186 
187  if ( hpair.cross_angle() <= cross_angle_ ) {
188  // Eangle = -wa if( a < a0 )
189  hh_scores_[ num ] += -angle_wts_;
190  } else {
191  // Eangle = -wa * exp( -( c-c0 )**2/(2*sa) ) if ( a > a0 )
192  Real r = numeric::square( hpair.cross_angle() - cross_angle_ )/asigma;
193  Real s = - angle_wts_*exp( -r );
194  hh_scores_[ num ] += s;
195  }
196 
197  } else {
198  // Edist = -wd * exp( -( d-d0 )**2/(2*sd) ) if ( d > d0 )
199  Real r = numeric::square( hpair.dist() - mid_dist_ )/dsigma;
200  Real s = - dist_wts_*exp( -r );
201  hh_scores_[ num ] += s;
202  }
203 
204  hh_score += hh_scores_[ num ];
205 
206  TR.Debug << hpair << " " << hh_scores_[ num ] << std::endl;
207 
208  } // for ( HelixPairings )
209 
210 } // score
211 
212 
213 } // ns sspot
214 } // ns potentials
215 } // ns fldsgn
216 } // ns protocols