25 #include <ObjexxFCL/FArray2D.hh>
28 #include <utility/vector1.functions.hh>
31 #include <utility/vector1.hh>
36 namespace match_enzdes_util {
44 ignore_h_collisions_( false )
49 ligand_restype_( other.ligand_restype_ ),
50 orientation_atoms_( other.orientation_atoms_ ),
51 oats_in_D3_frame_( other.oats_in_D3_frame_ ),
52 oframe_in_D3frame_( other.oframe_in_D3frame_ ),
53 points_in_global_orintation_frame_( other.points_in_global_orintation_frame_ ),
54 atoms_123_( other.atoms_123_ ),
57 ang123_( other.ang123_ ),
58 points_in_D3_frame_( other.points_in_D3_frame_ ),
59 collision_check_id_2_restype_id_( other.collision_check_id_2_restype_id_ ),
60 restype_id_2_collision_check_id_( other.restype_id_2_collision_check_id_ )
110 return numeric::constants::d::radians_to_degrees *
111 numeric::angle_radians(
120 Real6 const & orientation,
136 for (
Size ii = 1; ii <= atom_indices.size(); ++ii ) {
138 assert( atom_indices[ ii ].rsd() == 1 );
151 Size orientation_atom1,
152 Size orientation_atom2,
153 Size orientation_atom3,
165 d12_ = residue.
xyz( D1 ).distance( residue.
xyz( D2 ) );
166 d23_ = residue.
xyz( D2 ).distance( residue.
xyz( D3 ) );
167 ang123_ = numeric::constants::d::radians_to_degrees * numeric::angle_radians(
168 residue.
xyz( D1 ), residue.
xyz( D2 ), residue.
xyz( D3 ) );
171 orientation_atoms_[ 2 ] = orientation_atom2;
172 orientation_atoms_[ 3 ] = orientation_atom3;
176 utility_exit_with_message(
"ERROR in LigandConformer: cannot build a residue with fewer than three atoms" );
180 HTReal D3frame( residue.
xyz( D1 ), residue.
xyz( D2 ), residue.
xyz( D3 ) );
181 HTReal oframe( residue.
xyz( orientation_atom1 ), residue.
xyz( orientation_atom2 ), residue.
xyz( orientation_atom3 ) );
188 for (
Size ii = 1; ii <= natoms; ++ii ) {
193 bool const atom1_virtual = residue.
atom_type( D1 ).
name() ==
"X";
194 bool const atom2_virtual = residue.
atom_type( D2 ).
name() ==
"X";
195 bool const atom3_virtual = residue.
atom_type( D3 ).
name() ==
"X";
197 bool atom1_heavy = residue.
atom_type( D1 ).
element() !=
"H" && ! atom1_virtual;
198 bool atom2_heavy = residue.
atom_type( D2 ).
element() !=
"H" && ! atom2_virtual;
199 bool atom3_heavy = residue.
atom_type( D3 ).
element() !=
"H" && ! atom3_virtual;
202 for (
Size ii = 1; ii <= natoms; ++ii )
if ( residue.
atom_type( ii ).
element() ==
"X" ) ++nvirt;
205 residue.
nheavyatoms() - ( atom1_heavy ? 1 : 0 ) - ( atom2_heavy ? 1 : 0 ) - ( atom3_heavy ? 1 : 0 ) :
206 natoms - nvirt - ( atom1_virtual ? 0 : 1 ) - ( atom2_virtual ? 0 : 1 ) - ( atom3_virtual ? 0 : 1 ));
212 selected[ D1 ] = selected[ D2 ] = selected[ D3 ] =
true;
237 Vector euler_angles = global_frame.euler_angles_deg();
238 for (
Size ii = 1; ii <= 3; ++ii )
if ( euler_angles( ii ) < 0 ) euler_angles( ii ) += 360.0;
239 Vector oat3_coords = global_frame.point();
242 global_coords[ 1 ] = oat3_coords( 1 );
243 global_coords[ 2 ] = oat3_coords( 2 );
244 global_coords[ 3 ] = oat3_coords( 3 );
245 global_coords[ 4 ] = euler_angles( 1 );
246 global_coords[ 5 ] = euler_angles( 2 );
247 global_coords[ 6 ] = euler_angles( 3 );
282 return global_coords;
290 Vector oat3_coord(orientation[ 1 ], orientation[ 2 ], orientation[ 3 ] );
291 Vector euler_deg( orientation[ 4 ], orientation[ 5 ], orientation[ 6 ] );
298 oframe.from_euler_angles_deg( euler_deg );
299 oframe.set_point( oat3_coord );
308 Vector euler_deg2 = oframe.euler_angles_deg();
318 utility_exit_with_message(
"ERROR: ignore_h_collisions_ must be set before the downstream restype is initialized" );
329 Size start_from( 1 );
331 for (
Size ii = 1; ii <= restype_atnos_to_move_early.size(); ++ii ) {
332 Size iiatom = restype_atnos_to_move_early[ ii ];
334 selected[ iiatom ] =
true;
341 for (
Size ii = 1; ii <= 3; ++ii ) {
354 ObjexxFCL::FArray2D< numeric::Real > & coords,
355 HTReal const & orientation_frame,
359 for(
core::Size ii = 1; ii <= restype_atomnos.size(); ++ii ){
361 coords( 1, ii ) = coord[0];
362 coords( 2, ii ) = coord[1];
363 coords( 3, ii ) = coord[2];
378 ObjexxFCL::FArray2D< Real > atdists( natoms, natoms );
381 for (
Size ii = 1; ii <= natoms; ++ii ) {
383 if (
ligand_restype_->atom_type( ii ).element() ==
"X" ) ignore[ ii ] =
true;
384 if ( ignore[ ii ] )
continue;
386 for(
Size jj = ii + 1; jj <= natoms; ++jj ) {
393 for (
Size ii = count_from; ii <= n_atoms_for_collision_check; ++ii ) {
395 std::fill( atdist_sums.begin(), atdist_sums.end(), 0.0);
396 for (
Size jj = 1; jj <= natoms; ++jj ) {
397 if ( selected[ jj ] || ignore[ jj ] ) {
398 atdist_sums[ jj ] = -1.0;
400 for (
Size kk = 1; kk <= natoms; ++kk ) {
401 if ( ignore[ kk ] )
continue;
402 if ( selected[ kk ] ) atdist_sums[ jj ] += atdists( kk, jj );
408 Size furthest = utility::arg_max( atdist_sums );
412 selected[ furthest ] =
true;