Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SingleResidueDunbrackLibrary.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 // Unit headers
12 
13 // Package headers
14 ///#include <core/pack/dunbrack/SingleResidueDunbrackLibrary.tmpl.hh>
15 // AUTO-REMOVED #include <core/pack/dunbrack/ChiSet.hh>
16 // AUTO-REMOVED #include <core/pack/dunbrack/CoarseRotamer.hh>
17 // AUTO-REMOVED #include <core/pack/dunbrack/CoarseSingleResidueLibrary.hh>
21 
26 
27 // Project headers
29 // AUTO-REMOVED #include <core/conformation/ResidueFactory.hh>
30 
31 // AUTO-REMOVED #include <core/coarse/Translator.hh>
32 #include <core/graph/Graph.hh>
33 
34 #include <basic/options/option.hh>
35 #include <basic/options/keys/packing.OptionKeys.gen.hh>
36 
38 
39 #include <core/pose/Pose.hh>
40 
42 
43 #include <basic/basic.hh>
44 // AUTO-REMOVED #include <basic/interpolate.hh>
45 #include <basic/Tracer.hh>
46 
48 // AUTO-REMOVED #include <core/pack/rotamer_set/RotamerSetOperation.hh>
49 
50 // Utility headers
51 #include <utility/exit.hh>
52 #include <utility/io/izstream.hh>
53 #include <utility/io/ozstream.hh>
54 #include <utility/vector1.hh>
55 
56 // Numeric headers
57 #include <numeric/random/random.hh>
58 
59 
60 namespace core {
61 namespace pack {
62 namespace dunbrack {
63 
64 static basic::Tracer SRDL_TR("core.pack.dunbrack");
65 static const Real MIN_ROT_PROB = 1.e-8;
66 
67 Real const SingleResidueDunbrackLibrary::NEUTRAL_PHI = -90; // R++ value. Roland Dunbrack suggests -60.
68 Real const SingleResidueDunbrackLibrary::NEUTRAL_PSI = 130; // R++ value. Roland Dunbrack suggests 60.
69 
71  AA const aa,
72  Size const n_rotameric_chi,
73  bool dun02
74 ) :
75  dun02_( dun02 ),
76  aa_( aa ),
77  n_rotameric_chi_( n_rotameric_chi ),
78  n_chi_bins_( n_rotameric_chi, 0 ),
79  n_chi_products_( n_rotameric_chi, 1),
80  n_packed_rots_( 0 ),
81  n_possible_rots_( 0 ),
82  prob_to_accumulate_buried_(0.98),
83  prob_to_accumulate_nonburied_(0.95),
84  packed_rotno_conversion_data_current_( false )
85 {
86  // this builds on the hard coded hack bellow
87  // since NCAAs are aa_unk we cannot hard code the information
88  // alternativly it is added to the residue type paramater files
89  read_options();
90  if (aa_ != chemical::aa_unk) {
92  for ( Size ii = n_rotameric_chi_; ii > 1; --ii ) {
93  n_chi_products_[ ii - 1 ] = n_chi_products_[ ii ] * n_chi_bins_[ ii ];
94  }
98  std::fill( rotwell_exists_.begin(), rotwell_exists_.end(), false );
99  std::fill( rotno_2_packed_rotno_.begin(), rotno_2_packed_rotno_.end(), 0 );
100  }
101 }
102 
103 /// @details Sets the number of bins for a particular chi angle, used for the NCAAs, info for CAAs is hardcoded bellow
104 void
106 {
107  // load rot size vector
108  n_chi_bins_.resize( n_chi_bins.size() );
109  for ( Size i = 1; i <= n_chi_bins.size(); ++i ) {
110  n_chi_bins_[i] = n_chi_bins[i];
111  }
112 
113  // basically the same as the ctor
114  for ( Size ii = n_rotameric_chi_; ii > 1; --ii ) {
115  n_chi_products_[ ii - 1 ] = n_chi_products_[ ii ] * n_chi_bins_[ ii ];
116  }
120  std::fill( rotwell_exists_.begin(), rotwell_exists_.end(), false );
121  std::fill( rotno_2_packed_rotno_.begin(), rotno_2_packed_rotno_.end(), 0 );
122 }
123 
125 
126 void
128 {
129  using namespace basic::options;
130  if ( option[ OptionKeys::packing::dunbrack_prob_buried ].user() )
131  prob_to_accumulate_buried( option[ OptionKeys::packing::dunbrack_prob_buried ]() );
132  if ( option[ OptionKeys::packing::dunbrack_prob_nonburied ].user() )
133  prob_to_accumulate_nonburied( option[ OptionKeys::packing::dunbrack_prob_nonburied ]() );
134 }
135 
136 /// @details the number of wells defined for the 08 library; includes
137 /// the number of wells for the semi-rotameric chi (arbitrarily chosen).
138 void
140  chemical::AA const aa,
141  RotVector & rot
142 )
143 {
144  /// HARD CODED HACK -- SHOULD MOVE THIS TO BECOME A VIRTUAL FUNCTION CALL
145  using namespace chemical;
146  switch ( aa ) {
147  case aa_ala: rot.resize( 0 ); break;
148  case aa_cys: rot.resize( 1 ); rot[ 1 ] = 3; break;
149  case aa_asp: rot.resize( 2 ); rot[ 1 ] = rot[ 2 ] = 6; break;
150  case aa_glu: rot.resize( 3 ); rot[ 1 ] = rot[ 2 ] = rot[ 3 ] = 6; break;
151  case aa_phe: rot.resize( 2 ); rot[ 1 ] = 3; rot[ 2 ] = 6; break;
152  case aa_gly: rot.resize( 0 ); break;
153  case aa_his: rot.resize( 2 ); rot[ 1 ] = 3; rot[ 2 ] = 12; break;
154  case aa_ile: rot.resize( 2 ); rot[ 1 ] = rot[ 2 ] = 3; break;
155  case aa_lys: rot.resize( 4 ); rot[ 1 ] = rot[ 2 ] = rot[ 3 ] = rot[ 4 ] = 3; break;
156  case aa_leu: rot.resize( 2 ); rot[ 1 ] = rot[ 2 ] = 3; break;
157  case aa_met: rot.resize( 3 ); rot[ 1 ] = rot[ 2 ] = rot[ 3 ] = 3; break;
158  case aa_asn: rot.resize( 2 ); rot[ 1 ] = 3; rot[ 2 ] = 12; break;
159  case aa_pro: rot.resize( 3 ); rot[ 1 ] = 2; rot[ 2 ] = rot[ 3 ] = 1; break;
160  case aa_gln: rot.resize( 3 ); rot[ 1 ] = rot[ 2 ] = 3; rot[ 3 ] = 12; break;
161  case aa_arg: rot.resize( 4 ); rot[ 1 ] = rot[ 2 ] = rot[ 3 ] = rot[ 4 ] = 3; break;
162  case aa_ser: rot.resize( 1 ); rot[ 1 ] = 3; break;
163  case aa_thr: rot.resize( 1 ); rot[ 1 ] = 3; break;
164  case aa_val: rot.resize( 1 ); rot[ 1 ] = 3; break;
165  case aa_trp: rot.resize( 2 ); rot[ 1 ] = 3; rot[ 2 ] = 12; break;
166  case aa_tyr: rot.resize( 2 ); rot[ 1 ] = 3; rot[ 2 ] = 6; break;
167  default:
168  rot.resize( 0 );
169  }
170 }
171 
172 /// @details For the rotameric chi -- not all chi are rotameric
173 void
175  chemical::AA const aa,
176  RotVector & rot,
177  bool dun02
178 )
179 {
180  if ( dun02 ) {
181  n_rotamer_bins_for_aa_02( aa, rot );
182  return;
183  }
184 
185 
186  using namespace chemical;
187  switch ( aa ) {
188  case aa_ala: rot.resize( 0 ); break;
189  case aa_cys: rot.resize( 1 ); rot[ 1 ] = 3; break;
190  case aa_asp: rot.resize( 1 ); rot[ 1 ] = 3; break;
191  case aa_glu: rot.resize( 2 ); rot[ 1 ] = rot[ 2 ] = 3; break;
192  case aa_phe: rot.resize( 1 ); rot[ 1 ] = 3; break;
193  case aa_gly: rot.resize( 0 ); break;
194  case aa_his: rot.resize( 1 ); rot[ 1 ] = 3; break;
195  case aa_ile: rot.resize( 2 ); rot[ 1 ] = rot[ 2 ] = 3; break;
196  case aa_lys: rot.resize( 4 ); rot[ 1 ] = rot[ 2 ] = rot[ 3 ] = rot[ 4 ] = 3; break;
197  case aa_leu: rot.resize( 2 ); rot[ 1 ] = rot[ 2 ] = 3; break;
198  case aa_met: rot.resize( 3 ); rot[ 1 ] = rot[ 2 ] = rot[ 3 ] = 3; break;
199  case aa_asn: rot.resize( 1 ); rot[ 1 ] = 3; break;
200  case aa_pro: rot.resize( 3 ); rot[ 1 ] = 2; rot[ 2 ] = rot[ 3 ] = 1; break;
201  case aa_gln: rot.resize( 2 ); rot[ 1 ] = rot[ 2 ] = 3; break;
202  case aa_arg: rot.resize( 4 ); rot[ 1 ] = rot[ 2 ] = rot[ 3 ] = rot[ 4 ] = 3; break;
203  case aa_ser: rot.resize( 1 ); rot[ 1 ] = 3; break;
204  case aa_thr: rot.resize( 1 ); rot[ 1 ] = 3; break;
205  case aa_val: rot.resize( 1 ); rot[ 1 ] = 3; break;
206  case aa_trp: rot.resize( 1 ); rot[ 1 ] = 3; break;
207  case aa_tyr: rot.resize( 1 ); rot[ 1 ] = 3; break;
208  default:
209  rot.resize( 0 );
210  }
211 }
212 
213 /// @details To continue supporting the 2002 Dunbrack library, we
214 /// need to preserve the rotamer well definitions that it made.
215 void
217  chemical::AA const aa,
218  RotVector & rot
219 )
220 {
221  using namespace chemical;
222  switch ( aa ) {
223  case aa_ala: rot.resize( 0 ); break;
224  case aa_cys: rot.resize( 1 ); rot[ 1 ] = 3; break;
225  case aa_asp: rot.resize( 2 ); rot[ 1 ] = rot[ 2 ] = 3; break;
226  case aa_glu: rot.resize( 3 ); rot[ 1 ] = rot[ 2 ] = rot[ 3 ] = 3; break;
227  case aa_phe: rot.resize( 2 ); rot[ 1 ] = 3; rot[ 2 ] = 2; break;
228  case aa_gly: rot.resize( 0 ); break;
229  case aa_his: rot.resize( 2 ); rot[ 1 ] = rot[ 2 ] = 3; break;
230  case aa_ile: rot.resize( 2 ); rot[ 1 ] = rot[ 2 ] = 3; break;
231  case aa_lys: rot.resize( 4 ); rot[ 1 ] = rot[ 2 ] = rot[ 3 ] = rot[ 4 ] = 3; break;
232  case aa_leu: rot.resize( 2 ); rot[ 1 ] = rot[ 2 ] = 3; break;
233  case aa_met: rot.resize( 3 ); rot[ 1 ] = rot[ 2 ] = rot[ 3 ] = 3; break;
234  case aa_asn: rot.resize( 2 ); rot[ 1 ] = 3; rot[ 2 ] = 6; break;
235  case aa_pro: rot.resize( 3 ); rot[ 1 ] = 2; rot[ 2 ] = rot[ 3 ] = 1; break;
236  case aa_gln: rot.resize( 3 ); rot[ 1 ] = rot[ 2 ] = 3; rot[ 3 ] = 4; break;
237  case aa_arg: rot.resize( 4 ); rot[ 1 ] = rot[ 2 ] = rot[ 3 ] = rot[ 4 ] = 3; break;
238  case aa_ser: rot.resize( 1 ); rot[ 1 ] = 3; break;
239  case aa_thr: rot.resize( 1 ); rot[ 1 ] = 3; break;
240  case aa_val: rot.resize( 1 ); rot[ 1 ] = 3; break;
241  case aa_trp: rot.resize( 2 ); rot[ 1 ] = rot[ 2 ] = 3; break;
242  case aa_tyr: rot.resize( 2 ); rot[ 1 ] = 3; rot[ 2 ] = 2; break;
243  default:
244  rot.resize( 0 );
245  }
246 }
247 
248 
249 /// 2002 Library hard code symmetry information.
250 Real
252  Real chi1,
253  Real chi2,
254  chemical::AA const & aa,
255  int chino
256 )
257 {
258  using namespace chemical;
259  using basic::periodic_range;
260 
261 
262  if ( chino == 2 ) { // handle symmetry cases for chi2
263  // -- not for HIS in new dunbrack version
264  if ( aa == aa_phe || aa == aa_tyr ) {
265  return periodic_range((chi1-chi2),180.);
266  } else if ( aa == aa_asp ) {
267  return periodic_range((chi1-chi2),180.);
268  }
269  } else if ( chino == 3 ) { // handle symmetry cases for chi3
270  if ( aa == aa_glu ) {
271  return periodic_range((chi1-chi2),180.);
272  }
273  }
274  return periodic_range((chi1-chi2),360.);
275 }
276 
277 
278 /// @brief The base class needs to be informed about which rotamer wells
279 /// exist in order to create the rotwell to packed rot conversion data.
280 /// set_chi_nbins must be called first.
281 void
283  utility::vector1< Size > const & rotwell
284 )
285 {
287  Size const rotno( rotwell_2_rotno( rotwell ) );
288  rotwell_exists_[ rotno ] = true;
289 }
290 
291 /// @brief After the derived class has marked all the rotwells that do exist,
292 /// the base class will create the rotwell to packerot conversion data.
293 void
295 {
296  Size count = 0;
297  for ( Size ii = 1; ii <= n_possible_rots_; ++ii ) {
298  if ( rotwell_exists_[ ii ] ) ++count;
299  }
300  n_packed_rots_ = count;
303  count = 0;
304  utility::vector1< Size > rotwell;
305  for ( Size ii = 1; ii <= n_possible_rots_; ++ii ) {
306  if ( rotwell_exists_[ ii ] ) {
307  ++count;
308  packed_rotno_2_rotno_[ count ] = ii;
309  rotno_2_packed_rotno_[ ii ] = count;
310  rotno_2_rotwell( ii, rotwell );
311  packed_rotno_2_rotwell_[ count ] = rotwell;
312  } else {
313  rotno_2_packed_rotno_[ ii ] = 0;
314  }
315  }
317 
318  // force deallocatation of rotamer_exists_ data
319  // neither resize() nor clear() guarantee emptying; swap does.
320  utility::vector1< bool > empty_vector;
321  rotwell_exists_.swap( empty_vector );
322 
323 }
324 
325 /// Conversion functions
326 
327 /// @brief Convert from the rotamer bin indices for each chi to the
328 /// (non-compact) "rotamer number"
329 Size
331  utility::vector1< Size > const & rotwell
332 ) const
333 {
334  assert( n_chi_products_.size() <= rotwell.size() );
335  Size runsum = 1;
336  for ( Size ii = 1; ii <= n_chi_products_.size(); ++ii ) {
337  runsum += n_chi_products_[ ii ]*( rotwell[ ii ] - 1 );
338  }
339  return runsum;
340 }
341 
342 /// @brief Convert from the rotamer bin indices for each chi to the
343 /// (non-compact) "rotamer number"
344 Size
346 {
347  assert( n_chi_products_.size() <= rotwell.size() );
348  Size runsum = 1;
349  for ( Size ii = 1; ii <= n_chi_products_.size(); ++ii ) {
350  runsum += n_chi_products_[ ii ]*( rotwell[ ii ] - 1 );
351  }
352  return runsum;
353 
354 }
355 
356 
357 /// @brief Convert from the rotamer number to the compacted
358 /// "packed rotamer number". Returns 0 if rotno has no corresponding packed rotno.
359 Size
361 {
363  if (rotno < 1 || rotno > rotno_2_packed_rotno_.size() ) return 0;
364  return rotno_2_packed_rotno_[ rotno ];
365 }
366 
367 
368 Size
370  utility::vector1< Size > const & rotwell
371 ) const
372 {
374  return rotno_2_packed_rotno( rotwell_2_rotno( rotwell ) );
375 }
376 
377 /// @brief Convert from the rotamer bin indices for each chi to the
378 /// compacted "packed rotamer number." Returns 0 if rotwell has no corresponding packed rotno
379 Size
381 {
383  return rotno_2_packed_rotno( rotwell_2_rotno( rotwell ) );
384 }
385 
386 
387 void
389  Size const packed_rotno,
390  utility::vector1< Size > & rotwell
391 ) const
392 {
393  rotwell = packed_rotno_2_rotwell_[ packed_rotno ];
394 }
395 
396 void
398  Size const packed_rotno,
399  Size4 & rotwell
400 ) const
401 {
402  assert( packed_rotno_2_rotwell_[ packed_rotno ].size() <= rotwell.size() );
403  std::copy( packed_rotno_2_rotwell_[ packed_rotno ].begin(), packed_rotno_2_rotwell_[ packed_rotno ].end(), rotwell.begin() );
404 }
405 
408 {
409  return packed_rotno_2_rotwell_[ packed_rotno ];
410 }
411 
412 
413 void
414 SingleResidueDunbrackLibrary::write_to_binary( utility::io::ozstream & out ) const
415 {
416  using namespace boost;
417  /// 1. n_packed_rots_
418  {
419  boost::int32_t n_packed_rots( n_packed_rots_ );
420  out.write( (char*) & n_packed_rots, sizeof( boost::int32_t ));
421  }
422 
423 
424  /// 2. rotno_2_packed_rotno_
425  {
426  boost::int32_t * rotno_2_packed_rotno = new boost::int32_t[ n_possible_rots_ ];
427  for ( Size ii = 1; ii <= n_possible_rots_; ++ii ) rotno_2_packed_rotno[ ii - 1 ] = rotno_2_packed_rotno_[ ii ];
428  out.write( (char*) rotno_2_packed_rotno, n_possible_rots_ * sizeof( boost::int32_t ) );
429  delete [] rotno_2_packed_rotno; rotno_2_packed_rotno = 0;
430  }
431 
432  /// 3. packed_rotno_2_rotno_
433  {
434  boost::int32_t * packed_rotno_2_rotno = new boost::int32_t[ n_packed_rots_ ];
435  for ( Size ii = 1; ii <= n_packed_rots_; ++ii ) packed_rotno_2_rotno[ ii - 1 ] = packed_rotno_2_rotno_[ ii ];
436  out.write( (char*) packed_rotno_2_rotno, n_packed_rots_ * sizeof( boost::int32_t ) );
437  delete [] packed_rotno_2_rotno; packed_rotno_2_rotno = 0;
438  }
439 
440  /// 4. packed_rotno_2_rotwell_
441  {
442  boost::int32_t * packed_rotno_2_rotwell = new boost::int32_t[ n_packed_rots_ * n_rotameric_chi_ ];
443  Size count( 0 );
444  for ( Size ii = 1; ii <= n_packed_rots_; ++ii ) {
445  for ( Size jj = 1; jj <= n_rotameric_chi_; ++jj ) {
446  packed_rotno_2_rotwell[ count ] = packed_rotno_2_rotwell_[ ii ][ jj ];
447  ++count;
448  }
449  }
450  out.write( (char*) packed_rotno_2_rotwell, n_packed_rots_ * n_rotameric_chi_ * sizeof( boost::int32_t ) );
451  delete [] packed_rotno_2_rotwell; packed_rotno_2_rotwell = 0;
452  }
453 
454 }
455 
456 void
458 {
459 
460  /// 1. n_packed_rots_
461  {
462  boost::int32_t n_packed_rots( 0 );
463  in.read( (char*) & n_packed_rots, sizeof( boost::int32_t ));
465  }
466 
467  /// 2. rotno_2_packed_rotno_
468  {
469  boost::int32_t * rotno_2_packed_rotno = new boost::int32_t[ n_possible_rots_ ];
470  in.read( (char*) rotno_2_packed_rotno, n_possible_rots_ * sizeof( boost::int32_t ) );
471  for ( Size ii = 1; ii <= n_possible_rots_; ++ii ) rotno_2_packed_rotno_[ ii ] = rotno_2_packed_rotno[ ii - 1 ];
472  delete [] rotno_2_packed_rotno; rotno_2_packed_rotno = 0;
473  }
474 
475  /// 3. packed_rotno_2_rotno_
476  {
477  boost::int32_t * packed_rotno_2_rotno = new boost::int32_t[ n_packed_rots_ ];
478  in.read( (char*) packed_rotno_2_rotno, n_packed_rots_ * sizeof( boost::int32_t ) );
480  for ( Size ii = 1; ii <= n_packed_rots_; ++ii ) packed_rotno_2_rotno_[ ii ] = packed_rotno_2_rotno[ ii - 1 ];
481  delete [] packed_rotno_2_rotno; packed_rotno_2_rotno = 0;
482  }
483 
484  /// 4. packed_rotno_2_rotwell_
485  {
486  boost::int32_t * packed_rotno_2_rotwell = new boost::int32_t[ n_packed_rots_ * n_rotameric_chi_ ];
487  in.read( (char*) packed_rotno_2_rotwell, n_packed_rots_ * n_rotameric_chi_ * sizeof( boost::int32_t ) );
489  Size count( 0 );
490  for ( Size ii = 1; ii <= n_packed_rots_; ++ii ) {
492  for ( Size jj = 1; jj <= n_rotameric_chi_; ++jj ) {
493  packed_rotno_2_rotwell_[ ii ][ jj ] = packed_rotno_2_rotwell[ count ];
494  ++count;
495  }
496  }
497  delete [] packed_rotno_2_rotwell;
498  }
500 }
501 
502 /// @details not as fast as going through the packed_rotno_2_rotwell_
503 /// lookup table, but does the modulo converstion from a 1-based index
504 /// to a lexicographical index ordering.
505 ///
506 /// if there are 3 chi, and 3 rotamer bins per chi, then
507 /// 21 would represent (3-1) * 3**2 + (1-1) * 3**1 + (3-1) * 3**0 + 1 = [ 3, 1, 3 ];
508 void
510  Size const rotno,
511  utility::vector1< Size > & rotwell
512 ) const
513 {
514  Size remainder = rotno - 1;
515  rotwell.resize( n_rotameric_chi_ );
516  std::fill( rotwell.begin(), rotwell.end(), 1 );
517  for ( Size ii = 1; ii <= n_rotameric_chi_; /* no increment */ ) {
518  if ( remainder > n_chi_products_[ ii ] ) {
519  remainder -= n_chi_products_[ ii ];
520  ++rotwell[ ii ];
521  } else {
522  ++ii;
523  }
524  }
525 }
526 
527 Real
529  bool buried
530 ) const
531 {
533 }
534 
535 /// @brief setters for accumulation probability cutoff (to support externally-controlled option dependence)
536 void
538 {
539  prob_to_accumulate_buried( buried );
540  prob_to_accumulate_nonburied( nonburied );
541 }
542 void
544 {
545  if ( buried <= 0. || buried > 1.0 ) utility_exit_with_message("illegal probability");
547 }
548 void
550 {
551  if ( nonburied <= 0. || nonburied > 1.0 ) utility_exit_with_message("illegal probability");
552  prob_to_accumulate_nonburied_ = nonburied;
553 }
554 
556 {
558 }
559 
561 {
562  Size total = 0;
563  total += n_chi_bins_.size() * sizeof( Size );
564  total += n_chi_products_.size() * sizeof( Size );
565  total += rotwell_exists_.size() * sizeof( Size );
566  total += rotno_2_packed_rotno_.size() * sizeof( Size );
567  total += packed_rotno_2_rotno_.size() * sizeof( Size );
568  for ( Size ii = 1; ii <= packed_rotno_2_rotwell_.size(); ++ii ) {
569  total += packed_rotno_2_rotwell_[ ii ].size() * sizeof( Size );
570  }
571  total += packed_rotno_2_rotwell_.size() * sizeof( utility::vector1< Size > );
572  return total;
573 }
574 
575 
576 /// @details forces instantiation of virtual functions for templated
577 /// derived classes... part of the uglyness of mixing templates and
578 /// polymorphism. Never invoke this function.
579 void
581 {
582  assert( false );
583  utility_exit_with_message(
584  "ERROR: SingleResidueDunbrackLibrary::hokey_template_workaround should never be called!");
585 
590 
591  SemiRotamericSingleResidueDunbrackLibrary< ONE > srsrdl_1( chemical::aa_ala, true, true ); //e.g. asn,phe
592  SemiRotamericSingleResidueDunbrackLibrary< TWO > srsrdl_2( chemical::aa_ala, true, true ); // e.g. glu
593  // three and four do not exist... they could in the future if needed.
594 
595  chemical::ResidueType blah( 0, 0, 0, 0 ); ///TODO shouldnt this variable be named something else?
596  conformation::Residue rsd( blah, true );
598  Size4 rotwell;
599  Size i(0);
600 
605 
606  rsrdl_1.nchi();
607  rsrdl_2.nchi();
608  rsrdl_3.nchi();
609  rsrdl_4.nchi();
610  srsrdl_1.nchi();
611  srsrdl_2.nchi();
612 
613  rsrdl_1.n_rotamer_bins();
614  rsrdl_2.n_rotamer_bins();
615  rsrdl_3.n_rotamer_bins();
616  rsrdl_4.n_rotamer_bins();
617  srsrdl_1.n_rotamer_bins();
618  srsrdl_2.n_rotamer_bins();
619 
620 
621  rsrdl_1.rotamer_energy( rsd, scratch );
622  rsrdl_2.rotamer_energy( rsd, scratch );
623  rsrdl_3.rotamer_energy( rsd, scratch );
624  rsrdl_4.rotamer_energy( rsd, scratch );
625  srsrdl_1.rotamer_energy( rsd, scratch );
626  srsrdl_2.rotamer_energy( rsd, scratch );
627 
628  rsrdl_1.rotamer_energy_deriv( rsd, scratch );
629  rsrdl_2.rotamer_energy_deriv( rsd, scratch );
630  rsrdl_3.rotamer_energy_deriv( rsd, scratch );
631  rsrdl_4.rotamer_energy_deriv( rsd, scratch );
632  srsrdl_1.rotamer_energy_deriv( rsd, scratch );
633  srsrdl_2.rotamer_energy_deriv( rsd, scratch );
634 
635  rsrdl_1.best_rotamer_energy( rsd, true, scratch );
636  rsrdl_2.best_rotamer_energy( rsd, true, scratch );
637  rsrdl_3.best_rotamer_energy( rsd, true, scratch );
638  rsrdl_4.best_rotamer_energy( rsd, true, scratch );
639  srsrdl_1.best_rotamer_energy( rsd, true, scratch );
640  srsrdl_2.best_rotamer_energy( rsd, true, scratch );
641 
646  RotamerVector rv;
647 
648  rsrdl_1.fill_rotamer_vector( pose, sfxn, task, png, cr, rsd, ecs, true, rv );
649  rsrdl_2.fill_rotamer_vector( pose, sfxn, task, png, cr, rsd, ecs, true, rv );
650  rsrdl_3.fill_rotamer_vector( pose, sfxn, task, png, cr, rsd, ecs, true, rv );
651  rsrdl_4.fill_rotamer_vector( pose, sfxn, task, png, cr, rsd, ecs, true, rv );
652  srsrdl_1.fill_rotamer_vector( pose, sfxn, task, png, cr, rsd, ecs, true, rv );
653  srsrdl_2.fill_rotamer_vector( pose, sfxn, task, png, cr, rsd, ecs, true, rv );
654 
655  utility::io::ozstream ozs;
656  rsrdl_1.write_to_file( ozs );
657  rsrdl_2.write_to_file( ozs );
658  rsrdl_3.write_to_file( ozs );
659  rsrdl_4.write_to_file( ozs );
660  srsrdl_1.write_to_file( ozs );
661  srsrdl_2.write_to_file( ozs );
662 
663  utility::io::ozstream os;
664  rsrdl_1.write_to_binary( os );
665  rsrdl_2.write_to_binary( os );
666  rsrdl_3.write_to_binary( os );
667  rsrdl_4.write_to_binary( os );
668  srsrdl_1.write_to_binary( os );
669  srsrdl_2.write_to_binary( os );
670 
671  utility::io::izstream is;
672  rsrdl_1.read_from_binary( is );
673  rsrdl_2.read_from_binary( is );
674  rsrdl_3.read_from_binary( is );
675  rsrdl_4.read_from_binary( is );
676  srsrdl_1.read_from_binary( is );
677  srsrdl_2.read_from_binary( is );
678 
679  rsrdl_1.memory_usage_in_bytes();
680  rsrdl_2.memory_usage_in_bytes();
681  rsrdl_3.memory_usage_in_bytes();
682  rsrdl_4.memory_usage_in_bytes();
683  srsrdl_1.memory_usage_in_bytes();
684  srsrdl_2.memory_usage_in_bytes();
685 
687  rsrdl_1.get_rotamer_from_chi( chi, rot );
688  rsrdl_2.get_rotamer_from_chi( chi, rot );
689  rsrdl_3.get_rotamer_from_chi( chi, rot );
690  rsrdl_4.get_rotamer_from_chi( chi, rot );
691  srsrdl_1.get_rotamer_from_chi( chi, rot );
692  srsrdl_2.get_rotamer_from_chi( chi, rot );
693 
694  rsrdl_1.find_another_representative_for_unlikely_rotamer( rsd, rotwell );
695  rsrdl_2.find_another_representative_for_unlikely_rotamer( rsd, rotwell );
696  rsrdl_3.find_another_representative_for_unlikely_rotamer( rsd, rotwell );
697  rsrdl_4.find_another_representative_for_unlikely_rotamer( rsd, rotwell );
698  srsrdl_1.find_another_representative_for_unlikely_rotamer( rsd, rotwell );
699  srsrdl_2.find_another_representative_for_unlikely_rotamer( rsd, rotwell );
700 
701  rsrdl_1.interpolate_rotamers( rsd, scratch, i, prot1 );
702  rsrdl_2.interpolate_rotamers( rsd, scratch, i, prot2 );
703  rsrdl_3.interpolate_rotamers( rsd, scratch, i, prot3 );
704  rsrdl_4.interpolate_rotamers( rsd, scratch, i, prot4 );
705  srsrdl_1.interpolate_rotamers( rsd, scratch, i, prot1 );
706  srsrdl_2.interpolate_rotamers( rsd, scratch, i, prot2 );
707 
708  rsrdl_1.memory_usage_dynamic();
709  rsrdl_2.memory_usage_dynamic();
710  rsrdl_3.memory_usage_dynamic();
711  rsrdl_4.memory_usage_dynamic();
712  srsrdl_1.memory_usage_dynamic();
713  srsrdl_2.memory_usage_dynamic();
714 
715  rsrdl_1.memory_usage_static();
716  rsrdl_2.memory_usage_static();
717  rsrdl_3.memory_usage_static();
718  rsrdl_4.memory_usage_static();
719  srsrdl_1.memory_usage_static();
720  srsrdl_2.memory_usage_static();
721 
722  rsrdl_1.get_all_rotamer_samples( 0.0, 0.0 );
723  rsrdl_2.get_all_rotamer_samples( 0.0, 0.0 );
724  rsrdl_3.get_all_rotamer_samples( 0.0, 0.0 );
725  rsrdl_4.get_all_rotamer_samples( 0.0, 0.0 );
726  srsrdl_1.get_all_rotamer_samples( 0.0, 0.0 );
727  srsrdl_2.get_all_rotamer_samples( 0.0, 0.0 );
728 
729 
730  numeric::random::RandomGenerator RG(1);
731  ChiVector chiv;
732 
733  rsrdl_1.assign_random_rotamer_with_bias( rsd, scratch, RG, chiv, true );
734  rsrdl_2.assign_random_rotamer_with_bias( rsd, scratch, RG, chiv, true );
735  rsrdl_3.assign_random_rotamer_with_bias( rsd, scratch, RG, chiv, true );
736  rsrdl_4.assign_random_rotamer_with_bias( rsd, scratch, RG, chiv, true );
737  srsrdl_1.assign_random_rotamer_with_bias( rsd, scratch, RG, chiv, true );
738  srsrdl_2.assign_random_rotamer_with_bias( rsd, scratch, RG, chiv, true );
739 
740  rsrdl_1.get_probability_for_rotamer( 0.0, 0.0, 1 );
741  rsrdl_2.get_probability_for_rotamer( 0.0, 0.0, 1 );
742  rsrdl_3.get_probability_for_rotamer( 0.0, 0.0, 1 );
743  rsrdl_4.get_probability_for_rotamer( 0.0, 0.0, 1 );
744  srsrdl_1.get_probability_for_rotamer( 0.0, 0.0, 1 );
745  srsrdl_2.get_probability_for_rotamer( 0.0, 0.0, 1 );
746 
747  rsrdl_1.get_rotamer( 0.0, 0.0, 1 );
748  rsrdl_2.get_rotamer( 0.0, 0.0, 1 );
749  rsrdl_3.get_rotamer( 0.0, 0.0, 1 );
750  rsrdl_4.get_rotamer( 0.0, 0.0, 1 );
751  srsrdl_1.get_rotamer( 0.0, 0.0, 1 );
752  srsrdl_2.get_rotamer( 0.0, 0.0, 1 );
753 
754  /*
755  rsrdl_1
756  rsrdl_2
757  rsrdl_3
758  rsrdl_4
759  srsrdl_1
760  srsrdl_2
761  */
762 
763 }
764 
765 
766 } // namespace dunbrack
767 } // namespace scoring
768 } // namespace core
769