Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SurfVolEnergy.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/packing/SurfVolEnergy.cc
11 /// @brief Packing Score
12 /// @author Will Sheffler
13 
14 
15 //Unit headers
18 
19 // AUTO-REMOVED #include <core/scoring/packing/PoseBalls.hh>
20 
22 
23 //Package headers
24 
25 //#include <core/scoring/ScoringManager.hh>
26 // AUTO-REMOVED #include <core/scoring/EnergyGraph.hh>
27 // AUTO-REMOVED #include <core/scoring/rms_util.hh>
28 #include <core/pose/Pose.hh>
29 #include <basic/datacache/BasicDataCache.hh>
31 // AUTO-REMOVED #include <core/io/pdb/pose_io.hh>
33 // AUTO-REMOVED #include <basic/options/option.hh>
34 
35 // AUTO-REMOVED #include <core/scoring/packing/compute_holes_score_res.hh>
36 
37 // AUTO-REMOVED #include <basic/prof.hh>
38 
39 //numeric headers
40 #include <numeric/numeric.functions.hh>
41 #include <numeric/xyzMatrix.hh>
42 #include <numeric/xyzVector.hh>
43 // AUTO-REMOVED #include <numeric/xyz.functions.hh>
44 
45 //utility headers
46 // AUTO-REMOVED #include <utility/vector1.hh>
47 #include <utility/exit.hh>
48 
49 //C++ headers
50 #include <iostream>
51 
53 #include <core/pose/util.hh>
55 #include <utility/vector1.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 SurfVolEnergy class,
66 /// never an instance already in use
70 ) const {
71  return new SurfVolEnergy;
72 }
73 
76  ScoreTypes sts;
77  // sts.push_back( dab_sasa );
78  sts.push_back( dab_sev );
79  return sts;
80 }
81 
82 
83 //////////////////////////////////////////////////////
84 //@brief
85 //////////////////////////////////////////////////////
88 {}
89 
90 
91 //////////////////////////////////////////////////////
92 //@brief
93 //////////////////////////////////////////////////////
94 void
96  pose::Pose & pose,
97  ScoreFunction const &,
98  EnergyMap & totals
99 ) const
100 {
101  SurfVol sv = get_surf_vol(pose,1.4);
102  totals[ dab_sasa ] = sv.tot_surf;
103  totals[ dab_sev ] = sv.tot_vol;
104 }
105 
106 void
108  pose::Pose & pose,
109  ScoreFunction const &
110 ) const {
111  std::cerr << "SurfVolEnergy::setup_for_derivatives" << std::endl;
112 
113  //using namespace core::pose::datacache::CacheableDataType;
114  using namespace basic::datacache;
115  using namespace id;
116  using namespace numeric;
117 
119  pose.data().set( core::pose::datacache::CacheableDataType::DAB_SASA_POSE_INFO, new CacheableAtomID_MapVector );
120  pose.data().set( core::pose::datacache::CacheableDataType::DAB_SEV_POSE_INFO, new CacheableAtomID_MapVector );
121  }
122 
123  CacheableDataOP dat1( pose.data().get_ptr( core::pose::datacache::CacheableDataType::DAB_SASA_POSE_INFO ) );
124  CacheableAtomID_MapVectorOP cachemap1 = static_cast< CacheableAtomID_MapVector * >(dat1());
125  AtomID_Map<xyzVector<Real> > & sasa_derivs(cachemap1->map());
126 
127  CacheableDataOP dat2( pose.data().get_ptr( core::pose::datacache::CacheableDataType::DAB_SASA_POSE_INFO ) );
128  CacheableAtomID_MapVectorOP cachemap2 = static_cast< CacheableAtomID_MapVector * >(dat2());
129  AtomID_Map<xyzVector<Real> > & sev_derivs(cachemap2->map());
130 
131  SurfVolDeriv svd = get_surf_vol_deriv( pose, 1.4 );
132 
135 
136  for( Size ir = 1; ir <= sasa_derivs.size(); ir++ ) {
137  for( Size ia = 1; ia <= sasa_derivs.n_atom(ir); ia++ ) {
138  AtomID const i(ia,ir);
139  sasa_derivs[i] = svd.dsurf[i];
140  sev_derivs[i] = svd. dvol[i];
141  }
142  }
143 
144 }
145 
146 
147 void
149  id::AtomID const & aid,
150  pose::Pose const & pose,
151  kinematics::DomainMap const &,
152  ScoreFunction const &,
153  EnergyMap const & weights,
154  Vector & F1,
155  Vector & F2
156 ) const
157 {
158  // std::cerr << "SurfVolEnergy::eval_atom_derivative " << aid << std::endl;
159  //using namespace core::pose::datacache::CacheableDataType;
160  using namespace basic::datacache;
161  using namespace id;
162  using namespace numeric;
163 
164  // CacheableDataCOP dat( pose.data().get_const_ptr( core::pose::datacache::CacheableDataType::HOLES_POSE_INFO ) );
165  // CacheableAtomID_MapVector const *cachemap = (CacheableAtomID_MapVector const *)dat();
166  // AtomID_Map<xyzVector<Real> > const & derivs(cachemap->map());
167 
168  CacheableDataCOP dat1( pose.data().get_const_ptr( core::pose::datacache::CacheableDataType::DAB_SASA_POSE_INFO ) );
169  CacheableAtomID_MapVectorCOP cachemap1 = static_cast< CacheableAtomID_MapVector const * > (dat1());
170  AtomID_Map<xyzVector<Real> > const & sasa_derivs(cachemap1->map());
171 
172  CacheableDataCOP dat2( pose.data().get_const_ptr( core::pose::datacache::CacheableDataType::DAB_SASA_POSE_INFO ) );
173  CacheableAtomID_MapVectorCOP cachemap2 = static_cast< CacheableAtomID_MapVector const * >(dat2());
174  AtomID_Map<xyzVector<Real> > const & sev_derivs(cachemap2->map());
175 
176  if( aid.rsd() > sasa_derivs.n_residue() || aid.atomno() > sasa_derivs.n_atom(aid.rsd()) ) {
177  return;
178  }
179  // std::cerr << "eval_atom_derivative " << aid << " " << derivs[aid].x() << " " << derivs[aid].y() << " " << derivs[aid].z() << std::endl;
180  // F2 += weights * derivs[aid];
181  // F1 += weights * derivs[aid].cross(xyzVector<Real>(1,0,0));
182 
183  {
184  numeric::xyzVector<core::Real> atom_x = pose.xyz(aid);
185  numeric::xyzVector<core::Real> const f2( sasa_derivs[aid] );
186  numeric::xyzVector<core::Real> const atom_y = atom_x - f2; // a "fake" atom in the direcion of the gradient
187  numeric::xyzVector<core::Real> const f1( atom_x.cross( atom_y ) );
188  F1 += weights[ dab_sasa ] * f1;
189  F2 += weights[ dab_sasa ] * f2;
190  }
191  {
192  numeric::xyzVector<core::Real> atom_x = pose.xyz(aid);
193  numeric::xyzVector<core::Real> const f2( sev_derivs[aid] );
194  numeric::xyzVector<core::Real> const atom_y = atom_x - f2; // a "fake" atom in the direcion of the gradient
195  numeric::xyzVector<core::Real> const f1( atom_x.cross( atom_y ) );
196  F1 += weights[ dab_sev ] * f1;
197  F2 += weights[ dab_sev ] * f2;
198  }
199 
200 }
203 {
204  return 1; // Initial versioning
205 }
206 
207 
208 
209 
210 } // packing
211 } // scoring
212 } // core