Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ScoreFunctionInfo.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 core/scoring/ScoreFunctionInfo.cc
11 /// @brief Score function class descriptor
12 /// @author Phil Bradley
13 
14 // Unit Headers
16 
17 // Package Headers
22 
24 
25 #include <utility/vector1.hh>
26 
27 
28 namespace core {
29 namespace scoring {
30 
31 /// default constructor -- fill this in
32 ScoreFunctionInfo::ScoreFunctionInfo() : utility::pointer::ReferenceCount(),
33  max_atomic_interaction_distance_( 0.0 ),
34  max_context_neighbor_cutoff_( 0.0 ),
35  context_graphs_required_( num_context_graph_types, false ),
36  energy_method_options_( 0 )
37 {}
38 
39 /// @details Make sure to make a copy of the EMOpts, instead of just copying the pointer;
40 /// we don't want SFIs to share pointers to the same objects or the object could change
41 /// underneath the SFI.
42 ScoreFunctionInfo::ScoreFunctionInfo( ScoreFunctionInfo const & src ) : utility::pointer::ReferenceCount(),
43  max_atomic_interaction_distance_( src.max_atomic_interaction_distance_ ),
44  max_context_neighbor_cutoff_( src.max_context_neighbor_cutoff_ ),
45  context_graphs_required_( src.context_graphs_required_ ),
46  scores_present_( src.scores_present_ ),
47  energy_method_options_( src.energy_method_options_ ? new methods::EnergyMethodOptions( * src.energy_method_options_ ) : 0 )
48 {
49 }
50 
52 
54 :
55  context_graphs_required_( num_context_graph_types, false )
56 {
57  initialize_from( scorefxn );
58 }
59 
60 /// @brief initializes three peices of data that describe the score function,
61 /// the atomic interaction distance, the context neighbor distance, and the
62 /// context graphs required by the scoring function to be properly evaluated
63 ///
64 /// now also including the EnergyMethodOptions object, which holds eg the etable
65 /// name and (currently) the reference energy aa-weights
66 ///
67 void
69 
71 
72  std::fill( context_graphs_required_.begin(), context_graphs_required_.end(), false );
74 
76  for ( uint ii = 1; ii <= num_context_graph_types; ++ii ) {
77  if ( context_graphs_required_[ ii ] )
78  {
80  if ( example_graph->neighbor_cutoff() > max_context_neighbor_cutoff_ ) {
81  max_context_neighbor_cutoff_ = example_graph->neighbor_cutoff();
82  }
83  }
84  }
85  for ( uint ii = 1; ii <= n_score_types; ++ii ) {
86  scores_present_[ ScoreType ( ii ) ] = scorefxn.has_zero_weight( ScoreType( ii ) ) ? 0 : 1;
87  }
88 
89  /// Use the copy constructor to create a new object -- do not simply take a pointer to the existing object, which might change.
90  if ( ! energy_method_options_ ) {
92  } else {
94  }
95 }
96 
97 
98 bool
99 operator==( ScoreFunctionInfo const & a, ScoreFunctionInfo const & b ) /* PHIL */ {
100 
103  for ( uint ii = 1; ii <= num_context_graph_types; ++ii ) {
104  if ( a.context_graphs_required_[ ii ] != b.context_graphs_required_[ ii ] ) return false;
105  }
106  for ( uint ii = 1; ii <= n_score_types; ++ii ) {
107  if ( a.scores_present_[ ScoreType( ii ) ] != b.scores_present_[ ScoreType ( ii ) ] ) return false;
108  }
109  // SFIs are not the same if either of them have been default constructed without originating from
110  // an existing ScoreFunction.
111 
112  if ( ! a.energy_method_options_ || ! b.energy_method_options_ ) return false;
113  if ( (*a.energy_method_options_) != (*b.energy_method_options_) ) return false;
114 
115  return true;
116 }
117 
118 bool
120  return context_graphs_required_[ cgt ];
121 }
122 
123 
124 }
125 }