Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Rotates.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/pack/task/ResfileReader.cc
11 /// @brief implementation of resfile reader and its command classes
12 /// @author Gordon Lemmon (glemmon@gmail.com)
13 
14 // Unit Headers
19 
21 #include <core/pose/util.hh> // includes Pose.hh
22 
23 // Utility Headers
24 #include <numeric/random/random.hh>
25 #include <utility/exit.hh>
26 #include <utility/string_util.hh>
27 #include <basic/Tracer.hh>
28 #include <core/types.hh>
29 #include <utility/tag/Tag.hh>
30 
31 #include <algorithm>
32 
33 #include <utility/excn/Exceptions.hh>
34 #include <boost/foreach.hpp>
35 #define foreach BOOST_FOREACH
36 
37 using basic::T;
38 using basic::Error;
39 using basic::Warning;
40 
41 namespace protocols {
42 namespace ligand_docking {
43 
44 static basic::Tracer rotates_tracer("protocols.ligand_docking.ligand_options.rotates", basic::t_debug);
45 
48 {
50 }
51 
54  return new Rotates;
55 }
56 
59 {
60  return "Rotates";
61 }
62 
63 ///@brief
64 Rotates::Rotates(): Mover("Rotates")
65 {}
66 
67 Rotates::Rotates(Rotates const & that):
68  //utility::pointer::ReferenceCount(),
69  protocols::moves::Mover( that )
70 {}
71 
73 
75  return new Rotates( *this );
76 }
77 
79  return new Rotates;
80 }
81 
83  return "Rotates";
84 }
85 
86 ///@brief parse XML (specifically in the context of the parser/scripting scheme)
87 void
89  utility::tag::TagPtr const tag,
90  protocols::moves::DataMap & /*data_map*/,
91  protocols::filters::Filters_map const & /*filters*/,
92  protocols::moves::Movers_map const & /*movers*/,
93  core::pose::Pose const & pose
94 )
95 {
96  if ( tag->getName() != "Rotates" ){
97  throw utility::excn::EXCN_RosettaScriptsOption("This should be impossible");
98  }
99  if ( ! tag->hasOption("distribution") ) throw utility::excn::EXCN_RosettaScriptsOption("'Rotates' mover requires 'distribution' tag");
100  if ( ! tag->hasOption("degrees") ) throw utility::excn::EXCN_RosettaScriptsOption("'Rotates' mover requires 'degrees' tag");
101  if ( ! tag->hasOption("cycles") ) throw utility::excn::EXCN_RosettaScriptsOption("'Rotates' mover requires 'cycles' tag");
102  if( tag->hasOption("chain") && tag->hasOption("chains") ) throw utility::excn::EXCN_RosettaScriptsOption("'Rotates' mover cannot have both a 'chain' and a 'chains' tag");
103  if( ! (tag->hasOption("chain") || tag->hasOption("chains") ) ) throw utility::excn::EXCN_RosettaScriptsOption("'Rotates' mover requires either a 'chain' or a 'chains' tag");
104 
106  if( tag->hasOption("chain")){
107  chain_strs.push_back( tag->getOption<std::string>("chain") );
108  }
109  else if( tag->hasOption("chains") ){
110  std::string const chains_str = tag->getOption<std::string>("chains");
111  chain_strs= utility::string_split(chains_str, ',');
112  }
113 
114  std::string const distribution_str= tag->getOption<std::string>("distribution");
115  Distribution distribution= get_distribution(distribution_str);
116  core::Size const degrees = tag->getOption<core::Size>("degrees");
117  core::Size const cycles = tag->getOption<core::Size>("cycles");
118 
119  foreach(std::string chain, chain_strs){
121  foreach(core::Size chain_id, chain_ids){
122  Rotate_info rotate_info;
123  rotate_info.chain_id = chain_id;
124  rotate_info.jump_id = core::pose::get_jump_id_from_chain_id(chain_id, pose);
125  rotate_info.distribution= distribution;
126  rotate_info.degrees = degrees;
127  rotate_info.cycles = cycles;
128  rotates_.push_back( new Rotate(rotate_info) );
129  }
130  }
131 }
132 
134  foreach(RotateOP rotate, rotates_){
135  rotate->apply(pose);
136  }
137 }
138 
139 
140 
141 } //namespace ligand_docking
142 } //namespace protocols