Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SmoothCenPairEnergy.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/SmoothCenPairEnergy.cc
11 /// @brief Smooth, differentiable, version of cenpair
12 /// @author Frank DiMaio
13 
14 
15 // Unit headers
16 // AUTO-REMOVED #include <core/scoring/methods/util.hh>
19 
20 // Package headers
24 // AUTO-REMOVED #include <core/scoring/EnergyGraph.hh>
25 
26 // Project headers
27 #include <core/pose/Pose.hh>
28 // AUTO-REMOVED #include <core/conformation/Conformation.hh>
31 
32 #include <numeric/xyzVector.hh>
33 // AUTO-REMOVED #include <numeric/xyz.functions.hh>
34 
35 #include <core/kinematics/Jump.hh>
37 #include <utility/vector1.hh>
38 
39 namespace core {
40 namespace scoring {
41 namespace methods {
42 
46 ) const {
48 }
49 
50 /// @brief Return the set of score types claimed by the EnergyMethod
51 /// this EnergyMethodCreator creates in its create_energy_method() function
54  ScoreTypes sts;
55  sts.push_back( cen_pair_smooth );
56  sts.push_back( cenpack_smooth );
57  return sts;
58 }
59 
60 
61 /// c-tor
64  potential_( ScoringManager::get_instance()->get_SmoothEnvPairPotential() )
65 {}
66 
67 
68 /// clone
71  return new SmoothCenPairEnergy();
72 }
73 
74 
75 /////////////////////////////////////////////////////////////////////////////
76 // scoring
77 /////////////////////////////////////////////////////////////////////////////
78 
79 
80 ///
81 void
83 {
84  // compute interpolated number of neighbors at various distance cutoffs
87 }
88 
89 
90 //////////////////////////////////////////////////////////////
91 //
92 // CENTROID PAIR SCORE
93 // and
94 // "CENTROID PACK" SCORE (helps reproduce pairwise correlations
95 // between centroids, observed in PDB)
96 //
97 void
99  conformation::Residue const & rsd1,
100  conformation::Residue const & rsd2,
101  pose::Pose const &,
102  ScoreFunction const &,
103  EnergyMap & emap
104 ) const {
105  // ignore scoring residues which have been marked as "REPLONLY" residues (only the repulsive energy will be calculated)
108 
109  /// assumes centroids are being used
110  conformation::Atom const & cen1 ( rsd1.atom( rsd1.nbr_atom() ) ), cen2 (rsd2.atom( rsd2.nbr_atom() ) );
111  Real const cendist = cen1.xyz().distance_squared( cen2.xyz() );
112 
113  /// accumulate total energies
114  Real pair_score( 0.0 ), cenpack_score( 0.0 );
115  potential_.evaluate_pair_and_cenpack_score( rsd1, rsd2, cendist, pair_score, cenpack_score );
116 
117  //fpd I'll just keep these magic constants here
118  pair_score *= 2.019f;
119  cenpack_score *= 2.0f;
120 
121  //fpd Get rid of secstruct weighing
122  emap[ cen_pair_smooth ] += pair_score;
123  emap[ cenpack_smooth ] += cenpack_score;
124 }
125 
126 void
128  conformation::Residue const & rsd1,
129  conformation::Residue const & rsd2,
132  ResPairMinimizationData const &,
133  pose::Pose const &,
134  EnergyMap const & weights,
135  utility::vector1< DerivVectorPair > & r1_atom_derivs,
136  utility::vector1< DerivVectorPair > & r2_atom_derivs
137  ) const {
140 
141  Real weight1 = weights[ cen_pair_smooth ];
142  Real weight2 = weights[ cenpack_smooth ];
143 
144  /// assumes centroids are being used
145  conformation::Atom const & cen1 ( rsd1.atom( rsd1.nbr_atom() ) ), cen2 (rsd2.atom( rsd2.nbr_atom() ) );
146  Real const cendist = cen1.xyz().distance_squared( cen2.xyz() );
147  Real dpair_dr, dcenpack_dr;
148  potential_.evaluate_pair_and_cenpack_deriv( rsd1, rsd2, cendist, dpair_dr, dcenpack_dr );
149 
150  // again, multiply by magic constants
151  dpair_dr *= 2.019f;
152  dcenpack_dr *= 2.0f;
153 
154  Vector atom_x = rsd1.atom(rsd1.nbr_atom()).xyz();
155  Vector atom_y = rsd2.atom(rsd2.nbr_atom()).xyz();
156 
157  Vector f1( atom_x.cross( atom_y ) );
158  Vector f2( atom_x - atom_y );
159  Real const dis( f2.length() );
160  dpair_dr /= dis;
161  dcenpack_dr /= dis;
162 
163  f1 *= (weight1 * dpair_dr + weight2 * dcenpack_dr);
164  f2 *= (weight1 * dpair_dr + weight2 * dcenpack_dr);
165 
166  r1_atom_derivs[ rsd1.nbr_atom() ].f1() += f1;
167  r1_atom_derivs[ rsd1.nbr_atom() ].f2() += f2;
168  r2_atom_derivs[ rsd2.nbr_atom() ].f1() -= f1;
169  r2_atom_derivs[ rsd2.nbr_atom() ].f2() -= f2;
170 }
171 
172 
173 void
175  pose::Pose & pose,
176  ScoreFunction const &,
177  EnergyMap &
178 ) const {
179  potential_.finalize( pose );
180 }
181 
182 /// @brief SmoothCenPairEnergy distance cutoff
183 Distance
185  //return 6.0;
186  return 7.5;
187 }
188 
191  return 1; // Initial versioning
192 }
193 
194 }
195 }
196 }