Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AddHydrogens.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 protocols/ligand_docking/AddHydrogens.cc
11 ///
12 /// @brief
13 /// @Gordon Lemmon
14 
19 
20 #include <core/pose/util.hh>
21 
22 #include <core/types.hh>
23 
24 #include <basic/Tracer.hh>
25 
26 // option key includes
27 #include <utility/tag/Tag.hh>
28 
29 #include <utility/vector0.hh>
30 #include <utility/vector1.hh>
31 #include <boost/foreach.hpp>
32 
33 //Auto Headers
35 #include <core/pose/Pose.hh>
36 
37 #define foreach BOOST_FOREACH
38 
39 namespace protocols {
40 namespace ligand_docking {
41 
42 static basic::Tracer add_hydrogens_tracer("protocols.ligand_docking.LigandDesign", basic::t_debug);
43 
46 {
48 }
49 
52  return new AddHydrogens;
53 }
54 
57 {
58  return "AddHydrogens";
59 }
60 
62  //utility::pointer::ReferenceCount(),
63  Mover("AddHydrogens"),
64  chain_("X")
65 {
66  Mover::type( "AddHydrogens" );
67 }
68 
70  //utility::pointer::ReferenceCount(),
71  protocols::moves::Mover( that ),
72  chain_(that.chain_)
73 {}
74 
76 
78  return new AddHydrogens( *this );
79 }
80 
82  return new AddHydrogens;
83 }
84 
86  return "AddHydrogens";
87 }
88 
89 ///@brief parse XML (specifically in the context of the parser/scripting scheme)
90 void
92  utility::tag::TagPtr const tag,
93  protocols::moves::DataMap & /*datamap*/,
94  protocols::filters::Filters_map const & /*filters*/,
95  protocols::moves::Movers_map const & /*movers*/,
96  core::pose::Pose const & /*pose*/
97 )
98 {
99  assert( tag->getName() != "AddHydrogens");
100  if ( ! tag->hasOption("chain") ) utility_exit_with_message("'AddHydrogens' requires 'chain' tag");
101  chain_ = tag->getOption<std::string>("chain");
102 }
103 
104 void
106 {
108  core::Size const chain_begin= pose.conformation().chain_begin(chain_id);
109  core::Size const chain_end= pose.conformation().chain_end(chain_id);
110  utility::vector1<core::Size> unconnected_ids= find_unconnected_residues(pose, chain_begin, chain_end);
111 
112  foreach(core::Size unconnected_id, unconnected_ids){
113  core::conformation::Residue const & res_to_fix= pose.residue(unconnected_id);
115 
116  foreach(core::Size connect_id, connect_ids){
117  AddHydrogen AH(unconnected_id, connect_id);
118  AH.apply(pose);
119  }
120  }
121 }
122 
123 } // namespace ligand_docking
124 } // namespace protocols