31 #include <basic/Tracer.hh>
34 #include <utility/exit.hh>
38 #include <utility/vector1.hh>
39 #include <numeric/random/random.hh>
46 static basic::Tracer
TR(
"protocols.relax.Ramady");
57 using namespace conformation;
59 using namespace scoring;
60 using namespace constraints;
62 using namespace kinematics;
63 using namespace moves;
72 coordconstraint_segments = exclude_regions.
invert( nnonvrt_cst_target );
76 if ( nnonvrt_pose != nnonvrt_cst_target ) {
77 std::cerr <<
"ERROR coord constraint pose length mismatch with input pose: " << nnonvrt_cst_target <<
" vs. " << nnonvrt_pose << std::endl;
89 Real const coord_sdev( 0.5 );
90 for (
Size i = 1; i<= (
Size)nres; ++i ) {
92 if( coordconstraint_segments.is_loop_residue( i ) ) {
94 for (
Size ii = 1; ii<= nat_i_rsd.last_backbone_atom(); ++ii ) {
110 bool rama_list_pred(
const std::pair < core::Size, core::Real > &
left,
const std::pair < core::Size, core::Real > &right )
112 return left.second > right.second;
117 using namespace core;
119 using namespace optimization;
120 using namespace protocols::moves;
121 using namespace core::scoring;
122 using namespace core::pose;
123 using namespace conformation;
124 using namespace kinematics;
142 core::Real ok_phi[] = { -140, -72, -122, -82, -61, 57 } ;
143 core::Real ok_psi[] = { 153, 145, 117, -14, -41, 39 } ;
150 rama_scorefxn.set_weight(
rama, 1.0 );
151 rama_scorefxn.set_weight(
omega, 0.2 );
152 Energies & energies( pose.energies() );
155 MinimizerOptions options(
"dfpmin", 0.02,
true ,
false );
160 std::vector < std::pair < core::Size, core::Real > > rama_list;
162 for (
Size j=1; j<= pose.total_residue(); ++j ) {
163 EnergyMap & emap( energies.onebody_energies( j ) );
164 if ( emap[
rama ] > limit_rama_min )
165 rama_list.push_back( std::make_pair( j, emap[
rama ] ) );
168 if( rama_list.size() == 0 )
return;
173 for (
Size g=0; g< rama_list.size(); g++ ){
174 TR <<
"RAMALIST: " << rama_list[g].first <<
" " << rama_list[g].second << std::endl;
177 for (
Size g=0; g< how_many; g++ ){
179 if ( g >= rama_list.size() )
break;
181 if ( numeric::random::uniform() < skip_prob )
continue;
184 EnergyMap & emap( energies.onebody_energies( i ) );
187 TR <<
"RAMALIST: " << rama_list[g].first <<
" " << rama_list[g].second <<
" RAMA: " << rama_e <<
" RES: " << i << std::endl;
189 for(
core::Size ir = 1; ir < pose.total_residue(); ir ++ ){
190 temp_pose.set_phi( ir, pose.phi( ir ) );
191 temp_pose.set_psi( ir, pose.psi( ir ) );
192 temp_pose.set_omega( ir, pose.omega( ir ) );
194 std::vector < core::Size > used_angles;
196 while ( used_angles.size() < 6 ) {
210 TR <<
"S:" << curphi <<
" " << curpsi <<
" " << std::endl;
212 core::Real diffphi = ok_phi[a] - curphi;
while( diffphi > 180 ) diffphi-=360.0;
while( diffphi < -180 ) diffphi += 360.0;
213 core::Real diffpsi = ok_psi[a] - curpsi;
while( diffpsi > 180 ) diffpsi-=360.0;
while( diffpsi < -180 ) diffpsi += 360.0;
214 core::Real dist = sqrt( diffphi*diffphi + diffpsi * diffpsi );
215 TR <<
"T:" << ok_phi[a] <<
" " << ok_psi[a] <<
" " << dist << std::endl;
216 if( (dist < bestdist) || (a == 0) ){
217 if( std::find(used_angles.begin(), used_angles.end(), a)!=used_angles.end() )
continue;
224 used_angles.push_back( bestindex );
225 TR <<
"B:" << newphi <<
" " << newpsi <<
" " << bestdist <<
"BEST: " << bestindex << std::endl;
227 pose.set_phi( i, newphi );
228 pose.set_psi( i, newpsi );
233 for (
int ii=-4; ii< 3; ii ++ ){
236 if( res < 1 )
continue;
237 if( res > (
int)pose.total_residue() )
continue;
238 local_mm.
set_bb( res,
true );
244 AtomTreeMinimizer().run( pose, local_mm, rama_scorefxn, options );
245 AtomTreeMinimizer().run( pose, final_mm, rama_scorefxn, options );
250 post_fix_rama_e = emap[
rama ];
253 TR <<
"RMS:" << change_rms << std::endl;
257 if ( ( post_fix_rama_e < limit_rama ) &&
258 ( change_rms < limit_RMS ) ){
263 for(
core::Size ir = 1; ir < pose.total_residue(); ir ++ ){
264 pose.set_phi( ir, temp_pose.phi( ir ) );
265 pose.set_psi( ir, temp_pose.psi( ir ) );
266 pose.set_omega( ir, temp_pose.omega( ir ) );
271 TR <<
"RAMADY " << rama_e <<
" " << post_fix_rama_e <<
" " << change_rms << std::endl;
284 for (
Size i=1; i<= pose.total_residue(); ++i ) {
285 if ( !pose.residue_type(i).is_protein() )
continue;
286 EnergyMap & emap( energies.onebody_energies( i ) );
287 TR <<
"CHECK: " << i <<
" "
288 << pose.phi(i) <<
" "
289 << pose.psi(i) <<
" "
290 << emap[
rama ] << std::endl;
295 if ( !pose.residue_type(ir).is_protein() )
continue;
296 original_pose.
set_phi( ir, pose.phi( ir ) );
297 original_pose.
set_psi( ir, pose.psi( ir ) );
298 original_pose.
set_omega( ir, pose.omega( ir ) );