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(18451125);
60 static basic::Tracer
tr(
"protocols.simple_moves.sidechain_moves.JumpRotamerSidechainMover");
63 namespace simple_moves {
64 namespace sidechain_moves {
66 using namespace chemical;
67 using namespace conformation;
71 JumpRotamerSidechainMoverCreator::keyname()
const {
72 return JumpRotamerSidechainMoverCreator::mover_name();
76 JumpRotamerSidechainMoverCreator::create_mover()
const {
81 JumpRotamerSidechainMoverCreator::mover_name() {
82 return "JumpRotamerSidechain";
86 JumpRotamerSidechainMover::JumpRotamerSidechainMover() {
91 JumpRotamerSidechainMover::JumpRotamerSidechainMover(
93 ) :
Parent( rotamer_library ) {
126 return "JumpRotamerSidechainMover";
143 bool is_tempered( std::abs(
temperature() - 1.0 ) > 0.01 );
153 Real const inv_nrot( 1.0/rotamers.size() );
154 Real rot_prob_normalize (0);
155 runtime_assert( !is_tempered );
156 for ( rotnum=1; rotnum <=rotamers.size() &&rand > 0; ++rotnum ) {
157 rot_prob_normalize+=rotamers [rotnum].probability();
160 for ( rotnum=1; rotnum <= rotamers.size() && rand > 0; ++rotnum ) {
164 rand -= ( is_tempered ? rot_probs[ rotnum ]*normalize : ( rotamers[ rotnum ].probability()/rot_prob_normalize ));
170 runtime_assert( rotnum >= 1 && rotnum <= rotamers.size() );
172 rotamers[rotnum].assign_random_chi( new_chi,
RG,
temperature() );
183 using namespace pack::dunbrack;
205 bool is_tempered( std::abs(
temperature() - 1.0 ) > 0.01 );
211 for ( RotamerList::const_iterator it = rotamers.begin(); it!=rotamers.end(); ++it ) {
212 norm_prob += it->probability();
214 if ( std::abs( norm_prob - 1.0 ) > 0.00001 ) {
215 tr.Warning <<
"ALARM: probs are not normalized correctly: " << norm_prob << std::endl;
217 Real const inv_nrot( 1.0 / rotamers.size() );
218 for (
Size ii = 1; ii <= rotamers.size(); ++ii ) {
220 Real const within_well_prob( rotamers[ii].chi_probability( new_chi,
temperature() ) );
223 rot_density += inv_nrot * within_well_prob;
225 Real const well_prot( is_tempered ? rot_probs[ ii ]*normalize : rotamers[ii].probability()/norm_prob );
226 rot_density += exp( log( well_prot ) + log( within_well_prob ) );
239 rot_probs.resize( rotamers.size() );
241 Real sum_prob( 0.0 );
242 for (
Size rotnum=1; rotnum <= rotamers.size(); ++rotnum ) {
243 sum_prob+=std::pow( rotamers[ rotnum ].probability(), inv_T );
245 normalize = 1.0/sum_prob;