Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CountPairGeneric.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/etable/count_pair/CountPairIntraResC4.hh
11 /// @brief Count pair for residue pairs connected with one bond, where the
12 /// crossover from excluding to counting atom pair interactions is at 4 bonds.
13 /// @author Andrew Leaver-Fay (leaverfa@email.unc.edu)
14 
15 
17 
18 #include <core/types.hh>
21 
22 //Auto Headers
23 #include <platform/types.hh>
30 #include <utility/vector1.hh>
31 #include <utility/options/IntegerVectorOption.hh>
32 
33 
34 namespace core {
35 namespace scoring {
36 namespace etable {
37 namespace count_pair {
38 
40  conformation::Residue const & res1,
41  conformation::Residue const & res2
42 ) :
43  //r1_( res1 ),
44  //r2_( res2 ),
45  n_connect_( 0 ),
46  n_pconnect_( 0 ),
47  crossover_( 3 )
48 {
49  using namespace conformation;
50 
51  assert( res1.seqpos() != res2.seqpos() );
52 
53  if ( res1.is_bonded( res2 ) ) {
54  utility::vector1< Size > const & r1_connids( res1.connections_to_residue( res2 ) );
55  for ( Size ii = 1; ii <= r1_connids.size(); ++ii ) {
56  ++n_connect_;
57 
58  Size const r1_conn_id = r1_connids[ ii ];
59  Size const r2_conn_id = res1.actual_residue_connection( r1_conn_id ).connid();
60 
61  Size const r1conn_atom = res1.residue_connection( r1_conn_id ).atomno();
62  Size const r2conn_atom = res2.residue_connection( r2_conn_id ).atomno();
63 
64  res1_conn_point_path_dists_.push_back( & (res1.path_distance( r1conn_atom )) );
65  res2_conn_point_path_dists_.push_back( & (res2.path_distance( r2conn_atom )) );
66  }
67  }
68 
69  if ( res1.is_pseudo_bonded( res2 ) ) {
71  for ( PseudoBondCollection::PBIter pb_iter = pbc->iter_begin(),
72  pb_iter_end = pbc->iter_end(); pb_iter != pb_iter_end; ++pb_iter ) {
73  ++n_pconnect_;
74 
75  Size const r1_conn_id = res1.seqpos() < res2.seqpos() ? pb_iter->lr_conn_id() : pb_iter->ur_conn_id();
76  Size const r2_conn_id = res1.seqpos() < res2.seqpos() ? pb_iter->ur_conn_id() : pb_iter->lr_conn_id();
77 
78  Size const r1conn_atom = res1.residue_connection( r1_conn_id ).atomno();
79  Size const r2conn_atom = res2.residue_connection( r2_conn_id ).atomno();
80 
81  res1_pbconn_point_path_dists_.push_back( & (res1.path_distance( r1conn_atom )) );
82  res2_pbconn_point_path_dists_.push_back( & (res2.path_distance( r2conn_atom )) );
83  pb_lengths_.push_back( pb_iter->nbonds() );
84  }
85  }
86  assert( n_connect_ == res1_conn_point_path_dists_.size() );
87  assert( n_connect_ == res2_conn_point_path_dists_.size() );
88  assert( n_pconnect_ == res1_pbconn_point_path_dists_.size() );
89  assert( n_pconnect_ == res2_pbconn_point_path_dists_.size() );
90 }
91 
92 /// @brief Create a count pair object that pretends there exist
93 /// a chemical bond between some number of atoms in residue 1 and
94 /// some number of atoms in residue2; the bond_pairs vector is
95 /// a set of ordered-pairs of atom-indices, where the first
96 /// is an atom from restype1 and the second is an atom of restype2.
98  chemical::ResidueType const & restype1,
99  chemical::ResidueType const & restype2,
100  utility::vector1< std::pair< Size, Size > > bond_pairs
101 )
102 :
103  n_pconnect_( 0 ),
104  crossover_( 3 )
105 {
106  n_connect_ = bond_pairs.size();
109  for ( Size ii = 1; ii <= n_connect_; ++ii ) {
110  res1_conn_point_path_dists_.push_back( & (restype1.path_distance( bond_pairs[ ii ].first )) );
111  res2_conn_point_path_dists_.push_back( & (restype2.path_distance( bond_pairs[ ii ].second )) );
112  //std::cout << "Bond between " << restype1.name() << " " << restype1.atom_name( bond_pairs[ ii ].first );
113  //std::cout << " and " << restype2.name() << " " << restype2.atom_name( bond_pairs[ ii ].second ) << std::endl;
114  //std::cout << "path distances res1: " << std::endl;
115  //for ( Size jj = 1; jj <= restype1.natoms(); ++jj ) {
116  // std::cout << " " << restype1.atom_name( jj ) << " " << (*res1_conn_point_path_dists_[ ii ])[ jj ] << std::endl;
117  //}
118  //std::cout << "path distances res2: " << std::endl;
119  //for ( Size jj = 1; jj <= restype2.natoms(); ++jj ) {
120  // std::cout << " " << restype2.atom_name( jj ) << " " << (*res2_conn_point_path_dists_[ ii ])[ jj ] << std::endl;
121  //}
122  }
123 }
124 
126 
127 // Generic crossover behavior must be specified
128 // Unneccessary use of the letter x
129 void
131 {
132  crossover_ = xover;
133 }
134 
135 bool
137  int const at1,
138  int const at2,
139  Real & weight,
140  Size & path_dist
141 ) const
142 {
143  return operator()( at1, at2, weight, path_dist );
144 }
145 
146 void
148  conformation::Residue const & res1,
149  conformation::Residue const & res2,
150  etable::TableLookupEvaluator const & etable_energy,
151  EnergyMap & emap
152 ) const
153 {
154  inline_residue_atom_pair_energy( res1, res2, etable_energy, *this, emap );
155 }
156 
157 void
159  conformation::Residue const & res1,
160  conformation::Residue const & res2,
161  etable::TableLookupEvaluator const & etable_energy,
162  EnergyMap & emap
163 ) const
164 {
166  res1, res2, etable_energy, *this, emap );
167 }
168 
169 
170 void
172  conformation::Residue const & res1,
173  conformation::Residue const & res2,
174  etable::TableLookupEvaluator const & etable_energy,
175  EnergyMap & emap
176 ) const
177 {
179  res1, res2, etable_energy, *this, emap );
180 }
181 
182 
183 void
185  conformation::Residue const & res1,
186  conformation::Residue const & res2,
187  etable::TableLookupEvaluator const & etable_energy,
188  EnergyMap & emap
189 ) const
190 {
191  inline_residue_atom_pair_energy_backbone_backbone( res1, res2, etable_energy, *this, emap );
192 }
193 
194 
195 
196 void
198  conformation::Residue const & res1,
199  conformation::Residue const & res2,
200  etable::TableLookupEvaluator const & etable_energy,
201  EnergyMap & emap
202 ) const
203 {
204  inline_residue_atom_pair_energy_sidechain_sidechain( res1, res2, etable_energy, *this, emap );
205 }
206 
207 void
209  conformation::Residue const & res1,
210  conformation::Residue const & res2,
211  etable::AnalyticEtableEvaluator const & etable_energy,
212  EnergyMap & emap
213 ) const
214 {
215  inline_residue_atom_pair_energy( res1, res2, etable_energy, *this, emap );
216 }
217 
218 void
220  conformation::Residue const & res1,
221  conformation::Residue const & res2,
222  etable::AnalyticEtableEvaluator const & etable_energy,
223  EnergyMap & emap
224 ) const
225 {
227  res1, res2, etable_energy, *this, emap );
228 }
229 
230 
231 void
233  conformation::Residue const & res1,
234  conformation::Residue const & res2,
235  etable::AnalyticEtableEvaluator const & etable_energy,
236  EnergyMap & emap
237 ) const
238 {
240  res1, res2, etable_energy, *this, emap );
241 }
242 
243 void
245  conformation::Residue const & res1,
246  conformation::Residue const & res2,
247  etable::AnalyticEtableEvaluator const & etable_energy,
248  EnergyMap & emap
249 ) const
250 {
251  inline_residue_atom_pair_energy_backbone_backbone( res1, res2, etable_energy, *this, emap );
252 }
253 
254 void
256  conformation::Residue const & res1,
257  conformation::Residue const & res2,
258  etable::AnalyticEtableEvaluator const & etable_energy,
259  EnergyMap & emap
260 ) const
261 {
262  inline_residue_atom_pair_energy_sidechain_sidechain( res1, res2, etable_energy, *this, emap );
263 }
264 
265 
266 } // namespace count_pair
267 } // namespace etable
268 } // namespace scoring
269 } // namespace core
270