39 #include <basic/Tracer.hh>
42 #include <basic/options/option.hh>
44 #include <basic/options/keys/run.OptionKeys.gen.hh>
46 #include <utility/vector1.hh>
58 static basic::Tracer
TR(
"core.util.switchresiduetypeset");
69 bool allow_sloppy_match
72 using namespace core::chemical;
73 using namespace core::conformation;
90 std::string const & current_type_set_name ( rsd.type().residue_type_set().name() );
91 if ( current_type_set_name == type_set_name ) {
92 TR.Warning <<
"core::util::switch_to_residue_type_set: residue " << i <<
" already in " << type_set_name
93 <<
" residue_type_set" << std::endl;
100 if( ( rsd.aa() ==
aa_unk ) || ( rsd.name().substr(0,5) ==
"HIS_D" ) ){
104 for (
core::Size j=1; j<=rsd_types.size(); ++j ) {
106 if ( rsd.type().name() == new_rsd_type.
name() ) {
114 for (
core::Size j=1; j<= rsd_types.size(); ++j ) {
116 if ( rsd.type().variants_match( new_rsd_type ) ) {
121 if ( allow_sloppy_match ){
123 TR.Warning <<
"Did not find perfect match for residue: " << rsd.name()
124 <<
"at position " << i <<
". Trying to find acceptable match. " << std::endl;
125 for (
core::Size j=1; j<= rsd_types.size(); ++j ) {
127 if ( rsd.type().name3() == new_rsd_type.
name3() ) {
133 TR.Warning <<
"Found an acceptable match: " << rsd.type().name() <<
" --> " << new_rsd->name() << std::endl;
140 std::cerr << pose.
sequence() << std::endl;
141 std::cerr <<
"can not find a residue type that matches the residue " << rsd.name()
142 <<
"at position " << i << std::endl;
143 utility_exit_with_message(
"core::util::switch_to_residue_type_set fails\n" );
146 if ( !rsd.is_protein() ) {
148 TR.Debug <<
"trying to preserve existing coords for non-protein residue: " << rsd.seqpos() <<
' ' << rsd.name() << std::endl;
155 if(pose.
is_fullatom() && basic::options::option[ basic::options::OptionKeys::run::rebuild_disulf ]() ) {
159 if( disulfides.size() > 0 ) {
162 task->initialize_from_command_line().or_include_current(
true );
163 task->restrict_to_repacking();
172 if( !res.is_protein() )
176 bool is_disulf =
false;
177 for(
vector1<pair<core::Size, core::Size> >::const_iterator
178 disulf(disulfides.begin()), end_disulf(disulfides.end());
179 disulf != end_disulf; ++disulf)
181 if( i == disulf->first || i == disulf->second ) {
189 mm->set_chi(i,
true);
192 task->nonconst_residue_task(i).prevent_repacking();