Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DNATorsionEnergy.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/DNATorsionEnergy.cc
11 /// @brief DNATorsion energy method class implementation
12 /// @author Phil Bradley
13 /// @author Mike Tyka (mtyka@u.washington.edu)
14 /// @author Rhiju Das
15 /// @author Jim Havranek
16 
17 // Unit Headers
20 
21 // Package Headers
22 //#include <core/scoring/dna/DNATorsionPotential.hh>
30 
31 
32 //#include <core/pack/task/PackerTask.hh>
33 
34 // Project headers
35 #include <core/pose/Pose.hh>
36 #include <core/id/TorsionID.hh>
37 
38 // Utility headers
39 #include <numeric/conversions.hh>
40 
41 // C++
42 
43 
44 namespace core {
45 namespace scoring {
46 namespace dna {
47 
51 ) const {
52  return new DNATorsionEnergy;
53 }
54 
57  ScoreTypes sts;
58  sts.push_back( dna_bb_torsion );
59  sts.push_back( dna_sugar_close );
60  sts.push_back( dna_base_distance );
61  return sts;
62 }
63 
64 
65 /// ctor
68  dna_torsion_potential_( ScoringManager::get_instance()->get_DNATorsionPotential() ),
69  constraints_ready_( false ),
70  verbose_( false )
71 {}
72 
73 /// clone
76 {
77  return new DNATorsionEnergy;
78 }
79 
80 
81 ///////////////////////////////////////////////////////////////////////////////
82 void
84 {
85  // if ( constraints_ready_) return;
86 
88 
89  constraints_ready_ = true;
90 }
91 
92 ///////////////////////////////////////////////////////////////////////////////
93 void
95 {
96  // if ( constraints_ready_) return;
98  constraints_ready_ = true;
99 }
100 
101 ///////////////////////////////////////////////////////////////////////////////
102 /*
103 void
104 DNATorsionEnergy::setup_for_packing( pose::Pose & pose, pack::task::PackerTask const & task ) const{
105  // if ( constraints_ready_) return;
106  dna_torsion_potential_.setup_constraints( pose, dna_torsion_constraints_, dna_sugar_close_constraints_, dna_base_distance_constraints_ );
107 
108  //If designing, can't implement sugar closure constraints, because one of them depends on the first base atom ...
109  // whose name and location differ between bases! Luckily, sugar atoms and first base atom should not vary during design.
110  // So clear these constraints...
111  if ( task.design_any() ) dna_sugar_close_constraints_ = constraints::ConstraintSetOP( new constraints::ConstraintSet );
112 
113  constraints_ready_ = true;
114 }
115 */
116 ///////////////////////////////////////////////////////////////////////////////
117 void
119  conformation::Residue const & rsd1,
120  conformation::Residue const & rsd2,
121  pose::Pose const & pose,
122  ScoreFunction const & sfxn,
123  EnergyMap & emap ) const {
124 
125  if ( dna_torsion_constraints_ == 0 ) return;
126  if ( !constraints_ready_ ) return;
127 
128  EnergyMap emap_temp;
129  dna_torsion_constraints_->residue_pair_energy( rsd1, rsd2, pose, sfxn, emap_temp );
130  emap[ dna_bb_torsion] += emap_temp[ dna_bb_torsion];
131 
132  EnergyMap emap_2nd;
133  dna_base_distance_constraints_->residue_pair_energy( rsd1, rsd2, pose, sfxn, emap_2nd );
134  emap[ dna_base_distance ] += emap_2nd[ dna_base_distance ];
135 // std::cout << "respair_energy" << rsd1.seqpos() << " " << rsd2.seqpos() << " " << emap_2nd[ dna_base_distance ] << std::endl;
136 
137 }
138 
139 
140 ///////////////////////////////////////////////////////////////////////////////
141 void
143  conformation::Residue const & rsd,
144  pose::Pose const & pose,
145  ScoreFunction const & sfxn,
146  EnergyMap & emap ) const {
147 
148  if ( dna_torsion_constraints_ == 0 ) return;
149  if ( !constraints_ready_ ) return;
150 
151  ////////////////////////////////////////////////////////////////////////////////////
152  dna_torsion_constraints_->eval_intrares_energy( rsd, pose, sfxn, emap );
153  if ( verbose_ ) std::cout << "accumulated dna_torsion " << rsd.seqpos() << " " << emap[ dna_bb_torsion ] << std::endl;
154 
155  ////////////////////////////////////////////////////////////////////////////////////
156  // This seems a little wasteful ... there is a "global" dna_sugar_close_constraints_
157  // constraint set. But if the residue changes -- during design for example -- then we need to be more careful,
158  // as atom names and indices change around.
159  constraints::ConstraintSet residue_dna_sugar_close_constraints;
160  dna_torsion_potential_.add_sugar_ring_closure_constraints( rsd, residue_dna_sugar_close_constraints );
161  residue_dna_sugar_close_constraints.eval_intrares_energy( rsd, pose, sfxn, emap );
162  if ( verbose_ ) std::cout << "accumulated dna_sugar_close " << rsd.seqpos() << " " << emap[ dna_sugar_close ] << std::endl;
163 
164 }
165 
166 
167 ///////////////////////////////////////////////////////////////////////////////
168 void
170  pose::Pose & pose,
171  ScoreFunction const & sfxn,
172  EnergyMap & totals
173 ) const
174 {
175 
176  if ( dna_torsion_constraints_ == 0 ) return;
177  if ( !constraints_ready_ ) return;
178 
179  if ( verbose_ ) std::cout << " final_energy " << totals[ dna_bb_torsion ] << std::endl;
180  dna_torsion_constraints_->eval_non_residue_pair_energy( pose, sfxn, totals );
181  if ( verbose_ ) std::cout << " final_energy " << totals[ dna_bb_torsion ] << std::endl;
182 
183  // Sugar constraints are always intra-residue
184  //dna_sugar_close_constraints_->eval_non_residue_pair_energy( pose, sfxn, totals );
185 
186  constraints_ready_ = false;
187 
188 }
189 
190 ///////////////////////////////////////////////////////////////////////////////
191 void
193  id::AtomID const & id,
194  pose::Pose const & pose,
195  kinematics::DomainMap const &, // domain_map,
196  ScoreFunction const & sfxn,
197  EnergyMap const & weights,
198  Vector & F1,
199  Vector & F2
200 ) const
201 {
202  if ( dna_torsion_constraints_ == 0 ) return;
203  if ( !constraints_ready_ ) return;
204  dna_torsion_constraints_->deprecated_eval_atom_derivative( id, pose, sfxn, weights, F1, F2 );
205  dna_sugar_close_constraints_->deprecated_eval_atom_derivative( id, pose, sfxn, weights, F1, F2 );
206  dna_base_distance_constraints_->deprecated_eval_atom_derivative( id, pose, sfxn, weights, F1, F2 );
207 }
208 ///////////////////////////////////////////////////////////////////////////////
209 /// side chain torsion tethers...
210 Real
212  id::DOF_ID const &,
213  id::TorsionID const & ,
214  pose::Pose const & ,
215  ScoreFunction const & ,
216  EnergyMap const &
217 ) const
218 {
219  // if ( dna_torsion_constraints_ == 0 ) return 0.0;
220  // if ( dna_side_chain_torsion_tethers_ == 0 ) return 0.0;
221  if ( !constraints_ready_ ) return 0.0;
222 
223  // DOF_constraint machinery ... should remove this call, and perhaps all
224  // calls to dof_constraint!!
225  // Real result ( dna_torsion_constraints_->eval_dof_derivative( id, tor, pose, scorefxn, weights ) );
226 
227  Real result( 0.0 );
228 
229  return result;
230 }
231 
232 
233 
234 ///////////////////////////////////////////////////////////////////////////////
235 void
237  pose::Pose &,
238  ScoreFunction const &
239 ) const
240 {
241 
242  if ( dna_torsion_constraints_ == 0 ) return;
243  if ( !constraints_ready_ ) return;
244  constraints_ready_ = false;
245 
246 }
247 
248 
250 
253 {
254  return 1;
255 }
256 
257 
258 /// @brief DNA_PairwiseLowResolutionEnergy distance cutoff
259 Distance
261 {
262  return 0.0; /// Uh, I don't know.
263 }
264 
265 
266 } // dna
267 } // scoring
268 } // core
269