Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HbdGrid.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 
3 /// @file src/protocols/qsar/scoring_grid/HbaGrid.cc
4 /// @author Sam DeLuca
5 
8 
11 #include <core/id/AtomID.hh>
12 #include <core/pose/Pose.hh>
13 
14 #include <utility/tag/Tag.hh>
15 #include <utility/vector0.hh>
16 #include <utility/vector1.hh>
17 #include <utility/io/mpistream.hh>
18 
19 #include <numeric/interpolation/util.hh>
20 
21 #include <basic/database/open.hh>
22 
23 namespace protocols {
24 namespace qsar {
25 namespace scoring_grid {
26 
27 
29 {
31 }
32 
34 {
35  GridBaseOP hbd_grid= new HbdGrid();
36 
37  hbd_grid->parse_my_tag(tag);
38 
39  return hbd_grid;
40 }
41 
43 {
44  return new HbdGrid();
45 }
46 
47 
48 
50 {
51  return "HbdGrid";
52 }
53 
55 {
56  std::string lj_file(basic::database::full_name("scoring/qsar/hb_table.txt"));
57  lj_spline_ = numeric::interpolation::spline_from_file(lj_file,0.05).get_interpolator();
58 }
59 
60 
62 {
63 
64 }
65 
66 utility::json_spirit::Value HbdGrid::serialize()
67 {
68 
69  using utility::json_spirit::Value;
70  using utility::json_spirit::Pair;
71 
72  Pair spline_data("spline",lj_spline_->serialize());
73  Pair base_data("base_data",SingleGrid::serialize());
74 
75  return Value(utility::tools::make_vector(spline_data,base_data));
76 }
77 
78 void HbdGrid::deserialize(utility::json_spirit::mObject data)
79 {
80 
81  lj_spline_->deserialize(data["spline"].get_obj());
82  SingleGrid::deserialize(data["base_data"].get_obj());
83 }
84 
85 
86 
87 void
89 {
90 }
91 
92 void HbdGrid::refresh(core::pose::Pose const & pose, core::Vector const & )
93 {
94  this->fill_with_value(0.0);
95 
96  for(core::Size residue_index = 1; residue_index <= pose.total_residue();++residue_index)
97  {
98  core::conformation::Residue const residue = pose.residue(residue_index);
99  if(!residue.is_protein())
100  {
101  continue;
102  }
103  for(core::Size atom_index=1; atom_index <= residue.natoms();++ atom_index)
104  {
105  core::chemical::AtomType atom_type(residue.atom_type(atom_index));
106  if(atom_type.is_hydrogen())
107  {
108  utility::vector1<core::Size> bonded_to_hydrogen(residue.bonded_neighbor(atom_index));
109  for(core::Size index = 1; index <= bonded_to_hydrogen.size();++index)
110  {
111  if(residue.atom_type(bonded_to_hydrogen[index]).is_donor())
112  {
113  core::id::AtomID atom_id(atom_index,residue_index);
114  core::Vector xyz(pose.xyz(atom_id));
116  }
117  }
118  }
119  }
120  }
121 }
122 
123 void HbdGrid::refresh(core::pose::Pose const & pose, core::Vector const & center, core::Size const & )
124 {
125  refresh(pose,center);
126 }
127 
129 {
130  refresh(pose,center);
131 }
132 
133 
135 {
136  core::Real score = 0.0;
137  //GridBaseTracer << "map size is: " << qsar_map->size() <<std::endl;
138  for(core::Size atom_index = 1; atom_index <= residue.nheavyatoms() && score < max_score; ++atom_index)
139  {
140  core::Vector const & atom_coord(residue.xyz(atom_index));
141  if(this->get_grid().is_in_grid(atom_coord.x(),atom_coord.y(),atom_coord.z()))
142  {
143  core::chemical::AtomType atom_type(residue.atom_type(atom_index));
144  if(atom_type.is_acceptor())
145  {
146  core::Real grid_value = this->get_point(atom_coord.x(),atom_coord.y(),atom_coord.z());
147  score += grid_value;
148  }
149 
150  }
151  }
152 
153  return score;
154 }
155 
157 {
158  core::Vector const & atom_coord(residue.xyz(atomno));
159  if(this->get_grid().is_in_grid(atom_coord.x(),atom_coord.y(),atom_coord.z()))
160  {
161  core::chemical::AtomType atom_type(residue.atom_type(atomno));
162  if(atom_type.is_acceptor())
163  {
164  core::Real grid_value = this->get_point(atom_coord.x(),atom_coord.y(),atom_coord.z());
165  return grid_value;
166  }
167  }
168  return 0;
169 }
170 
171 }
172 }
173 }