32 #include <utility/vector1.hh>
35 #include <basic/Tracer.hh>
42 #include <numeric/xyz.functions.hh>
43 #include <ObjexxFCL/FArray2A.hh>
44 #include <basic/options/keys/score.OptionKeys.gen.hh>
45 #include <basic/options/option.hh>
49 static basic::Tracer
TR(
"core.scoring.disulfides.CentroidMatchingPotential");
60 namespace disulfides {
90 const core::Real probe_radius( basic::options::option[ basic::options::OptionKeys::score::disulf_matching_probe ] );
98 float mt_dist, mr_dist, mrt_dist;
99 float t_dist, r_dist, rt_dist;
102 mrt_dist = 3.0+probe_radius;
104 mt_dist = std::sqrt( scoring_RT.
get_translation().distance_squared( db_disulfides[1].get_translation() ));
105 r_dist = std::sqrt( scoring_RT.
get_rotation().col(1).distance_squared( db_disulfides[1].get_rotation().col(1) ) +
106 scoring_RT.
get_rotation().col(2).distance_squared( db_disulfides[1].get_rotation().col(2) ) +
107 scoring_RT.
get_rotation().col(3).distance_squared( db_disulfides[1].get_rotation().col(3) ) );
110 if (( r_dist <= mr_dist ) && ( mt_dist <= probe_radius )) mr_dist = r_dist;
112 if (( rt_dist <= mrt_dist ) && ( mt_dist <= probe_radius )) mrt_dist = rt_dist;
116 for (
Size d = 2; d <= db_disulfides.size(); ++d ) {
118 t_dist = std::sqrt( scoring_RT.
get_translation().distance_squared( db_disulfides[1].get_translation() ));
119 r_dist = std::sqrt( scoring_RT.
get_rotation().col(1).distance_squared( db_disulfides[1].get_rotation().col(1) ) +
120 scoring_RT.
get_rotation().col(2).distance_squared( db_disulfides[1].get_rotation().col(2) ) +
121 scoring_RT.
get_rotation().col(3).distance_squared( db_disulfides[1].get_rotation().col(3) ) );
126 if ( t_dist <= mt_dist ) mt_dist = t_dist;
127 if (( r_dist <= mr_dist ) && ( t_dist <= probe_radius )) mr_dist = r_dist;
128 if (( rt_dist <= mrt_dist ) && ( t_dist <= probe_radius )) mrt_dist = rt_dist;
150 if ( disulfides.size() > 0 ) {
152 for (
Size i = 1; i <= disulfides.size(); ++i ) {
154 Energy temp_RT(0.0), junk_rot(0.0), junk_trans(0.0);
157 pose.
residue(disulfides[i].first),
158 pose.
residue(disulfides[i].second),
196 Size const MAX_POS( 5 );
197 ObjexxFCL::FArray2D_float Epos1(3, MAX_POS), Epos2(3,MAX_POS);
199 Epos1(1,2) = res1_ptr->atom(res1_ptr->atom_index(
"CA")).
xyz()(1);
200 Epos1(2,2) = res1_ptr->atom(res1_ptr->atom_index(
"CA")).
xyz()(2);
201 Epos1(3,2) = res1_ptr->atom(res1_ptr->atom_index(
"CA")).
xyz()(3);
203 Epos1(1,1) = res1_ptr->atom(res1_ptr->atom_index(
"N")).
xyz()(1);
204 Epos1(2,1) = res1_ptr->atom(res1_ptr->atom_index(
"N")).
xyz()(2);
205 Epos1(3,1) = res1_ptr->atom(res1_ptr->atom_index(
"N")).
xyz()(3);
207 Epos1(1,4) = res1_ptr->atom(res1_ptr->atom_index(
"C")).
xyz()(1);
208 Epos1(2,4) = res1_ptr->atom(res1_ptr->atom_index(
"C")).
xyz()(2);
209 Epos1(3,4) = res1_ptr->atom(res1_ptr->atom_index(
"C")).
xyz()(3);
211 Epos2(1,2) = res2_ptr->atom(res2_ptr->atom_index(
"CA")).
xyz()(1);
212 Epos2(2,2) = res2_ptr->atom(res2_ptr->atom_index(
"CA")).
xyz()(2);
213 Epos2(3,2) = res2_ptr->atom(res2_ptr->atom_index(
"CA")).
xyz()(3);
215 Epos2(1,1) = res2_ptr->atom(res2_ptr->atom_index(
"N")).
xyz()(1);
216 Epos2(2,1) = res2_ptr->atom(res2_ptr->atom_index(
"N")).
xyz()(2);
217 Epos2(3,1) = res2_ptr->atom(res2_ptr->atom_index(
"N")).
xyz()(3);
219 Epos2(1,4) = res2_ptr->atom(res2_ptr->atom_index(
"C")).
xyz()(1);
220 Epos2(2,4) = res2_ptr->atom(res2_ptr->atom_index(
"C")).
xyz()(2);
221 Epos2(3,4) = res2_ptr->atom(res2_ptr->atom_index(
"C")).
xyz()(3);
232 numeric::xyzMatrix_double
const & p,
233 numeric::xyzMatrix_double & m
236 using namespace numeric;
238 xyzVector_double a1 = p.col_x() - p.col_y();
239 xyzVector_double a2 = p.col_z() - p.col_y();
241 xyzVector_double a3 = cross( a1, a2 );
243 a2 = cross( a3, a1 );
245 m = xyzMatrix_double::cols( a1, a2, a3 );
250 ObjexxFCL::FArray2A_float pos,
251 numeric::xyzMatrix_double & p
254 pos.dimension( 3, 5 );
255 using namespace numeric;
257 xyzVector_double n( &pos(1,1) );
258 xyzVector_double ca( &pos(1,2) );
259 xyzVector_double
c( &pos(1,4) );
261 p = xyzMatrix_double::cols( n, ca, c );
265 numeric::xyzMatrix_double
268 pos.dimension( 3, 5 );
269 using namespace numeric;
271 xyzVector_double n( &pos(1,1) );
272 xyzVector_double ca( &pos(1,2) );
273 xyzVector_double
c( &pos(1,4) );
275 return xyzMatrix_double::cols( n, ca, c );
289 Size const MAX_POS( 5 );
290 Epos1.dimension(3,MAX_POS);
291 Epos2.dimension(3,MAX_POS);
295 numeric::xyzMatrix_double p1, p2, m1, m2;
320 numeric::xyzVector_double e1( &Epos1(1,2) );
321 numeric::xyzVector_double e2( &Epos2(1,2) );
325 translation = m1.transposed() * ( e2 - e1 );
349 rotation = m1.transposed() * m2;