27 #include <basic/options/option.hh>
28 #include <basic/options/keys/in.OptionKeys.gen.hh>
40 #include <numeric/conversions.hh>
41 #include <numeric/xyz.functions.hh>
42 #include <numeric/xyzMatrix.hh>
43 #include <utility/tools/make_vector1.hh>
44 #include <utility/io/izstream.hh>
49 #include <ObjexxFCL/format.hh>
55 #include <utility/vector1.hh>
57 using numeric::conversions::degrees;
58 using numeric::conversions::radians;
70 f.
new_jump( moving_suite, moving_suite+1, moving_suite );
73 int const i( moving_suite ), j( moving_suite+1 );
74 for (
Size n = 1; n <= f.num_jump(); n++ ) {
75 if ( f.upstream_jump_residue(n) == i && f.downstream_jump_residue(n) == j )
return n;
76 if ( f.upstream_jump_residue(n) == j && f.downstream_jump_residue(n) == i )
return n;
79 utility_exit_with_message(
"Problem with jump number" );
101 for(
Size j=1; j<=residue_list.size(); j++){
102 if(seq_num==residue_list[j]) {
113 using namespace ObjexxFCL;
114 using namespace ObjexxFCL::fmt;
118 std::cout <<
A(4,
"T");
120 std::cout <<
A(4,
"F");
128 using namespace ObjexxFCL;
129 using namespace ObjexxFCL::fmt;
132 std::cout <<
A(4,
"T");
134 std::cout <<
A(4,
"F");
142 using namespace ObjexxFCL;
143 using namespace ObjexxFCL::fmt;
144 using namespace core::kinematics;
145 using namespace core::id;
148 std::cout <<
"Movemap (in term of partial_pose seq_num): " << std::endl;
149 std::cout <<
A(spacing,
"res_num") <<
A(spacing,
"alpha") <<
A(spacing,
"beta") <<
A(8,
"gamma") <<
A(8,
"delta") <<
A(8,
"eplison") <<
A(8,
"zeta");
150 std::cout <<
A(spacing,
"chi_1") <<
A(spacing,
"nu_2") <<
A(spacing,
"nu_1") <<
A(8,
"chi_O2") << std::endl;
152 for(
Size n=1; n<= total_residue; n++){
154 std::cout << I(spacing, 3 , n);
165 std::cout << std::endl;
174 bool const move_takeoff_torsions,
175 bool const move_jumps_between_chains
179 using namespace core::id;
183 ObjexxFCL::FArray1D< bool > allow_insert( nres,
true );
184 for (
Size i = 1; i <= fixed_res.size(); i++ ) allow_insert( fixed_res[ i ] ) =
false;
193 std::cout <<
"ALLOWING BB TO MOVE: ";
194 for (
Size i = 1; i <= nres; i++ ) {
197 if ( !move_takeoff_torsions && !allow_insert(i) )
continue;
204 for (
Size torsion_number = 1; torsion_number <= pose.
residue( i ).
nchi(); torsion_number++ ) {
209 for (
Size n = 1; n <= torsion_ids.size(); n++ ) {
211 TorsionID const & torsion_id = torsion_ids[ n ];
219 if ( !allow_insert( id1.
rsd() ) && !allow_insert( id2.
rsd() ) && !allow_insert( id3.
rsd() ) && !allow_insert( id4.
rsd() ) )
continue;
220 mm.
set( torsion_id,
true );
222 if ( n == 1 ) std::cout <<
' ' << i;
227 std::cout << std::endl;
230 Size chain_number( 0 );
233 chain_index.push_back( chain_number );
242 if ( allow_insert( jump_pos1 ) || allow_insert( jump_pos2 ) ) {
244 std::cout <<
"allow_insert ALLOWING JUMP " << n <<
" to move. It connects " << jump_pos1 <<
" and " << jump_pos2 <<
"." << std::endl;
247 if ( move_jumps_between_chains ){
248 if ( chain_index[ jump_pos1 ] != chain_index[ jump_pos2 ] ){
249 std::cout <<
"move_jumps_between_chains ALLOWING JUMP " << n <<
" to move. It connects " << jump_pos1 <<
" and " << jump_pos2 <<
"." << std::endl;
265 using namespace core::pose;
266 using namespace core::chemical;
267 using namespace core::conformation;
268 using namespace core::scoring::rna;
272 for (
Size i = 1; i <= slice_res.size(); i++ ) {
276 if ( (i > 1 && ( slice_res[i] != slice_res[i-1] + 1 )) || residue_to_add->is_lower_terminus() || residue_to_add->has_variant_type(
"N_ACETYLATION") || (i>1 && pose.
fold_tree().
is_cutpoint( slice_res[i-1] ) ) ){
309 pdbslice( mini_pose, pose, slice_res );
320 std::map< core::Size, core::Size > res_map;
328 res_map[ seq_num ] = seq_num;
338 std::map< core::Size, core::Size > res_map ){
340 using namespace chemical;
341 using namespace protocols::swa::protein;
342 using namespace protocols::swa::rna;
343 using namespace core::id;
350 if ( mod_pose.
residue( seq_num ).
is_RNA() && res_map.find( seq_num ) != res_map.end() && res_map[ seq_num ] > 0) {
372 if ( res_vector.size() == 0 )
return res_vector;
374 if ( working_res.size() == 0 )
return res_vector;
376 std::map< Size, Size > full_to_sub;
377 for (
Size i = 1; i <= working_res.size(); i++ ) {
378 full_to_sub[ working_res[ i ] ] = i;
383 for (
Size i = 1; i <= res_vector.size(); i++ ) {
384 if ( full_to_sub.find( res_vector[ i ] ) == full_to_sub.end() )
continue;
385 convert_res_vector.push_back( full_to_sub[ res_vector[ i ] ] );
388 return convert_res_vector;
403 using namespace core::scoring;
404 using namespace core::scoring::constraints;
405 using namespace core::id;
414 for (
Size i = 1; i <= slice_res.size(); i++) mapping[ slice_res[ i ] ] = i;
417 for (
Size n = 1; n <= csts.size(); n++ ) {
420 ConstraintOP cst_new = cst->remapped_clone( full_pose, pose, smap );
422 cst_set_new->add_constraint( cst_new );
463 std::cout <<
"NUM CONSTRAINTS " << cst_set_new->get_all_constraints().size() <<
" out of " <<
464 csts.size() << std::endl;
476 using basic::options::option;
478 using namespace basic::options::OptionKeys;
482 if ( option[ in::file::s ].active() ) {
483 pdb_file_names = option[ in::file::s ]().vector();
487 if ( option[ in::file::l ].active() )
488 list_file_names = option[ in::file::l ]().vector();
489 if ( option[ in::file::list ].active() ){
491 better_list_file_names= option[in::file::list ]().vector();
493 list_file_names.push_back(*i);
499 utility::io::izstream data( filename.c_str() );
500 if ( !data.good() ) {
501 utility_exit_with_message(
"Unable to open file: " + filename +
'\n' );
504 while( getline(data, line) ) {
510 return pdb_file_names;
518 Size pos( silent_file.find(
".out" ) );
520 silent_file_sample.replace( pos, 4, tag+
".out" );
521 return silent_file_sample;
530 using namespace core::scoring;
535 utility_exit_with_message(
"Since we want constraints, need to use a scorefunction with non-zero atom_pair_constraint and coordinate_constraint weight");
547 std::map< Size, bool > silly_map;
548 for (
Size n = 1; n <= vec1.size(); n++ ) silly_map[ vec1[n] ] =
true;
549 for (
Size n = 1; n <= vec2.size(); n++ ) silly_map[ vec2[n] ] =
true;
552 for ( std::map<Size,bool>::iterator it = silly_map.begin(); it != silly_map.end(); it++ ){
553 merged_vec.push_back( it->first );
572 Matrix M1 = numeric::rotation_matrix( axis3,
Real( radians( alpha ) ) );
573 Matrix M2 = numeric::rotation_matrix( axis2,
Real( radians( beta ) ) );
574 Matrix M3 = numeric::rotation_matrix( axis3,
Real( radians( gamma ) ) );
587 static Vector const axis1( 1.0, 0.0, 0.0 );
588 static Vector const axis2( 0.0, 1.0, 0.0 );
589 static Vector const axis3( 0.0, 0.0, 1.0 );
600 M2 = M1.transposed() * M2;
603 Vector z_vec = M2.col_z();
604 Real const gamma_radians = std::atan2( z_vec(2), z_vec(1) );
605 gamma = degrees( gamma_radians );
607 M2 = rotation_matrix(
Vector( 0.0, 0.0, 1.0 ), -1.0 * gamma_radians ) * M2;
609 if ( verbose ) std::cout <<
"This better have a zero in y position " << z_vec(1) <<
' ' << z_vec(2) <<
' ' << z_vec(3) << std::endl;
612 Real const beta_radians = std::atan2( z_vec(1), z_vec(3) );
613 beta = degrees( beta_radians );
615 M2 = rotation_matrix(
Vector( 0.0, 1.0, 0.0 ), -1.0 * beta_radians ) * M2;
617 if ( verbose ) std::cout <<
"This better have a zero in x and y position " << z_vec(1) <<
' ' << z_vec(2) <<
' ' << z_vec(3) << std::endl;
620 Vector x_vec = M2.col_x();
621 Real const alpha_radians = std::atan2( x_vec(2), x_vec(1) );
622 alpha = degrees( alpha_radians );
624 M2 = rotation_matrix(
Vector( 0.0, 0.0, 1.0 ), -1.0 * alpha_radians ) * M2;
626 if ( verbose ) std::cout <<
"This better have a zero in y and z position " << x_vec(1) <<
' ' << x_vec(2) <<
' ' << x_vec(3) << std::endl;
641 Vector const xaxis1 = M1.col_x();
642 Vector const yaxis1 = M1.col_y();
643 Vector const zaxis1 = M1.col_z();
652 std::cout <<
"These better match: " << std::endl;
653 std::cout << M(1,1) <<
' ' << M(1,2) <<
' ' << M(1,3) << std::endl;
654 std::cout << M(2,1) <<
' ' << M(2,2) <<
' ' << M(2,3) << std::endl;
655 std::cout << M(3,1) <<
' ' << M(3,2) <<
' ' << M(3,3) << std::endl;
656 std::cout << std::endl;
657 std::cout << M_test(1,1) <<
' ' << M_test(1,2) <<
' ' << M_test(1,3) << std::endl;
658 std::cout << M_test(2,1) <<
' ' << M_test(2,2) <<
' ' << M_test(2,3) << std::endl;
659 std::cout << M_test(3,1) <<
' ' << M_test(3,2) <<
' ' << M_test(3,3) << std::endl;
670 using namespace core::id;
672 for (
Size n = 1; n <= moving_res.size(); n++ ) {
673 Size const i = moving_res[ n ];
689 Vector const & centroid ){
691 using namespace core::id;
693 for (
Size n = 1; n <= moving_res.size(); n++ ) {
694 Size const i = moving_res[ n ];
710 Vector centroid( 0.0, 0.0, 0.0 );
711 rotate( pose, M, ref_pose, moving_res, centroid );
718 using namespace scoring::rna;
719 using namespace kinematics;
722 centroid = rna_centroid_info.get_base_centroid( pose.
residue( i ) );
723 Stub s = rna_centroid_info.get_base_coordinate_system( pose.
residue( i ), centroid );
730 using namespace protocols::swa;
736 translate( pose, -centroid, pose, moving_res);
737 if ( !do_not_rotate )
rotate( pose, M.transposed(), pose, moving_res);