Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AllResiduesChanged.hh
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 #ifndef INCLUDED_protocols_abinitio_AllResiduesChanged_hh
11 #define INCLUDED_protocols_abinitio_AllResiduesChanged_hh
12 
14 
16 #include <core/pose/Pose.hh>
17 
20 
21 #include <utility/vector1.hh>
22 
23 
24 namespace protocols {
25 namespace abinitio {
26 
27 //so far this class is only included by FragmentSampler.cc and ClassicAbinitio.cc
28 //change to a proper modul if you must
29 
30 
31 /// @brief (helper) functor class which keeps track of initial phi/psi values.
32 /// @detail
33 /// calls of operator ( pose ) compare the initial phi/psi values
34 ////to the current values of the given pose. Returns false once all phi/psi values
35 /// have been modified.
37 public:
39  core::fragment::InsertMap const& insert_map,
41  ) :
42  insert_pos_( pose.total_residue(), false )
43  {
44  set_initial_pose( pose );
45  compute_insert_pos( insert_map, mm );
46  }
47 
49  insert_pos_( pose.total_residue(), true )
50  {
51  set_initial_pose( pose );
52  }
53 
54 private:
55 
58  ) {
59  for ( core::fragment::InsertMap::const_iterator it = insert_map.begin(),
60  eit = insert_map.end(); it != eit; ++it ) {
61  Size const pos ( *it );
62  if ( pos > insert_pos_.size() ) break;
63  if ( mm.get_bb( pos ) ) {
64  insert_pos_[ pos ] = true;
65  }
66  }
67  }
68 
69  void set_initial_pose( const core::pose::Pose & pose ) {
70  for ( unsigned int i = 1; i <= pose.total_residue(); ++i ) {
71  if ( ! pose.residue(i).is_protein() ) continue;
72  initial_phis.push_back( pose.phi(i) );
73  initial_psis.push_back( pose.psi(i) );
74  }
75 
77  }
78 
79 public:
80  void show_unmoved( const core::pose::Pose & pose, std::ostream& out ) {
81  runtime_assert( original_sequence_ == pose.sequence() );
82  for ( core::Size i = 1; i <= pose.total_residue(); ++i ) {
83  if ( ! pose.residue(i).is_protein() ) continue;
84  if ( initial_phis[i] == pose.phi(i) && insert_pos_[ i ] ) {
85  out << i << " ";
86  continue;
87  }
88  if ( initial_psis[i] == pose.psi(i) && insert_pos_[ i ] ) {
89  out << i << " ";
90  }
91  }
92  out << std::endl;
93  }
94 
95  virtual bool operator() ( const core::pose::Pose & pose ) {
96  runtime_assert( original_sequence_ == pose.sequence() ); // imperfect attempt to check that Pose hasn't changed ...
97  for ( unsigned int i = 1; i <= pose.total_residue(); ++i ) {
98  if ( ! pose.residue(i).is_protein() ) continue;
99  if ( initial_phis[i] == pose.phi(i) && insert_pos_[ i ] ) {
100  return false;
101  }
102  if ( initial_psis[i] == pose.psi(i) && insert_pos_[ i ] ) {
103  return false;
104  }
105  }
106  return true;
107  }
108 
109 private:
112 
114 
117 };
118 
119 }
120 }
121 
122 #endif