23 #include <basic/Tracer.hh>
24 #include <numeric/random/random_permutation.hh>
25 #include <utility/vector1.hh>
30 #include <utility/vector0.hh>
34 namespace ligand_docking {
37 static basic::Tracer
TR(
"protocols.ligand_docking.grid_functions", basic::t_debug);
38 static numeric::random::RandomGenerator
my_RG(810329);
53 if( grid.
is_in_grid( atom.x(), atom.y(), atom.z() ) ) {
54 score += grid.
getValue( atom.x(), atom.y(), atom.z() );
57 TR <<
"Grid score: " << score << std::endl;
73 if( grid.
is_in_grid( atom.x(), atom.y(), atom.z() ) ) {
74 int val = grid.
getValue( atom.x(), atom.y(), atom.z() );
75 if( val > 0 ) rep_out += val;
79 TR <<
"Grid score rep=" << rep_out <<
" atr=" << atr_out << std::endl;
92 for(; begin <=
end; ++begin){
107 return std::pair<int, int>(atr,rep);
124 if( conformers.empty() )
return;
128 int best_score = 9999;
130 for(
core::Size i = 1, i_end = conformers.size(); i <= i_end; ++i) {
132 int const new_score =
grid_score(grid, *rsd, best_score);
133 if( new_score < best_score && new_score >= min_score ) {
134 best_score = new_score;
136 if(best_score == min_score)
break;
142 TR <<
"Best fit is conformer " << best_i <<
" with score " << best_score << std::endl;
160 if( conformers.empty() )
return;
161 TR<<
"conformers.size: "<< conformers.size()<< std::endl;
166 int best_rep = 9999, best_atr = 0;
168 for(
core::Size i = 1, i_end = conformers.size(); i <= i_end; ++i) {
170 int new_atr(0), new_rep(0);
172 if( new_rep < best_rep || (new_rep == best_rep && new_atr < best_atr) ) {
176 if(best_rep == perfect_rep && best_atr == perfect_atr)
break;
182 TR <<
"Best fit is conformer " << best_i <<
" with score rep=" << best_rep <<
" atr=" << best_atr << std::endl;
196 for(; begin <=
end; ++begin){
197 TR<<
"now performing rotamer trials on "<< begin << std::endl;
209 using namespace core::pack::task;
213 PackerTaskOP dummy_task = TaskFactory::create_packer_task(pose);
218 if( reslib.get() == NULL )
return;
224 reslib->fill_rotamer_vector(
231 empty_extra_chi_steps,
239 numeric::random::random_permutation(conformers_out,
my_RG);
258 int nx(0), ny(0), nz(0);
261 GridPt grid_min = grid.
gridpt( center - vec_rad );
262 GridPt grid_max = grid.
gridpt( center + vec_rad );
263 for(
int i = max(0, grid_min.x()), i_end = min(nx-1, grid_max.x()); i <= i_end; ++i) {
264 for(
int j = max(0, grid_min.y()), j_end = min(ny-1, grid_max.y()); j <= j_end; ++j) {
265 for(
int k = max(0, grid_min.z()), k_end = min(nz-1, grid_max.z()); k <= k_end; ++k) {
266 GridPt grid_pt(i, j, k);
269 if( box_ctr.distance_squared(center) <= radius2 ) grid.
setValue(grid_pt, value);
294 TR <<
"make_atr_rep_grid"<<std::endl;
295 using namespace core;
296 int const num_pts = 160;
297 Real const resol = 0.25;
298 Real const grid_halfwidth = (num_pts * resol) / 2.0;
299 Real const atr_rad = 4.75;
300 Real const rep_rad = 2.25;
305 center.x() - grid_halfwidth,
306 center.y() - grid_halfwidth,
307 center.z() - grid_halfwidth
309 grid->setDimensions(num_pts, num_pts, num_pts, resol, resol, resol);
347 ligand_chain_ids_to_exclude.push_back(ligand_chain_id_to_exclude);
358 TR <<
"make_atr_rep_grid_without_ligands"<<std::endl;
359 using namespace core;
360 int const num_pts = 160;
361 Real const resol = 0.25;
362 Real const grid_halfwidth = (num_pts * resol) / 2.0;
363 Real const atr_rad = 4.75;
364 Real const rep_rad = 2.25;
369 center.x() - grid_halfwidth,
370 center.y() - grid_halfwidth,
371 center.z() - grid_halfwidth
373 grid->setDimensions(num_pts, num_pts, num_pts, resol, resol, resol);
382 ligand_chain_ids_to_exclude.begin(),
383 ligand_chain_ids_to_exclude.end(),
385 ) != ligand_chain_ids_to_exclude.end()
399 ligand_chain_ids_to_exclude.begin(),
400 ligand_chain_ids_to_exclude.end(),
402 ) != ligand_chain_ids_to_exclude.end()