26 #include <basic/options/option.hh>
29 #include <basic/Tracer.hh>
32 #include <utility/vector1.hh>
35 #include <basic/options/keys/score.OptionKeys.gen.hh>
36 #include <basic/options/keys/corrections.OptionKeys.gen.hh>
38 #include <basic/options/keys/abinitio.OptionKeys.gen.hh>
39 #include <basic/options/keys/symmetry.OptionKeys.gen.hh>
44 static basic::Tracer
tr(
"core.scoring.ScoreFunctionFactory");
77 using basic::options::option;
78 using namespace basic::options::OptionKeys;
88 basic::options::option[ basic::options::OptionKeys::corrections::score::score12prime ] ) {
89 bool sc12patch =
false;
90 for (
Size ii = 1; ii <= patch_tags.size(); ++ii ) {
92 patch_tags[ ii ] =
"NOPATCH";
97 weights_tag =
"score12prime";
105 if ( patch_tag.size() && patch_tag !=
"NOPATCH" ) {
107 scorefxn->apply_patch_from_file( patch_tag );
114 if ( basic::options::option[ basic::options::OptionKeys::symmetry::symmetry_definition ].user() ) {
117 if ( basic::options::option[ basic::options::OptionKeys::score::docking_interface_score ]() ) {
120 if ( basic::options::option[ basic::options::OptionKeys::score::min_score_score ].user() ) {
121 scorefxn =
new MinScoreScoreFunction( scorefxn, basic::options::option[ basic::options::OptionKeys::score::min_score_score ]() );
123 scorefxn->name( weights_tag );
131 using basic::options::option;
132 using namespace basic::options::OptionKeys;
137 patch_tags.push_back( patch_tag );
172 using basic::options::option;
173 using namespace basic::options::OptionKeys;
177 if ( option[ score::set_weights ].user() ) {
178 std::string const errmsg(
"proper format for -set_weights is a list of paired strings, e.g: '-set_weights fa_atr 0.6 -fa_rep 0.55 -fa_sol 0.9' ");
180 if ( settings.size()%2 != 0 ) utility_exit_with_message( errmsg );
181 for (
Size i=0; i< settings.size()/2; ++i ) {
182 if ( !ObjexxFCL::is_float( settings[ 2*i+2 ] ) ) utility_exit_with_message( errmsg );
184 Real const value( ObjexxFCL::float_of( settings[ 2*i + 2 ] ) );
185 tr <<
"Setting/modifying scorefxn weight from command line: " << t <<
' ' << value << std::endl;
186 scorefxn->set_weight( t, value );
191 if ( option[ abinitio::rg_reweight ].user() ) {
192 scorefxn->set_weight(
rg, scorefxn->get_weight(
rg ) * option[ abinitio::rg_reweight ]() );
195 if ( option[ score::ref_offsets ].user() ) {
199 if (!energy_method_options.has_method_weights(
ref)) {
200 utility_exit_with_message(
"option -score:ref_offsets requires preexisting reference energies");
206 if (ref_offsets.size() % 2 != 0) {
207 utility_exit_with_message(
"option -score:ref_offsets requires pairs of 3 character residue types and offsets");
212 iter != iter_end; ++iter) {
214 std::istringstream aa_iss(*iter);
216 if (!(aa_iss >> aa)) {
217 utility_exit_with_message(aa_iss.str()+
" is not a valid 3 character residue type for -score:ref_offsets");
220 std::istringstream offset_iss(*(++iter));
222 if (!(offset_iss >> offset)) {
223 utility_exit_with_message(offset_iss.str()+
" is not a valid offset for -score:ref_offsets");
226 ref_weights[aa] += offset;
230 energy_method_options.set_method_weights(
ref, ref_weights);
231 scorefxn->set_energy_method_options(energy_method_options);
237 scorefxn->initialize_from_file(weights_tag);
259 using basic::options::option;
260 using namespace basic::options::OptionKeys;
266 if( option[ score::empty ]() )
return scorefxn;
272 if ( !option[ score::weights ].user() && !is_fullatom ){
282 if ( ( weight_set ==
"standard" && !option[ score::weights ].user() ) &&
283 ( !option[ score::patch ].user() ) ) {
284 patch_tags.push_back(
"score12" );
285 if( basic::options::option[basic::options::OptionKeys::corrections::correct]) {
286 weight_set =
"score12_w_corrections";
288 }
else if ( basic::options::option[ basic::options::OptionKeys::corrections::score::score12prime ] ) {
289 weight_set =
"score12prime";
296 T(
"core.scoring.ScoreFunctionFactory") <<
"SCOREFUNCTION: " << weight_set << std::endl;
297 if ( patch_tags.size() == 0 ) {
300 if ( patch_tags.size() > 1 && patch_tags[1]==
"" && patch_tags[2]!=
"" ) {
301 T(
"core.scoring.ScoreFunctionFactory") <<
"SCOREFUNCTION PATCH: " << patch_tags[2] << std::endl;
302 }
else if ( patch_tags[1]!=
"" )
T(
"core.scoring.ScoreFunctionFactory") <<
"SCOREFUNCTION PATCH: " << patch_tags[1] << std::endl;
326 bool const is_fullatom
328 using basic::options::option;
329 using namespace basic::options::OptionKeys;
331 if( option[ score::empty ]() )
return "empty";
337 if ( !option[ score::weights ].user() && !is_fullatom ){
347 if ( ( weight_set ==
"standard" && !option[ score::weights ].user() ) &&
348 ( !option[ score::patch ].user() ) ) {
349 patch_tags.push_back(
"score12" );
350 if( option[ corrections::correct ]) {
351 weight_set =
"score12_w_corrections";
353 }
else if ( option[ corrections::score::score12prime ] ) {
354 weight_set =
"score12prime";
360 if ( patch_tags.size() != 0 &&
362 option[ corrections::score::score12prime ] ) {
364 bool sc12patch =
false;
365 for (
Size ii = 1; ii <= patch_tags.size(); ++ii ) {
367 patch_tags[ ii ] =
"NOPATCH";
372 weight_set =
"score12prime";
376 std::stringstream patch_string;
377 for(
Size ii=1; ii <= patch_tags.size(); ++ii){
378 if( patch_tags[ii] ==
"NOPATCH" )
continue;
379 patch_string <<
"_" << patch_tags[ii];
382 return weight_set + patch_string.str();