37 #include <basic/options/option.hh>
38 #include <basic/options/keys/packing.OptionKeys.gen.hh>
39 #include <basic/Tracer.hh>
40 #include <basic/basic.hh>
41 #include <basic/prof.hh>
44 #include <numeric/angle.functions.hh>
45 #include <numeric/constants.hh>
46 #include <numeric/conversions.hh>
47 #include <numeric/random/random.hh>
50 #include <utility/string_util.hh>
51 #include <utility/tag/Tag.hh>
52 #include <utility/exit.hh>
55 #include <ObjexxFCL/string.functions.hh>
56 #include <ObjexxFCL/format.hh>
62 #include <utility/excn/Exceptions.hh>
63 #include <utility/fixedsizearray1.hh>
65 using namespace core::pose;
67 static numeric::random::RandomGenerator
RG(38256225);
68 static basic::Tracer
tr(
"protocols.simple_moves.sidechain_moves.SidechainMoverBase");
71 namespace simple_moves {
72 namespace sidechain_moves {
74 using namespace chemical;
75 using namespace conformation;
77 SidechainMoverBase::SidechainMoverBase():
78 rotamer_library_( pack::dunbrack::RotamerLibrary::get_instance() )
87 rotamer_library_(rotamer_library)
97 protocols::canonical_sampling::ThermodynamicMover(mover),
98 rotamer_library_(mover.rotamer_library_),
99 packed_residues_(mover.packed_residues_),
100 residue_packed_(mover.residue_packed_),
101 preserve_detailed_balance_(mover.preserve_detailed_balance_),
102 change_chi_without_replacing_residue_(mover.change_chi_without_replacing_residue_),
103 last_chi_angles_(mover.last_chi_angles_),
104 last_nchi_(mover.last_nchi_),
105 last_proposal_density_ratio_(mover.last_proposal_density_ratio_)
124 if ( tag->hasOption(
"task_operations") ) {
127 StringVec
const t_o_keys( utility::string_split( t_o_val,
',' ) );
128 for ( StringVec::const_iterator t_o_key( t_o_keys.begin() ),
end( t_o_keys.end() );
129 t_o_key !=
end; ++t_o_key ) {
130 if ( data.
has(
"task_operations", *t_o_key ) ) {
133 throw utility::excn::EXCN_RosettaScriptsOption(
"TaskOperation " + *t_o_key +
" not found in protocols::moves::DataMap.");
154 using namespace basic::options;
159 if ( option[ OptionKeys::packing::resfile ].user() ) {
177 utility_exit_with_message(
"Cannot create task because no task factory is set");
203 using numeric::conversions::degrees;
204 using numeric::conversions::radians;
217 Size const nchi( final->nchi() );
218 for (
Size i(1); i<=nchi; ++i ) {
219 pose.
set_chi(i, resnum, final->chi(i));
230 using numeric::conversions::degrees;
231 using numeric::conversions::radians;
232 using namespace ObjexxFCL;
236 Size resnum = old_res->seqpos();
237 Size nchi( old_chi.size() );
240 new_chi.reserve( 4 );
241 new_chi.resize( nchi );
244 tr <<
"chi1 (old/new): " << fmt::F(8,4,old_chi[ 1 ]) <<
" " << fmt::F( 8,4,new_chi[ 1 ]) << std::endl;
245 Real proposal_density_reverse(1);
246 Real proposal_density_forward(1);
251 tr <<
"chi1 (old/new): " << fmt::F(8,4,old_chi[ 1 ]) <<
" " << fmt::F( 8,4,new_chi[ 1 ]) << std::endl;
267 for (
Size i = 1; i <= old_res->nchi(); ++i) {
268 new_residue->set_chi( i, new_chi[ i ] );
271 tr <<
"chi1 (old/new): " << fmt::F(8,4,old_chi[ 1 ]) <<
" " << fmt::F( 8,4,new_chi[ 1 ]) << std::endl;
276 tr <<
"chi1 (old/new): " << fmt::F(8,4,old_chi[ 1 ]) <<
" " << fmt::F( 8,4,new_chi[ 1 ]) <<
" reverse/forward" <<
fmt::E( 10,5, proposal_density_reverse) <<
" " <<
fmt::E(10,5,proposal_density_forward ) << std::endl;
286 return "SidechainMoverBase";
307 if (residue_type.aa() ==
aa_pro)
continue;
310 if (residue_type.nchi() > chi.size()) chi.resize(residue_type.nchi());
311 for (
Size chinum = 1; chinum <= residue_type.nchi(); ++chinum) {
312 chi[chinum] = pose.
chi(chinum, resnum);
318 residue_task.preserve_c_beta())
323 for (
Size chinum = 1; chinum <= residue_type.nchi(); ++chinum) {
324 pose.
set_chi(chinum, resnum, chi[chinum]);
358 for (
Size i = 1; i <=
task_->total_residue(); ++i) {
363 for (ResidueLevelTask::ResidueTypeCOPListConstIter iter(residue_task.allowed_residue_types_begin());
364 iter != residue_task.allowed_residue_types_end(); ++iter) {
367 if ((*iter)->nchi() > 0 && (*iter)->aa() !=
aa_pro) {
406 Real static const pi(numeric::NumericTraits<Real>::pi());
416 bool all_names_match =
true;
422 iter != residueleveltask.allowed_residue_types_end(); ++iter) {
425 all_names_match =
false;
430 if (!all_names_match)
break;
436 if (chi_dof.valid()) range_vector.push_back(
id::DOF_ID_Range(chi_dof, -pi, pi));