Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
NonlocalFrags.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/frag_picker/nonlocal/NonlocalFrags.cc
11 /// @author David Kim (dekim@u.washington.edu)
12 
13 #ifdef BOINC
14 #include <protocols/boinc/boinc.hh>
15 #endif
16 
17 
18 // Unit headers
20 
21 // C/C++ headers
22 
23 // Package headers
24 
25 // Project headers
26 #include <core/pose/Pose.hh>
27 #include <core/pose/PDBInfo.hh>
28 #include <core/pose/util.hh>
32 #include <core/scoring/Energies.hh>
35 #include <core/scoring/rms_util.hh>
39 #include <protocols/relax/util.hh>
41 #include <protocols/jd2/util.hh>
43 #include <protocols/jd2/Job.hh>
44 #include <protocols/jd2/Job.fwd.hh>
49 
50 // Utility headers
51 #include <basic/options/option.hh>
52 #include <basic/options/keys/OptionKeys.hh>
53 #include <basic/options/keys/in.OptionKeys.gen.hh>
54 #include <basic/options/keys/out.OptionKeys.gen.hh>
55 #include <basic/options/keys/run.OptionKeys.gen.hh>
56 #include <basic/options/keys/frags.OptionKeys.gen.hh>
57 #include <basic/options/keys/relax.OptionKeys.gen.hh>
58 #include <basic/Tracer.hh>
59 #include <numeric/xyz.functions.hh>
60 #include <numeric/xyzVector.hh>
61 #include <utility/exit.hh>
62 #include <utility/file/file_sys_util.hh>
63 #include <numeric/random/random.hh>
64 
65 #include <sstream>
66 #include <fstream>
67 
68 static numeric::random::RandomGenerator RG(10420); // Magic Number
69 
70 namespace protocols {
71 namespace frag_picker {
72 namespace nonlocal {
73 
74 using namespace core;
75 
76 static basic::Tracer TR("protocols.frag_picker.nonlocal.NonlocalFrags");
77 
79  using namespace basic::options;
80  using namespace basic::options::OptionKeys;
81 
82  // input
83  option.add_relevant( in::file::s ); // PDB
84  option.add_relevant( in::file::l ); // PDB list
85  option.add_relevant( in::file::list ); // PDB list
86  option.add_relevant( frags::nonlocal::single_chain ); // pairs from same chain only
87  // relax options
88  option.add_relevant( frags::nonlocal::relax_input );
89  option.add_relevant( frags::nonlocal::relax_input_with_coordinate_constraints );
90  option.add_relevant( frags::nonlocal::relax_frags_repeats );
91  option.add_relevant( frags::contacts::min_seq_sep );
92  option.add_relevant( frags::contacts::dist_cutoffs );
93  // non-local contact definition options
94  option.add_relevant( frags::nonlocal::min_contacts_per_res );
95  option.add_relevant( frags::nonlocal::max_rmsd_after_relax );
96 
97  // output
98  option.add_relevant( frags::nonlocal::output_idealized );
99  option.add_relevant( frags::nonlocal::output_frags_pdbs );
100  // fragment sizes to output
101  option.add_relevant( frags::frag_sizes );
102 }
103 
105  single_chain_( false ),
106  relax_input_( false ),
107  relax_input_with_coordinate_constraints_( false ),
108  relax_frags_repeats_( 1 ),
109  checkpointfile_( "nonlocalfrags.checkpoint" ),
110  min_seq_sep_( 12 ),
111  ca_dist_squared_( 100.0 ),
112  min_contacts_per_res_( 1 ),
113  max_rmsd_after_relax_( 1.5 ),
114  max_ddg_score_( -4.0 ),
115  output_frags_pdbs_( false ),
116  output_idealized_( false )
117 {
118  initialize();
119 }
120 
122  using namespace basic::options;
123  using namespace basic::options::OptionKeys;
124 
125  if (!option[ in::file::s ].user() && !option[ in::file::l ].user() && !option[ in::file::list ].user()) {
126  utility_exit_with_message( "Error: in:file:s or in:file:l option required!" );
127  }
128  if (option[ frags::nonlocal::single_chain ].user()) {
129  single_chain_ = option[ frags::nonlocal::single_chain ]();
130  }
131  if (option[ frags::nonlocal::relax_input ].user()) {
132  relax_input_ = option[ frags::nonlocal::relax_input ]();
133  }
134  if (option[ frags::nonlocal::relax_input_with_coordinate_constraints ].user()) {
135  relax_input_with_coordinate_constraints_ = option[ frags::nonlocal::relax_input_with_coordinate_constraints ]();
136  }
137  if (option[ frags::nonlocal::relax_frags_repeats ].user()) {
138  relax_frags_repeats_ = option[ frags::nonlocal::relax_frags_repeats ]();
139  }
140  // non-local contact definition
141  if (option[ frags::contacts::min_seq_sep ].user()) {
142  min_seq_sep_ = option[ frags::contacts::min_seq_sep ]();
143  }
144  if (option[ frags::contacts::dist_cutoffs ].user()) {
145  utility::vector1<Real> dist_cutoffs = option[ frags::contacts::dist_cutoffs ]();
146  if (dist_cutoffs.size() != 1)
147  utility_exit_with_message( "Error: only one frags::contacts::dist_cutoffs value is allowed!" );
148  Real min_dist = dist_cutoffs[1];
149  ca_dist_squared_ = min_dist*min_dist;
150  }
151  if (option[ frags::nonlocal::min_contacts_per_res ].user()) {
152  min_contacts_per_res_ = (Size)option[ frags::nonlocal::min_contacts_per_res ]();
153  }
154  // for valid interacting pair
155  if (option[ frags::nonlocal::max_ddg_score ].user()) {
156  max_ddg_score_ = option[ frags::nonlocal::max_ddg_score ]();
157  }
158  if (option[ frags::nonlocal::max_rmsd_after_relax ].user()) {
159  max_rmsd_after_relax_ = option[ frags::nonlocal::max_rmsd_after_relax ]();
160  }
161  // fragment sizes
162  if (option[ frags::frag_sizes ].user()) {
163  frag_sizes_ = option[ frags::frag_sizes ]();
164  } else {
165  frag_sizes_.clear(); // default to no frag sizes
166  }
167  if (option[ frags::nonlocal::output_idealized ].user()) {
168  output_idealized_ = option[ frags::nonlocal::output_idealized ]();
169  }
170 
171  if (option[ frags::nonlocal::output_frags_pdbs ].user()) {
172  output_frags_pdbs_ = option[ frags::nonlocal::output_frags_pdbs ]();
173  }
174 
175  // make sure the silent file output is binary
176  option[ out::file::silent_struct_type ].value("binary");
177 
179 }
180 
182  std::map<std::string, std::string>::iterator it;
183  it=checkpoints_map_.find(tag);
184  if (it != checkpoints_map_.end()) {
185  // add recovered data to pose as a comment for output
186  if (checkpoints_map_[ tag ].size()) pose::add_comment( pose, tag, checkpoints_map_[ tag ] );
187  TR.Info << "Recovered checkpoint " << tag << std::endl;
188  return true;
189  }
190  return false;
191 }
192 
194  std::ofstream checkpoint( checkpointfile_.c_str(), std::ios_base::app );
195  if (!checkpoint.good()) {
196  TR.Debug << "Warning: cannot open checkpoint file for writing!" << std::endl;
197  return;
198  }
199  // check data
200 
201 #ifdef BOINC
202  boinc_begin_critical_section();
203 #endif
204  if (data.size()) {
205  Size pdbinfonumberj, pdbinfonumberk, contact_cnt;
206  Real sub_pose_score, relaxed_rmsd, relaxed_score, relaxed_ddg_score;
207  std::string chainj, chaink;
208  std::istringstream line_stream(data);
209  line_stream >> pdbinfonumberj >> chainj >> pdbinfonumberk >> chaink >>
210  contact_cnt >> sub_pose_score >> relaxed_rmsd >> relaxed_score >> relaxed_ddg_score;
211  if (line_stream.fail()) {
212  TR.Debug << "Warning: cannot parse checkpoint data!" << std::endl;
213  return;
214  }
215  checkpoint << tag << " " << data << std::endl;
216  checkpoints_map_[ tag ] = data;
217  } else {
218  checkpoint << tag << std::endl;
219  checkpoints_map_[ tag ] = "";
220  }
221 #ifdef BOINC
222  boinc_end_critical_section();
223 #endif
224  TR.Info << "Write checkpoint " << tag << std::endl;
225 }
226 
229  std::string line;
230  std::ifstream checkpoint( checkpointfile_.c_str() );
231  while( getline(checkpoint,line) ) {
232  Size pdbinfonumberj, pdbinfonumberk, contact_cnt;
233  Real sub_pose_score, relaxed_rmsd, relaxed_score, relaxed_ddg_score;
234  std::string tag, chainj, chaink;
235 
236  std::istringstream line_stream(line);
237  line_stream >> tag;
238  if (line_stream.eof()) {
239  checkpoints_map_[ tag ] = "";
240  } else {
241  line_stream >> pdbinfonumberj >> chainj >> pdbinfonumberk >> chaink >>
242  contact_cnt >> sub_pose_score >> relaxed_rmsd >> relaxed_score >> relaxed_ddg_score;
243  if (line_stream.fail()) utility_exit_with_message( "Error: checkpoint file parse error!" );
244  std::stringstream data;
245  data << pdbinfonumberj << " " << chainj << " " << pdbinfonumberk << " " << chaink <<
246  " " << contact_cnt << " " << sub_pose_score << " " << relaxed_rmsd << " " << relaxed_score <<
247  " " << relaxed_ddg_score;
248  checkpoints_map_[ tag ] = data.str();
249  }
250  TR.Info << "Read checkpoint " << tag << std::endl;
251  }
252  checkpoint.close();
253 }
254 
256  using namespace basic::options;
257  using namespace basic::options::OptionKeys;
258 
259  pose::Pose unmodified_pose = pose;
260  pose::Pose relaxed_pose;
261 
262  // set input pose as native
263  // Should not use in:file:native because the minirosetta app will add it to BOINC graphics and we will be using sub-poses for the fragment pairs
265  // clear the evaluators or else different input pdbs may cause a runtime error
266  // when doing rmsd evaluations
267  jd->job_outputter()->clear_evaluators();
268  jd->job_outputter()->add_evaluation( new simple_filters::RmsdEvaluator( new pose::Pose( unmodified_pose ), "" ));
269 
270  //scoring::ScoreFunctionOP scorefxn = scoring::ScoreFunctionFactory::create_score_function( scoring::STANDARD_WTS, scoring::SCORE12_PATCH );
272  Real unmodified_pose_score = (*scorefxn)( pose );
273 
275 
276 #ifdef BOINC_GRAPHICS
277  Size step_cnt = 0;
278  std::string input_tag = protocols::jd2::get_current_job()->input_tag();
279  protocols::boinc::Boinc::attach_graphics_current_pose_observer( pose );
280 #endif
281 
282  // relax input pose before picking non-local fragment pairs?
284 
285 #ifdef BOINC_GRAPHICS
286  // for some reason this is necessary to display the structures initially, i.e. the relax protocol may not
287  protocols::boinc::Boinc::update_graphics_low_energy( pose, unmodified_pose_score );
288  protocols::boinc::Boinc::update_graphics_last_accepted( pose, unmodified_pose_score );
289  protocols::boinc::Boinc::update_mc_trial_info( step_cnt++, "Relax_" + input_tag );
290 #endif
292  // a hack to turn on coordinate constraints (we don't want to use them for relaxing the fragment pairs later)
293  option[OptionKeys::relax::constrain_relax_to_start_coords].value(true);
294  }
295 
296  // a hack to checkpoint this relax
297  bool origval = option[run::delete_checkpoints]();
298  option[run::delete_checkpoints].value(false);
300  relax_protocol->set_current_tag( output_name );
301  relax_protocol->apply( pose );
302  // restore original option value
303  option[run::delete_checkpoints].value(origval);
304 
306  // turn off coordinate constraints
307  option[OptionKeys::relax::constrain_relax_to_start_coords].value(false);
308  scorefxn->set_weight(scoring::coordinate_constraint, 0.0 );
309  scorefxn->set_weight(scoring::atom_pair_constraint, 0.0 );
310  scorefxn->set_weight(scoring::angle_constraint, 0.0 );
311  scorefxn->set_weight(scoring::dihedral_constraint, 0.0 );
312  scorefxn->set_weight(scoring::res_type_constraint, 0.0);
313  }
314  // remove virtual residue
315  pose::Pose temp_pose = unmodified_pose;
316  for ( Size ii = 1; ii <= unmodified_pose.total_residue(); ++ii ) {
317  temp_pose.replace_residue( ii, pose.residue( ii ), false );
318  }
319  pose = temp_pose;
320  relaxed_pose = pose;
321  }
322 
323  // add input score comment for output
324  std::stringstream scorestr;
325  scorestr << unmodified_pose_score;
326  pose::add_comment( pose, output_name + "_input_score", scorestr.str() );
327 
328  // setup relax protocol for sub pose (frag pair)
330  kinematics::MoveMapOP mm = sub_pose_relax_protocol->get_movemap();
331  mm->set_jump(true); // set jumps movable
332 
333  // iterate each frag size
334  // note: shall this be random for BOINC?
335  Size total_residue = pose.total_residue();
336 
337 // Size frag_len = numeric::random::random_element( frag_sizes_ ); // = frag_sizes_[ i ]; // frag size
338  for ( Size i=1; i <= frag_sizes_.size(); ++i ) { // frag_sizes_ loop
339 
340  Size frag_len = frag_sizes_[ i ]; // frag size
341 
342 
343  Size total_len = frag_len*2;
344  if (total_residue >= frag_len+min_seq_sep_+frag_len) { // continue; // skip if pose is too small
345 
346  Size min_contacts = min_contacts_per_res_*frag_len; // min non-local contacts
347 
348 #ifdef BOINC_GRAPHICS
349  pose::Pose best_energy_pose;
350  Real min_relaxed_score = 100000000.0;
351 #endif
352 
353  // find non-local pairs
354  Size contact_cnt = 0;
355  bool continue_k = false;
356  for ( Size j=1; j<=total_residue-frag_len-min_seq_sep_; ++j ) {
357  for ( Size k=j+frag_len+min_seq_sep_; k<=total_residue-frag_len; ++k ) {
358  if (single_chain_ && (pose.residue(j).chain() != pose.residue(k).chain())) continue;
359 
360  // get tag for this frag pair
361  std::stringstream sstream;
362  sstream << "_" << frag_len << "_" << j << "_" << k;
363  std::string tag = sstream.str();
364 
365  // recover checkpoint
366  if (recover_checkpoint( output_name + tag, pose )) {
367 #ifdef BOINC_GRAPHICS
368  protocols::boinc::Boinc::update_mc_trial_info( step_cnt++, "NonLocalFrags_" + input_tag + tag );
369 #endif
370  continue;
371  }
372 
373  pose::PDBInfoCOP pdbinfo = pose.pdb_info();
374 
375  // j and k are starting positions for fragment pairs
376  // count CA contacts
377  contact_cnt = 0;
378  continue_k = false;
379  Size prev_chain_m, prev_chain_n;
380  Size prev_resnum_m, prev_resnum_n;
381  numeric::xyzVector< Real> prev_ca_xyz_m, prev_ca_xyz_n;
382  for ( Size m=0; m<frag_len; ++m) {
383  conformation::Residue const & rsd_m = pose.residue(j+m);
384  if (!rsd_m.has("CA") || !rsd_m.is_protein()) { continue_k = true; break; }
385  Size chain_m = rsd_m.chain();
386  Size resnum_m = pdbinfo->number(j+m);
387  numeric::xyzVector< Real> ca_xyz_m = rsd_m.xyz("CA");
388  // make sure the fragment residues are sequential in the orig PDB and from the same chain!
389  if (m>0 && (chain_m != prev_chain_m || resnum_m != prev_resnum_m+1 ||
390  ca_xyz_m.distance_squared(prev_ca_xyz_m) > 25)) { // CA-CA distance must be within 5 angstroms (i.e. no chainbreak)
391  continue_k = true; break;
392  }
393  prev_chain_m = chain_m;
394  prev_resnum_m = resnum_m;
395  prev_ca_xyz_m = ca_xyz_m;
396  for ( Size n=0; n<frag_len; ++n) {
397  conformation::Residue const & rsd_n = pose.residue(k+n);
398  Size chain_n = rsd_n.chain();
399  if (!rsd_n.has("CA") || !rsd_n.is_protein() || (single_chain_ && chain_m != chain_n)) { continue_k = true; break; }
400  Size resnum_n = pdbinfo->number(k+n);
401  numeric::xyzVector< Real> ca_xyz_n = rsd_n.xyz("CA");
402  // make sure the fragment residues are sequential in the orig PDB and from the same chain!
403  if (n>0 && (chain_n != prev_chain_n || resnum_n != prev_resnum_n+1 ||
404  ca_xyz_n.distance_squared(prev_ca_xyz_n) > 25)) { // CA-CA distance must be within 5 angstroms (i.e. no chainbreak)
405  continue_k = true; break;
406  }
407  prev_chain_n = chain_n;
408  prev_resnum_n = resnum_n;
409  prev_ca_xyz_n = ca_xyz_n;
410  if (rsd_m.xyz("CA").distance_squared(rsd_n.xyz("CA")) < ca_dist_squared_) contact_cnt++;
411  }
412  if (continue_k) break;
413  }
414 
415  if (!continue_k && contact_cnt >= min_contacts) {
416  // At this point, fragment pair has enough non-local contacts, no missing CA, and is a protein.
417 
418 #ifdef BOINC_GRAPHICS
419  protocols::boinc::Boinc::update_mc_trial_info( step_cnt++, "NonLocalFrags_" + input_tag + tag );
420 #endif
421  // Create a sub pose representing the pair
422  Size midpoint = static_cast<Size>(ceil(frag_len / 2.0));
423  kinematics::FoldTree tree(total_len);
424  int jump_id = tree.new_jump( midpoint, frag_len+midpoint, frag_len );
425  tree.set_jump_atoms(jump_id, "CA", "CA");
426  assert(tree.check_fold_tree());
427  // Create the sub pose
428  pose::Pose sub_pose;
429  utility::vector1<Size> positions;
430  for ( Size m=0; m<frag_len; ++m) positions.push_back( j+m );
431  for ( Size m=0; m<frag_len; ++m) positions.push_back( k+m );
432  pose::create_subpose( pose, positions, tree, sub_pose );
433 
434  // Detect disulfides
435  sub_pose.conformation().detect_disulfides();
436 
437  // Treat the fragments as separate chains
438  sub_pose.conformation().insert_chain_ending( frag_len );
439 
440  // RELAX non-local fragment pair
441  pose::Pose relax_sub_pose = sub_pose;
442  Real sub_pose_score = (*scorefxn)( sub_pose );
443 #ifdef BOINC_GRAPHICS
444  protocols::boinc::Boinc::attach_graphics_current_pose_observer( relax_sub_pose );
445  protocols::boinc::Boinc::update_graphics_low_energy( relax_sub_pose, sub_pose_score );
446 #endif
447  sub_pose_relax_protocol->set_current_tag( output_name + tag );
448  sub_pose_relax_protocol->apply( relax_sub_pose );
449 
450  // check relaxed pose
451  Real relaxed_rmsd = scoring::CA_rmsd( relax_sub_pose, sub_pose );
452  if (relaxed_rmsd > max_rmsd_after_relax_) {
453  write_checkpoint( output_name + tag, "" );
454  continue;
455  }
456  Real relaxed_score = (*scorefxn)( relax_sub_pose );
457 
458  // DDG of relaxed fragment pair
460  Real relaxed_ddg_score = ddg.compute( relax_sub_pose );
461  if (relaxed_ddg_score >= max_ddg_score_) { // DDG FILTER VALUE
462  write_checkpoint( output_name + tag, "" );
463  continue;
464  }
465 
466 #ifdef BOINC_GRAPHICS
467  if (relaxed_score < min_relaxed_score) {
468  min_relaxed_score = relaxed_score;
469  best_energy_pose = relax_sub_pose;
470  protocols::boinc::Boinc::update_graphics_low_energy( best_energy_pose, min_relaxed_score, protocols::boinc::Boinc::PERSIST );
471  }
472 #endif
473 
474  // add comment in pose for output, this is the main data for non-local fragment pairs
475  // make sure this data format matches the checkpoint methods
476  //seqj = sub_pose.sequence().substr(0,frag_len)
477  //seqk = sub_pose.sequence().substr(frag_len)
478  std::stringstream pair_data;
479  pair_data << pdbinfo->number(j) << " " << pdbinfo->chain(j) << " " << pdbinfo->number(k) << " " << pdbinfo->chain(k) <<
480  " " << contact_cnt << " " << sub_pose_score << " " << relaxed_rmsd << " " << relaxed_score << " " << relaxed_ddg_score;
481  pose::add_comment( pose, output_name + tag, pair_data.str() );
482  // should we also use this info?
483  // pose.pdb_info()->occupancy( seqpos, ii );
484  // pose.pdb_info()->temperature( seqpos, ii );
485 
486  // DEBUG
487  TR.Debug << output_name << tag << " " << pair_data.str() << std::endl;
488  if (output_frags_pdbs_) sub_pose.dump_pdb( output_name + tag + ".pdb" );
489 
490  write_checkpoint( output_name + tag, pair_data.str() );
491 
492 #ifdef BOINC_GRAPHICS
493  protocols::boinc::Boinc::update_graphics_last_accepted( relax_sub_pose, relaxed_score );
494 #endif
495  }
496  //else { // don't bother checkpointing at this point
497  // write_checkpoint( output_name + tag, "" );
498  //}
499  }
500  }
501 
502  } // frag_sizes_ loop
503 
504 
505  }
506 
507  if (output_idealized_) {
508 
509  pose::Pose idealize_pose = unmodified_pose;
510 
511 #ifdef BOINC_GRAPHICS
512  Real score = (*scorefxn)(idealize_pose);
513  protocols::boinc::Boinc::attach_graphics_current_pose_observer( idealize_pose );
514  protocols::boinc::Boinc::update_graphics_last_accepted( idealize_pose, score );
515  protocols::boinc::Boinc::update_graphics_low_energy( idealize_pose, score, protocols::boinc::Boinc::RESET );
516  protocols::boinc::Boinc::update_mc_trial_info( step_cnt++, "Idealize_" + input_tag );
517 #endif
518 
519  // idealize
520  TR.Info << "Idealize pose" << std::endl;
522  idealizer.fast( false );
523  idealizer.chainbreaks( true );
524  idealizer.apply( idealize_pose );
525  Real idealize_score = (*scorefxn)(idealize_pose);
526  // add input score comment for output
527  std::stringstream scorestr;
528  scorestr << idealize_score;
529  pose::add_comment( pose, output_name + "_idealize_score", scorestr.str() );
530 
531 #ifdef BOINC_GRAPHICS
532  protocols::boinc::Boinc::update_mc_trial_info( step_cnt++, "Relax_" + input_tag );
533 #endif
534 
535  // relax idealized
537  // a hack to turn on coordinate constraints (we don't want to use them for relaxing the fragment pairs later)
538  option[OptionKeys::relax::constrain_relax_to_start_coords].value(true);
539  }
540 
541  // a hack to checkpoint this relax
542  bool origval = option[run::delete_checkpoints]();
543  option[run::delete_checkpoints].value(false);
545  relax_protocol->set_current_tag( output_name + "_ideal" );
546 
547  relax_protocol->apply( idealize_pose );
548  // restore original option value
549  option[run::delete_checkpoints].value(origval);
550 
552  // turn off coordinate constraints
553  option[OptionKeys::relax::constrain_relax_to_start_coords].value(false);
554  scorefxn->set_weight(scoring::coordinate_constraint, 0.0 );
555  scorefxn->set_weight(scoring::atom_pair_constraint, 0.0 );
556  scorefxn->set_weight(scoring::angle_constraint, 0.0 );
557  scorefxn->set_weight(scoring::dihedral_constraint, 0.0 );
558  scorefxn->set_weight(scoring::res_type_constraint, 0.0);
559  }
560  // remove virtual residue
561  pose::Pose temp_pose = pose;
562  for ( Size ii = 1; ii <= unmodified_pose.total_residue(); ++ii ) {
563  temp_pose.replace_residue( ii, idealize_pose.residue( ii ), false );
564  }
565  pose = temp_pose;
566 
567  (*scorefxn)(pose);
568 
569  }
570 
571 #ifdef BOINC
572  boinc_begin_critical_section(); // for output safety
573 #endif
574 
575  // output relaxed pose?
577  // first check if it has already been done (from a preempted run)
578  // a hack since JobOutputter::affixed_numbered_name( JobCOP job ) is used to create the silent file
579  // output name and uses the out::prefix option
580  std::string origprefix = option[ out::prefix ].value();
581  option[ out::prefix ].value("relaxed_");
582  if (!jd->job_outputter()->job_has_completed( jd->current_job() ) && relaxed_pose.total_residue()) {
583  (*scorefxn)(relaxed_pose);
584  jd->job_outputter()->final_pose( jd->current_job(), relaxed_pose );
585  }
586  option[ out::prefix ].value(origprefix);
587  }
588 
589 }
590 
592  return "NonlocalFrags";
593 }
594 
596  return new NonlocalFrags(*this);
597 }
598 
600  return new NonlocalFrags();
601 }
602 
603 
604 } // namespace nonlocal
605 } // namespace frag_picker
606 } // namespace protocols