37 #include <basic/Tracer.hh>
38 #include <basic/basic.hh>
39 #include <basic/prof.hh>
42 #include <numeric/angle.functions.hh>
43 #include <numeric/constants.hh>
44 #include <numeric/conversions.hh>
45 #include <numeric/random/random.hh>
48 #include <utility/string_util.hh>
49 #include <utility/tag/Tag.hh>
50 #include <utility/exit.hh>
55 #include <utility/fixedsizearray1.hh>
57 using namespace core::pose;
59 static numeric::random::RandomGenerator
RG(18611125);
60 static basic::Tracer
TR(
"protocols.simple_moves.sidechain_moves.PerturbRotamerSidechainMover");
63 namespace simple_moves {
64 namespace sidechain_moves {
66 using namespace chemical;
67 using namespace conformation;
71 PerturbRotamerSidechainMoverCreator::keyname()
const {
72 return PerturbRotamerSidechainMoverCreator::mover_name();
76 PerturbRotamerSidechainMoverCreator::create_mover()
const {
81 PerturbRotamerSidechainMoverCreator::mover_name() {
82 return "PerturbRotamerSidechain";
86 PerturbRotamerSidechainMover::PerturbRotamerSidechainMover() {
91 PerturbRotamerSidechainMover::PerturbRotamerSidechainMover(
93 ) :
Parent( rotamer_library ) {
127 return "PerturbRotamerSidechainMover";
141 Real max_rot_prob = 0;
142 Size max_rot_num = 0;
145 for (
Size ii = 1; ii <= rotamers.size() ; ++ii) {
147 Real rot_prob( rotamers[ii].chi_probability( old_chi,
temperature_ )*rotamers[ ii ].probability());
149 if ( rot_prob > max_rot_prob ) {
151 max_rot_prob = rot_prob;
158 rotamers[ max_rot_num ].assign_random_chi( new_chi,
RG,
temperature_ );
176 Real within_rot_density;
179 return within_rot_density;
186 bool filter_low_probabilities,
189 using namespace pack::dunbrack;
191 rotamers.reserve( 200 );
198 dynamic_cast< SingleResidueDunbrackLibrary const * >( residue_rotamer_library.get() )
201 if ( !residue_dunbrack_library )
return;
204 Real const phi( residue_dunbrack_library->get_phi_from_rsd( residue ) );
205 Real const psi( residue_dunbrack_library->get_psi_from_rsd( residue ) );
206 RotamerList rotamers_raw( residue_dunbrack_library->get_all_rotamer_samples(
phi,
psi ) );
209 if ( !filter_low_probabilities ) {
210 rotamers=rotamers_raw;
213 most_probable_rotamers.reserve( rotamers.size() );
214 Real probability_threshold = 0.01;
216 while ( i <= rotamers.size() &&
217 rotamers[ i ].probability() > probability_threshold ) {
218 rotamers.push_back( rotamers[ i ] );
229 Real& within_rot_density
232 Real max_new_rot_prob(0);
233 Real max_old_rot_prob(0);
237 for (
Size jj=1; jj <= rotamers.size(); ++jj) {
238 norm_prob+=rotamers[jj].probability();
244 for (
Size ii = 1; ii <= rotamers.size(); ++ii ) {
246 Real well_prob( rotamers[ii].probability() );
247 Real const new_rot_prob( rotamers[ii].chi_probability( new_chi,
temperature() )*well_prob );
249 Real const old_rot_prob( rotamers[ii].chi_probability( old_chi,
temperature() )*well_prob );
250 if (old_rot_prob > max_old_rot_prob) {
251 max_old_rot_prob = old_rot_prob;
252 max_new_rot_prob = new_rot_prob;
255 within_rot_density = max_new_rot_prob;