Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FloatingResonance.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
11 /// @brief
12 /// @detailed
13 ///
14 ///
15 ///
16 /// @author Oliver Lange
17 
18 // Unit Headers
20 
21 // Package Headers
25 
26 // Project Headers
27 #include <core/chemical/AA.hh>
28 #include <core/id/NamedAtomID.hh>
29 
30 // Utility headers
31 #include <ObjexxFCL/format.hh>
32 #include <basic/Tracer.hh>
33 
34 //// C++ headers
35 #include <string>
36 #include <utility/vector1.hh>
37 
38 
39 
40 static basic::Tracer tr("protocols.noesy_assign.resonances");
41 
42 using core::Real;
43 using namespace core;
44 using namespace basic;
45 
46 namespace protocols {
47 namespace noesy_assign {
48 
49 FloatingResonance::FloatingResonance() {}
50 
51 FloatingResonance::FloatingResonance( Resonance const& resin, FloatList const& partner, ResonanceList* reslist ) :
52  Resonance( resin ),
53  partner_ids_( partner ),
54  res_list_( reslist )
55 {}
56 
58 
59 core::Real FloatingResonance::pmatch( core::Real peakfreq, core::Real error, FoldResonance const& folder ) const {
60  Real min_match = 100000;
61  for ( FloatList::const_iterator it = partner_ids_.begin(); it!=partner_ids_.end(); ++it ) {
62  Real m = (*res_list_)[ *it ]._pmatch( peakfreq, error, folder );
63  if ( m < min_match ) min_match = m;
64  }
65  return min_match;
66 }
67 
68 void FloatingResonance::write_to_stream( std::ostream& os ) const {
70  _write_partner_ids( os );
71 }
72 
73 void FloatingResonance::_write_partner_ids( std::ostream& os ) const {
74  if ( partner_ids_.size() > 1 ) {
75  os << "[";
76  long pos( os.tellp() );
77  for ( FloatList::const_iterator it = partner_ids_.begin(); it != partner_ids_.end(); ++it ) {
78  os << *it;
79  pos = os.tellp();
80  os << ",";
81  }
82  os.seekp( pos );
83  os << "]";
84  }
85 }
86 
87 void FloatingResonance::write_to_stream( std::ostream& os, core::chemical::AA aa ) const {
88  Parent::write_to_stream( os, aa );
89  _write_partner_ids( os );
90 }
91 
92 } //NoesyAssign
93 } //devel