19 #include <basic/options/option.hh>
24 #include <basic/Tracer.hh>
29 #include <basic/options/keys/packing.OptionKeys.gen.hh>
37 #include <utility/vector1.hh>
45 using namespace scoring;
46 using namespace scoring::constraints;
48 static basic::Tracer
TR(
"core.pack.dunbrack.RotamerConstraint");
53 using namespace basic::options;
54 using namespace core::pose;
55 if( !option[ OptionKeys::packing::unboundrot ].active() )
return;
58 if( unboundrot_poses.empty() ) {
59 for(
Size i = 1; i <= option[ OptionKeys::packing::unboundrot ]().
size(); ++i) {
61 TR <<
"Adding 'unbound' rotamers from " << filename << std::endl;
65 unboundrot_poses.push_back( pose );
74 if( unboundrot_poses.empty() )
return;
80 map< string, RotamerConstraintOP > by_res_type;
81 for(
Size pose_num = 1; pose_num <= unboundrot_poses.size(); ++pose_num) {
82 if( rsd_num > unboundrot_poses[pose_num]->total_residue() )
continue;
86 TR <<
"Can't use " << rsd.
type().
name() <<
" " << rsd_num <<
" for residue constraint -- protein only." << std::endl;
90 if( by_res_type.find( rsd.
type().
name() ) == by_res_type.end() ) {
91 TR.Debug <<
"Creating rotamer constraint for " << rsd.
type().
name() <<
" at " << rsd_num << std::endl;
94 by_res_type[ rsd.
type().
name() ] = constraint;
97 constraint->add_residue( unboundrot_poses[pose_num]->residue(rsd_num) );
109 rsd_type_name_( pose.residue_type(seqpos).name() ),
111 rotlib_( core::pack::dunbrack::
RotamerLibrary::get_instance().get_rsd_library( pose.residue_type(seqpos) ) ),
113 favored_rotamer_numbers_()
118 for(
Size i = 1, i_end = rsd.nheavyatoms(); i <= i_end; ++i) {
167 if(
rotlib_() == NULL )
return;
168 if( weights[ this->
score_type() ] == 0 )
return;
178 Real const best_rotE =
rotlib_->best_rotamer_energy(rsd,
false , scratch);
179 Real const this_rotE =
rotlib_->best_rotamer_energy(rsd,
true , scratch);
180 assert( best_rotE <= this_rotE );
181 TR <<
"rotamer constraint active for " <<
seqpos_ <<
" thisE = " << this_rotE <<
" bestE = " << best_rotE <<
" dE = " << ( best_rotE - this_rotE ) << std::endl;
182 emap[ this->
score_type() ] += ( best_rotE - this_rotE );