Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TrialCounterObserver.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/canonical_sampling/TrialCounterObserver.cc
11 /// @brief protocols::canonical_sampling::TrialCounterObserver methods implemented
12 /// @author
13 
14 
15 // Unit Headers
18 
20 // Package Headers
21 
22 // Project Headers
23 #include <core/pose/Pose.hh>
24 
25 
26 // Utility Headers
27 #include <basic/Tracer.hh>
28 #include <core/types.hh>
29 #include <utility/exit.hh>
30 #include <utility/tag/Tag.hh>
31 
32 // C++ Headers
33 
34 static basic::Tracer tr( "protocols.canonical_sampling.TrialCounter" );
35 
36 namespace protocols {
37 namespace canonical_sampling {
38 
39 
43 }
44 
47  return new TrialCounterObserver;
48 }
49 
52  return "TrialCounterObserver";
53 }
54 
55 
56 ///@brief
59 {
60  Mover::type( "TrialCounterObserver" );
61 }
62 
64 
66  return "TrialCounterObserver";
67 }
68 
71  return new TrialCounterObserver( *this );
72 }
73 
74 
75 
76 void
78  utility::tag::TagPtr const tag,
82  core::pose::Pose const &
83 ) { //no options ...
84  file_ = tag->getOption< std::string >("file","trial.stats");
85 }
86 
87 
88 void
90  core::pose::Pose & /*pose*/,
91  MetropolisHastingsMover const& mhm, /*metropolis_hastings_mover*/
92  core::Size //default=0; non-zero if trajectory is restarted
93 )
94 {
96  counters_.reset();
97 }
98 
99  /// @brief callback executed after the Metropolis criterion is evaluated
100 void
102  MetropolisHastingsMover const & metropolis_hastings_mover
103 ) {
104  std::string const& move_type( metropolis_hastings_mover.last_move().type() );
105  counters_.count_trial( move_type );
106  if ( metropolis_hastings_mover.last_accepted() ) {
107  counters_.count_accepted( move_type );
108  }
109 }
110 
111 void
113  core::pose::Pose & /*pose*/,
114  MetropolisHastingsMover const &mhm /*metropolis_hastings_mover*/
115 )
116 {
117  counters_.show( tr.Info );
119 }
120 
121 } //moves
122 } //protocols
123