Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HolesEnergy.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/HolesEnergy.cc
11 /// @brief Packing Score
12 /// @author Will Sheffler
13 
14 
15 //Unit headers
18 
20 
21 //Package headers
22 
23 //#include <core/scoring/ScoringManager.hh>
24 // AUTO-REMOVED #include <core/scoring/EnergyGraph.hh>
25 // AUTO-REMOVED #include <core/scoring/rms_util.hh>
26 #include <core/pose/Pose.hh>
28 #include <basic/datacache/CacheableData.hh>
29 #include <basic/datacache/BasicDataCache.hh>
30 // AUTO-REMOVED #include <core/io/pdb/pose_io.hh>
31 #include <basic/database/open.hh>
33 #include <basic/options/option.hh>
34 
36 
37 // AUTO-REMOVED #include <basic/prof.hh>
38 
39 #include <basic/options/keys/holes.OptionKeys.gen.hh>
40 
41 //numeric headers
42 #include <numeric/numeric.functions.hh>
43 #include <numeric/xyzMatrix.hh>
44 #include <numeric/xyzVector.hh>
45 // AUTO-REMOVED #include <numeric/xyz.functions.hh>
46 
47 //utility headers
48 #include <utility/vector1.hh>
49 #include <utility/exit.hh>
50 
51 //C++ headers
52 #include <iostream>
53 
54 #include <core/pose/util.hh>
56 
57 //Auto Headers
58 #include <core/pose/util.tmpl.hh>
59 
60 namespace core {
61 namespace scoring {
62 namespace packing {
63 
64 
65 /// @details This must return a fresh instance of the HolesEnergy class,
66 /// never an instance already in use
70 ) const {
71  return new HolesEnergy;
72 }
73 
76  ScoreTypes sts;
77  sts.push_back( holes );
78  sts.push_back( holes_decoy );
79  sts.push_back( holes_resl );
80  sts.push_back( holes_min );
81  sts.push_back( holes_min_mean );
82  return sts;
83 }
84 
85 
86 //////////////////////////////////////////////////////
87 //@brief
88 //////////////////////////////////////////////////////
90 {
91  decoy_params_.read_data_file(basic::database::full_name("scoring/rosettaholes/decoy25.params"));
92  resl_params_ .read_data_file(basic::database::full_name("scoring/rosettaholes/resl.params"));
93  std::string p = basic::options::option[ basic::options::OptionKeys::holes::minimize ]();
94  min_params_ .read_data_file(basic::database::full_name("scoring/rosettaholes/"+p+".params"));
95 }
96 
97 
98 //////////////////////////////////////////////////////
99 //@brief
100 //////////////////////////////////////////////////////
101 void
103  pose::Pose & pose,
104  ScoreFunction const &,
105  EnergyMap & totals
106 ) const
107 {
108  PoseBalls pb(pose);
109 
110  Real resl_score = compute_holes_score(pose,pb, resl_params_,false).score;
111  Real decoy_score = compute_holes_score(pose,pb,decoy_params_,true ).score;
112  Real min_score = compute_holes_score(pose,pb, min_params_,true ).score;
113 
114  totals[ holes_decoy ] = decoy_score;
115  totals[ holes_resl ] = resl_score;
116  totals[ holes_min ] = min_score;
117 
118  decoy_score /= pb.nballs();
119  resl_score /= pb.nballs();
120  // min_score /= pb.nballs();
121  Real composite_score = 1.0 - (1.0 / (1.0 + exp( -3.768941 * decoy_score - 0.5842765 ) ));
122  composite_score = resl_score + 3*composite_score;
123 
124  totals[ holes ] = composite_score;
125  totals[ holes_decoy ] = decoy_score;
126  totals[ holes_resl ] = resl_score;
127  totals[ holes_min ] = min_score;
128  totals[ holes_min_mean ] = min_score / pb.nballs();
129 
130 }
131 
132 void
134  pose::Pose & pose,
135  ScoreFunction const &
136 ) const {
137 
138  //using namespace core::pose::datacache::CacheableDataType;
139  using namespace basic::datacache;
140  using namespace id;
141  using namespace numeric;
142 
144  pose.data().set( core::pose::datacache::CacheableDataType::HOLES_POSE_INFO, new CacheableAtomID_MapVector );
145  }
146  CacheableDataOP dat( pose.data().get_ptr( core::pose::datacache::CacheableDataType::HOLES_POSE_INFO ) );
147  CacheableAtomID_MapVectorOP cachemap = (CacheableAtomID_MapVector*)dat();
148  AtomID_Map<xyzVector<Real> > & derivs(cachemap->map());
150 
151  /*Real score = */compute_holes_deriv( pose, min_params_, derivs );//.score;
152 
153  // if( !pose.data().has( HOLES_POSE_SCORE ) ) {
154  // pose.data().set( HOLES_POSE_SCORE, new CacheableAtomID_MapVector );
155  // }
156  // dat = pose.data().get_ptr( HOLES_POSE_SCORE );
157  // CacheableReal *cachereal = (CacheableReal*)dat();
158  // cachereal->value() = score;
159 
160 }
161 
162 
163 void
165  id::AtomID const & aid,
166  pose::Pose const & pose,
167  kinematics::DomainMap const &,
168  ScoreFunction const &,
169  EnergyMap const & weights,
170  Vector & F1,
171  Vector & F2
172 ) const
173 {
174  //using namespace core::pose::datacache::CacheableDataType;
175  using namespace basic::datacache;
176  using namespace id;
177  using namespace numeric;
178  CacheableDataCOP dat( pose.data().get_const_ptr( core::pose::datacache::CacheableDataType::HOLES_POSE_INFO ) );
179  CacheableAtomID_MapVectorCOP cachemap = (CacheableAtomID_MapVector const *)dat();
180  AtomID_Map<xyzVector<Real> > const & derivs(cachemap->map());
181 
182  if( aid.rsd() > derivs.n_residue() || aid.atomno() > derivs.n_atom(aid.rsd()) ) {
183  return;
184  }
185 
186  numeric::xyzVector<core::Real> atom_x = pose.xyz(aid);
187  numeric::xyzVector<core::Real> const f2( derivs[aid] );
188  numeric::xyzVector<core::Real> const atom_y = atom_x - f2; // a "fake" atom in the direcion of the gradient
189  numeric::xyzVector<core::Real> const f1( atom_x.cross( atom_y ) );
190 
191  F1 += weights[ holes_min ] * f1;
192  F2 += weights[ holes_min ] * f2;
193 }
196 {
197  return 1; // Initial versioning
198 }
199 
200 
201 
202 
203 } // packing
204 } // scoring
205 } // core