Rosetta
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
rosetta_scripts.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 apps/public/rosetta_scripts/rosetta_scripts.cc
11 /// @brief The application file for rosetta_scripts, aka jd2_scripting or the parser
12 /// @author Sarel Fleishman (sarelf@u.washington.edu)
13 
14 // Project Headers
15 #include <protocols/jd2/JobDistributor.hh>
16 #include <protocols/jd2/MPIWorkPoolJobDistributor.hh>
17 #include <protocols/jd2/MPIFileBufJobDistributor.hh>
18 #include <protocols/jd2/BOINCJobDistributor.hh>
19 #include <protocols/viewer/viewers.hh>
20 #include <core/types.hh>
21 #include <protocols/abinitio/ClassicAbinitio.hh>
22 
23 
24 #include <devel/init.hh>
25 #include <basic/options/option.hh>
26 
27 // Utility Headers
28 
29 // Unit Headers
30 #include <protocols/moves/Mover.fwd.hh>
31 
32 #include <basic/options/keys/parser.OptionKeys.gen.hh>
33 #include <basic/options/keys/jd2.OptionKeys.gen.hh>
34 
35 #include <utility/vector1.hh>
37 #include <basic/Tracer.hh>
38 
39 // C++ headers
40 
41 void* my_main( void *);
42 
43 void*
44 my_main( void *)
45 {
46  protocols::moves::MoverOP mover;//note that this is not instantiated and will crash if the job distributor actually tries to use it. That means that this can only be used with parser=true
47  protocols::jd2::JobDistributor::get_instance()->go(mover);
48  return 0 ;
49 }
50 
51 /// @details dock_design_scripting provides an xml-based scripting capability
52 /// to run rosetta movers and filters defined in a text file provided by the
53 /// user. A full documentation of dock_design_scripting is available at:
54 /// manual_doxygen/applications/app_dock_design.dox
55 int
56 main( int argc, char * argv [] )
57 {
58  try{
60  // setup random numbers and options
61  devel::init(argc, argv);
62  using namespace basic::options;
63  using namespace basic::options::OptionKeys;
64 
65  bool const view( option[ parser::view ] );
66  protocols::moves::MoverOP mover;//note that this is not instantiated and will crash if the job distributor actually tries to use it.
67  //That means that this can only be used with parser=true
68  option[ jd2::dd_parser ].value( true ); // So here we fix that. jd2_parser app makes no sense without this option=true
69  if ( !option[ jd2::ntrials ].user() ) {
70  // when using rosteta_scripts we want ntrials to be set to 1 if the user forgot to specify. o/w infinite loops might
71  // occur. We don't want ntrials to be set as default to 1, b/c other protocols might want it to behave differently
72  option[ jd2::ntrials ].value( 1 );
73  }
74 
75  if ( view ) {
76  protocols::viewer::viewer_main( my_main );
77  } else {
78 #ifdef BOINC
79  protocols::jd2::BOINCJobDistributor::get_instance()->go( mover );
80 #else
81 #ifdef USEMPI
82  protocols::jd2::MPIFileBufJobDistributor::get_instance()->go( mover );
83 #else
84  protocols::jd2::JobDistributor::get_instance()->go( mover );
85 #endif
86 #endif
87  }
88  } catch( utility::excn::EXCN_Base& excn ) {
89  basic::Error()
90  << "ERROR: Exception caught by rosetta_scripts application:"
91  << excn << std::endl;
92  std::exit( 1 );
93  }
94 }
95 
int main(int argc, char *argv[])
void register_options()
void init(int argc, char *argv[])
Command line init() version.
Definition: init.cc:23
BooleanOptionKey const user("options:user")
Definition: OptionKeys.hh:40
void * my_main(void *)
Tracer & Error(TracerPriority priority=t_error)
Predefined Error tracer.
Definition: Tracer.hh:395
Tracer IO system.
rule< Scanner, options_closure::context_t > options
Definition: Tag.cc:377
utility::options::OptionCollection option
OptionCollection global.
Definition: option.cc:45
BooleanOptionKey const exit("options:exit")
Definition: OptionKeys.hh:51
vector1: std::vector with 1-based indexing
base class for Exception system
Program options global and initialization function.