24 #include <basic/Tracer.hh>
25 #include <basic/MemTracer.hh>
26 #include <numeric/random/random.hh>
27 #include <numeric/random/random_permutation.hh>
29 #include <ObjexxFCL/string.functions.hh>
30 #include <utility/file/file_sys_util.hh>
33 static basic::Tracer
tr(
"protocols.iterative.HedgeArchive");
36 static numeric::random::RandomGenerator
RG(12983472);
47 : score_cut_per_batch_( 0.1 ),
56 tr.Debug <<
"batch " << batch_id <<
" has finished... incorporating into hedge archive " << std::endl;
60 for ( SilentStructs::const_iterator sit = sorted_decoys.begin(); sit != sorted_decoys.end() && ind_max>0; ++sit ) {
63 tr.Debug <<
"add decoy from batch " << batch_id << std::endl;
85 return std::string(
"pending_")+ObjexxFCL::lead_zero_string_of( batch_id , 4 );
91 std::string const backup_filename ( ffilename+
".backup" );
92 std::string const tmp_filename ( ffilename+
".tmp" );
98 for ( SilentStructs::const_iterator it = decoys.begin(); it != decoys.end(); ++it ) {
105 rename( ffilename.c_str(), backup_filename.c_str() );
107 rename( tmp_filename.c_str(), ffilename.c_str() );
113 std::string const backup_filename ( ffilename+
".backup" );
114 std::string const tmp_filename ( ffilename+
".tmp" );
115 utility::file::file_delete( ffilename );
116 utility::file::file_delete( backup_filename );
117 utility::file::file_delete( tmp_filename );
126 numeric::random::random_permutation(indices,
RG);
127 numeric::random::random_permutation(indices,
RG);
129 start_decoys.reserve( batch.
nstruct() );
130 for ( Parent::SilentStructs::const_iterator it =
decoys().begin(); it !=
decoys().end(); ++it, ++i ) {
132 start_decoys.push_back( *it );
139 os <<
"OPEN_BATCHES" << std::endl;
141 if ( !it->second.size() )
continue;
142 os << it->first << std::endl;
145 os <<
"END_BATCHES" << std::endl;
152 runtime_assert( tag ==
"OPEN_BATCHES" );
153 while ( is >> tag ) {
154 if ( tag ==
"END_BATCHES" )
break;
155 Size batch_id = ObjexxFCL::int_of( tag );
158 std::string const backup_filename ( ffilename+
".backup" );
159 std::string const tmp_filename ( ffilename+
".tmp" );
161 using namespace core::io::silent;
163 if ( !sfd.read_file( ffilename ) )
throw ( utility::excn::EXCN_BadInput(
"problem reading silent file"+ffilename ) );