20 #include <utility/string_util.hh>
21 #include <utility/exit.hh>
27 #include <boost/lexical_cast.hpp>
28 #include <basic/Tracer.hh>
30 #include <ObjexxFCL/format.hh>
33 #include <numeric/xyzVector.hh>
34 #include <numeric/conversions.hh>
36 #include <utility/vector1.hh>
39 static basic::Tracer
TR(
"protocols.topology.HelixPairing" );
49 HelixPairing::HelixPairing():
56 align_angle_( -99.0 ),
71 align_angle_( -99.0 ),
74 runtime_assert( h1 < h2 );
82 align_angle_( -99.0 ),
86 runtime_assert( parts.size() == 2 );
89 h1_ = boost::lexical_cast<
Size>( helices[1] );
90 h2_ = boost::lexical_cast<
Size>( helices[2] );
91 runtime_assert(
h1_ < h2_ );
93 char para = parts[2][0];
94 runtime_assert( para ==
'P' || para ==
'A' );
103 using namespace boost;
132 using ObjexxFCL::fmt::F;
134 out <<
A( 7, hp.
name() ) <<
" "
160 if(
orient() ==
'A' ) flip = -1.0;
162 Helices const & helices( ss_info->helices() );
163 Strands const & strands( ss_info->strands() );
165 Helix const & hx1 = *helices[
h1() ];
166 Helix const & hx2 = *helices[
h2() ];
169 dist_ = midvec.length();
170 cross_angle_ = numeric::conversions::degrees( angle_of( hx1.orient(), flip*hx2.
orient() ) );
174 if( r1 < 1 || r2 < 1 )
return;
176 Size const s1 = ss_info->strand_id(
Size( r1 ) );
177 Size const s2 = ss_info->strand_id(
Size( r2 ) );
178 if( s1 == 0 || s2 == 0 )
return;
181 Real dot = ss_info->strand( s1 )->orient().dot( ss_info->strand( s2 )->orient() );
183 if( dot < 0 ) sign = -1.0;
185 Vector const v1 = ( strands[ s2 ]->mid_pos() - strands[ s1 ]->mid_pos() ).normalized();
186 Vector const v2 = ( strands[ s1 ]->orient() + sign*strands[ s2 ]->orient() ).normalized();
187 Vector sheet_plane = v1.cross( v2 );
189 Vector const h1 = hx1.Nend_pos() - sheet_plane.dot( hx1.Nend_pos() - strands[ s2 ]->mid_pos() )*sheet_plane;
190 Vector const h2 = hx1.Cend_pos() - sheet_plane.dot( hx1.Cend_pos() - strands[ s2 ]->mid_pos() )*sheet_plane;
192 Vector const h4 = hx2.
Cend_pos() - sheet_plane.dot( hx2.
Cend_pos() - strands[ s2 ]->mid_pos() )*sheet_plane;
199 align_angle_ = numeric::conversions::degrees( angle_of( v3, flip*v4 ) );
207 hpairset_name_(
"" ),
209 initialize_map_helix_pairings_( false )
214 hpairset_name_( helix_pairings ),
216 initialize_map_helix_pairings_( false )
218 if( helix_pairings ==
"" ) {
230 helix_pairings_( helix_pairings ),
231 hpairset_name_(
"" ),
233 initialize_map_helix_pairings_( false )
249 helix_pairings_( s.helix_pairings_ ),
250 hpairset_name_( s.hpairset_name_ ),
251 num_helices_( s.num_helices_ ),
252 initialize_map_helix_pairings_( s.initialize_map_helix_pairings_ ),
253 map_helix_pairings_( s.map_helix_pairings_ )
269 out <<
"#### HelixPairingSet Info " << std::endl;
270 out <<
"# " << s.
name() << std::endl;
271 out <<
"# name distance cross_angle align_angle " << std::endl;
273 for( HelixPairings::const_iterator iter = hpairs.begin(); iter != hpairs.end(); ++iter ) {
274 out <<
"# " << (**iter) << std::endl;
352 hpair->calc_geometry( ss_info );