Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RG_Energy.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/methods/RG_Energy.cc
11 /// @brief Radius of gyration energy function definition. Returns -1 * RG for a given Pose.
12 /// @author James Thompson
13 
14 
15 // Unit headers
17 
18 // Package headers
21 
23 //#include <core/scoring/ScoringManager.hh>
25 
26 // Project headers
27 #include <core/pose/Pose.hh>
29 
30 
31 // Utility headers
32 #include <basic/prof.hh>
33 #include <ObjexxFCL/format.hh>
34 
35 
36 // C++
37 
38 
39 namespace core {
40 namespace scoring {
41 namespace methods {
42 
43 /// THIS CLASS IS DEPRICATED.
44 /// USE RG_Energy_Fast
46 {
47  //add_score_type( rg );
48 }
49 
50 
51 /// clone
54 {
55  return new RG_Energy();
56 }
57 
58 
59 /////////////////////////////////////////////////////////////////////////////
60 // scoring
61 /////////////////////////////////////////////////////////////////////////////
62 
63 /// @brief Calculate the radius of gyration and place the answer into
64 /// totals[ rg ].
65 void
67  pose::Pose & pose,
68  ScoreFunction const &,
69  EnergyMap & totals
70 ) const {
71  using namespace conformation;
72 
73  PROF_START( basic::RG );
74 
75  Size const nres( pose.total_residue() );
76 
77  ///////////////////////////////////////
78  //
79  // RG SCORE
80  core::Real rg_score = 0;
81  for( Size i = 1; i <= nres; ++i ) { // outer loop over residues
82  Vector const v( pose.residue(i).nbr_atom_xyz() );
83  for ( Size j = i + 1; j <= nres; ++j ) {
84  rg_score += distance_squared( v, pose.residue(j).nbr_atom_xyz() );
85  }
86  }
87 
88  rg_score /= ( pose.total_residue() * pose.total_residue() - pose.total_residue() );
89  totals[ rg ] = sqrt(rg_score);
90 
91  PROF_STOP( basic::RG );
92 }
93 
94 }
95 }
96 }