34 #include <basic/Tracer.hh>
37 #include <utility/string_util.hh>
38 #include <utility/vector1.hh>
46 namespace match_enzdes_util {
48 static basic::Tracer
tr(
"protocols.toolbox.match_enzdes_util.InvrotTree" );
71 if(
invrot_targets_.size() == 0 ) utility_exit_with_message(
"InvrotTree is asked to generate constraints even though no target states exist. Something is wrong somewhere.");
86 return invrot_collectors;
92 tr <<
"Writing InvrotTree to file(s).... " << std::endl;
95 if( invrot_collectors.size() == 0 ){
96 tr <<
"Error when trying to dump inverse rotamer tree to file. No inverse rotamers found in tree.";
101 Size files_to_write( invrot_collectors.size() );
102 tr <<
"A total of " << files_to_write <<
" unique definitions of the invrot tree exist." << std::endl;
104 for(
Size i =1; i <= files_to_write; ++i ){
106 std::vector< std::list< core::conformation::ResidueCOP > >
const & invrot_lists( invrot_collectors[i]->invrots() );
107 Size num_rotamer_lists( invrot_lists.size() );
108 std::vector< std::list< core::conformation::ResidueCOP >::const_iterator > res_iterators( num_rotamer_lists );
110 tr <<
"Writing definition " << i <<
" to file " << filename <<
"... " << std::endl;
111 for(
Size j =0; j < num_rotamer_lists; ++j ){
112 res_iterators[ j ] = invrot_lists[j].begin();
113 tr << invrot_lists[j].size() <<
" invrots for list " << j <<
", ";
118 bool all_res_iterators_at_end(
false );
119 std::ofstream file_out( filename.c_str() );
120 file_out <<
"MODEL 1\n";
122 while( !all_res_iterators_at_end ){
123 all_res_iterators_at_end =
true;
124 for(
core::Size j =0; j < num_rotamer_lists; ++j ){
125 if( res_iterators[ j ] != invrot_lists[j].
end() ){
126 all_res_iterators_at_end =
false;
128 res_iterators[ j ]++;
131 if( !all_res_iterators_at_end ){
132 file_out <<
"ENDMDL \n";
133 file_out <<
"MODEL "+utility::to_string( ++modelcount )+
"\n";
164 utility_exit_with_message(
"stubbed out");
182 else if( ligres->is_ligand() ){
190 all_rots.push_back( ligres );
200 conformer_groups.push_back( all_rots );
203 for(
Size i =1; i <= conformer_groups.size(); ++i ){
206 if( !invtarg->initialize_tree_nodes_from_enzcst_io(
enzcst_io_ ) )
tr <<
"Target from conformer group " << i <<
" failed to initialize, cstfile geometry (clashes?) is bad somewhere." << std::endl;
209 if( this->
num_target_states() == 0 ) utility_exit_with_message(
"No targets could be initialized by TheozymeInvrotTree. check cstfile");