Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PackingScore.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/packstat/PackingScore.cc
11 ///
12 /// @brief
13 /// @author will sheffler
14 
15 
16 // Unit header or inline function header
18 // AUTO-REMOVED #include <core/pose/Pose.hh>
19 
20 #include <cmath>
21 #include <iostream>
22 
23 
24 namespace core {
25 namespace scoring {
26 namespace packstat {
27 
28 using core::Real;
29 using utility::vector1;
30 
31 // bool print = false;
32 
33 std::ostream & operator<< ( std::ostream & out, PackingScoreResData const & dat ) {
34  for( Size i =1; i <= dat.nrad(); ++i ) {
35  for( Size j =1; j <= dat.npr(); ++j ) {
36  out << dat.msa(i,j) << " ";
37  }
38  out << " ";
39  }
40  return out;
41 }
42 
43 
45  assert( dat->npr() == npr() && dat->nrad() == nrad() );
46  Real score = 0;
47  for( Size i =1; i <= nrad(); ++i ) {
48  for( Size j =1; j <= npr(); ++j ) {
49  // std::cerr << "DAT " << i << " " << j << " " << dat->msa(i,j) << std::endl;
50  score += ( dat->msa(i,j) - center(i,j) ) * weight(i,j);
51  }
52  }
53  score -= rho();
54  // if(print) std::cerr << " DV " << score;
55  if( compprob() ) {
56  score = 1.0 - (1.0 / (1.0 + exp( probA_ * score + probB_ ) ));
57  } else {
58  score = probA_ * score + probB_;
59  }
60  // if(print) std::cerr << " SC " << score << std::endl;
61  return score;
62 }
63 
64 
66  Real sc = 0.0/*, psc = 0.0*/;
67  for( Size di = 1; di <= dats.size(); ++di ) {
68  for( Size i =1; i <= nrad(); ++i ) {
69  for( Size j =1; j <= npr(); ++j ) {
70  // std::cerr << i << " " << j << " DAT " << dats[di]->msa(i,j) << std::endl;
71  sc += ( dats[di]->msa(i,j) - center(i,j) ) * weight(i,j);
72  }
73  }
74  // if( di == 1 ) {
75  // std::cerr << "di " << di;
76  // print = true;
77  // } else {
78  // print = false;
79  // }
80  //
81  // psc += score( dats[di] );
82  // std::cerr << "score: " << di << " " << score(dats[di]) << std::endl;
83  // std::exit(-1);
84  }
85  sc = sc / dats.size();
86  sc = sc - rho();
87  // std::cout << "SCORE " << sc << std::endl;
88  if( compprob() ) {
89  sc = 1.0 - (1.0 / (1.0 + exp( probA_ * sc + probB_ ) ) );
90  } else {
91  sc = probA_ * sc + probB_;
92  }
93  // std::cerr << "avg: " << psc / (float)dats.size() << " " << sc << std::endl;
94  return sc;
95 }
96 
97 
98 } // namespace packstat
99 } // namespace scoring
100 } // namespace core