47 #include <basic/Tracer.hh>
53 #include <ObjexxFCL/string.functions.hh>
54 #include <ObjexxFCL/FArray1D.hh>
56 #include <utility/exit.hh>
62 #include <utility/vector1.hh>
76 static basic::Tracer
TR(
"protocols.swa.stepwise_residue_sampler" ) ;
87 job_parameters_( job_parameters ),
88 moving_residues_( job_parameters_->working_moving_res_list() ),
91 centroid_scorefxn_( core::scoring::
ScoreFunctionFactory::create_score_function(
"score3.wts" ) ),
93 filter_native_big_bins_( false ),
94 centroid_screen_( false ),
95 centroid_score_ref_( 999999999999999.99),
96 centroid_score_diff_cut_( 20.0 ),
97 apply_vdw_cut_( false ),
98 centroid_vdw_ref_( 9999999999999999.999 ),
99 nstruct_centroid_( 0 ),
100 ghost_loops_( false ),
101 is_pre_proline_( job_parameters_->is_pre_proline() )
113 return "StepWiseProteinScreener";
126 clock_t
const time_start( clock() );
138 std::cout <<
"Total time in StepWiseProteinScreener: " <<
139 static_cast<Real>(clock() - time_start) / CLOCKS_PER_SEC << std::endl;
165 using namespace core::id;
169 for ( ResMap::const_iterator it=ghost_map.begin(); it != ghost_map.end(); it++ ) {
170 Size const & res( it->first );
171 Size const & template_res( it->second );
177 std::cout <<
"PROBLEM! " << res <<
" " << pose.
residue( res ).
atom_name( j ) <<
" != " <<
178 template_res <<
" " << template_pose.
residue( template_res ).
atom_name( j ) << std::endl;
179 utility_exit_with_message(
"mismatch in ghost pose" );
195 Size prev_res( 0 ), total_res( 0 );
198 for ( ResMap::const_iterator it=ghost_map.begin(); it != ghost_map.end(); it++ ) {
199 Size const & res( it->first );
200 Size const & template_res( it->second );
202 std::cout <<
"MAPPING " << res <<
" --> " << template_res << std::endl;
204 if ( (template_res-1) != prev_res ) cutpoints.push_back( res-1 );
205 prev_res = template_res;
212 for (
Size n = 1; n <= cutpoints.size(); n++ ) {
213 std::cout <<
"Adding jump across: " << cutpoints[ n ] << std::endl;
214 f.
new_jump( cutpoints[ n ], cutpoints[ n ] +1, cutpoints[ n ] );
225 Size const which_res,
230 using namespace core::chemical;
231 using namespace core::scoring;
240 for (
Size k = 1; k <= main_chain_torsion_set_list.size(); k++ ) {
244 pose.
set_phi( n, main_chain_torsion_set.
phi() );
245 pose.
set_psi( n, main_chain_torsion_set.
psi() );
253 std::string const tag =
"S_"+ ObjexxFCL::lead_zero_string_of( count, 5 );
273 using namespace core::chemical;
275 main_chain_torsion_set_list.clear();
279 Real best_energy_cutoff = 0.8;
339 TR <<
"----- SAMPLING CIS OMEGA --------" << std::endl;
351 using namespace core::chemical;
360 }
else if ( pose.
aa( n ) ==
aa_gly ) {
409 Real best_energy = 999999.9999;
413 if ( temp_rama < best_energy ) {
414 best_energy = temp_rama;
418 if ( best_energy < best_energy_cutoff ){
433 Real best_energy = 999999.9999;
437 if ( temp_rama < best_energy ) {
438 best_energy = temp_rama;
442 if ( best_energy < best_energy_cutoff ){
457 TR <<
"JUNCTION RESIDUE --> PREPEND " << n << std::endl;
460 Real best_rama_energy( 99999.999 ), best_phi( 0.0 );
465 if ( rama_energy < best_rama_energy || i == 1){
466 best_rama_energy = rama_energy;
469 if ( rama_energy > energy_cutoff )
continue;
474 if ( main_chain_torsion_set_list.size() == 0 ) main_chain_torsion_set_list.push_back(
MainChainTorsionSet( best_phi, psi ) );
485 TR <<
"JUNCTION RESIDUE --> APPEND " << n << std::endl;
488 Real best_rama_energy( 99999.999 ), best_psi( 0.0 );
493 if ( rama_energy < best_rama_energy || j == 1){
494 best_rama_energy = rama_energy;
497 if ( rama_energy > energy_cutoff )
continue;
502 if ( main_chain_torsion_set_list.size() == 0 ) main_chain_torsion_set_list.push_back(
MainChainTorsionSet( phi, best_psi ) );
512 if ( phi < -20.0 && psi > -90.0 && psi < -10.0 ) {
514 }
else if ( phi < -20.0 && (psi > 20.0 || psi < -170.0) ) {
533 utility_exit_with_message(
"Filter based on native big bins, but not native specified?" );
539 if ( n == 1 )
return;
543 if ( big_bin == 3 )
return;
552 char const & secstruct,
557 if ( secstruct ==
'H' ) big_bin = 1;
558 if ( secstruct ==
'E' ) big_bin = 2;
561 if ( big_bin == 3 )
return;
574 for (
Size n = 1; n <= main_chain_torsion_set_list.size(); n++ ) {
575 Real const phi = main_chain_torsion_set_list[ n ].phi();
576 Real const psi = main_chain_torsion_set_list[ n ].psi();
577 if ( ( big_bin == 1 &&
get_big_bin( phi, psi ) == 1 ) ||
578 ( big_bin == 2 &&
get_big_bin( phi, psi ) == 2 ) ) {
579 main_chain_torsion_set_list_new.push_back( main_chain_torsion_set_list[ n ] );
583 main_chain_torsion_set_list = main_chain_torsion_set_list_new;
590 std::list< std::pair< Real, Size > > energy_index_list;
594 energy_index_list.sort();
600 main_chain_torsion_sets_for_moving_residues_new.push_back(
612 for (
Size n = 1; n <= main_chain_torsion_set_list.size(); n++ ) {
613 Real const phi = main_chain_torsion_set_list[ n ].phi();
614 Real const psi = main_chain_torsion_set_list[ n ].psi();
619 main_chain_torsion_set_list = main_chain_torsion_set_list_new;
699 for (
Size n = 1; n <= main_chain_torsion_set_list.size(); n++ ) {
700 output.push_back( main_chain_torsion_set_list[ n ].
phi() );
701 output.push_back( main_chain_torsion_set_list[ n ].
psi() );
702 output.push_back( main_chain_torsion_set_list[ n ].
omega() );
704 output_list.push_back( output );
713 using namespace core::id;
716 for (
Size n = 1; n <= 3; n++ ) {
732 for (
Size i = 1; i <= working_fixed_res.size(); i++ ){
750 for (
Size i = 1; i <= fixed_res.size(); i++ ){
764 Real const & centroid_score_diff_cut,
766 Size const nstruct_centroid,
767 bool const ghost_loops) {
769 using namespace core::scoring;
784 centroid_scorefxn->set_weight(
rg, 0.0 );
800 using namespace core::kinematics;
801 using namespace core::scoring;
805 ObjexxFCL::FArray1D<bool> moving_array( full_sequence.size(), false );
811 for (
Size n = 1; n <= full_sequence.size(); n++ ){
812 if ( moving_array(n) )
continue;
814 desired_sequence += full_sequence[n-1];
820 TR <<
"FULL SEQUENCE " << full_sequence << std::endl;
821 TR <<
"DESIRED SEQUENCE " << desired_sequence << std::endl;
835 for (
Size n = 1; n <= ghost_pose_blowup.num_jump(); n++ ) {
836 Jump jump( ghost_pose_blowup.jump( n ) );
838 ghost_pose_blowup.set_jump( n, jump );
840 ghost_pose_blowup.dump_pdb(
"GHOST_BLOWUP.pdb" );
858 using namespace core::chemical;
859 using namespace core::pose;
862 ghost_pose =
new Pose;
864 copy_coords( *ghost_pose, template_pose, ghost_map );
865 ghost_pose->fold_tree( f );
894 using namespace core::scoring;
895 using namespace core::chemical;
896 using namespace core::pose;
900 TR <<
"CHECKING: decoy " << tag <<
": " << rmsd <<
" vs. filter " <<
rmsd_cutoff_ << std::endl;
904 Real centroid_score( 0.0 );
911 centroid_score = (*centroid_scorefxn_)( *ghost_pose_ );
913 Real const centroid_vdw = ghost_pose_->energies().total_energies()[
vdw ];
918 centroid_score = (*centroid_scorefxn_)( pose );