Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ResidueDistanceFilter.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 protocols/simple_filters/ResidueDistanceFilter.cc
11 /// @brief
12 /// @author Sarel Fleishman (sarelf@u.washington.edu), Jacob Corn (jecorn@u.washington.edu)
13 
16 
17 #include <utility/tag/Tag.hh>
20 #include <core/pose/selection.hh>
23 #include <core/pose/Pose.hh>
24 
25 // Utility Headers
26 #include <basic/Tracer.hh>
27 
28 
29 namespace protocols {
30 namespace simple_filters {
31 
32 static basic::Tracer residue_distance_filter_tracer( "protocols.simple_filters.ResidueDistanceFilter" );
33 
36 
38 ResidueDistanceFilterCreator::keyname() const { return "ResidueDistance"; }
39 
41 
42 void
44 {
45  res1_ = core::pose::get_resnum( tag, pose, "res1_" );
46  res2_ = core::pose::get_resnum( tag, pose, "res2_" );
47  distance_threshold_ = tag->getOption<core::Real>( "distance", 8.0 );
48 
49  residue_distance_filter_tracer<<"ResidueDistanceFilter with distance threshold of "<<distance_threshold_<<" between residues "<<res1_<<" and "<<res2_<<std::endl;
50 }
51 
52 bool
54  core::Real const distance( compute( pose ) );
55 
56  residue_distance_filter_tracer<<"Distance between residues "<<pose.residue( res1_ ).name3()<<res1_<<" and "<<pose.residue( res2_ ).name3()<<res2_<<" is "<<distance<<std::endl;
57  return( distance<=distance_threshold_ );
58 }
59 
60 void
61 ResidueDistanceFilter::report( std::ostream & out, core::pose::Pose const & pose ) const {
62  core::Real const distance( compute( pose ) );
63 
64  out<<"Distance between residues "<<pose.residue( res1_ ).name3()<<res1_<<" and "<<pose.residue( res2_ ).name3()<<res2_<<" is "<<distance<<'\n';
65 }
66 
69  core::Real const distance( compute( pose ) );
70 
71  return( distance );
72 }
75  core::conformation::Residue const res_res1( pose.conformation().residue( res1_ ) );
76  core::conformation::Residue const res_res2( pose.conformation().residue( res2_ ) );
77  core::Real const distance( res_res1.xyz( res_res1.nbr_atom() ).distance( res_res2.xyz( res_res2.nbr_atom() ) ) );
78  return( distance );
79 }
80 
81 }
82 }