Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DiversifyDihedralsSelector.cc
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 // vi: set ts=2 noet:
3 //
4 // (c) Copyright Rosetta Commons Member Institutions.
5 // (c) This file is part of the Rosetta software suite and is made available under license.
6 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9 
10 /// @file protocols/frag_picker/CompositeFragmentSelector.cc
11 /// @brief provides a selector that picks fragments diferent enough from the fragments that have been already picked
12 /// @author Dominik Gront (dgront@chem.uw.edu.pl)
13 
15 
16 // package headers
19 
20 #include <basic/Tracer.hh>
21 #include <utility/vector1.hh>
22 #include <cmath>
23 
24 namespace protocols {
25 namespace frag_picker {
26 
27 using namespace core;
28 
29 static basic::Tracer trDiversifyDihedralsSelector(
30  "protocols.frag_picker.DiversifyDihedralsSelector");
31 
32 
33 /// @brief Selects desired number of fragments from a given set of candidates
35  ScoredCandidatesVector1 const& in,
37 {
38 
39  if(in.size()==0) return;
40 
41  Size len = in[1].first->get_length();
42 
43  if (phi_.size() < len) {
44  phi_.resize(len);
45  psi_.resize(len);
46  }
47 
48  out.push_back( in[1] );
49  for(Size i=2;i<=in.size();i++) {
50  if(out.size() >= frags_per_pos() ) break;
51  bool is_ok = true;
52  for(Size j=1;j<=out.size();j++) {
53  Real rms = dihedral_rmsd(in[i].first, out[j].first);
54  if(rms<cutoff_) {
55  is_ok = false;
56  trDiversifyDihedralsSelector.Trace<<"Phi-Psi rmsd is "<<rms<<" fragment "<< *in[i].first<<" denied"<<std::endl;;
57  break;
58  }
59  }
60  if(is_ok) {
61  out.push_back( in[i] );
62  trDiversifyDihedralsSelector.Trace<<"Fragment "<< *in[i].first<<" passed"<<std::endl;;
63  }
64  }
65  trDiversifyDihedralsSelector<<out.size()<<" fragments passed through DiversifyDihedralsSelector at query position "
66  << in[1].first->get_first_index_in_query()<<std::endl;
67 }
68 
70 
71  Real rms = 0.0;
72  assert ( f1->get_length() == f2->get_length() );
73  for(Size k=1;k<=f1->get_length();k++) {
74  Real d = f1->get_residue(k)->phi() - f2->get_residue(k)->phi();
75  rms += d*d;
76  d = f1->get_residue(k)->psi() - f2->get_residue(k)->psi();
77  rms += d*d;
78  d = f1->get_residue(k)->omega() - f2->get_residue(k)->omega();
79  rms += d*d;
80  }
81 
82  return sqrt(rms) / (3.0 * f1->get_length());
83 }
84 
85 } // frag_picker
86 } // protocols