Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MiniPose.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/pose/MiniPose.cc
11 /// @brief MiniPose class
12 /// @details minimal class with xyz and fold_tree but not the atom_tree + energies machinery...
13 /// @author Rhiju Das
14 
15 // Unit headers
16 #include <core/pose/Pose.hh>
17 #include <core/pose/MiniPose.hh>
18 #include <core/types.hh>
19 
20 // Project headers
22 #include <core/id/AtomID.hh>
24 #include <utility/vector1.hh>
25 #include <numeric/xyzVector.hh>
26 #include <ObjexxFCL/format.hh>
27 
28 #include <string>
29 
30 namespace core {
31 namespace pose {
32 
33 // @brief Auto-generated virtual destructor
35 
36  ///////////////////////////////////////////////////////////////////////
38  {
39  coords_.clear();
40  atom_names_list_.clear();
41  variant_types_list_.clear();
42 
43  for ( Size i = 1; i <= pose.total_residue(); i++ ) {
46  for ( Size j = 1; j <= pose.residue(i).natoms(); j++ ) {
47  xyz.push_back( pose.residue(i).xyz( j ) ) ;
48  atom_name.push_back( pose.residue_type(i).atom_name( j ) );
49  }
50  coords_.push_back( xyz );
51  atom_names_list_.push_back(atom_name);
52  variant_types_list_.push_back(pose.residue_type(i).variant_types());
53  }
54  sequence_ = pose.sequence();
55  fold_tree_ = pose.fold_tree();
56  }
57 
58  //////////////////////////////////////////////////////////////////////////////////
60  core::kinematics::FoldTree const & fold_tree,
61  std::string const & sequence ):
62  coords_( coords ),
63  fold_tree_( fold_tree ),
64  sequence_( sequence )
65  {}
66 
67  //////////////////////////////////////////////////////////////////////////////////
70  return fold_tree_;
71  }
72 
75  if(coords_.size()==0) utility_exit_with_message("coords_ is empty!");
76 
77  return coords_;
78  }
79 
82  if(atom_names_list_.size()==0) utility_exit_with_message("atom_names_list_ is empty!");
83  return atom_names_list_;
84  }
85 
88  if(variant_types_list_.size()==0) utility_exit_with_message("variant_types_list_ is empty!");
89  return variant_types_list_;
90  }
91 
92  Size
93  MiniPose::size() const {
94  return coords_.size();
95  }
96 
97  Size
99  return coords_.size();
100  }
101 
102  std::string const &
104  return sequence_;
105  }
106 
107  PointPosition const &
108  MiniPose::xyz( core::id::AtomID atom_id ) const{
109 
110  if(coords_.size()==0) utility_exit_with_message("coords_ is empty!");
111 
112  if(coords_.size()<atom_id.rsd()){
113  std::cout << "atom_id.rsd()= " << atom_id.rsd() << " coords_.size()= " << coords_.size() << std::endl;
114  utility_exit_with_message("atom_id.rsd()" +ObjexxFCL::string_of(atom_id.rsd())+ " is out of range!");
115  }
116 
117  if(coords_[ atom_id.rsd() ].size()<atom_id.atomno()){
118  std::cout << "atom_id.atomno()= " << atom_id.atomno() << " coords_[" << atom_id.rsd() << "].size()= " << coords_[ atom_id.rsd() ].size() << std::endl;
119  utility_exit_with_message("atom_id.atomno()" +ObjexxFCL::string_of(atom_id.atomno())+ " is out of range!");
120  }
121 
122  return coords_[ atom_id.rsd() ][ atom_id.atomno() ];
123  }
124 
125  std::string const &
127  if(atom_names_list_.size()==0) utility_exit_with_message("atom_names_list_ is empty!");
128 
129  if(atom_names_list_.size()<atom_id.rsd()){
130  std::cout << "atom_id.rsd()= " << atom_id.rsd() << " atom_names_list_.size()= " << atom_names_list_.size() << std::endl;
131  utility_exit_with_message("atom_id.rsd()" +ObjexxFCL::string_of(atom_id.rsd())+ " is out of range!");
132  }
133 
134  if(atom_names_list_[ atom_id.rsd() ].size()<atom_id.atomno()){
135  std::cout << "atom_id.atomno()= " << atom_id.atomno() << " atom_names_list_[" << atom_id.rsd() << "].size()= " << atom_names_list_[ atom_id.rsd() ].size() << std::endl;
136  utility_exit_with_message("atom_id.atomno()" +ObjexxFCL::string_of(atom_id.atomno())+ " is out of range!");
137  }
138 
139  return atom_names_list_[ atom_id.rsd() ][ atom_id.atomno() ];
140  }
141 
143  MiniPose::variant_types( Size const seq_num) const{
144 
145  if(variant_types_list_.size()==0) utility_exit_with_message("variant_types_list_ is empty!");
146 
147  if(variant_types_list_.size()<seq_num){
148  std::cout << "seq_num= " << seq_num << " variant_types_list_.size()= " << variant_types_list_.size() << std::endl;
149  utility_exit_with_message("seq_num" +ObjexxFCL::string_of(seq_num)+ " is out of range!");
150  }
151 
152  return variant_types_list_[seq_num];
153  }
154 
155 
156 
157 } // pose
158 } // core