Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
grid_functions.hh
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 protocols/ligand_docking/grid_functions.hh
11 ///
12 /// @brief
13 /// @author Ian W. Davis
14 
15 
16 #ifndef INCLUDED_protocols_ligand_docking_grid_functions_hh
17 #define INCLUDED_protocols_ligand_docking_grid_functions_hh
18 
19 // AUTO-REMOVED #include <core/conformation/Residue.hh>
20 // AUTO-REMOVED #include <core/grid/CartGrid.hh>
21 // AUTO-REMOVED #include <core/pose/Pose.hh>
22 // AUTO-REMOVED #include <utility/vector1.hh>
23 
24 #include <iostream>
25 
27 #include <core/grid/CartGrid.hh>
28 #include <core/pose/Pose.fwd.hh>
29 #include <utility/vector1.hh>
30 
31 namespace protocols {
32 namespace ligand_docking {
33 
34 
35 /// @brief Sum the grid values for all heavy atoms in the residue
36 int grid_score(
37  core::grid::CartGrid<int> const & grid,
38  core::conformation::Residue const & rsd,
39  int max_score = 9999
40 );
41 
42 
43 /// @brief Sum the grid values for all heavy atoms in the residue
45  core::grid::CartGrid<int> const & grid,
46  core::conformation::Residue const & rsd,
47  int & atr_out, //< sum of negative grid values
48  int & rep_out, //< sum of positive grid values
49  int max_rep = 9999
50 );
51 
52 /// @brief Sum the grid values for all heavy atoms in the residue
53 
55  core::grid::CartGrid<int> const & grid,
56  core::pose::Pose const & pose,
57  core::Size begin,
58  core::Size const end,
59  int & atr_out, //< sum of negative grid values
60  int & rep_out, //< sum of positive grid values
61  int max_rep = 9999
62 );
63 
64 ///@brief a cleaner implementation of rb_grid_score_atr_rep
65 std::pair<int, int> get_rb_atr_and_rep_scores(
66  core::grid::CartGrid<int> const & grid,
67  core::pose::Pose const & pose,
68  core::Size begin,
70 );
71 
72 /// @brief Try all rotamers for the specified residue and install the first one
73 /// that minimizes the grid score. Only tested with ligand residues w/ a conformer library.
75  core::grid::CartGrid<int> const & grid,
76  core::pose::Pose & pose,
77  core::Size rsd_no,
78  int const min_score = 0
79 );
80 
82  core::grid::CartGrid<int> const & grid,
83  core::pose::Pose & pose,
84  core::Size begin,
86 );
87 
88 /// @brief Try all rotamers for the specified residue and install the first one
89 /// that minimizes the repulsive score, breaking ties by the attractive score.
90 /// Only tested with ligand residues w/ a conformer library.
92  core::grid::CartGrid<int> const & grid,
93  core::pose::Pose & pose,
94  core::Size rsd_no
95 );
96 
97 /// @brief Internal helper function for rotamer trials; fills conformers_out.
99  core::pose::Pose & pose,
100  core::Size rsd_no,
102 );
103 
104 
105 /// @brief Set the value for all grid boxes whose centers fall inside the sphere.
106 /* void set_sphere(
107  core::grid::CartGrid<int> const & grid,
108  core::Vector const & center,
109  core::Real radius,
110  int value
111 ); */
112 
113 
114 /// @brief Make a grid around the specified point with attractive (negative)
115 /// and repulsive (positive) values for the protein backbone.
117  core::pose::Pose const & pose,
118  core::Vector const & center
119 );
120 
121 /// @brief Make a grid around the specified point with attractive (negative)
122 /// and repulsive (positive) values for all heavy atoms not in ligand_chain_id_to_exclude
124  core::pose::Pose const & pose,
125  core::Vector const & center,
126  core::Size const & ligand_chain_id_to_exclude
127 );
128 
129 /// @brief Make a grid around the specified point with attractive (negative)
130 /// and repulsive (positive) values for all heavy atoms not in ligand_chain_ids_to_exclude
132  core::pose::Pose const & pose,
133  core::Vector const & center,
134  utility::vector1<core::Size> ligand_chain_ids_to_exclude
135 );
136 
137 /// @details Just writes the points -- you have to write @ dotlist, etc.
138 template<typename T>
140  std::ostream & out,
141  core::grid::CartGrid<T> const & grid,
142  T min_val,
143  T max_val,
144  int stride /*= 1*/
145 )
146 {
147  typedef core::grid::CartGrid<int>::GridPt GridPt;
148  using core::Vector;
149 
150  int nx(0), ny(0), nz(0); // grid points in each dimension
151  grid.getNumberOfPoints(nx, ny, nz);
152  for(int i = 0, i_end = nx; i < i_end; i += stride) {
153  for(int j = 0, j_end = ny; j < j_end; j += stride) {
154  for(int k = 0, k_end = nz; k < k_end; k += stride) {
155  GridPt grid_pt(i, j, k);
156  Vector box_ctr = grid.coords( grid_pt );
157  T value = grid.getValue(grid_pt);
158  if( min_val <= value && value <= max_val ) {
159  out << '{' << i << ' ' << j << ' ' << k << "}U "
160  << box_ctr.x() << ' ' << box_ctr.y() << ' ' << box_ctr.z() << '\n';
161  }
162  }
163  }
164  }
165 }
166 
167 
168 } // namespace ligand_docking
169 } // namespace protocols
170 
171 #endif // INCLUDED_protocols_ligand_docking_grid_functions_HH