Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SurfEnergy.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/SurfEnergy.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 
52 //Auto Headers
55 #include <utility/vector1.hh>
56 
57 //Auto Headers
58 #include <core/pose/util.tmpl.hh>
59 
60 
61 namespace core {
62 namespace scoring {
63 namespace packing {
64 
65 
66 /// @details This must return a fresh instance of the SurfEnergy class,
67 /// never an instance already in use
71 ) const {
72  return new SurfEnergy;
73 }
74 
77  ScoreTypes sts;
78  sts.push_back( dab_sasa );
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  totals[ dab_sasa ] = get_surf_tot(pose,1.4);
102 }
103 
104 void
106  pose::Pose & pose,
107  ScoreFunction const &
108 ) const {
109  std::cerr << "SurfEnergy::setup_for_derivatives" << std::endl;
110 
111  //using namespace core::pose::datacache::CacheableDataType;
112  using namespace basic::datacache;
113  using namespace id;
114  using namespace numeric;
115 
117  pose.data().set( core::pose::datacache::CacheableDataType::DAB_SASA_POSE_INFO, new CacheableAtomID_MapVector );
118  pose.data().set( core::pose::datacache::CacheableDataType::DAB_SEV_POSE_INFO, new CacheableAtomID_MapVector );
119  }
120 
121  CacheableDataOP dat1( pose.data().get_ptr( core::pose::datacache::CacheableDataType::DAB_SASA_POSE_INFO ) );
122  CacheableAtomID_MapVectorOP cachemap1 = static_cast< CacheableAtomID_MapVector * > (dat1());
123  AtomID_Map< xyzVector< Real > > & sasa_derivs(cachemap1->map());
124 
125  CacheableDataOP dat2( pose.data().get_ptr( core::pose::datacache::CacheableDataType::DAB_SASA_POSE_INFO ) );
126  CacheableAtomID_MapVectorOP cachemap2 = static_cast< CacheableAtomID_MapVector * > (dat2());
127  AtomID_Map< xyzVector< Real > > & sev_derivs(cachemap2->map());
128 
129  SurfVolDeriv svd = get_surf_vol_deriv( pose, 1.4 );
130 
133 
134  for( Size ir = 1; ir <= sasa_derivs.size(); ir++ ) {
135  for( Size ia = 1; ia <= sasa_derivs.n_atom(ir); ia++ ) {
136  AtomID const i(ia,ir);
137  sasa_derivs[i] = svd.dsurf[i];
138  sev_derivs[i] = svd. dvol[i];
139  }
140  }
141 
142 }
143 
144 
145 void
147  id::AtomID const & aid,
148  pose::Pose const & pose,
149  kinematics::DomainMap const &,
150  ScoreFunction const &,
151  EnergyMap const & weights,
152  Vector & F1,
153  Vector & F2
154 ) const
155 {
156  // std::cerr << "SurfEnergy::eval_atom_derivative " << aid << std::endl;
157  //using namespace core::pose::datacache::CacheableDataType;
158  using namespace basic::datacache;
159  using namespace id;
160  using namespace numeric;
161 
162  // CacheableDataCOP dat( pose.data().get_const_ptr( core::pose::datacache::CacheableDataType::HOLES_POSE_INFO ) );
163  // CacheableAtomID_MapVector const *cachemap = (CacheableAtomID_MapVector const *)dat();
164  // AtomID_Map<xyzVector<Real> > const & derivs(cachemap->map());
165 
166  CacheableDataCOP dat1( pose.data().get_const_ptr( core::pose::datacache::CacheableDataType::DAB_SASA_POSE_INFO ) );
167  CacheableAtomID_MapVectorCOP cachemap1 = static_cast< CacheableAtomID_MapVector const * > (dat1());
168  AtomID_Map<xyzVector<Real> > const & sasa_derivs(cachemap1->map());
169 
170  CacheableDataCOP dat2( pose.data().get_const_ptr( core::pose::datacache::CacheableDataType::DAB_SASA_POSE_INFO ) );
171  CacheableAtomID_MapVectorCOP cachemap2 = static_cast< CacheableAtomID_MapVector const* > (dat2());
172  AtomID_Map<xyzVector<Real> > const & sev_derivs(cachemap2->map());
173 
174  if( aid.rsd() > sasa_derivs.n_residue() || aid.atomno() > sasa_derivs.n_atom(aid.rsd()) ) {
175  return;
176  }
177  // std::cerr << "eval_atom_derivative " << aid << " " << derivs[aid].x() << " " << derivs[aid].y() << " " << derivs[aid].z() << std::endl;
178  // F2 += weights * derivs[aid];
179  // F1 += weights * derivs[aid].cross(xyzVector<Real>(1,0,0));
180 
181  {
182  numeric::xyzVector<core::Real> atom_x = pose.xyz(aid);
183  numeric::xyzVector<core::Real> const f2( sasa_derivs[aid] );
184  numeric::xyzVector<core::Real> const atom_y = atom_x - f2; // a "fake" atom in the direcion of the gradient
185  numeric::xyzVector<core::Real> const f1( atom_x.cross( atom_y ) );
186  F1 += weights[ dab_sasa ] * f1;
187  F2 += weights[ dab_sasa ] * f2;
188  }
189  {
190  numeric::xyzVector<core::Real> atom_x = pose.xyz(aid);
191  numeric::xyzVector<core::Real> const f2( sev_derivs[aid] );
192  numeric::xyzVector<core::Real> const atom_y = atom_x - f2; // a "fake" atom in the direcion of the gradient
193  numeric::xyzVector<core::Real> const f1( atom_x.cross( atom_y ) );
194  F1 += weights[ dab_sev ] * f1;
195  F2 += weights[ dab_sev ] * f2;
196  }
197 
198 }
201 {
202  return 1; // Initial versioning
203 }
204 
205 
206 
207 
208 } // packing
209 } // scoring
210 } // core