24 #include <basic/Tracer.hh>
27 #include <numeric/xyz.functions.hh>
28 #include <numeric/xyz.io.hh>
29 #include <numeric/xyzTransform.hh>
36 #include <utility/string_util.hh>
38 #include <utility/vector1.hh>
52 namespace conformation {
62 typedef numeric::xyzTransform<Real>
Xform;
70 static basic::Tracer
TR(
"core.conformation.symmetry.SymmData");
76 utility::pointer::ReferenceCount(),
81 anchor_residue_(
"1" ),
94 utility::pointer::ReferenceCount(),
101 anchor_residue_(
"1" ),
115 utility::pointer::ReferenceCount(),
118 symmetry_name_( src.symmetry_name_ ),
119 symmetry_type_( src.symmetry_type_ ),
120 subunits_( src.subunits_ ),
121 num_components_( src.num_components_ ),
122 interfaces_( src.interfaces_ ),
123 score_subunit_( src.score_subunit_ ),
124 anchor_residue_( src.anchor_residue_ ),
125 recenter_( src.recenter_ ),
127 slide_info_(src.slide_info_),
128 slide_order_string_(src.slide_order_string_),
129 symm_transforms_( src.symm_transforms_ ),
130 rotation_matrices_( src.rotation_matrices_ ),
131 translation_matrices_( src.translation_matrices_ ),
132 virtual_coordinates_( src.virtual_coordinates_ ),
133 jump_string_to_virtual_pair_( src.jump_string_to_virtual_pair_ ),
134 jump_string_to_jump_num_( src.jump_string_to_jump_num_ ),
135 virt_id_to_virt_num_( src.virt_id_to_virt_num_ ),
136 virt_id_to_subunit_num_( src.virt_id_to_subunit_num_ ),
137 virt_id_to_subunit_chain_( src.virt_id_to_subunit_chain_ ),
138 virt_id_to_subunit_residue_( src.virt_id_to_subunit_residue_ ),
139 virt_num_to_virt_id_( src.virt_num_to_virt_id_ ),
140 subunit_num_to_virt_id_( src.subunit_num_to_virt_id_ ),
141 jump_clones_( src.jump_clones_ ),
143 allow_virtual_( src.allow_virtual_ ),
144 score_multiply_subunit_( src.score_multiply_subunit_ ),
145 include_subunit_( src.include_subunit_ ),
146 output_subunit_( src.output_subunit_ ),
147 cell_a_(src.cell_a_),
148 cell_b_(src.cell_b_),
149 cell_c_(src.cell_c_),
150 cell_alfa_(src.cell_alfa_),
151 cell_beta_(src.cell_beta_),
152 cell_gamma_(src.cell_gamma_),
153 components_(src.components_),
154 name2component_(src.name2component_),
155 jname2components_(src.jname2components_),
156 jname2subunits_(src.jname2subunits_)
252 vector< numeric::xyzMatrix< core::Real > >
const &
258 vector< numeric::xyzMatrix< core::Real > >
const &
264 map< string, VirtualCoordinate >
const &
276 map< Size, SymDof >
const &
282 map< Size, WtedClones >
const &
288 map< string, Size >
const &
294 map< string, Size >
const &
300 map< string, Size >
const &
306 map< string, char >
const &
312 map< string, string >
const &
318 map< Size, string >
const &
324 map< Size, string >
const &
330 map< string, pair< string, string > >
const &
455 vector< vector< string> > symm_transforms )
513 std::ifstream infile( filename.c_str() );
515 if (!infile.good()) {
516 utility_exit_with_message(
"[ERROR] Error opening pdb file for symmetry extraction '" + filename +
"'" );
520 int start_symm_matrices( 0 );
521 bool row1_found(
false ), row2_found(
false ), row3_found(
false );
524 vector< numeric::xyzMatrix < Real > > smtry_rot_matrices;
525 vector< numeric::xyzMatrix < Real > > smtry_trans_matrices;
526 while( getline(infile,line) ) {
530 if( tokens.size() > 0 ) {
531 if ( tokens[1] ==
"REMARK" && tokens[2] ==
"290" ) {
532 if ( tokens.size() > 7 && tokens[6] ==
"SPACE" && tokens[7] ==
"GROUP:" )
534 string symmetry_name =
"";
535 for (
Size i=8; i<= tokens.size(); ++i ){
536 symmetry_name += tokens[i];
537 symmetry_name +=
" ";
540 if ( tokens[3] ==
"SYMOP" ){
541 start_symm_matrices = linecount + 2;
545 if ( linecount >= start_symm_matrices ){
546 split_vector = utility::string_split( tokens[4],
',' );
547 if ( split_vector.size() == 3 ){
548 matrices.push_back( split_vector );
557 Vector row1, row2,row3, rowa, rowb, rowc;
558 if ( tokens[3] ==
"SMTRY1" ){
559 row1 =
Vector ( static_cast<core::Real>( std::atof( tokens[5].c_str() ) ),
560 static_cast<core::Real>( std::atof( tokens[6].c_str() ) ),
561 static_cast<core::Real>( std::atof( tokens[7].c_str() ) ) );
562 rowa =
Vector ( static_cast<core::Real>( std::atof( tokens[8].c_str() ) ),
566 if ( tokens[3] ==
"SMTRY2" ){
567 row2 =
Vector ( static_cast<core::Real>( std::atof( tokens[5].c_str() ) ),
568 static_cast<core::Real>( std::atof( tokens[6].c_str() ) ),
569 static_cast<core::Real>( std::atof( tokens[7].c_str() ) ) );
570 rowb =
Vector ( 0.0, static_cast<core::Real>( std::atof( tokens[8].c_str() ) ),
574 if ( tokens[3] ==
"SMTRY3" ){
575 row3 =
Vector ( static_cast<core::Real>( std::atof( tokens[5].c_str() ) ),
576 static_cast<core::Real>( std::atof( tokens[6].c_str() ) ),
577 static_cast<core::Real>( std::atof( tokens[7].c_str() ) ) );
578 rowc =
Vector ( 0.0, 0.0, static_cast<core::Real>( std::atof( tokens[8].c_str() ) ) );
581 if ( row1_found && row2_found && row3_found ){
582 smtry_rot = Matrix::rows( row1, row2, row3 );
583 smtry_trans = Matrix::rows( rowa, rowb, rowc );
584 smtry_rot_matrices.push_back( smtry_rot );
585 smtry_trans_matrices.push_back( smtry_trans );
586 row1_found = row2_found = row3_found =
false;
589 if ( tokens[1] ==
"CRYST1" && tokens.size() > 7){
609 std::ifstream infile( filename.c_str() );
611 if (!infile.good()) {
612 utility_exit_with_message(
"[ERROR] Error opening symmetry file '" + filename +
"'" );
620 std::istream & infile
625 bool read_virtual_coords (
false);
626 bool read_transforms (
false);
627 bool start_coordinates_found (
false);
629 bool have_virtual_coordinates(
false );
630 bool read_consecutive_transforms(
false);
631 bool read_subunits(
false);
632 bool set_jump_numbers_from_tags(
true);
633 bool connect_virtuals_specified(
false);
635 vector< Matrix > rot_matrix;
636 vector< Vector > trans_vector;
637 vector< pair< Size, string > > transform_type;
638 Size num_transformations( 0 );
641 std::set<char> subchains;
644 while( getline(infile,line) ) {
648 if (tokens.size() == 0)
continue;
649 if (line.substr(0,1) ==
"#")
continue;
652 if (read_virtual_coords) {
653 if ( tokens[1] ==
"xyz" ) {
658 if ( tokens.size() < 5 )
659 utility_exit_with_message(
"[ERROR] xyz lines in symm def file const contain an identifier and 3 coordinate vectors (X,Y,ORIG)" );
660 string identifier( tokens[2] );
665 utility_exit_with_message(
"[ERROR] VRT identifier "+identifier+
" defined twice in symmetry definition file!" );
673 }
else if ( tokens[1] ==
"virtual_coordinates_stop" ) {
674 read_virtual_coords =
false;
675 have_virtual_coordinates =
true;
677 utility_exit_with_message(
"[ERROR] Error reading symm def file while at '"+line+
"'");
681 else if (read_transforms) {
684 if ( tokens[1] ==
"start" && tokens.size() >= 3 ) {
685 string identifier =
"VRT0001";
691 string tag =
"BASEJUMP";
698 start_coordinates_found =
true;
699 }
else if ( tokens[1] ==
"rot" || tokens[1] ==
"trans" ) {
700 if ( !start_coordinates_found ) {
701 utility_exit_with_message(
"[ERROR] When specifying Rotation operations a starting coordinate must be give" );
704 if ( tokens[2] ==
"Rx" ) {
706 if ( tokens.size() != 3 ) {
707 utility_exit_with_message(
"[ERROR] Need to give two arguments..." );
710 N = utility::string2int( tokens[2] );
713 rot_matrix.push_back( numeric::rotation_matrix_degrees( axis, 360.0 / N ) );
715 transform_type.push_back( make_pair( ++num_transformations,
"rot") );
717 if ( tokens[2] ==
"Ry" ) {
718 if ( tokens.size() != 3 ) {
719 utility_exit_with_message(
"[ERROR] Need to give two arguments..." );
721 N = utility::string2int( tokens[2] );
723 rot_matrix.push_back( numeric::rotation_matrix_degrees( axis, 360.0 / N ) );
724 transform_type.push_back( make_pair( ++num_transformations,
"rot") );
726 if ( tokens[2] ==
"Rz" ) {
727 if ( tokens.size() != 3 ) {
728 utility_exit_with_message(
"[ERROR] Need to give two arguments..." );
730 N = utility::string2int( tokens[3] );
732 rot_matrix.push_back( numeric::rotation_matrix_degrees( axis, 360.0 / N ) );
733 transform_type.push_back( make_pair( ++num_transformations,
"rot") );
736 if ( tokens[2] ==
"Rx_angle" ) {
737 if ( tokens.size() != 3 ) {
738 utility_exit_with_message(
"[ERROR] Need to give two arguments..." );
741 Real angle =
static_cast<core::Real>( std::atof( tokens[3].c_str() ) );
742 rot_matrix.push_back( numeric::rotation_matrix_degrees( axis, angle ) );
743 transform_type.push_back( make_pair( ++num_transformations,
"rot") );
745 if ( tokens[2] ==
"Ry_angle" ) {
746 if ( tokens.size() != 3 ) {
747 utility_exit_with_message(
"[ERROR] Need to give two arguments..." );
750 Real angle =
static_cast<core::Real>( std::atof( tokens[3].c_str() ) );
751 rot_matrix.push_back( numeric::rotation_matrix_degrees( axis, angle ) );
752 transform_type.push_back( make_pair( ++num_transformations,
"rot") );
754 if ( tokens[2] ==
"Rz_angle" ) {
755 if ( tokens.size() != 3 ) {
756 utility_exit_with_message(
"[ERROR] Need to give two arguments..." );
759 Real angle =
static_cast<core::Real>( std::atof( tokens[3].c_str() ) );
760 rot_matrix.push_back( numeric::rotation_matrix_degrees( axis, angle ) );
761 transform_type.push_back( make_pair( ++num_transformations,
"rot") );
764 if ( tokens[1] ==
"trans" ) {
766 runtime_assert( split.size() == 3 );
767 Vector trans( ( static_cast<core::Real>( std::atof( split[1].c_str() ) ) ),
768 ( static_cast<core::Real>( std::atof( split[2].c_str() ) ) ),
769 ( static_cast<core::Real>( std::atof( split[3].c_str() ) ) ) );
770 trans_vector.push_back( trans );
771 transform_type.push_back( make_pair( ++num_transformations,
"trans") );
773 }
else if ( tokens[1] ==
"virtual_transforms_stop" ) {
774 read_transforms =
false;
780 Size num_rots(0), num_trans(0);
783 utility_exit_with_message(
"[ERROR] start coordinates VRT0001 not found..." );
787 if ( read_consecutive_transforms ) {
789 Vector x_new( virt_coord.get_x() );
790 Vector y_new( virt_coord.get_y() );
791 Vector origin_new ( virt_coord.get_origin() );
792 Size num_rots(0), num_trans(0);
793 for ( vector< pair< Size, string > >::const_iterator it = transform_type.begin();
794 it != transform_type.end(); ++it ) {
795 if ( it->second ==
"rot" ) {
796 Size matrix_num ( ++num_rots );
797 x_new = rot_matrix[matrix_num -1]*x_new;
798 y_new = rot_matrix[matrix_num -1]*y_new;
799 origin_new = rot_matrix[matrix_num -1]*origin_new;
800 }
else if ( it->second ==
"trans" ) {
801 Size vector_num ( ++num_trans );
802 origin_new = trans_vector[vector_num -1] + origin_new;
808 std::ostringstream stream;
809 stream << std::setfill(
'0') << std::setw(4) << jump_num;
810 tag =
"CLONE" + stream.str();
811 string identifier =
"VRT" + stream.str();
823 if ( i > transform_type.size() ) {
829 Vector x_new( virt_coord.get_x() );
830 Vector y_new( virt_coord.get_y() );
831 Vector origin_new ( virt_coord.get_origin() );
832 if ( transform_type[index-1].second ==
"rot" ) {
833 Size matrix_num ( ++num_rots );
834 x_new = rot_matrix[matrix_num -1]*x_new;
835 y_new = rot_matrix[matrix_num -1]*y_new;
836 origin_new = rot_matrix[matrix_num -1]*origin_new;
837 }
else if ( transform_type[i-1].second ==
"trans" ) {
838 Size vector_num ( ++num_trans );
839 origin_new = trans_vector[vector_num -1] + origin_new;
844 std::ostringstream stream;
845 stream << std::setfill(
'0') << std::setw(4) << jump_num;
846 tag =
"CLONE" + stream.str();
847 string identifier =
"VRT" + stream.str();
858 utility_exit_with_message(
"[ERROR] Error reading symm def file while at '"+line+
"'");
863 if ( tokens[1] ==
"virtual_coordinates_start" ) {
865 read_virtual_coords =
true;
866 }
else if ( tokens[1] ==
"virtual_transforms_start" ) {
868 read_transforms =
true;
869 if ( tokens.size() >= 2 && tokens[2] ==
"consecutive" )
870 read_consecutive_transforms =
true;
871 }
else if ( tokens[1] ==
"symmetry_name" ) {
874 }
else if ( tokens[1] ==
"subunits" ) {
876 subunits_ = utility::string2int( tokens[2] );
877 read_subunits =
true;
882 }
else if ( tokens[1] ==
"number_of_interfaces") {
885 }
else if ( tokens[1] ==
"anchor_residue") {
888 }
else if ( tokens[1] ==
"recenter" ) {
890 }
else if ( tokens[1] ==
"E" && tokens[2] ==
"=" ) {
898 score_multiply_subunit_string.push_back( line );
899 }
else if ( tokens[1] ==
"connect_virtual" ) {
901 connect_virtuals_specified =
true;
902 if ( tokens.size() < 4 )
903 utility_exit_with_message(
"[ERROR] You have to give jump identifier together with two virtual residue ids..." );
905 utility_exit_with_message(
"[ERROR] jump identifiers have to be unique..." + tokens[2] +
" found twice " );
907 utility_exit_with_message(
"[ERROR] Virtual residue " + tokens[3] +
" in jump " + tokens[2] +
" not found" );
909 utility_exit_with_message(
"[ERROR] Virtual residue " + tokens[4] +
" in jump " + tokens[2] +
" not found" );
912 if ( tokens[4] ==
"SUBUNIT" ) {
913 if( tokens.size()==4 ) {
923 if(!have_virtual_coordinates) utility_exit_with_message(
"multicomponent symmetry not supported with virtual_transforms_start/stop!");
924 string subchain = tokens[5];
925 if( subchain.size() != 1 || subchain[0]==
' ' ) utility_exit_with_message(
"[ERRIR] bad chain: "+subchain+
" specified on SUBUNIT line:\n"+line);
927 subchains.insert(subchain[0]);
930 if( tokens.size() > 6 ) utility_exit_with_message(
"[ERROR] extra input on SUBUNIT line:\n"+line);
933 }
else if ( tokens[1] ==
"set_dof" ) {
939 if ( !connect_virtuals_specified ) {
941 std::ostringstream
str, str2;
942 str << std::setfill(
'0') << std::setw(4) << i;
943 str2 << std::setfill(
'0') << std::setw(4) << i-1;
944 string tag =
"JUMP" + str2.str();
945 string vrt_start =
"VRT" + str2.str();
946 string vrt_end =
"VRT" + str.str();
952 if ( set_jump_numbers_from_tags ) {
958 for ( map<
string, pair< string, string > >::const_iterator itv = itv_start; itv != itv_end; ++itv ) {
959 pair< string, string > connect( itv->second );
960 string pos_id1( connect.first );
961 string pos_id2( connect.second );
962 if ( pos_id2 ==
"SUBUNIT" ) {
968 for ( map<
string, pair< string, string > >::const_iterator itv = itv_start; itv != itv_end; ++itv ) {
969 pair< string, string > connect( itv->second );
970 string pos_id2( connect.second );
972 if ( pos_id2 ==
"SUBUNIT" )
continue;
976 set_jump_numbers_from_tags =
false;
979 if ( tokens.size() < 3 )
980 utility_exit_with_message(
"[ERROR] Error reading set_dof line '"+line+
"'");
982 string jump_id ( tokens[2] );
984 string error(
"[ERROR] Jump id is not found..." + jump_id );
985 utility_exit_with_message( error );
990 dofs_[ jump_nbr ] = dof;
991 }
else if( tokens[1] ==
"include_subunit" ) {
993 for(
Size i=2; i<=tokens.size();i++) {
994 core::Size j ( utility:: string2int( tokens[i] ) );
997 }
else if( tokens[1] ==
"output_subunit" ) {
999 for(
Size i =2; i<=tokens.size();i++) {
1000 core::Size j ( utility:: string2int( tokens[i] ) );
1003 }
else if( tokens[1] ==
"set_jump_group" ) {
1009 if ( set_jump_numbers_from_tags ) {
1015 for ( map<
string, pair< string, string > >::const_iterator itv = itv_start; itv != itv_end; ++itv ) {
1016 pair< string, string > connect( itv->second );
1017 string pos_id1( connect.first );
1018 string pos_id2( connect.second );
1019 if ( pos_id2 ==
"SUBUNIT" ) {
1025 for ( map<
string, pair< string, string > >::const_iterator itv = itv_start; itv != itv_end; ++itv ) {
1026 pair< string, string > connect( itv->second );
1027 string pos_id2( connect.second );
1029 if ( pos_id2 ==
"SUBUNIT" )
continue;
1033 set_jump_numbers_from_tags =
false;
1039 for (
Size i = 3; i <= tokens.size(); ++i ) {
1045 if (jump_split_i.size() > 1) {
1046 wt_i = std::atof( jump_split_i[2].c_str() );
1050 utility_exit_with_message(
"[ERROR] Undefined jump "+jump_split_i[1]+
" in jump group '"+tokens[2]+
"'");
1055 utility_exit_with_message(
"[ERROR] Multiple movable jumps specified in jump group '"+tokens[2]+
"'");
1059 jump_nums.push_back( jump_nbr );
1060 jump_wts.push_back( wt_i );
1065 master = jump_nums[1];
1067 runtime_assert (master >= 0);
1072 for (
Size i = 1; i <= jump_nums.size(); ++i ) {
1073 if ( (
int)jump_nums[i] == master ) {
1074 if ( jump_wts[i] != 1.0 ) {
1075 TR.Warning <<
"Setting weight of master jump ( jump-id=" << master <<
" ) to 1.0 ";
1076 if (jump_wts[i] == 0.0)
1077 TR.Warning <<
"(was undefined)" << endl;
1079 TR.Warning <<
"(was " << jump_wts[i] <<
")" << endl;
1082 thisCloneList.push_back( make_pair(jump_nums[i],jump_wts[i]) );
1087 if (jump_nums.size() > 1) {
1088 TR.Warning <<
"Setting jump_group " << tokens[2] <<
": [master " << master <<
"] ";
1089 for (
Size i = 1; i <= jump_nums.size(); ++i ) {
1090 if ( (
int)jump_nums[i] != master )
TR.Warning <<
" " << jump_nums[i] <<
":" << jump_wts[i] <<
" ";
1094 }
else if( tokens[1] ==
"slide_type" ) {
1095 if ( tokens.size() != 2 ) utility_exit_with_message(
"[ERROR] Error reading slide_type '"+line+
"'");
1096 if ( tokens[2] ==
"SEQUENTIAL" ) {
1098 }
else if ( tokens[2] ==
"ORDERED_SEQUENTIAL" ) {
1100 }
else if ( tokens[2] ==
"RANDOM" ) {
1103 utility_exit_with_message(
"[ERROR] Unknown slide_type '"+tokens[2]+
"'");
1105 }
else if( tokens[1] ==
"slide_criteria_type" ) {
1106 if ( tokens.size() != 2 ) utility_exit_with_message(
"[ERROR] Error reading slide_criteria_type '"+line+
"'");
1107 if ( tokens[2] ==
"CEN_DOCK_SCORE" ) {
1109 }
else if ( tokens[2] ==
"FA_REP_SCORE" ) {
1111 }
else if ( tokens[2] ==
"CONTACTS" ) {
1114 utility_exit_with_message(
"[ERROR] Unknown slide_type '"+tokens[2]+
"'");
1116 }
else if( tokens[1] ==
"slide_criteria_val" ) {
1117 if ( tokens.size() != 2 ) utility_exit_with_message(
"[ERROR] Error reading slide_criteria_val '"+line+
"'");
1119 }
else if( tokens[1] ==
"slide_order" ) {
1120 for (
Size record = 2; record <= tokens.size(); ++record ) {
1124 utility_exit_with_message(
"[ERROR] Error reading symm def file while at '"+line+
"'");
1133 if(chains.size() <= 1) utility_exit_with_message(
"processing multicomponent symmetry, but only one chain!");
1134 std::sort(chains.begin(),chains.end());
1136 TR <<
"MULTICOMPONENT " <<
"You have specified the following chains for multi-component:";
1137 TR <<
" primary: " << *i;
1138 TR <<
", secondary:";
1139 for(++i; i != chains.end(); ++i)
TR <<
" " << *i;
1141 char firstchain = chains[1];
1144 map<char,Size> chaincount;
1146 char const & chain = i->second;
1147 if(chaincount.count(chain)==0) chaincount[chain] = 0;
1148 chaincount[chain]++;
1150 if( chaincount.size() == 1 ) utility_exit_with_message(
"For compatibility, don't use multicomponent format with only one component!!!");
1153 for(map<char,Size>::const_iterator i = chaincount.begin(); i != chaincount.end(); ++i) {
1155 for(map<char,Size>::const_iterator j = chaincount.begin(); j != chaincount.end(); ++j) {
1156 TR <<
"SUBUNIT " << j->first <<
" num subs: " << j->second << endl;
1158 utility_exit_with_message(
"[ERROR] bad number of subunits");
1162 map<pair<char,Size>,
Xform> frames;
1164 string const & virt_id = i->first;
1165 Size const & subnum = i->second;
1168 Mat const R( Mat::cols( vc.
get_x().normalized(), vc.
get_y().normalized(), vc.
get_x().cross(vc.
get_y()).normalized() ) );
1171 if( vc.
get_origin() .distance(toframe*
Vec(0,0,0) ) > 0.0000000001 ||
1172 vc.
get_x() .normalized().distance(toframe*
Vec(1,0,0).normalized()) > 0.0000000001 ||
1173 vc.
get_y() .normalized().distance(toframe*
Vec(0,1,0).normalized()) > 0.0000000001 ||
1174 vc.
get_x().cross(vc.
get_y()).normalized().distance(toframe*
Vec(0,0,1).normalized()) > 0.0000000001 )
1176 std::cerr << virt_id <<
" " << chain <<
" " << subnum <<
" " <<
"orig " << vc.
get_origin() << endl;
1177 std::cerr << virt_id <<
" " << chain <<
" " << subnum <<
" " <<
"xform " << toframe*
Vec(0,0,0) << endl;
1178 std::cerr << virt_id <<
" " << chain <<
" " << subnum <<
" " <<
"orig " << vc.
get_x() << endl;
1179 std::cerr << virt_id <<
" " << chain <<
" " << subnum <<
" " <<
"xform " << toframe*
Vec(1,0,0) << endl;
1180 std::cerr << virt_id <<
" " << chain <<
" " << subnum <<
" " <<
"orig " << vc.
get_y() << endl;
1181 std::cerr << virt_id <<
" " << chain <<
" " << subnum <<
" " <<
"xform " << toframe*
Vec(0,1,0) << endl;
1182 std::cerr << virt_id <<
" " << chain <<
" " << subnum <<
" " <<
"orig " << vc.
get_x().cross(vc.
get_y()) << endl;
1183 std::cerr << virt_id <<
" " << chain <<
" " << subnum <<
" " <<
"xform " << toframe*
Vec(0,0,1) << endl;
1184 utility_exit_with_message(
"computed frame xforms not correct!");
1186 frames[make_pair(chain,(subnum-1)%
subunits_+1)] = toframe;
1190 map<pair<char,Size>,
Xform> relxforms;
1192 string const & virt_id = i->first;
1193 Size const & subnum = i->second;
1195 relxforms[make_pair(chain,subnum)] = frames[make_pair(chain,(subnum-1)%
subunits_+1)] * ~frames[make_pair(chain,1)];
1199 map<pair<char,Size>,
Size> subperm;
1201 string const & virt_id = i->first;
1202 Size const & subnum = i->second;
1204 if(chain == firstchain)
continue;
1205 Xform const & xform1( relxforms[make_pair(chain,subnum)] );
1206 for(map<pair<char,Size>,
Xform>::const_iterator j = relxforms.begin(); j != relxforms.end(); ++j){
1207 Size const & subnum2(j->first.second);
1208 char const & chain2 (j->first.first);
1209 Xform const & xform2(j->second);
1210 if(chain2!=firstchain)
continue;
1211 if( xform1.distance(xform2) < 0.000001 ){
1212 if( subperm.count(make_pair(chain,subnum)) > 0 ){
1213 utility_exit_with_message(
string(
"multiple matching transforms for chain ")+
1214 chain+
" in primary chain "+firstchain+
"! probably a malformed or imprecise symmetry");
1216 subperm[make_pair(chain,subnum)] = (subnum2-1)%
subunits_+1;
1219 if( subperm.find(make_pair(chain,subnum)) == subperm.end() ){
1220 utility_exit_with_message(
string(
"can't find matching transform for chain ")+
1221 chain+
" in primary chain "+firstchain+
"! probably a malformed or imprecise symmetry");
1229 string const & virt_id = i->first;
1230 Size const & subnum = i->second;
1233 if(chain==firstchain){
1235 TR <<
"MULTICOMPONENT " <<
"replace raw subunit "<< virt_id <<
" num in primary chain " << chain <<
" with normalized subunit: "
1238 if(subperm.find(make_pair(chain,subnum)) == subperm.end()){
1239 utility_exit_with_message(
"error computing correct subnum for component!");
1241 newsubnum = subperm[make_pair(chain,subnum)];
1242 TR <<
"MULTICOMPONENT " <<
"replace raw subunit "<< virt_id <<
" num in secondary chain " << chain <<
" with correctly permuted subunit: "
1245 if(newsubnum==0) utility_exit_with_message(
"error computing correct subnum for component!");
1250 map<char,string> chainres;
1252 string const & virt_id = i->first;
1253 char const & chain = i->second;
1257 std::cerr <<
"ERROR in chain " << chain <<
" " << virt_id << endl;
1258 utility_exit_with_message(
"SUBUNIT <chain> [<res>] must match!");
1265 map<Size,string> jnum2dofname_;
1267 jnum2dofname_[i->second] = i->first;
1282 for( map< Size, SymDof >::iterator i =
dofs_.begin(); i !=
dofs_.end(); ++i){
1283 string dofname = jnum2dofname_[i->first];
1305 map< string, pair< string, string > >::const_iterator it, it2;
1309 for ( it = it_start; it != it_end; ++it ) {
1310 pair< string, string > connect( it->second );
1311 if (connect.second ==
"SUBUNIT")
continue;
1313 utility_exit_with_message(
"[ERROR] Cycle found in connect_virtual" );
1314 downstream_targets[ virt_id_to_virt_num_[ connect.second ] ] =
true;
1317 for (
int i=1; i<=(
int)nvrt; ++i) {
1318 if (!downstream_targets[i]) {
1325 utility_exit_with_message(
"[ERROR] Cycle found in connect_virtual" );
1333 score_multiply_subunit_vector.push_back(0);
1337 score_multiply_subunit_vector.push_back(1);
1340 if (score_multiply_subunit_string.size() == 0)
1341 utility_exit_with_message(
"[ERROR] No total energy line specified!" );
1342 vector1< string> split_1 = utility::string_split( score_multiply_subunit_string[1],
'=' );
1343 if (split_1.size() < 2)
1344 utility_exit_with_message(
"[ERROR] Error parsing line '"+score_multiply_subunit_string[1]+
"'" );
1347 for (
Size i = 1; i<=split_2.size(); ++i ) {
1349 utility::trim(split_2[i],
" ");
1353 string virtual_residues = split_3[1];
1354 if (split_3.size() > 1) {
1355 factor = utility::string2int( split_3[1] );
1356 virtual_residues = split_3[2];
1358 utility::trim( virtual_residues,
"()" );
1359 vector1< string> virtual_residues_split ( utility::string_split( virtual_residues,
':' ) );
1362 if ( virtual_residues_split.size() == 1 ) {
1363 utility::trim(virtual_residues_split[1],
" ");
1365 utility_exit_with_message(
"[ERROR] VRT " + virtual_residues_split[1] +
" not attached to a subunit");
1369 }
else if ( virtual_residues_split.size() == 2 ) {
1370 utility::trim(virtual_residues_split[2],
" ");
1372 utility_exit_with_message(
"[ERROR] VRT " + virtual_residues_split[2] +
" not attached to a subunit");
1376 utility_exit_with_message(
"[ERROR] Error parsing 'E =' line while at " + split_2[i] );
1378 score_multiply_subunit_vector[subunit] = factor;
1383 vector< Size > slide_order;
1385 string jump_id ( *it );
1387 string error(
"[ERROR] Jump id is not found..." + jump_id );
1388 utility_exit_with_message( error );
1391 slide_order.push_back(jump_nbr);
1407 utility_exit_with_message(
"[ERROR] No virtual atoms specified..." );
1410 utility_exit_with_message(
"[ERROR] Need to give number of subunits..." );
1413 utility_exit_with_message(
"[ERROR] Need to give number of interfaces..." );
1416 utility_exit_with_message(
"[ERROR] Need to specify how to calculate symmetrical energy..." );
1421 for ( map<
string, pair< string, string > >::const_iterator itv = itv_start; itv != itv_end; ++itv ) {
1422 pair< string, string > connect( itv->second );
1423 if ( connect.second ==
"SUBUNIT" ) ++subunits;
1426 std::cerr <<
"subunits from connect_virtual: " << subunits << endl;
1427 std::cerr <<
"subunits declared: " << subunits_ << endl;
1429 utility_exit_with_message(
"[ERROR] The number of subunits is not equal to the number of jumps from virtual residues to subunits..." );
1431 bool nullchain =
false;
1433 if( i->second == (
char)0 ) nullchain =
true;
1434 if( nullchain && i->second != (
char)0 ) utility_exit_with_message(
"[ERROR] all SUBUNITs must have chain if any have chain!");
1443 TR <<
"number of subunits: " <<
subunits_ << endl;
1448 map< string, VirtualCoordinate >::iterator vit;
1452 for ( vit = vit_begin; vit != vit_end; ++vit ) {
1453 string identifier( (*vit).first );
1455 TR <<
" Virtual coordinate system " << identifier << endl;
1456 TR <<
"x: " << coord.
get_x()(1) <<
" " << coord.
get_x()(2) <<
" " << coord.
get_x()(3)
1458 TR <<
"y: " << coord.
get_y()(1) <<
" " << coord.
get_y()(2) <<
" " << coord.
get_y()(3)
1464 map< Size, SymDof >::iterator it;
1465 map< Size, SymDof >::iterator it_begin =
dofs_.begin();
1466 map< Size, SymDof >::iterator it_end =
dofs_.end();
1467 for ( it = it_begin; it != it_end; ++it ) {
1468 int jump_nbr ( (*it).first );
1469 SymDof dof ( (*it).second );
1470 TR <<
"Dof for jump: " << jump_nbr << endl;
1471 for (
Size i=1; i<=6; ++i ) {
1472 string dir (
"n2c" );
1474 if ( i == 1 )
TR <<
"x ";
1475 if ( i == 2 )
TR <<
"y ";
1476 if ( i == 3 )
TR <<
"z ";
1477 if ( i == 4 )
TR <<
"x_angle ";
1478 if ( i == 5 )
TR <<
"y_angle ";
1479 if ( i == 6 )
TR <<
"z_angle ";
1481 <<
" " << dir << endl;
1487 for ( map<
string, pair< string, string > >::const_iterator itv = itv_start; itv != itv_end; ++itv ) {
1488 pair< string, string > connect( itv->second );
1489 string pos_id1( connect.first );
1490 string pos_id2( connect.second );
1491 TR <<
"Jump " << itv->first <<
" " << pos_id1 <<
" " << pos_id2 << endl;
1493 TR <<
"Include subunit:";
1495 TR <<
' ' << (*it) ;
1498 TR <<
"Output subunit:";
1500 TR <<
' ' << (*it) ;
1503 TR <<
"SlideType: ";
1507 TR <<
"SlideCriteriaType: ";
1511 TR <<
"SlideCriteriaVal: ";
1513 TR <<
"SlideOrder: ";
1517 TR <<
' ' << (*it) ;
1529 std::map<std::string,char>
const &
1533 std::map<std::string,utility::vector1<char> >
const &
1538 std::map<std::string,utility::vector1<Size> >
const &
1546 utility_exit_with_message(
"can't find parent jump of jump"+jname);
1549 if(i->second.second == upvirt)
return i->first;
1558 if(i->second.second == vname)
return i->second.first;
1571 if( *p == ancestor )
return true;
1579 std::set<string> seenit;
1587 if( seenit.find(*p) != seenit.end() )
return *p;
1595 std::set<string> seenit;
1603 if( seenit.find(*p) != seenit.end() )
return *p;
1612 utility_exit_with_message(
"unknown jump name in leaves of jump");
1625 std::set<char> components;
1636 std::set<Size> subunits;
1746 std::vector< std::vector< std::string > >::const_iterator
1749 ai != aie; ++ai, ++bi){
1751 !std::equal(ai->begin(), ai->end(), bi->begin())){
1757 std::map< Size, WtedClones >::const_iterator
1760 ai != aie; ++ai, ++bi){
1762 !std::equal(ai->second.begin(), ai->second.end(), bi->second.begin())){
1771 ai != aie; ++ai, ++bi){
1773 !std::equal(ai->second.begin(), ai->second.end(), bi->second.begin())){
1782 ai != aie; ++ai, ++bi){
1784 !std::equal(ai->second.begin(), ai->second.end(), bi->second.begin())){