Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JumpEvaluator.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 PoseEvaluator
11 /// @brief PoseEvaluator
12 /// @detailed
13 ///
14 ///
15 /// @author Oliver Lange
16 
17 
18 
19 // Unit Headers
21 
22 // Package Headers
23 
24 // Project Headers
27 #include <core/pose/Pose.hh>
28 
29 // ObjexxFCL Headers
30 #include <ObjexxFCL/string.functions.hh>
31 
32 #include <utility/vector1.hh>
33 #include <numeric/xyz.functions.hh>
34 
35 //Auto Headers
39 
40 
41 namespace protocols {
42 namespace simple_filters {
43 
44 using namespace core;
45 
46 /* It probably would be nice to change the interface away from using jump_nr towards
47  explicit naming of the Stubs one wants to evaluate
48 
49  New interface would be :
50  NamedStubID up_stub
51  NamedStubID down_stub
52 
53  that would enable us to get rid of the current distinction ( is_protein() ) which
54  switches between using the assumption that stub is N, CA, C or using the intrinsic atom-tree stubs
55 
56  using the atom-tree stubs is a bit against the philosophy of this evaluator since its existence was actually
57  prompted by the problem that the atom-tree was using different atoms for the stub then expected and thus screwing
58  up the simulation. An Evaluator using the atom-tree stubs would not have detected this problem.
59 
60 */
61 
62 JumpEvaluator::JumpEvaluator( pose::Pose const& native_pose, Size jump_nr ) :
63  evaluation::SingleValuePoseEvaluator< core::Real >( "RT_"+ObjexxFCL::string_of( jump_nr ) ),
64  jump_nr_( jump_nr )
65 {
66  using namespace kinematics;
67  kinematics::Edge jump_edge = native_pose.fold_tree().jump_edge( jump_nr );
68  Size res1=jump_edge.start();
69  Size res2=jump_edge.stop();
70 
71  // work out the stubID
72  chemical::ResidueType const& rt1 ( native_pose.residue_type ( res1 ) );
73  chemical::ResidueType const& rt2 ( native_pose.residue_type ( res2 ) );
74 
75  if ( jump_edge.has_atom_info() && !(rt1.is_protein() && rt2.is_protein()) ) { // if jump_atoms defined, get stubs directly from atom_tree. temporary fix to pass unit test, but check with Oliver!
76  up_jump_atom_ = id::AtomID( rt1.atom_index( jump_edge.start_atom() ), res1 );
77  down_jump_atom_ = id::AtomID( rt2.atom_index( jump_edge.stop_atom() ), res2 );
80  } else { // otherwise assume standard protein residue to residue jump
81  id::AtomID a1( rt1.atom_index ("N") , res1 );
82  id::AtomID a2( rt1.atom_index ("CA") , res1 );
83  id::AtomID a3( rt1.atom_index ("C") , res1 );
84  down_stub_ = id::StubID( a1, a2, a3 );
85 
86  id::AtomID b1( rt2.atom_index ("N") , res2 );
87  id::AtomID b2( rt2.atom_index ("CA") , res2 );
88  id::AtomID b3( rt2.atom_index ("C") , res2 );
89  up_stub_ = id::StubID(b1, b2, b3 );
90 
91  native_up_ = native_pose.conformation().atom_tree().stub_from_id( up_stub_ );
92  native_down_ = native_pose.conformation().atom_tree().stub_from_id( down_stub_ );
93  }
94 }
95 
96 
99  pose::Pose& pose
100 ) const {
101 
102  kinematics::Stub up, down;
103  if ( up_jump_atom_.valid() && down_jump_atom_.valid() ) { // jump_atoms defined
104  up = pose.conformation().atom_tree().atom( up_jump_atom_ ).get_stub();
105  down = pose.conformation().atom_tree().atom( down_jump_atom_ ).get_stub();
106  } else {
107  up = pose.conformation().atom_tree().stub_from_id( up_stub_ );
108  down = pose.conformation().atom_tree().stub_from_id( down_stub_ );
109  }
110  kinematics::RT rt(up, down);
111 
112  kinematics::Stub test_down;
113  rt.make_jump( native_up_, test_down );
114 
115  Real rms( 0.0 );
116  for ( Size i=1; i<=3; i++ ) {
117  Vector tv = test_down.build_fake_xyz( i );
119  Vector d = nv-tv;
120  rms += d.length();
121  }
122  return rms;
123 }
124 
127  pose::Pose& pose
128 ) const {
129  return pose.num_jump();
130 }
131 
132 
133 
134 }
135 }