Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ShortRangeTwoBodyEnergy.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/ShortRangeTwoBodyEnergy.cc
11 /// @brief Short-Range, Two-Body Energy Method base class implementation
12 /// @author Andrew Leaver-Fay
13 
14 // Unit Headers
16 
17 // Package Headers
20 
21 // Project Headers
24 
25 // ObjexxFCL Headers
26 #include <ObjexxFCL/FArray2D.hh>
27 
28 #include <utility/vector1.hh>
29 
30 
31 
32 namespace core {
33 namespace scoring {
34 namespace methods {
35 
37 
39 
40 bool
42 {
43  return false;
44 }
45 
46 void
48  conformation::RotamerSetBase const & set1,
49  conformation::RotamerSetBase const & set2,
50  pose::Pose const & pose,
51  ScoreFunction const & sfxn,
52  EnergyMap const & weights,
53  ObjexxFCL::FArray2D< core::PackerEnergy > & energy_table
54 ) const
55 {
56  using namespace conformation;
57  using namespace numeric;
58 
59  EnergyMap emap;
60 
61  for ( Size ii = 1; ii <= set1.get_n_residue_types(); ++ii ) {
62  Size const ii_offset = set1.get_residue_type_begin( ii );
63  Residue const & ii_example_rotamer( *set1.rotamer( ii_offset ));
64  Vector const & ii_coord( ii_example_rotamer.atom( ii_example_rotamer.type().nbr_atom() ).xyz());
65  Real const ii_radius( ii_example_rotamer.type().nbr_radius() );
66 
67  for ( Size jj = 1; jj <= set2.get_n_residue_types(); ++jj ) {
68  Size const jj_offset = set2.get_residue_type_begin( jj );
69  Residue const & jj_example_rotamer( *set2.rotamer( jj_offset ));
70  Vector const & jj_coord( jj_example_rotamer.atom( jj_example_rotamer.type().nbr_atom() ).xyz());
71  Real const jj_radius( jj_example_rotamer.type().nbr_radius() );
72 
73  if ( ii_coord.distance_squared( jj_coord ) < std::pow(ii_radius+jj_radius+atomic_interaction_cutoff(), 2 )) {
74  for ( Size kk = 1, kke = set1.get_n_rotamers_for_residue_type( ii ); kk <= kke; ++kk ) {
75  Size const kk_rot_id = ii_offset + kk - 1;
76  for ( Size ll = 1, lle = set2.get_n_rotamers_for_residue_type( jj ); ll <= lle; ++ll ) {
77  Size const ll_rot_id = jj_offset + ll - 1;
78 
79  emap.zero();
80  residue_pair_energy( *set1.rotamer( kk_rot_id ), *set2.rotamer( ll_rot_id ), pose, sfxn, emap );
81  energy_table( ll_rot_id, kk_rot_id ) += static_cast< core::PackerEnergy > (weights.dot( emap ));
82  }
83  }
84  }
85  }
86  }
87 
88 }
89 
90 void
92  conformation::RotamerSetBase const & set,
93  conformation::Residue const & residue,
94  pose::Pose const & pose,
95  ScoreFunction const & sfxn,
96  EnergyMap const & weights,
98 ) const
99 {
100  EnergyMap emap;
101  for ( Size ii = 1, ii_end = set.num_rotamers(); ii <= ii_end; ++ii ) {
102  emap.zero();
103  residue_pair_energy( *set.rotamer( ii ), residue, pose, sfxn, emap );
104  energy_vector[ ii ] += static_cast< core::PackerEnergy > (weights.dot( emap ));
105  }
106 }
107 
108 void
110  conformation::RotamerSetBase const & set,
111  conformation::Residue const & residue,
112  pose::Pose const & pose,
113  ScoreFunction const & sfxn,
114  EnergyMap const & , // weights
116 ) const
117 {
118  EnergyMap emap;
119  for ( Size ii = 1, ii_end = set.num_rotamers(); ii <= ii_end; ++ii ) {
120  emap.zero();
121  residue_pair_energy( *set.rotamer( ii ), residue, pose, sfxn, emap );
122  emaps[ ii ] += emap;
123  }
124 }
125 
126 }
127 }
128 }
129