Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PrecomputedPairEnergiesInteractionGraph.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/pack/interaction_graph/PrecomputedPairEnergiesInteractionGraph.cc
11 /// @brief Precomputed interaction graph class
12 /// @author Andrew Leaver-Fay (leaverfa@email.unc.edu)
13 
14 // Rosetta Headers
16 
17 // ObjexxFCL Headers
18 // AUTO-REMOVED #include <ObjexxFCL/FArray1A.hh>
19 #include <ObjexxFCL/FArray2D.hh>
20 // AUTO-REMOVED #include <ObjexxFCL/FArray2A.hh>
21 
22 // STL Headers
23 #include <iostream>
24 
25 using namespace ObjexxFCL;
26 
27 namespace core {
28 namespace pack {
29 namespace interaction_graph {
30 
31 
32 /// @param node1 - [in] - the index of the smaller-indexed node
33 /// @param node2 - [in] - the index of the larger-indexed node
34 /// @param oversized_res_res_energy_array - [in] - the large table
35 /// of rotamer pair energies
36 void PrecomputedPairEnergiesInteractionGraph::add_to_two_body_energies_for_edge
37 (
38  int node1,
39  int node2,
40  FArray2< core::PackerEnergy > const & oversized_res_res_energy_array
41 )
42 {
43  PrecomputedPairEnergiesEdge* edge =
44  (PrecomputedPairEnergiesEdge*) find_edge( node1, node2 );
45  if (edge == NULL){
46  std::cerr << "WARNING:: you've input edge energies for an edge that does not exist" << std::endl;
47  return;
48  }
49  edge->add_to_two_body_energies( oversized_res_res_energy_array );
50 }
51 
52 
53 /// @param node1 - [in] - the index of the smaller-indexed node
54 /// @param node2 - [in] - the index of the larger-indexed node
55 /// @param state_node1 - [in] - state on smaller-indexed node
56 /// @param state_node2 - [in] - state on larger-indexed node
57 /// @param two_body_energy - [in] - the energy for this state pair
58 void
59 PrecomputedPairEnergiesInteractionGraph::add_to_two_body_energies_for_edge
60 (
61  int node1,
62  int node2,
63  int state_node1,
64  int state_node2,
65  core::PackerEnergy const two_body_energy
66 )
67 {
69  (PrecomputedPairEnergiesEdge*) find_edge( node1, node2 );
70  if (edge == NULL) {
71  std::cerr << "WARNING:: you've input edge energies for an edge that does not exist" << std::endl;
72  return;
73  }
74  edge->add_to_two_body_energy( state_node1, state_node2, two_body_energy );
75 }
76 
77 
78 /// @param node1 - [in] - the index of the smaller-indexed node
79 /// @param node2 - [in] - the index of the larger-indexed node
80 /// @param state_node1 - [in] - state on smaller-indexed node
81 /// @param state_node2 - [in] - state on larger-indexed node
82 /// @param two_body_energy - [in] - the energy for this state pair
83 void PrecomputedPairEnergiesInteractionGraph::set_two_body_energy_for_edge(
84  int node1,
85  int node2,
86  int state_node1,
87  int state_node2,
88  core::PackerEnergy const two_body_energy
89 )
90 {
92  (PrecomputedPairEnergiesEdge*) find_edge( node1, node2 );
93  if (edge == NULL) {
94  std::cerr << "WARNING:: you've input edge energies for an edge that does not exist" << std::endl;
95  return;
96  }
97  edge->set_two_body_energy( state_node1, state_node2, two_body_energy );
98 }
99 
100 /// @param node1 - [in] - the index of the smaller-indexed node
101 /// @param node2 - [in] - the index of the larger-indexed node
102 /// @param state_node1 - [in] - state on smaller-indexed node
103 /// @param state_node2 - [in] - state on larger-indexed node
104 ///
105 /// @authors jk
106 ///
107 void PrecomputedPairEnergiesInteractionGraph::clear_two_body_energy_for_edge(
108  int node1,
109  int node2,
110  int state_node1,
111  int state_node2
112 )
113 {
115  (PrecomputedPairEnergiesEdge*) find_edge( node1, node2 );
116  if (edge == NULL) return;
117  edge->set_two_body_energy( state_node1, state_node2, 0 );
118 }
119 
120 
121 /// @brief call this if you're done storing energies in an edge - it will reduce
122 /// the memory usage for that edge if possible
123 ///
124 /// @param node1 - [in] - the index of the smaller-indexed node
125 /// @param node2 - [in] - the index of the larger-indexed node
126 void PrecomputedPairEnergiesInteractionGraph::declare_edge_energies_final
127 (
128  int node1,
129  int node2
130 )
131 {
133  (PrecomputedPairEnergiesEdge*) find_edge( node1, node2 );
134  if (edge == NULL) {
135  return;
136  }
137  edge->declare_energies_final();
138 }
139 
140 } //end namespace interaction_graph
141 } //end namespace pack
142 } //end namespace core