29 #include <basic/Tracer.hh>
40 #include <numeric/xyzMatrix.hh>
41 #include <numeric/xyzVector.hh>
46 #include <utility/vector1.hh>
52 static basic::Tracer
tr(
"core.scoring.rna.RNA_FullAtomStackingEnergy");
82 full_stack_cutoff_ ( 4.0 ),
84 dist_cutoff2_ ( dist_cutoff_ * dist_cutoff_ ),
85 base_base_only_( true )
109 rna_centroid_info.
update( pose );
120 rna_centroid_info.
update( pose );
135 if ( !rsd1.
is_RNA() )
return;
136 if ( !rsd2.
is_RNA() )
return;
138 Real score_aro1( 0.0 ), score_aro2( 0.0 );
147 if ( score <= -0.0001 ) {
178 Matrix const M_i ( stub_i.M );
189 if(rsd1.
type().
atom_name(m) !=
" O2*") utility_exit_with_message(
"m==rsd1.first_sidechain_atom() but rsd1.type().atom_name(m) !=\" O2*\" ");
193 Vector const heavy_atom_i( rsd1.
xyz( m ) );
204 if(rsd2.
type().
atom_name(n) !=
" O2*") utility_exit_with_message(
"n==rsd2.first_sidechain_atom() but rsd2.type().atom_name(n) !=\" O2*\" ");
211 Vector const heavy_atom_j( rsd2.
xyz( n ) );
212 Vector r = heavy_atom_j - heavy_atom_i;
213 Real const dist2 = r.length_squared();
219 score += fa_stack_score;
221 if (
is_aro( rsd1, m) &&
is_aro( rsd2, n) ) score_aro += fa_stack_score;
260 Size const & m,
Size const & n )
const {
266 if(rsd1.
type().
atom_name(m) !=
" O2*") utility_exit_with_message(
"m==rsd1.first_sidechain_atom() but rsd1.type().atom_name(m) !=\" O2*\" ");
276 if(rsd2.
type().
atom_name(n) !=
" O2*") utility_exit_with_message(
"n==rsd2.first_sidechain_atom() but rsd2.type().atom_name(n) !=\" O2*\" ");
289 Size const & m )
const {
313 if (rsd1.is_virtual(m))
return;
314 if ( !rsd1.is_RNA() )
return;
316 if ( m > rsd1.nheavyatoms() )
return;
325 Matrix const M_i ( stub_i.M );
327 Vector const heavy_atom_i( rsd1.xyz( m ) );
329 bool const pos1_fixed( domain_map( i ) != 0 );
335 EnergyGraph const & energy_graph( energies.energy_graph() );
338 iter = energy_graph.get_node( i )->const_edge_list_begin(),
340 iter != itere; ++iter ) {
342 Size const j( (*iter)->get_other_ind( i ) );
344 if ( pos1_fixed && domain_map(i) == domain_map(j) )
continue;
348 if ( !rsd2.is_RNA() )
continue;
356 for (
Size n = 1; n <= rsd2.nheavyatoms(); ++n ) {
359 if(rsd2.is_virtual(n))
continue;
363 Vector const heavy_atom_j( rsd2.xyz( n ) );
364 Vector r = heavy_atom_j - heavy_atom_i;
365 Real const dist2 = r.length_squared();
375 F1 += -1.0 * cross( force_vector_i, heavy_atom_j );
376 F2 += -1.0 * force_vector_i;
387 F1 += cross( force_vector_j, heavy_atom_i );
388 F2 += force_vector_j;
405 Vector const z_i = M_i.col_z();
407 Real const r = r_vec.length();
408 Real const z = dot( z_i, r_vec );
409 Real const cos_kappa = z / r;
414 score *= cos_kappa * cos_kappa ;
423 Real const b3 = b2*
b;
424 score *= ( 2 * b3 - 3 * b2 + 1 );
447 Vector const x_i = M_i.col_x();
448 Vector const y_i = M_i.col_y();
449 Vector const z_i = M_i.col_z();
451 Real const r = r_vec.length();
452 Real const x = dot( x_i, r_vec );
453 Real const y = dot( y_i, r_vec );
454 Real const z = dot( z_i, r_vec );
455 Real const cos_kappa = z / r;
463 dE_dcoskappa *= 2 * cos_kappa ;
469 Real b2( 0.0 ), b3( 0.0 );
472 if ( b > 0.0 && b < 1.0) {
475 dE_dcoskappa *= ( 2 * b3 - 3 * b2 + 1 );
484 dE_dr *= cos_kappa * cos_kappa ;
488 if ( b > 0.0 && b < 1.0) {
489 dE_dr *= ( 6 * b2 - 6 *
b );
490 dE_dr /= distance_scale;
495 Real const dE_dx = ( dE_dr ) * (x/r) - (dE_dcoskappa) * (x * z)/ (r*r*r) ;
496 Real const dE_dy = ( dE_dr ) * (y/r) - (dE_dcoskappa) * (y * z)/ (r*r*r) ;
497 Real const dE_dz = ( dE_dr ) * (z/r) + (dE_dcoskappa) * (x*x + y*y)/ (r*r*r);
501 return (dE_dx * x_i + dE_dy * y_i + dE_dz * z_i );