Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
InteractionGraphFactory.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 core/pack/interaction_graph/InteractionGraphFactory.cc
11 /// @brief Interation graph factory class definition
12 /// @author Andrew Leaver-Fay (aleaverfay@gmail.com)
13 
14 // Unit headers
16 
17 // Package headers
26 
32 
34 
35 #include <basic/Tracer.hh>
36 
37 #include <utility/pointer/owning_ptr.hh>
38 
40 #include <core/scoring/Energies.hh>
42 #include <utility/vector0.hh>
43 #include <utility/vector1.hh>
44 #include <utility/options/BooleanVectorOption.hh>
45 
46 
47 namespace core {
48 namespace pack {
49 namespace interaction_graph {
50 
51 basic::Tracer T("core.pack.interaction_graph.interaction_graph_factory", basic::t_info );
52 
55  task::PackerTask const & the_task,
56  rotamer_set::RotamerSets const & rotsets,
57  pose::Pose const & pose,
58  scoring::ScoreFunction const & sfxn
59 )
60 {
61  core::Real surface_weight( sfxn.get_weight( core::scoring::surface ) );
62  core::Real hpatch_weight( sfxn.get_weight( core::scoring::hpatch ) );
63 
64  // don't use the surface or hpatch interaction graphs if we're not designing
65  if ( ! the_task.design_any() ) { surface_weight = 0; hpatch_weight = 0; }
66 
67  if ( the_task.linmem_ig() ) {
68  /// Symmetric OTFIGs are not currently capable of handling either the Surface or HPatch scores, so check
69  /// for symmetry first and return a (pairwise-decomposable) SymmLinearMemoryInteractionGraph if requested.
70  if ( pose::symmetry::is_symmetric( pose )) {
71  T << "Instantiating SymmLinearMemoryInteractionGraph" << std::endl;
73  symlinmemig->set_pose( pose );
74  symlinmemig->set_score_function( sfxn );
75  return symlinmemig;
76  }
77 
78  if ( surface_weight ) {
79  T << "Instantiating LinearMemorySurfaceInteractionGraph" << std::endl;
81  lmsolig->set_pose( pose );
82  lmsolig->set_packer_task( the_task );
83  lmsolig->set_score_function( sfxn );
84  lmsolig->set_rotamer_sets( rotsets );
85  lmsolig->set_surface_score_weight( surface_weight );
86  return lmsolig;
87  }
88 
89  if ( hpatch_weight ) {
90  T << "Instantiating LinearMemoryHPatchInteractionGraph" << std::endl;
92  lmhig->set_pose( pose );
93  lmhig->set_packer_task( the_task );
94  lmhig->set_score_function( sfxn );
95  lmhig->set_rotamer_sets( rotsets );
96  lmhig->set_score_weight( hpatch_weight );
97  return lmhig;
98  }
99 
100  T << "Instantiating LinearMemoryInteractionGraph" << std::endl;
102  lmig->set_pose( pose );
103  lmig->set_score_function( sfxn );
104  return lmig;
105 
106  } else if ( the_task.design_any() ) {
107 
108  if ( rotsets.nmoltenres() >= 1 ) { //we are altering at least one residue
109  if ( rotsets.rotamer_set_for_moltenresidue(1)->num_rotamers() >= 1 ) { //and it has at least one rotamer
110  if ( rotsets.rotamer_set_for_moltenresidue(1)->rotamer(1)->residue_type_set().name() != chemical::CENTROID ) { //and it's not centroid repacking
111  if ( surface_weight ) { //Note that surface overrides lazy!
112  T << "Instantiating PDSurfaceInteractionGraph" << std::endl;
114  pdsig->set_pose( pose );
115  pdsig->set_packer_task( the_task );
116  pdsig->set_rotamer_sets( rotsets );
117  pdsig->set_surface_score_weight( surface_weight );
118  return pdsig;
119 
120  } else if ( hpatch_weight ) {
121  T << "Instantiating PDHPatchInteractionGraph" << std::endl;
123  hig->set_pose( pose );
124  hig->set_packer_task( the_task );
125  hig->set_rotamer_sets( rotsets );
126  hig->set_score_weight( hpatch_weight );
127  return hig;
128 
129  } else if ( the_task.lazy_ig() ) {
130  T << "Instantiating LazyInteractionGraph" << std::endl;
132  lazy_ig->set_pose( pose );
133  lazy_ig->set_score_function( sfxn );
134  return lazy_ig;
135  } else if ( the_task.double_lazy_ig() ) {
136  T << "Instantiating DoubleLazyInteractionGraph" << std::endl;
138  double_lazy_ig->set_pose( pose );
139  double_lazy_ig->set_score_function( sfxn );
140  //T << "Setting DoubleLazyIngeractionGraph memory limit to " << the_task.double_lazy_ig_memlimit() << std::endl;
141  double_lazy_ig->set_memory_max_for_rpes( the_task.double_lazy_ig_memlimit() );
142  return double_lazy_ig;
143  } else {
144  T << "Instantiating PDInteractionGraph" << std::endl;
145  return new PDInteractionGraph( the_task.num_to_be_packed() );
146  }
147  }
148  }
149  }
150  }
151 
152  // either of the two below
153  // 'linmem_ig flag is off and design is not being performed', or 'linmem_ig flag is off and centroid mode design is being performed'
154  //This will also trigger if there are no rotamers
155  T << "Instantiating DensePDInteractionGraph" << std::endl;
156  return new DensePDInteractionGraph( the_task.num_to_be_packed() );
157 }
158 
159 }
160 }
161 }
162