Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
xyzStripeHashPoseWithMeta.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 #ifndef INCLUDED_protocols_sic_dock_xyzStripeHashPoseWithMeta_hh
11 #define INCLUDED_protocols_sic_dock_xyzStripeHashPoseWithMeta_hh
12 
15 #include <numeric/geometry/hashing/xyzStripeHashWithMeta.hh>
16 
17 #include <core/pose/Pose.hh>
20 #include <core/id/AtomID.hh>
21 #include <core/id/AtomID_Map.hh>
22 
23 #include <platform/types.hh>
24 
25 namespace protocols {
26 namespace sic_dock {
27 
28 class xyzStripeHashPoseWithMeta : public numeric::geometry::hashing::xyzStripeHashWithMeta<double> {
29 public:
30  xyzStripeHashPoseWithMeta(double radius) : numeric::geometry::hashing::xyzStripeHashWithMeta<double>(radius) {}
31 
33  core::pose::Pose const & p,
35  ) : numeric::geometry::hashing::xyzStripeHashWithMeta<double>(radius) {
36  init_with_pose(p,m);
37  }
38 
40  core::pose::Pose const & p,
41  core::id::AtomID_Map<double> const & amap
42  ) : numeric::geometry::hashing::xyzStripeHashWithMeta<double>(radius) {
43  init_with_pose(p,amap);
44  }
45 
46  void
48  core::pose::Pose const & p,
50  ){
52  init_with_pose(p,dummy,m);
53  }
54 
55  void
57  core::pose::Pose const & p,
59  ){
60  using core::id::AtomID;
61  int natom = 0;
62  if( amap.n_residue() != p.n_residue()) utility_exit_with_message("BAD ATOMID_MAP");
63  for(int ir = 1; ir <= (int)p.n_residue(); ++ir) {
64  // core::conformation::Residue const & r(p.residue(ir));
65  for(int ia = 1; ia <= (int)amap.n_atom(ir); ia++) {
66  if(amap[AtomID(ia,ir)] > 0) natom++;
67  }
68  }
70  utility::vector1<double> meta (natom);
71  platform::uint count = 0;
72  for(int ir = 1; ir <= (int)p.n_residue(); ++ir) {
73  // core::conformation::Residue const & r(p.residue(ir));
74  for(int ia = 1; ia <= (int)amap.n_atom(ir); ia++) {
75  if(amap[AtomID(ia,ir)] > 0) {
76  atoms[++count] = p.xyz(AtomID(ia,ir));
77  meta [ count] = amap[AtomID(ia,ir)];
78  }
79  }
80  }
81  init(atoms,meta);
82  }
83 
84  void
86  core::pose::Pose const & p,
87  utility::vector1<double> const & meta_in,
89  ){
90  int natom = 0;
91  for(int ir = 1; ir <= (int)p.n_residue(); ++ir) {
92  core::conformation::Residue const & r(p.residue(ir));
93  if( NBR==m ) natom++;
94  if( CB==m ) if(r.has("CB")) natom++;
95  if( BB ==m ) natom += r.has("N")+r.has("CA")+r.has("C")+r.has("O")+r.has("CB");
96  if( HVY==m ) natom += r.nheavyatoms();
97  if( ALL==m ) natom += r.natoms();
98  }
100  utility::vector1<double> meta (natom);
101  platform::uint count = 0;
102  for(int ir = 1; ir <= (int)p.n_residue(); ++ir) {
103  core::conformation::Residue const & r(p.residue(ir));
104  if(NBR==m) {
105  int ia = r.nbr_atom();
106  core::id::AtomID const aid(ia,ir);
107  atoms[++count] = p.xyz(aid);
108  meta [ count] = r.atom_type(ia).lj_radius();
109  } else if(CB==m) {
110  if(r.has("CB")){ atoms[++count]=r.xyz("CB"); meta[count]=r.atom_type(r.atom_index("CB")).lj_radius(); }
111  } else if(BB==m) {
112  if(r.has( "N")){ atoms[++count]=r.xyz( "N"); meta[count]=r.atom_type(r.atom_index( "N")).lj_radius(); }
113  if(r.has("CA")){ atoms[++count]=r.xyz("CA"); meta[count]=r.atom_type(r.atom_index("CA")).lj_radius(); }
114  if(r.has( "C")){ atoms[++count]=r.xyz( "C"); meta[count]=r.atom_type(r.atom_index( "C")).lj_radius(); }
115  if(r.has( "O")){ atoms[++count]=r.xyz( "O"); meta[count]=r.atom_type(r.atom_index( "O")).lj_radius(); }
116  if(r.has("CB")){ atoms[++count]=r.xyz("CB"); meta[count]=r.atom_type(r.atom_index("CB")).lj_radius(); }
117  } else if(BB==m) {
118  if(r.has("CA")){ atoms[++count]=r.xyz("CA"); meta[count]=r.atom_type(r.atom_index("CA")).lj_radius(); }
119  if(r.has( "C")){ atoms[++count]=r.xyz( "C"); meta[count]=r.atom_type(r.atom_index( "C")).lj_radius(); }
120  if(r.has("CB")){ atoms[++count]=r.xyz("CB"); meta[count]=r.atom_type(r.atom_index("CB")).lj_radius(); }
121  } else {
122  int natom = (ALL==m) ? r.natoms() : r.nheavyatoms();
123  for(int ia = 1; ia <= natom; ++ia) {
124  core::id::AtomID const aid(ia,ir);
125  atoms[++count] = p.xyz(aid);
126  meta [ count] = r.atom_type(ia).lj_radius();
127  }
128  }
129  }
130  if(meta_in.size()!=0) {
131  init(atoms,meta_in);
132  } else {
133  init(atoms,meta);
134  }
135  }
136 
137 };
138 
139 
140 } // namespace sic_dock
141 } // namespace protocols
142 
143 #endif