32 #include <basic/options/option.hh>
68 #include <numeric/random/random.hh>
70 #include <basic/Tracer.hh>
71 #include <basic/prof.hh>
74 #include <utility/string_util.hh>
75 #include <utility/sort_predicates.hh>
76 #include <utility/file/file_sys_util.hh>
79 #include <numeric/statistics.functions.hh>
86 #include <basic/options/keys/loops.OptionKeys.gen.hh>
87 #include <basic/options/keys/backrub.OptionKeys.gen.hh>
88 #include <basic/options/keys/enzdes.OptionKeys.gen.hh>
89 #include <basic/options/keys/packing.OptionKeys.gen.hh>
90 #include <basic/options/keys/in.OptionKeys.gen.hh>
97 #include <utility/vector0.hh>
98 #include <utility/vector1.hh>
104 static basic::Tracer
tr(
"protocols.enzdes.EnzdesFlexBBProtocol");
110 enz_loops_file_(NULL),
111 mc_kt_low_(basic::options::option[basic::options::OptionKeys::enzdes::mc_kt_low] ),
112 mc_kt_high_(basic::options::option[basic::options::OptionKeys::enzdes::mc_kt_high] ),
113 brub_min_atoms_( basic::options::option[basic::options::OptionKeys::backrub::min_atoms] ),
114 brub_max_atoms_( basic::options::option[basic::options::OptionKeys::backrub::max_atoms] ),
115 loop_ensemble_size_( basic::options::option[basic::options::OptionKeys::enzdes::single_loop_ensemble_size]),
116 loopgen_trials_( basic::options::option[basic::options::OptionKeys::enzdes::loop_generator_trials] )
138 if ( ! basic::options::option[ basic::options::OptionKeys::enzdes::kic_loop_sampling ] ) {
161 using namespace basic::options;
162 using namespace basic::options::OptionKeys;
163 using namespace protocols::moves;
164 using namespace core::pack::task;
177 if( ! basic::options::option[basic::options::OptionKeys::in::file::native].user() ){
180 (*scorefxn_)( *natpose );
189 if( basic::options::option[basic::options::OptionKeys::enzdes::cstfile].user() ){
197 tr.Info <<
"Done setting up the task and constraints... " << std::endl;
199 (*scorefxn_)( pose );
202 if(basic::options::option[basic::options::OptionKeys::enzdes::cst_opt]){
204 tr.Info <<
"starting cst_opt minimization..." << std::endl;
206 (*scorefxn_)( pose );
207 tr.Info <<
"done cst_opt minimization." << std::endl;
211 if(basic::options::option[basic::options::OptionKeys::enzdes::cst_design]){
225 if( design_pack_task_template->pack_residue(i) && !pose.
residue( i ).
is_ligand() ) {
226 all_pack_positions.push_back( i );
251 if( basic::options::option[basic::options::OptionKeys::enzdes::enz_debug])
break;
256 if ( basic::options::option[ basic::options::OptionKeys::enzdes::dump_loop_samples ]() !=
"no"){
260 loops_pdb = fname.base() +
"_flex_loops.pdb";
265 if ( basic::options::option[ basic::options::OptionKeys::enzdes::dump_loop_samples ]() ==
"quit_afterwards" ) {
266 utility_exit_with_message(
"Exiting as requested by option enzdes::dump_loop_samples" );
279 if( basic::options::option[basic::options::OptionKeys::packing::soft_rep_design] ) flexpack_sfxn =
soft_scorefxn_;
283 time_t flex_start_time = time( NULL );
284 flex_packer->apply( pose );
285 time_t flex_end_time = time( NULL );
287 tr <<
" flexpacker took " << long( flex_end_time - flex_start_time ) <<
" seconds. " << std::endl;
289 if( option[OptionKeys::enzdes::cst_min] )
cst_minimize( pose, flex_pack_task );
292 if( option[OptionKeys::enzdes::design_min_cycles] > 1 ){
294 core::Size fixbb_cycles = option[OptionKeys::enzdes::design_min_cycles] - 1;
295 tr <<
"Doing " << fixbb_cycles <<
" rounds of fixbb design/min after flexpacking... " << std::endl;
299 enzdes_pack( pose, fix_pack_task,
scorefxn_, fixbb_cycles, basic::options::option[basic::options::OptionKeys::enzdes::cst_min],
false, option[ OptionKeys::enzdes::favor_native_res].user() );
305 if( ! basic::options::option[basic::options::OptionKeys::enzdes::no_unconstrained_repack]){
307 enzdes_pack( pose, repack_task,
scorefxn_, basic::options::option[basic::options::OptionKeys::enzdes::cst_min].user(), 1,
true,
false );
317 return "EnzdesFlexBBProtocol";
324 using namespace basic::options;
326 option.add_relevant( OptionKeys::enzdes::dump_loop_samples );
327 option.add_relevant( OptionKeys::loops::loop_file );
328 option.add_relevant( OptionKeys::enzdes::enz_loops_file );
329 option.add_relevant( OptionKeys::enzdes::cst_predock );
330 option.add_relevant( OptionKeys::enzdes::kic_loop_sampling);
331 option.add_relevant( OptionKeys::enzdes::mc_kt_low);
332 option.add_relevant( OptionKeys::enzdes::mc_kt_high);
333 option.add_relevant( OptionKeys::enzdes::single_loop_ensemble_size);
334 option.add_relevant( OptionKeys::enzdes::loop_generator_trials );
336 option.add_relevant( OptionKeys::enzdes::no_catres_min_in_loopgen );
337 option.add_relevant( OptionKeys::enzdes::min_cacb_deviation );
338 option.add_relevant( OptionKeys::enzdes::max_bb_deviation_from_startstruct );
339 option.add_relevant( OptionKeys::enzdes::max_bb_deviation );
340 option.add_relevant( OptionKeys::enzdes::checkpoint );
384 it != current_node->const_edge_list_end(); ++it ) {
385 Size pos = (*it)->get_other_ind(i);
387 residue_positions[ pos ] =
true;
400 using namespace core::pack::task;
402 tr <<
"Modifiyng task according to flexible regions. The following residues are additionally set to designing: ";
404 PackerTaskOP mod_task = TaskFactory::create_packer_task( pose );
405 mod_task->initialize_from_command_line();
414 mod_task->nonconst_residue_task( i ).append_rotamer_operation( *rot_it );
417 mod_task->nonconst_residue_task( i ).append_rotamerset_operation( *rotset_it );
422 if( !basic::options::option[basic::options::OptionKeys::enzdes::fix_catalytic_aa] ) mod_task->nonconst_residue_task(i).restrict_to_repacking();
424 else mod_task->nonconst_residue_task(i).prevent_repacking();
430 mod_task->nonconst_residue_task(i).restrict_to_repacking();
434 mod_task->nonconst_residue_task(i).restrict_to_repacking();
438 mod_task->nonconst_residue_task(i).restrict_to_repacking();
443 mod_task->nonconst_residue_task( i ).prevent_repacking() ;
449 if( mod_task->design_residue(i) ) {
455 mod_task->nonconst_residue_task( i ).restrict_to_repacking();
467 keep_aas[ (*res_it)->aa() ] =
true;
472 mod_task->nonconst_residue_task(i).restrict_absent_canonical_aas( keep_aas );
477 mod_task->nonconst_residue_task(i).restrict_absent_canonical_aas( all_aas );
489 mod_task->set_IGEdgeReweights()->add_reweighter( *it );
505 if( !
flex_regions_[regcount]->
remap_resid( pose, smap ) ) utility_exit_with_message(
"Failed to remap resid for flexible region");
519 tr <<
"Determining regions to be treated as flexible... " << std::endl;
523 else if( !
enz_loops_file_ && basic::options::option[ basic::options::OptionKeys::enzdes::enz_loops_file ].user() ){
527 if( !loops_file->read_loops_file( basic::options::option[ basic::options::OptionKeys::enzdes::enz_loops_file ] ) ){
528 utility_exit_with_message(
"Reading enzdes loops file failed");
542 runtime_assert( segob->segments().size() ==
enz_loops_file_->num_loops() );
550 lstart = segob->segments()[i].first;
551 lstop = segob->segments()[i].second - 1;
576 tr <<
" " << lstart <<
"-" << lstop;
582 flex_regions_[i]->declare_remodelable( min_length, max_length );
583 tr <<
" (remodelable with min_length " << min_length <<
" and max_length " << max_length <<
")";
590 else if( basic::options::option[basic::options::OptionKeys::loops::loop_file].user() ){
595 tr <<
"reading information from loops file " << loops_helper.
loop_file_name() <<
": loops are " ;
600 core::Size lstart( lit->start() ), lstop( lit->stop() );
602 tr <<
" " << lstart <<
"-" << lstop;
604 if( lit->is_extended() ){
608 flex_regions_[no_flex_regions]->declare_remodelable( min_length, max_length );
610 tr <<
" (remodelable with min_length " << min_length <<
" and max_length " << max_length <<
")";
633 if( (flex_res[lower] && (lower != i ) ) && (flex_res[upper] && (upper != i ) ) ) utility_exit_with_message(
"Somehow a non polymer residue got into the middle of a flexible region.");
649 tr <<
"found " << i <<
"-" << j - 1 <<
", ";
656 tr <<
flex_regions_.size() <<
" flexible regions in total." << std::endl;
668 time_t start_time = time(NULL);
670 tr <<
"Starting to generate ensemble for region " << region <<
" ( aiming for " <<
loop_ensemble_size_ <<
" members, " <<
loopgen_trials_ <<
" brub trials for each ) ... " << std::endl;
673 if ( ! basic::options::option[ basic::options::OptionKeys::enzdes::kic_loop_sampling ] ) {
681 minimize_cats_ = !( basic::options::option[basic::options::OptionKeys::enzdes::no_catres_min_in_loopgen].user()) &&
flex_regions_[region]->contains_catalytic_res();
689 Size const region_middle( (region_size + 1) / 2 );
706 using namespace core::kinematics;
709 ft_temp.
new_jump( rbegin, rend+3, rend+2 );
718 if ( basic::options::option[ basic::options::OptionKeys::enzdes::kic_loop_sampling ] ) {
721 bump_filter->set_positions(
flex_regions_[region]->positions() );
723 bump_filter->set_cutoff( bump_filter->get_score( pose ) + region_size * 0.2 );
735 perturber->set_degree_vicinity( sample_vicinity );
736 perturber->set_max_sample_iterations( 100 );
750 perturber->set_degree_vicinity( sample_vicinity );
751 perturber->set_max_sample_iterations( 100 );
768 time_t end_time = time(NULL);
770 tr <<
" done generating ensemble for region " << region <<
" in " << long(end_time - start_time ) <<
" seconds. " << std::endl;
780 std::set< core::Size >
const & chi_to_move,
781 bool const including_CA_angles,
785 return flex_regions_[region]->minimize_region( pose, scorefxn, chi_to_move, including_CA_angles, min_tolerance );
794 using namespace core;
795 using namespace core::fragment;
796 using namespace core::chemical;
798 flex_regions_[region]->set_target_proximity_to_starting_conformation(
799 std::min( 0.2, basic::options::option[basic::options::OptionKeys::enzdes::max_bb_deviation_from_startstruct] / 2) );
801 std::list< std::pair< Real, FragDataOP > > scored_confs;
828 native_loop_pose->prepend_polymer_residue_before_seqpos( pose.
residue(
flex_regions_[region]->start() - 1) , 1,
false );
830 loop_poses.push_back( native_loop_pose );
839 static Size count_output = 1;
849 mc.
reset( local_pose );
853 kinmover_successes = 0;
855 for (
core::Size kinits = 1; kinits <= kintrials; ++kinits ){
870 core::Size p1( numeric::random::random_range( rbegin, rend - 3) );
871 core::Size p2( numeric::random::random_range( p1+1, rend - 1) );
872 core::Size p3( numeric::random::random_range( p2+1, rend) ) ;
884 kinmover_successes++;
896 FragDataOP newfrag = example_fragment->clone();
900 scored_confs.push_back( std::make_pair( score, newfrag ) );
902 mc_temp = mc_temp - mc_decrement;
911 if( kinmover_successes > 0 ){
958 if(
flex_regions_[region]->
apply( numeric::random::random_range( 1,
flex_regions_[region]->nr_frags() ), pose ) !=
flex_regions_[region]->length() ) utility_exit_with_message(
"unknown error when trying to apply a random fragment during ensemble generation.");
964 scored_confs.sort( utility::SortFirst< Real, FragDataOP >() );
969 Size const count_limit( basic::options::option[basic::options::OptionKeys::enzdes::max_bb_deviation ].user() ? 4: 2 );
972 tr <<
"Not enough fragments after monte carlo (" <<
flex_regions_[region]->nr_frags() <<
" so far) , going through all stored configurations to find more." << std::endl;
979 flex_regions_[region]->scale_target_proximity_to_other_conformations( 3 );
980 flex_regions_[region]->set_target_proximity_to_starting_conformation(
981 basic::options::option[basic::options::OptionKeys::enzdes::max_bb_deviation_from_startstruct]);
986 flex_regions_[region]->scale_target_proximity_to_starting_conformation( 1.5 );
991 flex_regions_[region]->scale_target_proximity_to_other_conformations( 2 );
994 for ( std::list< std::pair< Real, FragDataOP > >::iterator list_it = scored_confs.begin(),
995 list_end = scored_confs.end(); list_it != list_end; ) {
999 if (
flex_regions_[region]->examine_new_loopconf( local_pose, loop_template_pose, loop_poses, rmsd_to_native ) ){
1000 list_it = scored_confs.erase( list_it );
1008 core::Real av_rmsd = numeric::statistics::mean( rmsd_to_native.begin(), rmsd_to_native.end(), 0.0 );
1009 core::Real std_dev_rmsd = numeric::statistics::std_dev_with_provided_mean( rmsd_to_native.begin(), rmsd_to_native.end(), av_rmsd );
1011 tr <<
" done generating ensemble for region " << region <<
". " <<
flex_regions_[region]->nr_frags() - 1 <<
" new unique fragments were generated. Average rmsd/stdev to native is " << av_rmsd <<
" +- " << std_dev_rmsd <<
". Kinematic Mover had a success rate of " << kinmover_successrate << std::endl;
1035 native_loop_pose->prepend_polymer_residue_before_seqpos( pose.
residue(
flex_regions_[region]->start() - 1) , 1,
false );
1040 loop_poses.push_back( native_loop_pose );
1061 PROF_START( basic::BACKRUB_MOVER );
1063 PROF_STOP( basic::BACKRUB_MOVER );
1085 PROF_START( basic::MC_ACCEPT );
1086 mc_temp = mc_temp - mc_decrement;
1089 PROF_STOP( basic::MC_ACCEPT );
1113 if(
flex_regions_[region]->
apply( numeric::random::random_range( 1,
flex_regions_[region]->nr_frags() ), pose ) !=
flex_regions_[region]->length() ) utility_exit_with_message(
"unknown error when trying to apply a random fragment during ensemble generation.");
1127 if(
flex_regions_[region]->
apply( 1, pose ) !=
flex_regions_[region]->length() ) utility_exit_with_message(
"unknown error when trying to reapply native fragment after generating ensemble.");
1130 core::Real av_rmsd = numeric::statistics::mean( rmsd_to_native.begin(), rmsd_to_native.end(), 0.0 );
1131 core::Real std_dev_rmsd = numeric::statistics::std_dev_with_provided_mean( rmsd_to_native.begin(), rmsd_to_native.end(), av_rmsd );
1133 tr <<
flex_regions_[region]->nr_frags() - 1 <<
" new unique fragments were generated. Average rmsd/stdev to native is " << av_rmsd <<
" +- " << std_dev_rmsd <<
"." << std::endl;
1177 if( best_region == 0 ) utility_exit_with_message(
"Trying to assemble a new combination of loops even though all combinations have alrady been assembled.");
1179 tr <<
"Assembling next best loop conformation: fragment " <<
fragment_counters_[best_region] <<
" of region " << best_region <<
" with deltaE_best " << lowest_deltaE <<
"put into pose." << std::endl;
1205 bool all_regions_at_end(
true);
1210 first_region_at_end = j;
1211 if( last_region_at_end == 0 ) last_region_at_end = j;
1213 else all_regions_at_end =
false;
1217 if( first_region_at_end == 0 ){
1224 if( all_regions_at_end )
return false;
1262 using namespace basic::options;
1273 std::string loops_pdb = option[OptionKeys::enzdes::checkpoint];
1275 if( loops_pdb ==
"" ){
1277 loops_pdb = pose.
pdb_info()->name();
1280 loops_pdb = fname.base() +
"_flex_loops.pdb";
1283 if( option[OptionKeys::enzdes::checkpoint].user() ){
1287 tr <<
"Recovering loop conformations from file " << loops_pdb <<
"... " << std::endl;
1289 tr <<
" done recovering loop conformations." << std::endl;
1294 utility_exit_with_message(
"Unknown error when trying to recover loop conformations from file "+loops_pdb+
".");
1326 tr <<
"Allowing minimization of the following catalytic residues during ensemble generation for region " << region <<
": ";
1330 tr << rescount <<
", ";
1347 core::fragment::
Frame( start, end, nr_res ),
1349 enzdes_protocol_( enz_prot ),
1351 target_proximity_to_native_conformation_(
1352 basic::options::option[basic::options::OptionKeys::enzdes::max_bb_deviation_from_startstruct] ),
1353 target_proximity_to_other_conformations_(
1354 basic::options::option[basic::options::OptionKeys::enzdes::max_bb_deviation].user() ?
1355 basic::options::option[basic::options::OptionKeys::enzdes::max_bb_deviation] :
1357 remodelable_(false),
1358 remodel_min_length_(nr_res),
1359 remodel_max_length_(nr_res)
1365 if( addfrag_returnval != 1 ) utility_exit_with_message(
"Could not add the native conformation to the EnzdesFlexibleRegion, returnval is "+utility::to_string( addfrag_returnval ) +
".");
1380 for( std::set< core::Size >::const_iterator cat_it =
design_targets_.begin();
1393 utility_exit_with_message(
"no enzdes loops file was read, but the info therein requested." );
1396 assert( index_ <= loop_file->num_loops() );
1398 return loop_file->loop_info(
index_ );
1418 if( frag_rank >
frag_designabilities_.size() ) utility_exit_with_message(
"Trying to add a fragment that is not ranked.");
1430 using namespace core::fragment;
1452 std::pair<std::vector<core::Size>,
core::Real> newpair;
1461 angles.push_back( newpair );
1468 new_fragdata->add_residue( srfd );
1472 if( ! new_fragdata->steal( pose, this->start(), this->
end() ) ) utility_exit_with_message(
"Some error occured when trying to steal enzdes_fragdata from the pose. fuckin' A ... ");
1474 return new_fragdata;
1500 using namespace core::pack;
1501 using namespace core::pack::task;
1505 (*scorefxn)( pose );
1518 for(
core::Size i = 1; i <= pose.total_residue(); ++i ){
1520 if( looptask_template->design_residue( i )
1524 looptask_template->nonconst_residue_task(i).prevent_repacking();
1525 other_design_res.push_back( i );
1528 else if( looptask_template->pack_residue(i)
1532 looptask_template->nonconst_residue_task(i).prevent_repacking();
1536 utility_exit_with_message(
"Task is corrupted when trying to screen ensemble for region "+utility::to_string(
index_));
1544 looptask_template->set_IGEdgeReweights()->add_reweighter( ig_up );
1546 tr <<
"Beginning designability screen for " << this->
nr_frags() <<
" ensemble members of flexible region " <<
index_ <<
"... " << std::endl;
1547 time_t start_time = time(NULL);
1552 pose.update_residue_neighbors();
1554 scorefxn->setup_for_packing( pose, looptask->repacking_residues(), looptask->designing_residues() );
1560 (*scorefxn)( pose );
1565 native_lig_part_sum_compare.push_back( native_designability );
1567 lig_part_sums.push_back( native_lig_part_sum_compare );
1569 std::list< SizeRealPair > frag_designability_list;
1574 if( this->
apply( i, pose ) != this->
length() ) utility_exit_with_message(
"unknown error when trying to apply a fragment for generating designability score.");
1576 pose.update_residue_neighbors();
1578 scorefxn->setup_for_packing( pose, looptask->repacking_residues(), looptask->designing_residues() );
1586 (*scorefxn)( pose );
1591 lig_part_sum_compare.push_back( designability );
1593 if( (designability < native_designability) && (backgroundE < native_backgroundE) ) {
1594 frag_designability_list.push_back(
SizeRealPair( i, designability ) );
1598 lig_part_sums.push_back( lig_part_sum_compare );
1603 for( std::list< SizeRealPair >::const_iterator it = frag_designability_list.begin(); it != frag_designability_list.end(); ++it)
frag_designabilities_.push_back( *it );
1605 time_t end_time = time(NULL);
1606 tr <<
"done with designability screen for region " <<
index_ <<
" in " << (long)(end_time - start_time ) <<
" seconds, " <<
frag_designabilities_.size() <<
" of " << this->
nr_frags() <<
" ensemble conformations are potentially better than the native conformation." << std::endl;
1616 if( this->
apply( 1, pose ) != this->
length() ) utility_exit_with_message(
"unknown error when trying to reapply the native conformation after getting designability scores for fragments.");
1621 lig_part_sum_it != lig_part_sums.end(); ++lig_part_sum_it ){
1623 tr <<
"LIGPARTCOMPARE ";
1625 tr << *comp_it <<
" ";
1649 rotsets->set_task( task );
1651 rotsets->build_rotamers( pose, *scorefxn, packer_neighbor_graph );
1653 rotsets->prepare_sets_for_packing( pose, *scorefxn );
1658 ig->initialize( *rotsets );
1660 rotsets->compute_one_body_energies( pose, *scorefxn, packer_neighbor_graph, ig );
1666 residue_groups[ *cat_it ] = 2;
1669 else residue_groups[ *cat_it ] = 1;
1674 rotsets->precompute_two_body_energies( pose, *scorefxn, packer_neighbor_graph, ig );
1678 core::Size moltenid = rotsets->resid_2_moltenres( *pos_it);
1683 for( ig->reset_edge_list_iterator_for_node( moltenid ); !ig->edge_list_iterator_at_end(); ig->increment_edge_list_iterator() ){
1690 core::Size lower_res = std::min( moltenid, targ_moltenid );
1691 core::Size upper_res = std::max( moltenid, targ_moltenid );
1693 for(
int ii = 1; ii <= ig->get_num_states_for_node( lower_res ); ++ii){
1695 core::Real pos_1body_E = ig->get_one_body_energy_for_node_state( lower_res, ii );
1696 if( pos_1body_E < 0.0 ) pos_1body_E = 0.0;
1698 for(
int jj = 1; jj <= ig->get_num_states_for_node( upper_res ); ++jj){
1702 dtps_this_position += exp(- boltzmann_fac * E_this_state );
1712 dtps += dtps_this_position;
1731 using namespace core::scoring;
1735 core::Real per_res_design_target_interactionE(0);
1745 core::Size other_res = (*egraph_it)->get_other_ind( *targ_it );
1750 per_res_design_target_interactionE += Eedge->
dot( cur_weights );
1758 std::set< Size > interacting_neighbors;
1765 core::Size other_res = (*egraph_it)->get_other_ind( i );
1766 if( task->design_residue( other_res )
1771 && ( interacting_neighbors.find( other_res) == interacting_neighbors.end() ) ) interacting_neighbors.insert( other_res );
1775 av_background_interactionE += Eedge->
dot( cur_weights );
1780 av_background_interactionE /= ( interacting_neighbors.size() + this->
length() );
1782 backgroundE = av_background_interactionE;
1784 return per_res_design_target_interactionE;
1795 if( frag_rank >
frag_designabilities_.size() ) utility_exit_with_message(
"Trying to access a fragment that is not ranked.");
1830 runtime_assert( compare_poses.size() > 0 );
1834 if( !newfrag->steal( pose, *
this ) ) utility_exit_with_message(
"unknown error when trying to steal fragment from pose for examination.");
1836 if( !newfrag->is_valid() ) utility_exit_with_message(
"unknown error when trying to steal fragment from pose for examination. fragment not valid");
1838 newfrag->apply( template_pose, 2, this->
length() );
1864 if( !frag_close_to_native )
return false;
1867 bool frag_unique(
true);
1876 frag_unique =
false;
1882 bool frag_close_to_another_fragment(
true );
1883 if ( basic::options::option[basic::options::OptionKeys::enzdes::max_bb_deviation ].user() )
1888 for (
Size ii = 2; ii <= compare_poses.size(); ++ii ) {
1891 if ( ii_super < smallest_max_dist ) {
1892 smallest_max_dist = ii_super;
1902 if ( frag_unique && frag_close_to_native && frag_close_to_another_fragment ){
1962 std::set< core::Size >
const & chi_to_move,
1963 bool const including_CA_angles,
1987 bool backward_into_seg(
false), backward_outof_seg(
false);
1993 bool is_jump( e->is_jump() ), backward( e->start() > e->stop() ), start_in_seg( e->start() >= (
int)this->
start() && e->start() <= (
int)this->
end() ), stop_in_seg( e->stop() >= (
int)this->
start() && e->stop() <= (
int)this->
end() );
1994 bool span( backward ? ( (e->start() > (
int)this->
end()) && (e->stop() < (
int)this->
start()) ) : ( (e->start() < (
int)this->
start()) && (e->stop() > (
int)this->
end()) ) );
1998 if( start_in_seg && stop_in_seg ){
1999 if( is_jump ) old_njump--;
2003 if( is_jump && start_in_seg ) jump_destinations.push_back( std::pair<core::Size, int>(e->stop(), e->label()) );
2004 else if( is_jump && stop_in_seg ) jump_origins.push_back( std::pair< core::Size, int>(e->start(), e->label() ) );
2005 else if( !is_jump && start_in_seg ){
2007 temp_fold_tree.
add_edge( this->
start(), e->stop(), e->label() );
2008 backward_outof_seg =
true;
2010 else temp_fold_tree.
add_edge( this->
end() + 1, e->stop(), e->label() );
2012 else if( !is_jump && stop_in_seg ){
2014 temp_fold_tree.
add_edge( e->start(), this->
end() + 1, e->label() );
2015 backward_into_seg =
true;
2017 else temp_fold_tree.
add_edge( e->start(), this->
start(), e->label() );
2019 else if (!is_jump && span ){
2022 temp_fold_tree.
add_edge( e->start(), this->
end() + 1, e->label() );
2023 temp_fold_tree.
add_edge( this->
start(), e->stop(), e->label() );
2024 backward_outof_seg =
true;
2025 backward_into_seg =
true;
2029 temp_fold_tree.
add_edge( e->start(), this->
start(), e->label() );
2030 temp_fold_tree.
add_edge( this->
end() + 1, e->stop(), e->label() );
2040 if( backward_into_seg && backward_outof_seg ){
2041 jump_focus = this->
end() + 1;
2049 for(
utility::vector1< std::pair<core::Size, int> >::const_iterator jump_o_it = jump_origins.begin(); jump_o_it != jump_origins.end(); ++jump_o_it ) temp_fold_tree.
add_edge(
core::kinematics::Edge(jump_o_it->first, jump_focus, jump_o_it->second ,
"CA",
"CA",
false ) );
2051 for(
utility::vector1< std::pair< core::Size,int> >::const_iterator jump_d_it = jump_destinations.begin(); jump_d_it != jump_destinations.end(); ++jump_d_it ) temp_fold_tree.
add_edge(
core::kinematics::Edge( jump_focus, jump_d_it->first, jump_d_it->second ,
"CA",
"CA",
false ) );
2058 utility_exit_with_message(
"Invalid fold tree after trying to set up for flexbb ca angle min");
2074 movemap->set_chi( i,
true );
2075 movemap->set_bb( i,
true );
2077 if( including_CA_angles ){
2080 movemap->set( ca_dof,
true );
2085 for( std::set< core::Size >::const_iterator chi_it = chi_to_move.begin(); chi_it != chi_to_move.end(); ++chi_it ){
2086 movemap->set_chi( *chi_it,
true );
2092 (*min_scorefxn)(pose);
2094 dfpMinTightTol->apply(pose);
2106 if( cbE_end > ( cbE_start + 0.1) ){
2107 tr <<
"FlexRegion minimization failed: cbE_start " << cbE_start <<
", cbE_end " << cbE_end <<
"." << std::endl;
2111 if( totE_end > totE_start ){
2112 tr <<
"FlexRegion minimization failed: totE_start " << totE_start <<
", totE_end " << totE_end <<
"." << std::endl;
2117 if( !this->
steal( pose ) ) utility_exit_with_message(
"Unknown error when trying to save fragdata after minimizing region.");
2118 runtime_assert( this->
nr_frags() == 1 );
2129 using namespace core::scoring;
2147 core::Size newlength( newend - newstart + 1 );
2150 if( newlength == this->
length() ){
2164 if( (newstart == 0) || (newend == 0 ) || !
is_continuous() )
return false;
2193 core::Size other_res = (*graph_it)->get_other_ind( i );
2212 using namespace flexpack::rotamer_set;
2216 std::cerr <<
"FlexbbRotamerSet test: done initialising set." << std::endl;
2218 flexset->set_frames( pose, flex_regions_ );
2220 std::cerr <<
"FlexbbRotamerSet test: done setting frames." << std::endl;
2224 std::cerr <<
"FlexbbRotamerSet test: done setting up flexpack neighbor graph." << std::endl;
2226 flexset->build_rotamers( pose, *scorefxn_, *flex_graph );
2228 std::cerr <<
"FlexbbRotamerSet test: done building rotamers." << std::endl;
2230 flexset->dump_pdbs( pose,
"flextest" );