Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
NcontactsFilter.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/filters/NcontactsFilter.cc
11 /// @brief filter structures by sheet topology
12 /// @detailed
13 /// @author Nobuyasu Koga ( nobuyasu@uw.edu )
14 
15 // Unit Headers
18 
19 // Package Headers
21 
22 // Project Headers
23 #include <basic/MetricValue.hh>
24 #include <basic/Tracer.hh>
25 
27 #include <utility/tag/Tag.hh>
28 
29 //// C++ headers
30 // AUTO-REMOVED #include <cmath>
31 #include <map>
32 
33 #include <utility/vector0.hh>
34 #include <utility/vector1.hh>
35 
36 
37 static basic::Tracer tr("protocols.fldsgn.filters.NcontactsFilter");
38 
39 namespace protocols {
40 namespace fldsgn {
41 namespace filters {
42 
43 /// @brief default constructor
45  Filter( "Ncontacts" ),
46  report_type_( "sidechain_heavy_apolar_atm" ),
47  filter_value_( 0.0 )
48 {}
49 
50 /// @brief default constructor
52  String const & report_type,
53  Real const filter_value ):
54  Filter( "Ncontacts" ),
55  report_type_( report_type ),
56  filter_value_( filter_value )
57 {}
58 
59 /// @brief copy constructor
61  //utility::pointer::ReferenceCount(),
62  Super( rval ),
63  report_type_( rval.report_type_ ),
64  filter_value_( rval.filter_value_ )
65 {}
66 
67 /// @brief destructor
69 
70 /// @brief
72 NcontactsFilter::report_sm( Pose const & pose ) const
73 {
74  return compute( pose );
75 }
76 
77 /// @brief
78 void
79 NcontactsFilter::report( std::ostream & out, Pose const & pose ) const
80 {
81  out << "Ncontacts: " << compute( pose ) << "\n";
82 }
83 
84 
85 // @brief returns true if the given pose passes the filter, false otherwise.
86 // In this case, the test is whether the give pose is the topology we want.
87 bool
88 NcontactsFilter::apply( Pose const & pose ) const
89 {
90  Real score = compute( pose );
91 
92  if( filter_value_ < score ){
93  return true;
94  }else{
95  return false;
96  }
97 } // apply
98 
99 /// @brief comute ncontacts
101 NcontactsFilter::compute( Pose const & pose ) const
102 {
103 
104  basic::MetricValue< Real > ncontact;
105 
106  NcontactsCalculator calc_ncon;
107  calc_ncon.get( report_type_, ncontact, pose );
108 
109  return ncontact.value();
110 } // compute
111 
112 /// @brief parse xml
113 void
115  TagPtr const tag,
116  DataMap &,
117  Filters_map const &,
118  Movers_map const &,
119  Pose const & )
120 {
121  report_type_ = tag->getOption< String >( "type", "sidechain_heavy_apolar_atm" );
122  filter_value_ = tag->getOption< Real >( "value", 0.0 );
123 }
124 
127 
129 NcontactsFilterCreator::keyname() const { return "Ncontacts"; }
130 
131 
132 
133 } // filters
134 } // fldsgn
135 } // protocols