19 #include <numeric/conversions.hh>
20 #include <numeric/trig.functions.hh>
21 #include <numeric/xyzVector.hh>
23 #include <utility/vector1.hh>
34 namespace potentials {
58 using numeric::conversions::degrees;
59 using numeric::sin_cos_range;
64 Vector const uz( v1.normalized_or_zero() );
65 Vector const uy( uz.cross( v21 ).normalized_or_zero() );
66 Vector const ux( uy.cross( uz ).normalized_or_zero() );
68 Real const v2x = v2.dot( ux );
69 Real const v2y = v2.dot( uy );
70 Real const v2z = v2.dot( uz );
72 Vector const u21( v21.normalized_or_zero() );
76 if ( v2y != 0.0 && v2x != 0.0 ) {
77 phi = degrees( std::atan2( v2y, v2x ) );
81 }
else if ( phi < -180.0 ) {
85 Real r1 = v2.length();
86 Real const v2z_r1 = v2z/r1;
87 if ( r1 != 0.0 && std::abs( v2z_r1 ) <= 1.0 ) {
88 theta = degrees( numeric::arccos( v2z_r1 ) );
89 }
else if ( v2z_r1 > 1.0 ) {
106 Size begin ( std::min(pos1,pos2) );
107 Size end ( std::max(pos1,pos2) );
108 bool is_break (
false );
110 for (
Size i = begin; i <
end; ++i ) {
115 return end - begin + gap_size;