Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MPI_Relax.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/loops/LoopHashMap.cc
11 /// @brief
12 /// @author Mike Tyka
13 
14 
15 // MPI headers
16 #ifdef USEMPI
17 #include <mpi.h> //keep this first
18 #endif
19 
21 
24 
30 #include <basic/options/keys/in.OptionKeys.gen.hh>
31 #include <basic/options/keys/out.OptionKeys.gen.hh>
32 #include <basic/options/keys/relax.OptionKeys.gen.hh>
33 #include <basic/options/option.hh>
34 #include <core/pose/Pose.hh>
37 #include <basic/Tracer.hh>
39 #include <protocols/relax/util.hh>
41 
42 
43 
44 namespace protocols {
45 namespace wum {
46 
47 
48 static basic::Tracer TR("MPI_Relax");
49 
50 void
52  // Open input stream
53  TR << "Opening input streams! " << std::endl;
55 
56 }
57 
58 
59 bool
61 {
62  using namespace basic::options;
63  using namespace basic::options::OptionKeys;
64 
65  TR << "Reading in structures..." << std::endl;
66 
68  if ( option[ in::file::fullatom ]() ) {
70  } else {
72  }
73 
74  core::Size count = 0;
75  while( input_.has_another_pose() && ( outbound().size() < max_out_queue_size_ ) ) {
76  TR << "Reading in pose: " << count << std::endl;
77  core::pose::Pose pose;
78  input_.fill_pose( pose, *rsd_set );
79 
80  TR << "Adding pose: " << count << std::endl;
81 
82  WorkUnitBaseCOP base_cop = work_unit_list().get_work_unit("relax");
83  WorkUnit_MoverWrapperOP new_wu = dynamic_cast< WorkUnit_MoverWrapper* >( &(*(base_cop->clone())));
84  if( !new_wu ){
85  TR << "ERROR ERROR ERROR" << std::endl;
86  continue;
87  }
88  new_wu->decoys().add( pose );
89  outbound().add( new_wu );
90  count ++;
91  }
92  TR << "Added " << count << " workunits to outbound queue" << std::endl;
93 
94  if( count == 0) return false;
95 
96  return true;
97 }
98 
99 
101  TR << "Register movers..." << std::endl;
103  WorkUnit_MoverWrapperOP wu_relax = new WorkUnit_MoverWrapper( relax_pose );
104  work_unit_list().register_work_unit( "relax", wu_relax );
105 }
106 
107 
108 void
110  TR << "MPI_Relax slave. " << std::endl;
111 }
112 
113 void
115  // just make sure the queue stays full
117 }
118 
119 
120 void
122  using namespace basic::options;
123  using namespace basic::options::OptionKeys;
124 
125  while( inbound().size() > 0 )
126  {
127  WorkUnitBaseOP next_wu = inbound().pop_next();
128 
129  WorkUnit_SilentStructStore* structure_wu = dynamic_cast< WorkUnit_SilentStructStore * > ( (WorkUnitBase*) (&(*next_wu)) );
130 
131  if ( structure_wu == NULL ){
132  TR << "Cannot save structural data for WU: " << std::endl;
133  next_wu->print( std::cout );
134  } else {
135  TR << "Saving decoy store.. " << std::endl;
136  SilentStructStore &decoys = structure_wu->decoys();
137  if( decoys.size() == 0 ){
138  TR << "ERROR: WU did not contain any structures. " << std::endl;
139  }else{
141  std::string filename = option[ OptionKeys::out::file::silent ]();
142 
143  for( SilentStructStore::const_iterator it = decoys.begin();
144  it != decoys.end();
145  ++it )
146  {
147  sfd.write_silent_struct( (*(*it)), filename );
148  }
149  }
150 
151  }
152 
153 
154  }
155 
156 
157 
158 }
159 
160 
161 
162 
163 }
164 }
165