Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vs_test.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 /// @brief stupid test file for visual studio c++
11 /// @detailed
12 
13 #include <core/types.hh>
14 #include <core/pose/Pose.hh>
15 
19 
20 // AUTO-REMOVED #include <core/fragment/FragSet.hh>
21 // AUTO-REMOVED #include <core/fragment/ConstantLengthFragSet.hh>
22 #include <core/sequence/util.hh>
24 
28 
29 
31 
33 
34 #include <basic/options/option.hh>
35 
39 
40 #include <utility/io/ozstream.hh>
41 
42 #include <string>
43 
44 // AUTO-REMOVED #include <numeric/random/random.hh>
45 
46 
47 // option key includes
48 
49 #include <basic/options/keys/out.OptionKeys.gen.hh>
50 #include <basic/options/keys/james.OptionKeys.gen.hh>
51 // AUTO-REMOVED #include <basic/options/keys/abinitio.OptionKeys.gen.hh>
52 #include <basic/options/keys/in.OptionKeys.gen.hh>
53 
55 #include <utility/vector1.hh>
56 #include <numeric/random/random.fwd.hh>
57 
58 
59 
60 using namespace basic::options;
61 using namespace basic::options::OptionKeys;
62 using namespace ObjexxFCL::fmt;
63 
64 namespace protocols {
65 namespace abinitio {
66 
67 // the following code leaks memory on Windows if compiled with Visual Studio 2005. The fix is to
68 // upgrade to Service Pack 1. The important bit is the F() statement, which uses a C++ iostream
69 // to do its formatted output. See here for more information:
70 // http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=98861
71 // tex 2008-09-09
73  std::string sequence(
75  option[ in::file::fasta ]()[1]
76  )[1]->sequence()
77  );
78  core::pose::Pose fold_pose;
80  fold_pose,
81  sequence,
83  );
84 
86 
87  utility::io::ozstream log( "debug_log.txt" );
88  // fragments
89  //std::string frag_small_file = option[ in::file::frag3 ]();
90  //ConstangLengthFragSetOP fragset_small = new ConstantLengthFragSet;
91  //fragset_small->read_fragment_file( frag_small_file, option[ OptionKeys::abinitio::number_3mer_frags ]() );
92 
93  // make a MoveMap
95  movemap->set_bb( true );
96 
97  // nstruct iterations
98  core::Size iterations = option[ out::nstruct ]();
99 
100  using core::Size;
101  using namespace protocols::moves;
102  MonteCarloOP mc( new MonteCarlo( fold_pose, *scorefxn, 1.0 ) );
103  simple_moves::SmallMoverOP small_mover( new simple_moves::SmallMover( movemap, 1.0, 1 ) );
104  moves::TrialMoverOP smooth_trials( new moves::TrialMover( small_mover, mc ) );
105 
106  if ( option[ james::debug ]() ) {
108 
109  using numeric::random::gaussian;
110  for ( core::Size i = 1; i <= iterations; ++i ) {
111  // wiggle all of the residues a bit.
112  for ( core::Size pos = 1; pos <= fold_pose.total_residue(); pos++ ) {
113  fold_pose.set_phi ( pos, fold_pose.phi( pos ) + gaussian() );
114  fold_pose.set_psi ( pos, fold_pose.psi( pos ) + gaussian() );
115  fold_pose.set_omega( pos, fold_pose.omega( pos ) + gaussian() );
116  }
117 
118  (*scorefxn)(fold_pose);
119  // core::Real score = (*scorefxn)(fold_pose);
120  //mc.boltzmann( fold_pose );
121 
122  log << "iteration " << i << std::endl;
123 
124  log << "initializing ProteinSilentStruct!" << std::endl;
125  core::io::silent::ProteinSilentStruct pss( fold_pose );
126  log << "calling write_silent_struct!" << std::endl;
127  sfd.write_silent_struct( pss, "test.out" );
128  } // for i
129  } else {
130  for ( core::Size i = 1; i <= iterations * 100; ++i ) {
131  log << F( 8, 3, 3.14159 ) << std::endl;
132  }
133  } // else
134 
135  log.close();
136 
137  return 0;
138 }
139 
140 
141 } // abinitio
142 } // protocols