22 #include <basic/MetricValue.hh>
33 #include <basic/Tracer.hh>
34 #include <utility/exit.hh>
35 #include <utility/string_util.hh>
38 #include <basic/options/keys/packing.OptionKeys.gen.hh>
43 static basic::Tracer
TR(
"protocols.toolbox.PoseMetricCalculators.NeighborsByDistanceCalculator");
47 namespace pose_metric_calculators {
50 :
parent(), central_residue_(central_residue), dist_cutoff_(dist_cutoff), num_neighbors_(0)
55 :
parent(), central_residue_(calculator.central_residue()), dist_cutoff_(calculator.dist_cutoff())
64 basic::MetricValueBase * valptr
67 if ( key ==
"central_residue" ) {
68 basic::check_cast( valptr, &
central_residue_,
"central_residue expects to return a core::Size" );
69 (
static_cast<basic::MetricValue<core::Size> *
>(valptr))->set(
central_residue_ );
71 }
else if ( key ==
"dist_cutoff" ) {
72 basic::check_cast( valptr, &
dist_cutoff_,
"dist_cutoff expects to return a core::Real" );
73 (
static_cast<basic::MetricValue<core::Real> *
>(valptr))->set(
dist_cutoff_ );
75 }
else if ( key ==
"num_neighbors" ) {
76 basic::check_cast( valptr, &
num_neighbors_,
"num_neighbors expects to return a core::Size" );
77 (
static_cast<basic::MetricValue<core::Size> *
>(valptr))->set(
num_neighbors_ );
79 }
else if ( key ==
"neighbors" ) {
80 basic::check_cast( valptr, &
neighbors_,
"neighbors expects to return a std::set< core::Size >" );
81 (
static_cast<basic::MetricValue< std::set< core::Size >
> *>(valptr))->set(
neighbors_ );
84 basic::Error() <<
"NeighborsByDistanceCalculator cannot compute metric " << key << std::endl;
93 if ( key ==
"central_residue" ) {
96 }
else if ( key ==
"dist_cutoff" ) {
99 }
else if ( key ==
"num_neighbors" ) {
102 }
else if ( key ==
"neighbors" ) {
103 using namespace basic::options;
104 std::string const spacer( option[ OptionKeys::packing::print_pymol_selection].value() ?
"+" :
" ");
107 nbrs_string += utility::to_string(*it) + spacer;
111 basic::Error() <<
"NeighborsByDistanceCalculator cannot compute metric " << key << std::endl;
125 TR.Error <<
"central residue " <<
central_residue_ <<
" outside of pose; NBDC reporting empty set!" << std::endl;
133 core::conformation::find_neighbors<core::conformation::PointGraphVertexData,core::conformation::PointGraphEdgeData>( pg,
dist_cutoff_ );
137 edge_end_iter = pg->get_vertex(r).upper_edge_list_end(); edge_iter != edge_end_iter; ++edge_iter ) {
138 core::Size const other = edge_iter->upper_vertex();