25 #include <basic/prof.hh>
26 #include <basic/Tracer.hh>
32 #include <numeric/constants.hh>
35 #include <utility/vector1.fwd.hh>
36 #include <utility/pointer/ReferenceCount.hh>
37 #include <numeric/numeric.functions.hh>
45 #include <utility/vector1.hh>
49 namespace simple_moves {
53 static basic::Tracer
trGunnCost(
"protocols.FragmentMover.GunnCost");
64 if ( frame.
length() == 1 ) {
75 if ( !
frag_cache_.retrieve( frame, i, frag_gunn ) ) {
79 scores[ i ] =
score_tuple( curr_pose_gunn, frag_gunn );
84 using namespace core::pose;
86 PROF_START( basic::TEST3 );
101 PROF_STOP( basic::TEST3 );
106 if ( begin == end )
return;
115 id::AtomID Nj( rtj.atom_index (
"N") , begin );
116 id::AtomID CAj( rtj.atom_index (
"CA") , begin );
117 id::AtomID Cj( rtj.atom_index (
"C") , begin );
118 p1 = pose.
xyz ( Nj );
119 p2 = pose.
xyz ( CAj );
120 p3 = pose.
xyz ( Cj );
134 cross( x1, p3 - p2, z1 );
145 p1 = pose.
xyz ( Nk );
146 p2 = pose.
xyz ( CAk );
147 p3 = pose.
xyz ( Ck );
156 cross( x2, p3 - p2, z2 );
162 R = pose.
xyz( CAk ) - pose.
xyz( CAj );
166 data.
q6 = R.length();
169 data.
q1 = dot_product( x1, R );
170 data.
q2 = dot_product( x2, R );
171 data.
q3 = dot_product( x1, x2) - data.
q1 * data.
q2;
172 data.
q3 /= ( std::sqrt( (1-data.
q1*data.
q1) * (1-data.
q2*data.
q2) ) + .0001 );
173 data.
q3 = std::acos( numeric::sin_cos_range( data.
q3 ) );
174 data.
q4 = std::acos( numeric::sin_cos_range( dot_product( y1, R ) / ( std::sqrt( 1-data.
q1 * data.
q1 ) + .0001 ) ) );
175 data.
q5 = std::acos( numeric::sin_cos_range( dot_product( y2, R ) / ( std::sqrt( 1-data.
q2 * data.
q2 ) + .0001 ) ) );
180 using numeric::constants::d::pi_over_2;
181 using numeric::constants::d::pi;
188 Real d3 ( std::abs( g1.
q3 - g2.
q3 ) );
189 if ( d3 > pi_over_2 ) d3 = pi - d3;
190 Real d4 ( std::abs( g1.
q4 - g2.
q4 ) );
191 if ( d4 > pi_over_2 ) d4 = pi - d4;
192 Real d5 ( std::abs( g1.
q5 - g2.
q5 ) );
193 if ( d5 > pi_over_2 ) d5 = pi - d5;
196 c3 * std::log( 1.0 + ( std::abs( g1.
q1 - g2.
q1 ) + std::abs( g1.
q2 - g2.
q2 ) ) ) +
197 c2 * std::log( 1.0 + std::abs( g1.
q6 - g2.
q6 ) ) +
198 c1 * std::log( 1.0 + d3 ) +
199 c4 * std::log( 1.0 + d4 + d5 );
200 if ( cost < 2.95 ) cost = 100;