Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
WaterAdductHBondEnergy.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/WaterAdductHBondEnergy.cc
11 /// @brief
12 /// @author Jim Havranek
13 /// @author Phil Bradley
14 /// @author Andrew Leaver-Fay
15 
16 
17 // Unit headers
20 
21 // Package headers
24 #include <core/scoring/Energies.hh>
27 // AUTO-REMOVED #include <core/scoring/hbonds/hbonds.hh>
28 
29 // Project headers
30 // AUTO-REMOVED #include <core/conformation/Residue.hh>
31 #include <core/pose/Pose.hh>
32 
33 #include <utility/vector1.hh>
34 
35 
36 // Utility headers
37 
38 
39 // C++
40 
41 
42 namespace core {
43 namespace scoring {
44 namespace methods {
45 
46 
47 /// @details This must return a fresh instance of the WaterAdductHBondEnergy class,
48 /// never an instance already in use
52 ) const {
53  return new WaterAdductHBondEnergy;
54 }
55 
58  ScoreTypes sts;
59  sts.push_back( h2o_hbond );
60  return sts;
61 }
62 
63 
66  potential_( ScoringManager::get_instance()->get_WaterAdductHBondPotential() )
67 {}
68 
69 
70 /// clone
73 {
74  return new WaterAdductHBondEnergy();
75 }
76 
77 ///
78 void
80 {
83  hbonds::HBondSetOP h2o_hbond_set( new hbonds::HBondSet( pose.total_residue() ) );
84  potential_.fill_h2o_hbond_set( pose, *h2o_hbond_set );
85  pose.energies().data().set( H2O_HBOND_SET, h2o_hbond_set );
86 }
87 
88 ///
89 void
91 {
93 }
94 
95 void
97 {
99 }
100 
101 /////////////////////////////////////////////////////////////////////////////
102 // scoring
103 /////////////////////////////////////////////////////////////////////////////
104 
105 ///
106 void
108  conformation::Residue const & rsd1,
109  conformation::Residue const & rsd2,
110  pose::Pose const & , //pose,
111  ScoreFunction const &,
112  EnergyMap & emap
113 ) const
114 {
115 
116  emap[ h2o_hbond ] += potential_.water_adduct_hbond_score( rsd1, rsd2 );
117 
118 }
119 
120 
121 void
123  id::AtomID const & atom_id,
124  pose::Pose const & pose,
125  kinematics::DomainMap const &,
126  ScoreFunction const &,
127  EnergyMap const & weights,
128  Vector & F1,
129  Vector & F2
130  ) const
131 {
133  /// f1 and f2 are zeroed
134  hbonds::HBondSet const & hbond_set
135  ( static_cast< hbonds::HBondSet const & >
136  ( pose.energies().data().get( H2O_HBOND_SET ) ) );
137  Vector f1,f2;
138  get_atom_h2o_hbond_derivative( atom_id, hbond_set, weights, f1, f2 );
139  F1 += f1;
140  F2 += f2;
141 }
142 
143 
144 ///////////////////////////////////////////////////////////////////////////////
145 /// \brief Get the f1 and f2 contributions from all hbonds involving this atom
146 
147 void
149  id::AtomID const & atom,
150  hbonds::HBondSet const & hbond_set,
151  EnergyMap const & weights,
152  Vector & f1,
153  Vector & f2
154 ) const
155 {
156  f1 = Vector(0.0);
157  f2 = Vector(0.0);
158 
160  ( hbond_set.atom_hbonds( atom ) );
161 
162  for ( Size i=1; i<= hbonds.size(); ++i ) {
163  hbonds::HBond const & hbond( *hbonds[ i ] );
164  Real sign_factor( 0.0 );
165 
166  // This part is different from the straight hbond version
167  // since there is no real hydrogen when water adducts donate
168  if ( hbond.atom_is_acceptor( atom ) ) {
169  sign_factor = -1.0;
170  } else {
171  sign_factor = 1.0;
172  }
173 
174 // std::cout << "Processing h2o hbond with energy" << hbond.energy() << std::endl;
175 
176  // get the appropriate type of hbond weight
177  Real const weight ( sign_factor * hbond.weight() * weights[ h2o_hbond ] );
178 // std::cout << "Applying weight " << weight << std::endl;
179 // std::cout << "sign_factor " << sign_factor << std::endl;
180 // std::cout << "hbond stored weight " << hbond.weight() << std::endl;
181 // std::cout << "stupid type weight " << weights[ h2o_hbond ] << std::endl;
182  f1 += weight * hbond.derivs().h_deriv.f1();
183  f2 += weight * hbond.derivs().h_deriv.f2();
184 // std::cout << "F1 is " <<
185 // f1[0] << " " <<
186 // f1[1] << " " <<
187 // f1[2] << " " <<
188 // std::endl;
189 // std::cout << "F2 is " <<
190 // f2[0] << " " <<
191 // f2[1] << " " <<
192 // f2[2] << " " <<
193 // std::endl;
194  }
195 }
196 
197 
198 
199 /// @brief distance cutoff
200 Distance
202 {
203  return 5.5; // -- temporary hack to allow us to use the standard neighbor array
204 }
205 
206 /// @brief WaterAdductHBondEnergy
207 void
209 {
210 }
213 {
214  return 1; // Initial versioning
215 }
216 
217 
218 
219 } // methods
220 } // scoring
221 } // core