Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ClassicGrid.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 src/protocols/qsar/scoring_grid/ClassicGrid.cc
11 /// @author Sam DeLuca
12 
15 
16 #include <core/pose/Pose.hh>
18 
19 #include <utility/tools/make_vector.hh>
20 #include <utility/json_spirit/json_spirit_value.h>
21 #include <utility/tag/Tag.hh>
22 
23 namespace protocols {
24 namespace qsar {
25 namespace scoring_grid {
26 
28 {
30 }
31 
33 {
34  GridBaseOP classic_grid = new ClassicGrid();
35  classic_grid->parse_my_tag(tag);
36  return classic_grid;
37 }
38 
40 {
41  return new ClassicGrid();
42 }
43 
45 {
46  return "ClassicGrid";
47 }
48 
49 ClassicGrid::ClassicGrid(): SingleGrid("ClassicGrid"), atr_radius_(4.75), rep_radius_(2.25)
50 {
51  //
52 }
53 
54 utility::json_spirit::Value ClassicGrid::serialize()
55 {
56  using utility::json_spirit::Value;
57  using utility::json_spirit::Pair;
58 
59  Pair atr("atr",Value(atr_radius_));
60  Pair rep("rep",Value(rep_radius_));
61  Pair base_data("base_data",SingleGrid::serialize());
62 
63  return Value(utility::tools::make_vector(atr,rep,base_data));
64 
65 }
66 
67 void ClassicGrid::deserialize(utility::json_spirit::mObject data)
68 {
69  atr_radius_ = data["atr"].get_real();
70  rep_radius_ = data["rep"].get_real();
71  SingleGrid::deserialize(data["base_data"].get_obj());
72 }
73 
75 {
76 
77 }
78 
80 {
81  //set attractive zones
82  for(core::Size residue_index = 1; residue_index <=pose.total_residue(); ++residue_index)
83  {
84  core::conformation::Residue const & residue(pose.residue(residue_index));
85  if(!residue.is_protein()) continue;
86  for(core::Size atom_index = 1; atom_index <= residue.nheavyatoms(); ++atom_index)
87  {
88  set_sphere(residue.xyz(atom_index),atr_radius_,-1);
89  }
90  }
91 
92  //set neutral zones
93  for(core::Size residue_index = 1; residue_index <= pose.total_residue(); ++residue_index)
94  {
95  core::conformation::Residue const & residue(pose.residue(residue_index));
96  if(!residue.is_protein()) continue;
97  for(core::Size atom_index = 1; atom_index <= residue.nheavyatoms(); ++atom_index)
98  {
99  set_sphere(residue.xyz(atom_index),rep_radius_,0);
100  }
101  }
102 
103  //set repulsive zones
104  for(core::Size residue_index = 1; residue_index <= pose.total_residue(); ++residue_index)
105  {
106  core::conformation::Residue const & residue = pose.residue(residue_index);
107  if( !residue.is_protein() ) continue;
108  if( residue.has("CB") ) set_sphere(residue.xyz("CB"), rep_radius_, 1);
109  if( residue.has("N") ) set_sphere(residue.xyz("N"), rep_radius_, 1);
110  if( residue.has("CA") ) set_sphere(residue.xyz("CA"), rep_radius_, 1);
111  if( residue.has("C") ) set_sphere(residue.xyz("C"), rep_radius_, 1);
112  if( residue.has("O") ) set_sphere(residue.xyz("O"), rep_radius_, 1);
113  }
114 }
115 
116 void ClassicGrid::refresh(core::pose::Pose const & pose, core::Vector const & center, core::Size const & )
117 {
118  refresh(pose,center);
119 }
120 
122 {
123  refresh(pose,center);
124 }
125 
126 
127 
128 }
129 }
130 }
131 
132 
133