18 #include <basic/options/keys/cp.OptionKeys.gen.hh>
19 #include <basic/options/keys/in.OptionKeys.gen.hh>
22 #include <core/chemical/AA.hh>
23 #include <core/conformation/Residue.hh>
24 #include <core/import_pose/import_pose.hh>
25 #include <core/pose/PDBInfo.hh>
26 #include <core/scoring/Energies.hh>
27 #include <core/scoring/ScoreFunction.hh>
28 #include <core/scoring/ScoreFunctionFactory.hh>
31 #include <protocols/vip/VIP_Mover.hh>
34 #include <protocols/simple_moves/ScoreMover.hh>
35 #include <protocols/relax/FastRelax.hh>
36 #include <protocols/relax/ClassicRelax.hh>
37 #include <protocols/relax/MiniRelax.hh>
44 #include <protocols/jd2/JobDistributor.hh>
49 namespace core {
namespace options {
namespace OptionKeys {
55 main(
int argc,
char * argv [] )
59 using namespace basic::options::OptionKeys;
67 core::import_pose::pose_from_pdb(
71 core::scoring::ScoreFunctionOP
scorefxn = core::scoring::ScoreFunctionFactory::create_score_function(
option[ cp::relax_sfxn ] );
72 protocols::simple_moves::ScoreMover scoreme = protocols::simple_moves::ScoreMover(
scorefxn );
77 std::string rmover =
option[ cp::relax_mover ];
78 if ( rmover ==
"relax" ) {
79 protocols::relax::RelaxProtocolBaseOP relaxmover(
new protocols::relax::FastRelax(
scorefxn, 15 ) );
80 relaxmover->apply( in_pose );
81 }
else if ( rmover ==
"classic_relax" ) {
82 protocols::relax::RelaxProtocolBaseOP relaxmover(
new protocols::relax::ClassicRelax(
scorefxn ) );
83 relaxmover->apply( in_pose );
84 }
else if ( rmover ==
"cst_relax" ) {
85 protocols::relax::RelaxProtocolBaseOP cstrelaxmover(
new protocols::relax::MiniRelax(
scorefxn ) );
86 cstrelaxmover->apply( in_pose );
96 bool use_unrelaxed_mutants(
option[ cp::use_unrelaxed_starting_points ] );
97 bool easy_acceptance(
option[ cp::easy_vip_acceptance ] );
104 bool not_finished(
true );
106 while ( not_finished ) {
107 TR <<
"Entering VIP loop with it # " << it << std::endl;
108 scoreme.apply(in_pose);
110 old_energy = in_pose.energies().total_energy();
111 initial_E = old_energy;
114 protocols::vip::VIP_Mover();
115 protocols::vip::VIP_Mover vip_mover;
116 if ( ( it > 1 ) && use_unrelaxed_mutants && ( stored_unrelaxed_pose.total_residue() > 0 ) ) {
117 vip_mover.set_initial_pose( stored_unrelaxed_pose );
120 vip_mover.set_initial_pose( in_pose );
122 vip_mover.set_iteration( it );
125 out_pose = vip_mover.get_final_pose();
126 core::Real new_energy = vip_mover.get_final_energy();
128 bool improved( new_energy < old_energy ?
true :
false );
131 if ( out_pose.total_residue() == 0 ) {
134 if ( use_unrelaxed_mutants ) {
135 stored_unrelaxed_pose = vip_mover.get_unrelaxed_pose();
137 TR <<
"Comparing new energy " << new_energy <<
" with old energy " << old_energy << std::endl;
143 for (
core::Size j = 1 ; j <= in_pose.total_residue() ; ++j ) {
144 if ( out_pose.residue( j ).name() != in_pose.residue( j ).name() ) {
145 core::Size pdb_position( out_pose.pdb_info()->number( j ) );
146 char pdb_chain( out_pose.pdb_info()->chain( j ) );
147 TR <<
"Accepting mutation at position " << pdb_position <<
" chain " << pdb_chain
148 <<
" from " << in_pose.residue( j ).name()
149 <<
" to " << out_pose.residue( j ).name() << std::endl;
151 if (
option[ cp::print_intermediate_pdbs ] ) {
153 TR <<
"Dumping intermediate pdb file " << pdb_file << std::endl;
154 out_pose.dump_pdb( pdb_file );
157 vip_mover.set_energy_to_beat( easy_acceptance ? initial_E : new_energy );
158 vip_mover.set_use_stored_energy(
true );
163 old_energy = ( easy_acceptance ? initial_E : new_energy );
166 current_failures = 0;
169 TR <<
"Rejecting attempted mutation!" << std::endl;
172 bool done_improving( (current_failures >= max_failures) && !improved );
177 not_finished = ( ncycles == 0 ? !done_improving : ( it <= ncycles && !done_improving ) );
182 std::cout <<
"caught exception " << e.
msg() << std::endl;
virtual std::string const msg() const
void init(int argc, char *argv[])
Command line init() version.
static THREAD_LOCAL basic::Tracer TR("VIP")
Abstract automatic hidden index key for options.
common derived classes for thrown exceptions
int main(int argc, char *argv[])
static THREAD_LOCAL basic::Tracer TR("basic.options")
Automatic hidden index key for boolean options.
basic::options::BooleanOptionKey const minimize_sidechains("minimize_sidechains")
rule< Scanner, options_closure::context_t > options
utility::options::OptionCollection option
OptionCollection global.
ocstream cout(std::cout)
Wrapper around std::cout.
Class for handling user debug/warnings/errors. Use instance of this class instead of 'std::cout' for ...
std::string to_string(const T &t)
Some std::string helper functions.
Program options global and initialization function.