Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SymmetricLigandEnergy.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 // This file is part of the Rosetta software suite and is made available under license.
5 // The Rosetta software is developed by the contributing members of the Rosetta Commons consortium.
6 // (C) 199x-2009 Rosetta Commons participating institutions and developers.
7 // For more information, see http://www.rosettacommons.org/.
8 
9 /// @file core/scoring/methods/SymmetricLigandEnergy.cc
10 /// @brief Dunbrack energy method implementation
11 /// @author Andrew Leaver-Fay (aleaverfay@gmail.com)
12 
13 // Unit headers
16 
17 // Package Headers
19 //#include <core/scoring/ScoringManager.hh>
20 
22 
23 // Project headers
24 #include <core/pose/Pose.hh>
25 
26 // Utility headers
27 // AUTO-REMOVED #include <numeric/conversions.hh>
29 
30 #include <core/id/AtomID.hh>
31 #include <utility/vector1.hh>
32 
33 
34 namespace core {
35 namespace scoring {
36 namespace methods {
37 
38 
39 /// @details This must return a fresh instance of the SymmetricLigandEnergy class,
40 /// never an instance already in use
44 ) const {
45  return new SymmetricLigandEnergy;
46 }
47 
50  ScoreTypes sts;
51  sts.push_back( sym_lig );
52  return sts;
53 }
54 
55 ////////////////////////////////////////////////////////////////////////////
56 // SymmetricLigandEnergy
57 ////////////////////////////////////////////////////////////////////////////
58 
61 {}
62 
63 
65 
66 /// clone
69 {
70  return new SymmetricLigandEnergy;
71 }
72 
73 /////////////////////////////////////////////////////////////////////////////
74 // methods for ContextIndependentOneBodyEnergies
75 /////////////////////////////////////////////////////////////////////////////
76 
77 ///
78 void
80  conformation::Residue const & rsd,
81  pose::Pose const &,
82  EnergyMap & emap
83 ) const
84 {
85  numeric::xyzVector<core::Real> target(0,0,4);
86  if( rsd.has("CEN") ) { // centroid
87  if( /*"HIS" == rsd.name3() &&*/ rsd.xyz("CEN").z() > 0.0 ) {
88  numeric::xyzVector<core::Real> cen = rsd.xyz("CEN");
89  numeric::xyzVector<core::Real> base = rsd.xyz("CA" );
90  Real score = numeric::min( 0.0, (-10.0 / (cen.distance(target) + 1.0) + 1.0) );
91  score *= dot( (cen-base).normalized(),(target-cen).normalized());
92  emap[sym_lig] += score;
93 
94  Real penalty = rsd.xyz("CA" ).y();
95  penalty *= penalty;
96  emap[sym_lig] += penalty * 0.01;
97 
98  }
99  emap[sym_lig] += numeric::min( 0.0, rsd.xyz("CEN").distance(target) - 20.0 ) / 20;
100  } else { // full atom
101  if( "HIS" == rsd.name3() && rsd.xyz("NE2").z() > 0.0 ) {
102  numeric::xyzVector<core::Real> cen = rsd.xyz("NE2");
103  numeric::xyzVector<core::Real> base = (rsd.xyz("CG")+rsd.xyz("ND1"))/2.0;
104  Real score = numeric::min( 0.0, (-8.0 / (cen.distance(target) + 1.0) + 1.0) );
105  // no orientation here yet because I don't wanna do derives for it
106  // if( score != 0.0 ) {
107  // std::cerr << "FA HIS BONUS " << score << std::endl;
108  // }
109  emap[sym_lig] += score;
110  }
111  }
112 
113 
114 }
115 
116 
117 
118 void
120  id::AtomID const & id,
121  pose::Pose const & pose,
122  kinematics::DomainMap const & /*domain_map*/,
123  ScoreFunction const & /*sfxn*/,
124  EnergyMap const & weights,
125  Vector & F1,
126  Vector & F2
127 ) const {
128  if( "HIS" != pose.residue(id.rsd()).name3() ) return;
129 
130  if( "NE2" != pose.residue(id.rsd()).atom_name(id.atomno()) ) return;
131 
132  // std::cerr << "SymmetricLigandEnergy deriv " << id << std::endl;
133 
134  numeric::xyzVector<core::Real> target(0,0,4.0);
135  //if( pose.xyz(id).z() < 0.0 ) target *= -1.0;
136 
137  if( pose.xyz(id).distance(target) > 5.0 ) return;
138 
139  numeric::xyzVector<core::Real> atom_x = pose.xyz(id);
140  core::Real mag = pose.xyz(id).distance(target) + 1.0;
141  mag = 6.0 / (mag*mag);
142  numeric::xyzVector<core::Real> const f2( mag * ( pose.xyz(id) - target ).normalized() );
143  numeric::xyzVector<core::Real> const atom_y = atom_x - f2; // a "fake" atom in the direcion of the gradient
144  numeric::xyzVector<core::Real> const f1( atom_x.cross( atom_y ) );
145 
146  F1 += weights[ sym_lig ] * f1;
147  F2 += weights[ sym_lig ] * f2;
148 
149 }
150 
151 
152 /// @brief SymmetricLigandEnergy is context independent; indicates that no context graphs are required
153 void
155  utility::vector1< bool > & /*context_graphs_required*/
156 ) const
157 {}
160 {
161  return 1; // Initial versioning
162 }
163 
164 
165 
166 } // methods
167 } // scoring
168 } // core
169