Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SymShakeStructureMover.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
11 /// @brief
12 /// @author Liz Kellogg
13 
14 
15 
16 #include <core/types.hh>
17 
18 #include <core/chemical/AA.hh>
19 // AUTO-REMOVED #include <core/conformation/Residue.hh>
20 // AUTO-REMOVED #include <core/conformation/ResidueMatcher.hh>
21 // AUTO-REMOVED #include <core/chemical/ResidueTypeSet.hh>
22 // AUTO-REMOVED #include <core/chemical/ResidueSelector.hh>
23 // AUTO-REMOVED #include <core/conformation/ResidueFactory.hh>
24 
26 // AUTO-REMOVED #include <core/conformation/symmetry/util.hh>
27 
28 
32 
33 // AUTO-REMOVED #include <core/pack/pack_rotamers.hh>
34 // AUTO-REMOVED #include <core/pack/task/PackerTask.hh>
35 // AUTO-REMOVED #include <core/pack/task/TaskFactory.hh>
36 
38 
41 
42 #include <core/pose/Pose.hh>
43 
44 // AUTO-REMOVED #include <basic/options/util.hh>
45 // AUTO-REMOVED #include <basic/options/after_opts.hh>
46 // AUTO-REMOVED #include <basic/options/keys/OptionKeys.hh>
47 
48 // AUTO-REMOVED #include <core/init.hh>
49 // AUTO-REMOVED #include <core/io/pdb/pose_io.hh>
50 
51 #include <numeric/xyzVector.hh>
52 // AUTO-REMOVED #include <numeric/random/random.hh>
53 // AUTO-REMOVED #include <core/pack/task/ResfileReader.hh>
54 
55 // AUTO-REMOVED #include <fstream>
56 #include <iostream>
57 #include <sstream>
58 // AUTO-REMOVED #include <ios>
59 // AUTO-REMOVED #include <utility/io/izstream.hh>
60 
61 // C++ headers
62 #include <cstdlib>
63 #include <string>
64 
65 #include <basic/Tracer.hh>
66 
67 
68 // AUTO-REMOVED #include <core/chemical/ResidueTypeSet.fwd.hh>
69 
70 // AUTO-REMOVED #include <core/scoring/sasa.hh>
71 // AUTO-REMOVED #include <core/scoring/rms_util.hh>
72 //#include <core/scoring/ScoringManager.hh>
74 // AUTO-REMOVED #include <core/scoring/constraints/ConstraintIO.hh>
77 // AUTO-REMOVED #include <core/scoring/constraints/AtomPairConstraint.hh>
80 // AUTO-REMOVED #include <core/id/AtomID_Map.hh>
81 // AUTO-REMOVED #include <core/id/AtomID_Map.Pose.hh>
82 #include <core/id/AtomID.hh>
83 #include <core/id/DOF_ID.hh>
84 // AUTO-REMOVED #include <core/kinematics/AtomTree.hh>
85 #include <core/kinematics/Jump.hh>
86 
87 #include <core/pose/Pose.fwd.hh>
88 // AUTO-REMOVED #include <core/pose/PDBInfo.hh>
89 
90 
91 // AUTO-REMOVED #include <basic/options/option.hh>
92 
93 // AUTO-REMOVED #include <basic/basic.hh>
94 // AUTO-REMOVED #include <basic/database/open.hh>
95 // AUTO-REMOVED #include <core/io/silent/SilentFileData.hh>
96 // AUTO-REMOVED #include <core/io/silent/ProteinSilentStruct.hh>
97 
98 // AUTO-REMOVED #include <core/pack/rotamer_trials.hh>
100 // AUTO-REMOVED #include <core/io/silent/silent.fwd.hh>
101 
102 //protocols
108 // AUTO-REMOVED #include <protocols/simple_moves/RotamerTrialsMover.hh>
111 #include <protocols/moves/Mover.hh>
112 
113 // AUTO-REMOVED #include <utility/file/FileName.hh>
114 // AUTO-REMOVED #include <utility/vector1.hh>
115 // AUTO-REMOVED #include <utility/io/ozstream.hh>
116 // AUTO-REMOVED #include <time.h>
117 using basic::T;
118 using basic::Warning;
119 using basic::Error;
120 
121 // C++ headers
122 
123 #include <utility/vector0.hh>
124 #include <utility/vector1.hh>
125 
126 
127 
128 namespace protocols {
129 namespace simple_moves {
130 namespace symmetry {
131 
134  {}
135 
138  {}
139 
141  core::Real temperature):
142  ShakeStructureMover(s, temperature)
143  {}
144 
146  core::Real ens_diversity, core::Real ens_div_tolerance):
147  ShakeStructureMover(s, ens_diversity,ens_div_tolerance )
148  {}
149 
151 
152 // void
153 // SymShakeStructureMover::set_scorefunction(core::scoring::ScoreFunction & s){
154 // scorefxn = s;
155 // scorefunction_initialized=true;
156 // }
157 
160  return "SymShakeStructureMover";
161  }
162 
166  s.get_weight(core::scoring::score_type_from_name("fa_rep"))*fraction_fa_rep);
167  return s;
168  }
169 
170  void
174  //std::cout << "[DEBUG]: scorefunction being initialized"<< std::endl;
175  s->set_weight(core::scoring::score_type_from_name("rama"), 4.0);
176  s->set_weight(core::scoring::score_type_from_name("omega"), 1.0);
177  s->set_weight(core::scoring::score_type_from_name("fa_dun"), 1.0);
178  s->set_weight(core::scoring::score_type_from_name("p_aa_pp"), 2.0);
179  set_scorefunction(*s);
180  }
182 
183  if(get_min_cst() || get_sc_min() ){
185  }
186 
187  if(get_mc_temperature() <= 0 && get_ensemble_ca_rmsd() > 0){
188  //set mc_temp based on ensemble_ca_rmsd
189  set_testing_phase(true);
192  }else if(get_mc_temperature() > 0 && get_ensemble_ca_rmsd() < 0){
193  //ready to go!
195  }else{
196  //what to do, what to do?
198  }
199 
200 
201  }
202 
203  void
206 
208  float const minimizer_tol = 0.0000001;
209  core::optimization::MinimizerOptions options( "dfpmin_armijo_nonmonotone",
210  minimizer_tol,
211  true /*use_nb_list*/,
212  false /*deriv_check_in*/,
213  false /*deriv_check_verbose_in*/);
214  options.nblist_auto_update( true );
215  // options.max_iter(5000);
217  if(!get_sc_min() ){
218  mm->set_bb(true);
219  }else{
220  mm->set_bb(false);
221  }
222  mm->set_chi(true);
223 
225 
226  if( get_ramp_fa_rep() ){
228  reduce_fa_rep(0.1,one_tenth_orig);
229  min_struc.run(p,*mm,one_tenth_orig,options);
231  reduce_fa_rep(0.33,one_third_orig);
232  min_struc.run(p,*mm,one_third_orig,options);
233  }
234  min_struc.run(p,*mm,s,options);
235 
236  }
237 
238  void
240  core::Real temperature){
241 
242  using namespace protocols;
243  using namespace simple_moves;
244 
245  core::pose::Pose init(p); //for comparison at the end
246 
247  core::Size nmoves = (core::Size)p.total_residue()/4; //number of moves for each move type
248 
250  mm->set_bb(true);
251 
252  // make symmetric movemap
254 
255  simple_moves::SmallMoverOP small_mover(new simple_moves::SmallMover( mm, temperature, nmoves)) ;
256  simple_moves::ShearMoverOP shear_mover( new simple_moves::ShearMover(mm, temperature, nmoves));
257 
258  setup_movers(small_mover,shear_mover,
259  0.2,0.2,0.4,
260  1.6,1.6,2.0);
261 
262  moves::RandomMoverOP apply_random_move( new moves::RandomMover());
263  apply_random_move->add_mover( small_mover, .5);
264  apply_random_move->add_mover( shear_mover, .5);
265 
266  simple_moves::SmallMoverOP small_mover_low(new simple_moves::SmallMover( mm, (temperature*0.25), nmoves)) ;
267  simple_moves::ShearMoverOP shear_mover_low( new simple_moves::ShearMover(mm, (temperature*0.25), nmoves));
268 
269  setup_movers(small_mover_low,shear_mover_low,
270  0.1,0.1,0.2,
271  1.0,1.0,1.5);
272 
273  moves::RandomMoverOP apply_random_move_low( new moves::RandomMover());
274  apply_random_move_low->add_mover( small_mover_low, .5);
275  apply_random_move_low->add_mover( shear_mover_low, .5);
276 
277  protocols::moves::MonteCarloOP mc(new moves::MonteCarlo(p,s,temperature));
278  //time_t time_per_decoy = time(NULL);
279 
280  // mc->reset_counters();
281  // mc->reset(p);
282  mc->set_temperature(temperature);
283 
284  moves::TrialMoverOP tm( new moves::TrialMover(apply_random_move,mc));
286  full_cycle->apply( p );
287 // mc->show_counters();
288 
289  if(!get_skip_low_temp_phase() ){
290  mc->reset_counters();
291 
292  mc->set_lowest_score_pose(mc->last_accepted_pose()); //high energy mark for annealing back to native
293  core::Real low_temp = temperature * 0.25;
294  mc->set_temperature(low_temp);
295 
296  moves::TrialMoverOP ltm( new moves::TrialMover(apply_random_move_low,mc));
298  full_cycle_2->apply( p );
299  //mc->show_counters();
300  p = mc->lowest_score_pose();
301  }
302  else{
303  p = mc->last_accepted_pose();
304  }
305 
306  if(get_min_cst() && !get_testing_phase() ){
307  //remove constraints
308  p.remove_constraints((p.constraint_set())->get_all_constraints());
309 
310  //std::cout << "minimizing with constraints" << std::endl;
311  //temporarily hardcode score12 into minimization.
312  setup_ca_constraints(p, (*get_min_scorefunction() ), 9.0, 0.5);
314 
315  //std::cout << " CA rmsd of current: " << core::scoring::CA_rmsd(p,init) << std::endl;
316  //time_t time_per_decoy_finish = time(NULL);
317  //std::cout << "time to finish decoy " << (time_per_decoy_finish-time_per_decoy) << std::endl;
318  }else{
319  //time_t time_per_decoy_finish = time(NULL);
320  //std::cout << " CA rmsd of current: " << core::scoring::CA_rmsd(p,init) << std::endl;
321  //std::cout << "time to finish decoy " << (time_per_decoy_finish-time_per_decoy) << std::endl;
322  }
323  }
324 
325 } // namespace symmetry
326 } // namespace simple_moves
327 } // namespace protocols
328