25 #include <basic/Tracer.hh>
28 #include <utility/tag/Tag.hh>
31 #include <boost/foreach.hpp>
34 #include <utility/vector0.hh>
35 #include <utility/vector1.hh>
36 #include <utility/string_util.hh>
38 #define foreach BOOST_FOREACH
44 static basic::Tracer
TR(
"protocols.jd2.parser.ScoreFunctionLoader" );
55 using namespace utility::tag;
58 TagPtrs const scorefxn_tags( tag->getTags() );
60 foreach(
TagPtr scorefxn_tag, scorefxn_tags){
61 using namespace core::scoring;
62 using namespace core::scoring::symmetry;
65 std::string const scorefxn_name( scorefxn_tag->getName() );
67 if( scorefxn_tag->hasOption(
"weights" ) && scorefxn_tag->hasOption(
"patch" ) ) {
70 TR <<
"defined score function \"" << scorefxn_name <<
"\" with weights \""
71 << scorefxn_weights <<
"\" and patch \"" << scorefxn_patch <<
"\"\n";
72 }
else if ( scorefxn_tag->hasOption(
"weights" ) ) {
74 TR <<
"defined score function \"" << scorefxn_name <<
"\" with weights \""
75 << scorefxn_weights <<
"\"\n";
79 TR <<
"***WARNING***: No weights/patch defined. Defining " << scorefxn_name <<
" with all-zero weights.\n";
81 foreach(
TagPtr mod_tag, scorefxn_tag->getTags()){
82 if( mod_tag->getName() ==
"Reweight" ) {
85 TR<<
"setting "<<scorefxn_name<<
" weight " << scoretype_name <<
" to " << weight<<
'\n';
87 in_scorefxn->set_weight( type, weight );
91 if( mod_tag->getName() ==
"Set" ){
95 if( mod_tag->hasOption(
"softrep_etable" )) {
96 if ( mod_tag->getOption<
bool>(
"softrep_etable" )) {
102 if( mod_tag->hasOption(
"hack_elec_min_dis" )) {
103 emoptions.hackelec_min_dis( mod_tag->getOption<
core::Real>(
"hack_elec_min_dis" ) );
105 if( mod_tag->hasOption(
"hack_elec_max_dis" )) {
106 emoptions.hackelec_max_dis( mod_tag->getOption<
core::Real>(
"hack_elec_max_dis" ) );
108 if( mod_tag->hasOption(
"hack_elec_dielectric" )) {
109 emoptions.hackelec_die( mod_tag->getOption<
core::Real>(
"hack_elec_dielectric" ) );
111 if( mod_tag->hasOption(
"hack_elec_no_dis_dep_die" )) {
112 emoptions.hackelec_no_dis_dep_die( mod_tag->getOption<
bool>(
"hack_elec_no_dis_dep_die" ) );
114 if( mod_tag->hasOption(
"exclude_protein_protein_hack_elec" )) {
115 emoptions.exclude_protein_protein_hack_elec( mod_tag->getOption<
bool>(
"exclude_protein_protein_hack_elec" ) );
117 if( mod_tag->hasOption(
"exclude_DNA_DNA" )) {
118 emoptions.exclude_DNA_DNA( mod_tag->getOption<
bool>(
"exclude_DNA_DNA" ) );
120 if( mod_tag->hasOption(
"exclude_DNA_DNA_hbond" )) {
121 hboptions->exclude_DNA_DNA( mod_tag->getOption<
bool>(
"exclude_DNA_DNA_hbond" ) );
123 if( mod_tag->hasOption(
"use_hb_env_dep_DNA" )) {
124 hboptions->use_hb_env_dep_DNA( mod_tag->getOption<
bool>(
"use_hb_env_dep_DNA" ) );
126 if( mod_tag->hasOption(
"use_hb_env_dep" )) {
127 hboptions->use_hb_env_dep( mod_tag->getOption<
bool>(
"use_hb_env_dep" ) );
129 if( mod_tag->hasOption(
"smooth_hb_env_dep" )) {
130 hboptions->smooth_hb_env_dep( mod_tag->getOption<
bool>(
"smooth_hb_env_dep" ) );
132 if( mod_tag->hasOption(
"decompose_bb_hb_into_pair_energies" )) {
133 hboptions->decompose_bb_hb_into_pair_energies( mod_tag->getOption<
bool>(
"decompose_bb_hb_into_pair_energies" ) );
135 if( mod_tag->hasOption(
"pb_bound_tag" )) {
136 emoptions.pb_bound_tag( mod_tag->getOption<
std::string>(
"pb_bound_tag" ) );
137 TR <<
"User defined bound tag: " << emoptions.pb_bound_tag() << std::endl;
139 if( mod_tag->hasOption(
"pb_unbound_tag" )) {
140 emoptions.pb_unbound_tag( mod_tag->getOption<
std::string>(
"pb_unbound_tag" ) );
141 TR <<
"User defined unbound tag: " << emoptions.pb_unbound_tag() << std::endl;
143 in_scorefxn->set_energy_method_options( emoptions );
150 if ( scorefxn_tag->hasOption(
"hs_hash") ) {
153 TR<<
"setting "<<scorefxn_name<<
" backbone_stub_constraint to "<<hs_hash<<
'\n';
158 bool const scorefxn_symm( scorefxn_tag->getOption<
bool>(
"symmetric", 0 ) );
161 TR<<
"symmetrizing "<<scorefxn_name<<
'\n';
165 if( !in_scorefxn->has_zero_weight(
PB_elec) ) {
169 if( emoptions.pb_bound_tag() ==
"" ){
173 if( emoptions.pb_unbound_tag() ==
"" ){
175 emoptions.pb_unbound_tag(
"unbound" );
177 in_scorefxn->set_energy_method_options( emoptions );
180 data.
add(
"scorefxns" , scorefxn_name, in_scorefxn );