Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HolesEnergyRes.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/HolesEnergyRes.cc
11 /// @brief Packing Score
12 /// @author Will Sheffler
13 
14 
15 //Unit headers
17 
19 
20 //Package headers
21 
22 //#include <core/scoring/ScoringManager.hh>
23 // AUTO-REMOVED #include <core/scoring/EnergyGraph.hh>
24 // AUTO-REMOVED #include <core/scoring/rms_util.hh>
26 #include <core/pose/Pose.hh>
27 // AUTO-REMOVED #include <core/io/pdb/pose_io.hh>
28 #include <basic/datacache/BasicDataCache.hh>
29 #include <basic/datacache/CacheableData.hh>
32 #include <basic/options/option.hh>
33 
35 
36 // AUTO-REMOVED #include <basic/prof.hh>
37 
38 //numeric headers
39 #include <numeric/numeric.functions.hh>
40 #include <numeric/xyzMatrix.hh>
41 #include <numeric/xyzVector.hh>
42 // AUTO-REMOVED #include <numeric/xyz.functions.hh>
43 
44 //utility headers
45 #include <utility/vector1.hh>
46 #include <utility/exit.hh>
47 
48 //C++ headers
49 #include <iostream>
50 
51 #include <core/pose/util.hh>
53 
54 //Auto Headers
55 #include <core/pose/util.tmpl.hh>
56 
57 namespace core {
58 namespace scoring {
59 namespace packing {
60 
61 
62 //////////////////////////////////////////////////////
63 //@brief THIS CLASS REQUIRES AN ENERGY METHOD CREATOR TO WORK PROPERLY
64 //////////////////////////////////////////////////////
66  parent( 0 ) // THIS WILL FAIL
67 {
68  //add_score_type( scoring::holes );
69 }
70 
71 
72 //////////////////////////////////////////////////////
73 //@brief
74 //////////////////////////////////////////////////////
75 void
77  pose::Pose & pose,
78  ScoreFunction const &,
79  EnergyMap & totals
80 ) const
81 {
82  totals[ holes ] = compute_holes_score_res(pose,params_);
83  //
84  //
85  // pose::Pose nat;
86  // core::import_pose::pose_from_pdb(nat,"hivp_high_1tw7.pdb.clean.align");
87  //
88  // Real rms = all_atom_rmsd(pose,nat);
89  //
90  // std::cout << "holes score: " << totals[holes]/(pose.total_residue()-2) << " rms " << rms << std::endl;
91 }
92 
93 void
95  pose::Pose & pose,
96  ScoreFunction const &
97 ) const {
98  std::cerr << "HolesEnergyRes::setup_for_derivatives" << std::endl;
99 
100  using namespace basic;
101  using namespace datacache;
102  using namespace id;
103  using namespace numeric;
105  pose.data().set( core::pose::datacache::CacheableDataType::HOLES_POSE_INFO, new CacheableAtomID_MapVector );
106  }
107  CacheableDataOP dat( pose.data().get_ptr( core::pose::datacache::CacheableDataType::HOLES_POSE_INFO ) );
108  CacheableAtomID_MapVectorOP cachemap = static_cast< CacheableAtomID_MapVector * >(dat());
109  AtomID_Map<xyzVector<Real> > & derivs(cachemap->map());
111 
112  compute_holes_deriv_res( pose, params_, derivs );
113 
114 }
115 
116 
117 void
119  id::AtomID const & aid,
120  pose::Pose const & pose,
121  kinematics::DomainMap const &,
122  ScoreFunction const &,
123  EnergyMap const & weights,
124  Vector & F1,
125  Vector & F2
126 ) const
127 {
128  // std::cerr << "HolesEnergyRes::eval_atom_derivative " << aid << std::endl;
129  using namespace basic;
130  using namespace datacache;
131  using namespace id;
132  using namespace numeric;
133  CacheableDataCOP dat( pose.data().get_const_ptr( core::pose::datacache::CacheableDataType::HOLES_POSE_INFO ) );
134  CacheableAtomID_MapVectorCOP cachemap = static_cast< CacheableAtomID_MapVector const *> (dat());
135  AtomID_Map<xyzVector<Real> > const & derivs(cachemap->map());
136 
137  if( aid.rsd() > derivs.n_residue() || aid.atomno() > derivs.n_atom(aid.rsd()) ) {
138  return;
139  }
140  // std::cerr << "eval_atom_derivative " << aid << " " << derivs[aid].x() << " " << derivs[aid].y() << " " << derivs[aid].z() << std::endl;
141  // F2 += weights * derivs[aid];
142  // F1 += weights * derivs[aid].cross(xyzVector<Real>(1,0,0));
143 
144  numeric::xyzVector<core::Real> atom_x = pose.xyz(aid);
145  numeric::xyzVector<core::Real> const f2( derivs[aid] );
146  numeric::xyzVector<core::Real> const atom_y = atom_x - f2; // a "fake" atom in the direcion of the gradient
147  numeric::xyzVector<core::Real> const f1( atom_x.cross( atom_y ) );
148 
149  F1 += weights[ holes ] * f1;
150  F2 += weights[ holes ] * f2;
151 }
152 
153 
156 {
157  return 1; //Initial version
158 }
159 } // packing
160 } // scoring
161 } // core