Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PoseBallsLite.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/scoring/packing/PoseBallsLite.cc
11 /// @brief
12 /// @author
13 
15 // AUTO-REMOVED #include <core/scoring/packstat/AtomRadiusMap.hh>
16 #include <core/pose/PDBInfo.hh>
17 #include <basic/Tracer.hh>
18 #include <core/pose/util.hh>
19 
20 #include <map>
21 
22 // ObjexxFCL headers
23 #include <ObjexxFCL/string.functions.hh>
24 // AUTO-REMOVED #include <ObjexxFCL/format.hh>
25 
27 #include <utility/vector1.hh>
28 
29 //Auto Headers
30 #include <core/pose/util.tmpl.hh>
31 
32 namespace core {
33 namespace scoring {
34 namespace packing {
35 
36 /// @details Auto-generated virtual destructor
38 
39 using namespace ObjexxFCL;
40 
41 static basic::Tracer TR("core.scoring.packing.PoseBallsLite");
42 
43 inline core::Real sqr ( core::Real x ) {
44  return x*x;
45 }
46 
47 // smoothed neighbor is between 9 and 11 A
48 inline core::Real sigmoidish_neighbor( core::Real sqdist ) {
49  if( sqdist > 121.0 ) {
50  return 0.0;
51  } else if( sqdist < 81.0 ) {
52  return 1.0;
53  } else {
54  Real dist = sqrt( sqdist );
55  return sqr(1.0 - sqr( (dist - 9.0) / (11.0 - 9.0) ) );
56  }
57 }
58 
59 /// @details Remove spaces from given string.
60 inline std::string strip_whitespace( std::string const & name )
61 {
62  std::string trimmed_name( name );
63  left_justify( trimmed_name ); trim( trimmed_name ); // simpler way to dothis?
64  return trimmed_name;
65 }
66 
67 
68 
70  core::pose::Pose const & pose,
71  core::Size Hmode,
72  bool /*ignore_water*/
73 )
74 {
75  using namespace numeric;
76 
77  // std::cerr << "PoseBallsLite.cc:67 (" << pose.total_residue() << ")" << std::endl;
78 
79  // initialize index and vars
80  core::Size index = 0;
81  Size num_unrec = 0;
82  if( pose.pdb_info() ) num_unrec = pose.pdb_info()->get_num_unrecognized_atoms();
83  balls_ .reserve( pose.total_residue()*5 + num_unrec );
84  index_to_id_.reserve( pose.total_residue()*5 + num_unrec );
85  core::pose::initialize_atomid_map( id_to_index_, pose );
86  id_to_index_.resize( pose.total_residue() + num_unrec );
87 
88 // std::cerr << "PoseBallsLite.cc:85 (" << ")" << std::endl;
89 
90  // add atoms in pose
91  core::Size skippedH = 0;
92  for( core::Size ir = 1; ir <= pose.total_residue(); ++ir ) {
93  for( core::Size ia = 1; ia <= pose.residue(ir).natoms(); ++ia ) {
94 // std::cerr << "PoseBallsLite.cc:91 (" << ")" << std::endl;
95  if( pose.residue(ir).is_virtual(ia) ) continue;
96  if ( Hmode == 0 ) { // no H's
97  if( pose.residue(ir).atom_type(ia).is_hydrogen() ) {
98  skippedH++;
99  continue;
100  }
101  } else if( Hmode == 1 ) { // polar H's only
102  if( pose.residue(ir).atom_type(ia).is_hydrogen() &&
103  !pose.residue(ir).atom_type(ia).is_polar_hydrogen() ) {
104  skippedH++;
105  continue;
106  }
107  } else if( Hmode == 2 ) {
108  ; // all Hs
109  }
110  atom_num_.push_back(ia);
111  res_num_.push_back(ir);
112 
113 // std::cerr << "PoseBallsLite.cc:107 (" << ")" << std::endl;
114  core::id::AtomID aid(ia,ir);
115  id_to_index_[ aid ] = ++index;
116  index_to_id_.push_back( aid );
117  balls_.push_back( Ball( pose.xyz(aid), pose.residue(ir).atom_type(ia).lj_radius() ) );
118  }
119  }
120 // std::cerr << "PoseBallsLite.cc:134 (" << ")" << std::endl;
121 
122  nballs_ = index;
123 }
124 
125 
126 } // namespace packing
127 } // namespace scoring
128 } // namespace core