40 #include <basic/Tracer.hh>
46 #include <ObjexxFCL/string.functions.hh>
47 #include <ObjexxFCL/FArray1D.hh>
49 #include <utility/exit.hh>
57 #include <utility/vector1.hh>
58 #include <utility/io/mpistream.hh>
76 static basic::Tracer
TR(
"protocols.swa.stepwise_residue_sampler" ) ;
85 StepWiseScreener::StepWiseScreener(
88 moving_residues_( moving_residues ),
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 )
102 for (
Size n = 1; n <= moving_residues.size(); n++ ) {
122 clock_t
const time_start( clock() );
134 std::cout <<
"Total time in StepWiseScreener: " <<
135 static_cast<Real>(clock() - time_start) / CLOCKS_PER_SEC << std::endl;
145 return "StepWiseScreener";
153 using namespace core::kinematics;
154 using namespace core::scoring;
158 ObjexxFCL::FArray1D<bool> moving_array( full_sequence.size(), false );
164 for (
Size n = 1; n <= full_sequence.size(); n++ ){
165 if ( moving_array(n) )
continue;
167 desired_sequence += full_sequence[n-1];
173 std::cout <<
"FULL SEQUENCE " << full_sequence << std::endl;
174 std::cout <<
"DESIRED SEQUENCE " << desired_sequence << std::endl;
188 for (
Size n = 1; n <= ghost_pose_blowup.num_jump(); n++ ) {
189 Jump jump( ghost_pose_blowup.jump( n ) );
191 ghost_pose_blowup.set_jump( n, jump );
193 ghost_pose_blowup.dump_pdb(
"GHOST_BLOWUP.pdb" );
211 using namespace core::chemical;
212 using namespace core::pose;
215 ghost_pose =
new Pose;
217 copy_coords( *ghost_pose, template_pose, ghost_map );
218 ghost_pose->fold_tree( f );
225 using namespace core::id;
229 for ( ResMap::const_iterator it=ghost_map.begin(); it != ghost_map.end(); it++ ) {
230 Size const & res( it->first );
231 Size const & template_res( it->second );
237 std::cout <<
"PROBLEM! " << res <<
" " << pose.
residue( res ).
atom_name( j ) <<
" != " <<
238 template_res <<
" " << template_pose.
residue( template_res ).
atom_name( j ) << std::endl;
239 utility_exit_with_message(
"mismatch in ghost pose" );
255 Size prev_res( 0 ), total_res( 0 );
258 for ( ResMap::const_iterator it=ghost_map.begin(); it != ghost_map.end(); it++ ) {
259 Size const & res( it->first );
260 Size const & template_res( it->second );
262 std::cout <<
"MAPPING " << res <<
" --> " << template_res << std::endl;
264 if ( (template_res-1) != prev_res ) cutpoints.push_back( res-1 );
265 prev_res = template_res;
272 for (
Size n = 1; n <= cutpoints.size(); n++ ) {
273 std::cout <<
"Adding jump across: " << cutpoints[ n ] << std::endl;
274 f.
new_jump( cutpoints[ n ], cutpoints[ n ] +1, cutpoints[ n ] );
304 Size const which_res,
309 using namespace core::chemical;
310 using namespace core::scoring;
317 for (
Size k = 1; k <= main_chain_torsion_set_list.size(); k++ ) {
321 pose.
set_phi( n, main_chain_torsion_set.
phi() );
322 pose.
set_psi( n, main_chain_torsion_set.
psi() );
330 std::string const tag =
"S_"+ ObjexxFCL::lead_zero_string_of( count, 5 );
346 using namespace core::scoring;
347 using namespace core::chemical;
348 using namespace core::pose;
352 TR <<
"CHECKING: decoy " << tag <<
": " << rmsd <<
" vs. filter " <<
rmsd_cutoff_ << std::endl;
356 Real centroid_score( 0.0 );
363 centroid_score = (*centroid_scorefxn_)( *ghost_pose_ );
365 Real const centroid_vdw = ghost_pose_->energies().total_energies()[
vdw ];
370 centroid_score = (*centroid_scorefxn_)( pose );
408 using namespace core::chemical;
410 main_chain_torsion_set_list.clear();
414 Real best_energy_cutoff = 0.8;
462 using namespace core::chemical;
471 }
else if ( pose.
aa( n ) ==
aa_gly ) {
520 Real best_energy = 999999.9999;
524 if ( temp_rama < best_energy ) {
525 best_energy = temp_rama;
529 if ( best_energy < best_energy_cutoff ){
544 Real best_energy = 999999.9999;
548 if ( temp_rama < best_energy ) {
549 best_energy = temp_rama;
553 if ( best_energy < best_energy_cutoff ){
565 TR <<
"JUNCTION RESIDUE --> PREPEND " << n << std::endl;
583 TR <<
"JUNCTION RESIDUE --> APPEND " << n << std::endl;
603 if ( phi < -20.0 && psi > -90.0 && psi < -10.0 ) {
605 }
else if ( phi < -20.0 && (psi > 20.0 || psi < -170.0) ) {
624 utility_exit_with_message(
"Filter based on native big bins, but not native specified?" );
630 if ( n == 1 )
return;
634 if ( big_bin == 3 )
return;
638 for (
Size n = 1; n <= main_chain_torsion_set_list.size(); n++ ) {
639 Real const phi = main_chain_torsion_set_list[ n ].phi();
640 Real const psi = main_chain_torsion_set_list[ n ].psi();
641 if ( ( big_bin == 1 &&
get_big_bin( phi, psi ) == 1 ) ||
642 ( big_bin == 2 &&
get_big_bin( phi, psi ) == 2 ) ) {
643 main_chain_torsion_set_list_new.push_back( main_chain_torsion_set_list[ n ] );
647 main_chain_torsion_set_list = main_chain_torsion_set_list_new;
655 std::list< std::pair< Real, Size > > energy_index_list;
659 energy_index_list.sort();
665 main_chain_torsion_sets_for_moving_residues_new.push_back(