Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
NumericalDerivCheckResult.hh
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/optimization/NumericalDerivCheckResult.hh
11 /// @brief Declaration for nuerical derivative check results classes
12 /// @author Andrew Leaver-Fay (aleaverfay@gmail.com)
13 
14 
15 #ifndef INCLUDED_core_optimization_NumericalDerivCheckResult_hh
16 #define INCLUDED_core_optimization_NumericalDerivCheckResult_hh
17 
18 // Unit headers
20 
21 // Project headers
22 #include <core/types.hh>
23 #include <core/id/DOF_ID.hh>
24 
25 // Utility headers
26 #include <utility/vector1.hh>
27 #include <utility/pointer/ReferenceCount.hh>
28 
29 
30 namespace core {
31 namespace optimization {
32 
34 public:
36  num_deriv_( 0.0 ),
37  ana_deriv_( 0.0 ),
38  ratio_( 0.0 ),
39  f11_( 0.0 ),
40  f00_( 0.0 ),
41  f22_( 0.0 ),
42  dof_val_( 0.0 )
43  {}
44 
48  Real ratio,
49  Real f11,
50  Real f00,
51  Real f22,
53  ) :
54  num_deriv_( num_deriv ),
55  ana_deriv_( ana_deriv ),
56  ratio_( ratio ),
57  f11_( f11 ),
58  f00_( f00 ),
59  f22_( f22 ),
60  dof_val_( dof_val )
61  {}
62 
63  Real num_deriv() const { return num_deriv_; } // numerically computed derivative
64  Real ana_deriv() const { return ana_deriv_; } // analytically computed derivative
65  Real ratio() const { return ratio_; }
66  Real f11() const { return f11_; }
67  Real f00() const { return f00_; }
68  Real f22() const { return f22_; }
69  Real dof_val() const { return dof_val_; }
70 
71 private:
72  Real num_deriv_; // numerically computed derivative
73  Real ana_deriv_; // analytically computed derivative
79 };
80 
82 public:
83  ///@brief Automatically generated virtual destructor for class deriving directly from ReferenceCount
84  virtual ~SimpleDerivCheckResult();
86  step_data_( nangles ),
87  abs_deriv_dev_( nangles, 0.0 ),
88  rel_deriv_dev_( nangles )
89  {
90  for ( Size ii = 1; ii <= nangles; ++ii ) {
91  step_data_[ ii ].resize( nsteps );
92  }
93  }
94 
95  Size nangles() const { return step_data_.size(); }
96  Size nsteps() const { if ( step_data_.size() > 0 ) return step_data_[ 1 ].size(); return 0; }
97 
98  void abs_deriv_dev( Size dof_ind, Real val ) { abs_deriv_dev_[ dof_ind ] = val; }
99  void rel_deriv_dev( Size dof_ind, Real val ) { rel_deriv_dev_[ dof_ind ] = val; }
100 
101  void best_cos_theta( Real val ) { best_cos_theta_ = val; }
105 
106  void step_data( Size dof_ind, Size step_ind, DerivCheckDataPoint const & dp ) { step_data_[ dof_ind ][ step_ind ] = dp; }
107 
108  Real abs_deriv_dev( Size dof_ind ) const { return abs_deriv_dev_[ dof_ind ]; }
109  Real rel_deriv_dev( Size dof_ind ) const { return rel_deriv_dev_[ dof_ind ]; }
110 
111  Real best_cos_theta() const { return best_cos_theta_; }
115 
116  DerivCheckDataPoint const & step_data( Size dof_ind, Size step_ind ) const { return step_data_[ dof_ind ][ step_ind ]; }
117 
118 private:
119 
121 
124 
129 
130 };
131 
133 public:
135  natoms_( 0 ),
136  num_deriv_( 0.0 ),
137  ana_deriv_( 0.0 ),
138  ratio_( 0.0 ),
139  f11_( 0.0 ),
140  f00_( 0.0 ),
141  f22_( 0.0 ),
142  dof_val_( 0.0 )
143  {}
144 
146  id::DOF_ID const & dof_id,
147  id::DOF_ID const & parent_id,
148  Size natoms,
149  Real num_deriv,
150  Real ana_deriv,
151  Real ratio,
152  Real f11,
153  Real f00,
154  Real f22,
155  Real dof_val
156  ) :
157  dof_id_( dof_id ),
158  parent_id_( parent_id ),
159  natoms_( natoms ),
160  num_deriv_( num_deriv ),
161  ana_deriv_( ana_deriv ),
162  ratio_( ratio ),
163  f11_( f11 ),
164  f00_( f00 ),
165  f22_( f22 ),
166  dof_val_( dof_val )
167  {}
168 
169  id::DOF_ID const & dof_id() const { return dof_id_; }
170  id::DOF_ID const & parent_id() const { return parent_id_; }
171  Size natoms() const { return natoms_; }
172  Real num_deriv() const { return num_deriv_; } // numerically computed derivative
173  Real ana_deriv() const { return ana_deriv_; } // analytically computed derivative
174  Real ratio() const { return ratio_; }
175  Real f11() const { return f11_; }
176  Real f00() const { return f00_; }
177  Real f22() const { return f22_; }
178  Real dof_val() const { return dof_val_; }
179 
180 private:
184  Real num_deriv_; // numerically computed derivative
185  Real ana_deriv_; // analytically computed derivative
191 };
192 
193 
195 public:
197 
198 public:
200  parent( nangles, nsteps ),
201  dof_step_data_( nangles )
202  {
203  for ( Size ii = 1; ii <= nangles; ++ii ) {
204  dof_step_data_[ ii ].resize( nsteps );
205  }
206  }
207 
208  virtual ~NumDerivCheckData() {}
209 
210  void dof_step_data( Size dof_ind, Size step_ind, DOF_DataPoint const & dofdp ) {
211  dof_step_data_[ dof_ind ][ step_ind ] = dofdp;
212  DerivCheckDataPoint dp( dofdp.num_deriv(), dofdp.ana_deriv(), dofdp.ratio(), dofdp.f11(), dofdp.f00(), dofdp.f22(), dofdp.dof_val() );
213  parent::step_data( dof_ind, step_ind, dp );
214  }
215  DOF_DataPoint const & dof_step_data( Size dof_ind, Size step_ind ) const { return dof_step_data_[ dof_ind ][ step_ind ]; }
216 
217 
218 private:
220 
221 };
222 
224 public:
226 
227 public:
229  virtual ~NumericalDerivCheckResult();
230 
231  void send_to_stdout( bool setting ) { send_to_stdout_ = setting; }
232  bool send_to_stdout() const { return send_to_stdout_; }
233 
234  void add_deriv_data(
235  NumDerivCheckDataOP deriv_check_data
236  );
237 
238  Size n_deriv_check_results() const;
239 
240  NumDerivCheckData const &
241  deriv_check_result( Size ind ) const;
242 
243 private:
246 };
247 
248 
249 } // namespace optimization
250 } // namespace core
251 
252 
253 #endif