30 #include <basic/Tracer.hh>
34 #include <numeric/kinematic_closure/bridgeObjects.hh>
36 #include <ObjexxFCL/format.hh>
37 #include <ObjexxFCL/string.functions.hh>
38 #include <ObjexxFCL/FArray1D.hh>
40 #include <numeric/conversions.hh>
42 #include <utility/exit.hh>
55 #include <utility/vector1.hh>
67 static basic::Tracer
TR(
"protocols.swa.protein.stepwise_loop_bridger" ) ;
79 sample_generator_( sample_generator ),
80 working_bridge_res_( job_parameters->working_bridge_res() ),
81 is_pre_proline_( job_parameters->is_pre_proline() ),
82 num_perturb_steps_( 0 ),
83 perturb_torsion_( 20.0 ),
88 use_icoor_geometry_( false ),
92 if (
working_bridge_res_.size() != 3 ) utility_exit_with_message(
"Must supply three bridge residues that are covered by -sample_res, -input_res1, and -input_res2!");
104 return "StepWiseProteinLoopBridger";
114 clock_t
const time_start( clock() );
116 Pose pose_save = pose;
135 std::cout <<
"Total time in StepWiseProteinLoopBridger: " <<
136 static_cast<Real>(clock() - time_start) / CLOCKS_PER_SEC << std::endl;
151 std::cout <<
"Loop combination " <<
pose_count_++ <<
". " ;
159 Real const psi_start = pose.
psi( pre_loop_res );
160 Real const phi_start = pose.
phi( post_loop_res );
165 pose.
set_psi( pre_loop_res, psi_perturb );
170 pose.
set_phi( post_loop_res, phi_perturb );
175 std::cout <<
"Loop combination " <<
pose_count_++ <<
". " ;
191 using namespace protocols::loops;
192 using namespace core::chemical;
199 if ( middle_bridge_res == 0 ) {
200 utility_exit_with_message(
"Is there a bridge residue that is not an input residue?" );
204 std::cout <<
"Found bridge residue: " << middle_bridge_res << std::endl;
205 std::cout << pose.
fold_tree() << std::endl;
208 for (
int offset = -2; offset < 1; offset++ ) {
209 Size const test_res =
static_cast<int>( middle_bridge_res ) + offset;
212 cutpoint_ = test_res;
215 std::cout <<
" cutpoint res? " << cutpoint_ << std::endl;
216 utility_exit_with_message(
"cutpoints not set up properly at cutpoint residue" );
221 if ( cutpoint_ == 0 ) utility_exit_with_message(
"could not find cutpoint!" );
222 std::cout <<
"Found cutpoint residue: " << cutpoint_ << std::endl;
224 loop_ =
Loop( middle_bridge_res-1 , middle_bridge_res+1 , cutpoint_ );
234 using namespace core::id;
271 std::cout <<
' ' << std::endl;
298 std::cout <<
"------ chainTORS output ---- " << std::endl;
299 for (
Size i = 1; i <= ( dt_ang.size()/3) ; i++) {
301 std::cout <<
"TORSIONS: ";
302 for (
Size j = 1; j <= 3; j++) std::cout << ObjexxFCL::fmt::F(8,3,dt_ang[ 3*(i-1)+ j ]) <<
" ";
304 std::cout <<
" BOND_ANGLES: ";
305 for (
Size j = 1; j <= 3; j++) std::cout << ObjexxFCL::fmt::F(8,3,db_ang[ 3*(i-1)+ j ]) <<
" ";
307 std::cout <<
" BOND_LENGTHS: ";
308 for (
Size j = 1; j <= 3; j++) std::cout << ObjexxFCL::fmt::F(8,3,db_len[ 3*(i-1)+ j ]) <<
" ";
310 std::cout << std::endl;
327 using namespace numeric::kinematic_closure;
329 if (
verbose_ ) std::cout <<
"About to run chainTORS" << std::endl;
331 for (
Size i = start_res_ - 1; i <= end_res_ + 1; i++) {
332 if (
verbose_ ) std::cout <<
"Filling residue " << i << std::endl;
334 for (
Size j=1; j<=3; j++) {
335 atoms[ind].resize(3);
336 atoms[ind][1] =
static_cast<Real> (res.
xyz(j).x());
337 atoms[ind][2] =
static_cast<Real> (res.
xyz(j).y());
338 atoms[ind][3] =
static_cast<Real> (res.
xyz(j).z());
346 chainTORS(atoms.size(), atoms, dt_ang, db_ang, db_len, R0, Q0);
356 using namespace core::kinematics;
357 using namespace protocols::loops;
358 using namespace numeric::kinematic_closure;
394 db_len[ 3 + 3*cut_offset_ + 3 ] =
idl_C_N_;
403 dt_ang[ 3 + 3*cut_offset_ + 3 ] = 180.0;
404 db_len[ 3 + 3*cut_offset_ + 3 ] = bond_length;
405 db_ang[ 3 + 3*cut_offset_ + 3 ] = 180.0 - numeric::conversions::degrees(bond_angle1);
406 db_ang[ 3 + 3*cut_offset_ + 4 ] = 180.0 - numeric::conversions::degrees(bond_angle2);
411 std::cout <<
"After setting desired geometry at cutpoint, relative to loop_start " << cut_offset_ << std::endl;
438 using namespace numeric::kinematic_closure;
445 if (
verbose_ ) std::cout <<
"About to run bridgeObjects" << std::endl;
446 bridgeObjects(atoms, dt_ang, db_ang, db_len, pivots, order, t_ang, b_ang, b_len, nsol);
447 if (
verbose_ ) std::cout <<
"Finished bridgeObjects" << std::endl;
449 Size const num_solutions = t_ang.size();
450 std::cout <<
"Kinematic loop closure found this many solutions: " << num_solutions << std::endl;
452 for (
Size i = 1; i <= num_solutions; i++) {
477 dt_ang[ 3 + 3*offset + 3 ] = 0.0 ;
488 for (
Size n = 1; n <= working_sequence.size(); n++ )
is_fixed_res_.push_back(
false );
490 for (
Size i = 1; i <= fixed_res.size(); i++ ){