26 #include <basic/prof.hh>
27 #include <basic/basic.hh>
28 #include <basic/Tracer.hh>
31 #include <ObjexxFCL/format.hh>
32 #include <ObjexxFCL/string.functions.hh>
37 #include <numeric/xyz.functions.hh>
38 #include <numeric/numeric.functions.hh>
39 #include <numeric/random/random.fwd.hh>
40 #include <utility/assert.hh>
42 #include <utility/vector1.hh>
48 using namespace ObjexxFCL;
49 using namespace ObjexxFCL::fmt;
53 namespace loop_closure {
60 basic::Tracer
tccd(
"protocols.loops.loop_closure.ccd.ccd_closure" );
72 coords.resize( nres );
73 torsions.resize( nres );
75 for (
Size i=1; i<= nres; ++i ) {
77 Size const nbb( rsd.mainchain_atoms().size() );
79 coords[i].resize( nbb );
80 torsions[i].resize( nbb );
81 for (
Size j=1; j <= nbb; ++j ) {
82 coords[i][j] = rsd.
atom( rsd.mainchain_atoms()[j] ).
xyz();
83 torsions[i][j] = rsd.mainchain_torsion(j);
99 for (
int i=loop_begin; i<= loop_end; ++i ) {
100 for (
Size j=1; j<= torsions[i].size(); ++j ) {
115 Real const bond_angle1,
116 Real const bond_length,
117 Real const bond_angle2,
121 using numeric::conversions::radians;
124 bool const local_debug(
false );
126 Size const nbb( coords[cutpoint].
size() );
134 if ( direction == 1 ) {
135 for (
int i=1; i<= 3; ++i ) atoms[i ] = coords[ cutpoint ][ nbb-3+i ];
136 for (
int i=1; i<= 3; ++i ) atoms[i+3] = coords[ cutpoint+1 ][ i ];
137 dihedrals[1] = radians( torsions[cutpoint ][ nbb-1 ] );
138 dihedrals[2] = radians( torsions[cutpoint ][ nbb ] );
139 dihedrals[3] = radians( torsions[cutpoint+1][ 1 ] );
140 angles[1] = bond_angle1;
141 angles[2] = bond_angle2;
143 for (
int i=1; i<= 3; ++i ) atoms[7-i ] = coords[ cutpoint ][ nbb-3+i ];
144 for (
int i=1; i<= 3; ++i ) atoms[7-i-3] = coords[ cutpoint+1 ][ i ];
145 dihedrals[3] = radians( torsions[cutpoint ][ nbb-1 ] );
146 dihedrals[2] = radians( torsions[cutpoint ][ nbb ] );
147 dihedrals[1] = radians( torsions[cutpoint+1][ 1 ] );
148 angles[2] = bond_angle1;
149 angles[1] = bond_angle2;
156 Stub const stub321( atoms[3], atoms[2], atoms[1] );
157 atom4p = stub321.spherical( dihedrals[1], angles[1], bond_length );
160 Stub const stub456( atoms[4], atoms[5], atoms[6] );
161 atom3p = stub456.spherical( dihedrals[3], angles[2], bond_length );
164 Stub const stub1( atom4p, atoms[3], atoms[2] );
165 Stub const stub2( atoms[4], atom3p, atoms[5] );
167 for (
int i=1; i<= 3; ++i ) {
168 M.col( i, stub1.local2global( stub2.global2local( atoms[3+i] ) ) );
172 Matrix const R( numeric::rotation_matrix_radians( ( atom4p - atoms[3] ).normalized(), dihedrals[2] ) );
173 M.col( 2, R * ( M.col(2) - atom4p ) + atom4p );
174 M.col( 3, R * ( M.col(3) - atom4p ) + atom4p );
178 using basic::subtract_radian_angles;
179 ASSERT_ONLY(
Real const dihedral1
180 ( dihedral_radians( atoms[1], atoms[2], atoms[3], M.col(1) ) );)
181 ASSERT_ONLY(
Real const dihedral2
182 ( dihedral_radians( atoms[2], atoms[3], M.col(1), M.col(2) ) );)
183 ASSERT_ONLY(
Real const dihedral3
184 ( dihedral_radians( atoms[3], M.col(1), M.col(2), M.col(3) ) );)
186 ASSERT_ONLY(
Real const angle1( std::acos( dot( ( atoms[3] - atoms[2] ).normalized(),
187 ( M.col(1) - atoms[3] ).normalized() ) ) );)
188 ASSERT_ONLY(
Real const angle2( std::acos( dot( ( M.col(2) - M.col(1) ).normalized(),
189 ( M.col(1) - atoms[3] ).normalized() ) ) );)
190 ASSERT_ONLY(
Real const length( atoms[3].
distance( M.col(1) ) );)
192 assert( std::abs( subtract_radian_angles( dihedral1, dihedrals[1] ) ) < 1e-3 );
193 assert( std::abs( subtract_radian_angles( dihedral2, dihedrals[2] ) ) < 1e-3 );
194 assert( std::abs( subtract_radian_angles( dihedral3, dihedrals[3] ) ) < 1e-3 );
195 assert( std::abs( subtract_radian_angles( angle1, angles[1] ) ) < 1e-3 );
196 assert( std::abs( subtract_radian_angles( angle2, angles[2] ) ) < 1e-3 );
197 assert( std::abs( length - bond_length ) < 1e-3 );
201 if ( direction == -1 ) {
203 for (
int i=1; i<= 3; ++i ) M.col( i, tmp.col(4-i) );
216 Real const bond_angle1,
217 Real const ASSERT_ONLY(bond_length),
218 Real const bond_angle2,
222 using numeric::conversions::radians;
225 Size const nbb( coords[cutpoint].
size() );
233 if ( direction == 1 ) {
234 for (
int i=1; i<= 3; ++i ) atoms[i ] = coords[ cutpoint ][ nbb-3+i ];
235 for (
int i=1; i<= 3; ++i ) atoms[i+3] = coords[ cutpoint+1 ][ i ];
236 dihedrals[1] = radians( torsions[cutpoint ][ nbb-1 ] );
237 dihedrals[2] = radians( torsions[cutpoint ][ nbb ] );
238 dihedrals[3] = radians( torsions[cutpoint+1][ 1 ] );
239 angles[1] = bond_angle1;
240 angles[2] = bond_angle2;
242 for (
int i=1; i<= 3; ++i ) atoms[7-i ] = coords[ cutpoint ][ nbb-3+i ];
243 for (
int i=1; i<= 3; ++i ) atoms[7-i-3] = coords[ cutpoint+1 ][ i ];
244 dihedrals[3] = radians( torsions[cutpoint ][ nbb-1 ] );
245 dihedrals[2] = radians( torsions[cutpoint ][ nbb ] );
246 dihedrals[1] = radians( torsions[cutpoint+1][ 1 ] );
247 angles[2] = bond_angle1;
248 angles[1] = bond_angle2;
253 if ( direction == -1 ) {
254 for (
int i=1; i<= 3; ++i ) M.col( i, M_in.col(4-i) );
258 using basic::subtract_radian_angles;
259 ASSERT_ONLY(
Real const dihedral1
260 ( dihedral_radians( atoms[1], atoms[2], atoms[3], M.col(1) ) );)
261 ASSERT_ONLY(
Real const dihedral2
262 ( dihedral_radians( atoms[2], atoms[3], M.col(1), M.col(2) ) );)
263 ASSERT_ONLY(
Real const dihedral3
264 ( dihedral_radians( atoms[3], M.col(1), M.col(2), M.col(3) ) );)
266 ASSERT_ONLY(
Real const angle1( std::acos( dot( ( atoms[3] - atoms[2] ).normalized(),
267 ( M.col(1) - atoms[3] ).normalized() ) ) );)
268 ASSERT_ONLY(
Real const angle2( std::acos( dot( ( M.col(2) - M.col(1) ).normalized(),
269 ( M.col(1) - atoms[3] ).normalized() ) ) );)
270 ASSERT_ONLY(
Real const length( atoms[3].
distance( M.col(1) ) );)
272 assert( std::abs( subtract_radian_angles( dihedral1, dihedrals[1] ) ) < 1e-3 );
273 assert( std::abs( subtract_radian_angles( dihedral2, dihedrals[2] ) ) < 1e-3 );
274 assert( std::abs( subtract_radian_angles( dihedral3, dihedrals[3] ) ) < 1e-3 );
275 assert( std::abs( subtract_radian_angles( angle1, angles[1] ) ) < 1e-3 );
276 assert( std::abs( subtract_radian_angles( angle2, angles[2] ) ) < 1e-3 );
277 assert( std::abs( length - bond_length ) < 1e-3 );
286 while ( atom > nbb ) {
306 int const nbb( coords[seqpos].
size() );
307 int pos1( seqpos ), pos2( seqpos ),
308 atom1( torsion ), atom2( torsion+1 );
311 axis_atom = coords[pos2][atom2];
312 axis_vector = ( axis_atom - coords[pos1][atom1] ).normalized();
331 using numeric::conversions::radians;
332 Size const nbb( coords[pos].
size() );
333 int const fold_end( ( dir == 1 ) ? cutpoint : cutpoint + 1 );
335 assert( ( fold_end - pos ) * dir >= 0 );
338 Vector axis_atom, axis_vector;
341 Matrix const R( numeric::rotation_matrix_degrees( axis_vector,
Real( dir * alpha) ) );
343 Vector const v( axis_atom - R * axis_atom );
350 int fold_begin( pos );
351 int fold_begin_atom( ( dir == 1 ) ? torsion + 2 : torsion - 1 );
355 for (
int i = fold_begin; ( fold_end - i ) * dir >= 0; i += dir ) {
356 int j_begin( ( i == fold_begin ) ? fold_begin_atom : ( dir == 1 ? 1 : nbb ) );
358 for (
Size j = j_begin; j >= 1 && j <= nbb; j += dir ) {
359 coords[i][j] = R * coords[i][j] + v;
364 for (
int i=1; i<= 3; ++i ) {
365 M.col(i, R*M.col(i) + v);
382 using numeric::conversions::radians;
383 using numeric::conversions::degrees;
390 int const n2c = { 1 };
391 int const c2n = { -1 };
393 bool const local_debug = {
false };
404 for (
int i = 1; i <= 3; ++i ) {
410 Vector const O( A + dot( M.col(i) -
A, axis_vector ) * axis_vector );
414 Real const r_length = r.length();
416 Vector const r_hat = r / r_length;
419 Vector const s_hat = cross( axis_vector, r_hat );
422 Vector const f_vector = F.col(i) -
O;
423 Real const f_length = f_vector.length();
425 aa += r_length * r_length + f_length * f_length;
427 bb += 2 * r_length * dot( f_vector, r_hat );
429 cc += 2 * r_length * dot( f_vector, s_hat );
433 assert( std::abs( dot( axis_vector, r_hat ) ) < 1e-3 );
434 assert( std::abs( dot( axis_vector, s_hat ) ) < 1e-3 );
435 assert( std::abs( dot( s_hat, r_hat ) ) < 1e-3 );
436 assert( axis_vector.is_unit( 1e-3 ) );
437 assert( s_hat.is_unit( 1e-3 ) );
438 assert( r_hat.is_unit( 1e-3 ) );
440 assert( std::abs( dot( M.col(i), axis_vector ) - dot( O, axis_vector ) ) < 1e-3 );
441 assert( std::abs( dot( r, axis_vector ) ) < 1e-3 );
446 Real const alpha = std::atan2( cc, bb );
448 dev = aa - bb * std::cos( alpha ) - cc * std::sin( alpha );
451 Real const one_degree = radians( 1.0 );
452 if ( ( dev > aa - bb * std::cos( alpha - one_degree ) - cc * std::sin( alpha - one_degree ) ) ||
453 ( dev > aa - bb * std::cos( alpha + one_degree ) - cc * std::sin( alpha + one_degree ) ) ) {
454 utility_exit_with_message(
"ccd problemo!" );
458 if ( direction == n2c ) {
459 angle = degrees(alpha);
460 }
else if ( direction == c2n ) {
461 angle = -degrees(alpha);
463 utility_exit_with_message(
"ccd_angle: unrecognized direction: "+string_of(direction) );
471 int const loop_begin,
478 int const nbb( torsions[ loop_begin ].
size() );
479 for (
int i=loop_begin; i<= loop_end; ++i ) {
480 for (
int torsion=1; torsion<= nbb; ++torsion ) {
482 for (
int k=1; k<= 4; ++k ) {
483 int seqpos(i), atomno(torsion+k-2);
485 xyz.push_back( coords[seqpos][atomno] );
487 Real const xyz_dihedral( numeric::dihedral_degrees( xyz[1], xyz[2], xyz[3], xyz[4] ) );
488 if ( ( i == cutpoint && ( torsion == nbb -1 || torsion == nbb ) ) ||
489 ( i == cutpoint+1 && ( torsion == 1 ) ) )
continue;
490 assert( std::abs( basic::subtract_degree_angles( xyz_dihedral, torsions[i][torsion] ) ) < 1e-3 );
491 tccd.Debug <<
"torsion-check: " << i <<
' ' << torsion <<
' ' << torsions[i][torsion] <<
' ' << xyz_dihedral << std::endl;
509 int const loop_begin,
513 Real const tolerance,
514 bool const rama_check,
515 Real const max_rama_score_increase,
516 Real const max_total_delta_helix,
517 Real const max_total_delta_strand,
518 Real const max_total_delta_loop,
519 Real & forward_deviation,
520 Real & backward_deviation,
521 Real & torsion_delta,
525 PROF_START( basic::CCD_CLOSE );
531 bool const local_debug = {
false };
532 bool const local_verbose = {
false };
533 int const n2c = { 1 };
534 int const c2n = { -1 };
539 Real const max_angle_delta_helix = { 1.0 };
540 Real const max_angle_delta_strand = { 5.0 };
541 Real const max_angle_delta_loop = { 10.0 };
543 Real const ccd_temperature = { 0.25 };
556 assert( coords[loop_begin].
size() == nbb && torsions[loop_begin].
size() == nbb );
563 rama = &(scoring::ScoringManager::get_instance()->get_Ramachandran());
564 for (
int i=loop_begin; i<= loop_end; ++i ) {
565 start_rama_score[i] = rama->eval_rama_score_residue( pose.
aa(i), torsions[i][1], torsions[i][2] );
573 int actual_cycles = ii_cycles;
579 for (
int ii = 1; ii <= ii_cycles; ++ii ) {
588 for (
int repeat = 1; repeat <= 2; ++repeat ) {
589 int direction,start_pos,stop_pos,increment;
592 start_pos = loop_begin;
593 stop_pos = std::min(loop_end,cutpoint);
597 start_pos = loop_end;
598 stop_pos = std::max(loop_begin,cutpoint+1);
607 for (
int i = 1; i <= 3; ++i ) {
608 if ( direction ==
n2c ) {
609 F.col( i, coords[ cutpoint + 1 ][ i ] );
611 F.col( i, coords[ cutpoint ][ nbb - 3 + i ] );
615 get_overlap_pos( coords, torsions, cutpoint, direction, bond_angle1, bond_length, bond_angle2, M );
618 check_overlap_pos( coords, torsions, cutpoint, direction, bond_angle1, bond_length, bond_angle2, M );
626 for (
int pos = start_pos; pos*increment <= stop_pos*increment;
632 Real max_angle_delta, max_total_delta;
634 max_angle_delta = max_angle_delta_helix;
635 max_total_delta = max_total_delta_helix;
636 }
else if ( pose.
secstruct(pos) ==
'E' ) {
637 max_angle_delta = max_angle_delta_strand;
638 max_total_delta = max_total_delta_strand;
640 max_angle_delta = max_angle_delta_loop;
641 max_total_delta = max_total_delta_loop;
644 if ( max_total_delta <= 0.01 ) {
645 tccd.Debug <<
"cant move this residue " << pos << std::endl;
653 save_coords.resize( nres );
654 for (
int i=loop_begin; i<= loop_end; ++i ) {
655 save_coords[i].resize( nbb );
656 for (
Size j=1; j<= nbb; ++j ) {
657 save_coords[i][j] = coords[i][j];
661 for (
Size torsion = 1; torsion <= nbb; ++torsion ) {
663 if ( !mm.
get( TorsionID( pos,
BB, torsion ) ) )
continue;
665 if ( pos == cutpoint && torsion == nbb )
continue;
668 check_overlap_pos( coords, torsions, cutpoint, direction, bond_angle1, bond_length, bond_angle2, M );
672 Real const alpha_orig( alpha );
675 if ( alpha > max_angle_delta ) alpha = max_angle_delta;
676 if ( alpha < -max_angle_delta ) alpha = -max_angle_delta;
679 Real const total_delta
680 ( basic::subtract_degree_angles( start_torsions[pos][torsion], torsions[pos][torsion] + alpha ) );
682 if ( total_delta > max_total_delta ) {
686 assert( alpha + max_total_delta < 180 );
688 alpha -= ( total_delta - max_total_delta + 0.01 );
690 alpha += ( total_delta - max_total_delta + 0.01 );
698 torsions[ pos ][ torsion ] = basic::periodic_range( torsions[pos][torsion] + alpha, 360.0 );
701 check_overlap_pos( coords, torsions, cutpoint, direction, bond_angle1, bond_length, bond_angle2, M );
707 check_torsions( loop_begin, loop_end, cutpoint, torsions, coords );
717 Real coord_dev = 0.0;
718 for (
int i = loop_begin; i <= loop_end; ++i ) {
719 for (
Size j = 1; j <= nbb; ++j ) {
720 coord_dev += coords[i][j].distance( tmp_coords[i][j] );
724 if ( coord_dev > 0.1 ) {
725 utility_exit_with_message(
"fold_loop_torsion dev:: " + string_of( coord_dev ) );
729 for (
int i = 1; i <= 3; ++i ) {
730 tmp_dev += M.col(i).distance_squared( F.col(i) );
733 if ( alpha == alpha_orig && std::abs( dev - tmp_dev) > 0.1 ) {
734 tccd.Warning <<
"WARNING:: ccd-dev error: " << dev <<
' ' <<
735 tmp_dev <<
' ' << std::abs( dev-tmp_dev) << std::endl;
739 tccd.Warning <<
"pos: " << I( 3, pos ) << I( 3, torsion) <<
740 " alpha-orig: " << fmt::F( 7, 3, alpha_orig ) <<
741 " alpha: " << fmt::F( 7, 3, alpha ) <<
742 " dev1: " << fmt::F( 13, 9, dev ) <<
743 " dev2: " << fmt::F( 13, 9, tmp_dev ) << std::endl;
753 Real const old_rama_score( rama->eval_rama_score_residue( pose.
aa(pos), torsions[pos][1], torsions[pos][2]));
754 Real const new_rama_score( rama->eval_rama_score_residue( pose.
aa(pos), save_torsions[1], save_torsions[2]));
757 tccd.Warning <<
"rama_check: " << pos <<
' ' << old_rama_score <<
' ' << new_rama_score << std::endl;
759 if ( new_rama_score > old_rama_score ) {
760 Real const boltz_factor ( (old_rama_score-new_rama_score)/ccd_temperature );
761 Real const negative_forty( -40.0f );
762 Real const probability ( std::exp(std::max(negative_forty,boltz_factor) ) );
763 if ( new_rama_score - start_rama_score[ pos ] > max_rama_score_increase ||
764 numeric::random::uniform() >= probability ) {
766 torsions[pos] = save_torsions;
769 for (
int i=loop_begin; i<= loop_end; ++i ) {
770 for (
Size j=1; j<= nbb; ++j ) {
771 coords[i][j] = save_coords[i][j];
775 get_overlap_pos( coords, torsions, cutpoint, direction, bond_angle1, bond_length, bond_angle2, M );
783 if ( ii%5 == 0 || ii == ii_cycles ) {
790 for (
int i = 1; i <= 3; ++i ) {
791 F.col( i, coords[ cutpoint + 1 ][ i ] );
794 get_overlap_pos( coords, torsions, cutpoint, direction, bond_angle1, bond_length, bond_angle2, M );
796 forward_deviation = 0.0;
797 for (
int i = 1; i <= 3; ++i ) {
798 for (
int j = 1; j <= 3; ++j ) {
802 forward_deviation = sqrt( forward_deviation / 3 );
806 for (
int i = 1; i <= 3; ++i ) {
807 F.col( i, coords[ cutpoint ][ nbb - 3 + i ] );
809 get_overlap_pos( coords, torsions, cutpoint, direction, bond_angle1, bond_length, bond_angle2, M );
811 backward_deviation = 0.0;
812 for (
int i = 1; i <= 3; ++i ) {
813 for (
int j = 1; j <= 3; ++j ) {
817 backward_deviation = sqrt( backward_deviation / 3 );
819 if (local_verbose)
tccd.Debug <<
"cycle/forward_dev/backward_dev: " << ii <<
" " << forward_deviation <<
" "
820 << backward_deviation << std::endl;
822 if ( forward_deviation < tolerance && backward_deviation < tolerance ) {
824 tccd.Debug <<
"closed early: ii= " << ii <<
' ' << tolerance << std::endl;
838 for (
int i=loop_begin; i<= loop_end; ++i ) {
839 for (
Size j=1; j<= nbb; ++j ) {
840 torsion_delta += std::abs( basic::subtract_degree_angles( start_torsions[i][j], torsions[i][j] ) );
843 Real const final_rama_score( rama->eval_rama_score_residue( pose.
aa(i), torsions[i][1], torsions[i][2] ) );
844 rama_delta += ( final_rama_score - start_rama_score[i] );
847 torsion_delta /= ( loop_end - loop_begin + 1);
848 rama_delta /= ( loop_end - loop_begin + 1);
850 PROF_STOP( basic::CCD_CLOSE );
851 return actual_cycles;
857 int const total_moves,
860 int const loop_begin,
872 bool const local_debug = {
false };
873 bool const local_verbose = {
false };
874 bool const rama_check = {
true };
876 int const n2c = { 1 };
877 int const c2n = { -1 };
883 Real const max_angle_delta_helix = { 1.0 };
884 Real const max_angle_delta_strand = { 5.0 };
885 Real const max_angle_delta_loop = { 10.0 };
887 Real const ccd_temperature = { 0.25 };
900 assert( coords[loop_begin].
size() == nbb && torsions[loop_begin].
size() == nbb );
908 Size total_insert( loop_end - loop_begin + 1 );
909 Real const H_weight ( 0.5 );
910 Real const E_weight ( 1.0 );
911 Real const L_weight ( 8.5 );
912 Real total_weight(0.0);
915 for (
Size i = 1; i <= total_insert; ++i ) {
917 char ss( pose.
secstruct( loop_begin - 1 + i ) );
920 total_weight += H_weight;
921 }
else if ( ss ==
'E' ) {
922 total_weight += E_weight;
925 total_weight += L_weight;
927 weight_map[ i ] = total_weight;
935 while ( nmoves <
Size ( total_moves ) ) {
937 if ( ntries >
Size ( 5*total_moves ) ) {
941 Real const weight( numeric::random::uniform()*total_weight );
943 for( ipos = 1; ipos <= total_insert; ++ipos ) {
944 if( weight < weight_map[ ipos ] )
break;
946 if( ipos > total_insert ) {
947 tccd.Debug <<
"ccd_moves: bad_weight " << weight <<
' ' <<
948 total_weight <<
' ' << weight_map[ total_insert ] << std::endl;
952 Size const pos = ipos + loop_begin - 1;
953 int const direction( pos <=
Size( cutpoint ) ?
n2c :
c2n );
961 for (
int i = 1; i <= 3; ++i ) {
962 if ( direction ==
n2c ) {
963 F.col( i, coords[ cutpoint + 1 ][ i ] );
965 F.col( i, coords[ cutpoint ][ nbb - 3 + i ] );
969 get_overlap_pos( coords, torsions, cutpoint, direction, bond_angle1, bond_length, bond_angle2, M );
972 check_overlap_pos( coords, torsions, cutpoint, direction, bond_angle1, bond_length, bond_angle2, M );
975 Real max_angle_delta;
977 max_angle_delta = max_angle_delta_helix;
978 }
else if ( pose.
secstruct(pos) ==
'E' ) {
979 max_angle_delta = max_angle_delta_strand;
981 max_angle_delta = max_angle_delta_loop;
988 save_coords.resize( nres );
989 for (
int i=loop_begin; i<= loop_end; ++i ) {
990 save_coords[i].resize( nbb );
991 for (
Size j=1; j<= nbb; ++j ) {
992 save_coords[i][j] = coords[i][j];
996 for (
Size torsion = 1; torsion <= nbb; ++torsion ) {
998 if ( !mm.
get( TorsionID( pos,
BB, torsion ) ) )
continue;
1000 if ( pos ==
Size( cutpoint ) && torsion == nbb )
continue;
1003 check_overlap_pos( coords, torsions, cutpoint, direction, bond_angle1, bond_length, bond_angle2, M );
1010 if ( alpha > max_angle_delta ) alpha = max_angle_delta;
1011 if ( alpha < -max_angle_delta ) alpha = -max_angle_delta;
1017 torsions[ pos ][ torsion ] = basic::periodic_range( torsions[pos][torsion] + alpha, 360.0 );
1020 check_overlap_pos( coords, torsions, cutpoint, direction, bond_angle1, bond_length, bond_angle2, M );
1028 rama = &(scoring::ScoringManager::get_instance()->get_Ramachandran());
1032 Real const old_rama_score( rama->eval_rama_score_residue( pose.
aa(pos), torsions[pos][1], torsions[pos][2]));
1033 Real const new_rama_score( rama->eval_rama_score_residue( pose.
aa(pos), save_torsions[1], save_torsions[2]));
1036 tccd.Debug <<
"rama_check: " << pos <<
' ' << old_rama_score <<
' ' << new_rama_score << std::endl;
1038 if ( new_rama_score > old_rama_score ) {
1039 Real const boltz_factor ( (old_rama_score-new_rama_score)/ccd_temperature );
1040 Real const negative_forty( -40.0f );
1041 Real const probability ( std::exp(std::max(negative_forty,boltz_factor) ) );
1042 if ( numeric::random::uniform() >= probability ) {
1044 torsions[pos] = save_torsions;
1047 for (
int i=loop_begin; i<= loop_end; ++i ) {
1048 for (
Size j=1; j<= nbb; ++j ) {
1049 coords[i][j] = save_coords[i][j];
1053 get_overlap_pos( coords, torsions, cutpoint, direction, bond_angle1, bond_length, bond_angle2, M );