24 #include <utility/string_util.hh>
25 #include <utility/exit.hh>
26 using utility::string_split;
28 #include <utility/vector0.hh>
29 #include <utility/vector1.hh>
32 #include <basic/Tracer.hh>
36 static basic::Tracer
TR(
"protocols.multistate_design.MultiStatePacker",t_info);
38 #include <ObjexxFCL/format.hh>
39 using namespace ObjexxFCL::fmt;
41 #include <boost/functional/hash.hpp>
50 #include <utility/options/IntegerVectorOption.hh>
54 namespace multistate_design {
66 if ( word.size() != 1 ) {
67 utility_exit_with_message(
"PosType std::string constructor failed to read a one-character word: " + word );
87 if ( parent::operator < ( rhs ) ) {
89 }
else if ( parent::operator == ( rhs ) ) {
90 if ( ! dynamic_cast< PosType const * > ( &rhs ) ) {
91 utility_exit_with_message(
"operator < unable to compare a " +
name() +
" object to a " + rhs.name() +
" object!" );
93 PosType const & pt_rhs( static_cast< PosType const & > ( rhs ) );
101 if ( parent::operator == ( rhs ) ) {
102 if ( ! dynamic_cast< PosType const * > ( &rhs ) ) {
103 utility_exit_with_message(
"operator < unable to compare a " +
name() +
" object to a " + rhs.name() +
" object!" );
105 PosType const & pt_rhs( static_cast< PosType const & > ( rhs ) );
116 if (
this != &rhs ) {
119 if ( ! dynamic_cast< PosType const * > ( &rhs ) ) {
120 utility_exit_with_message(
"operator < unable to compare a " +
name() +
" object to a " + rhs.name() +
" object!" );
122 PosType const & pt_rhs( static_cast< PosType const & > ( rhs ) );
163 runtime_assert( state );
167 state->run_packer( rot_to_pack );
168 ( *
scorefxn() )( state->nonconst_pose() );
169 Real const score( state->fitness_function()->evaluate(state->nonconst_pose()) );
170 state->set_best_score( score );
171 TR(t_info) <<
"Best single-state design score: " << F(8,2,score) << std::endl;
182 runtime_assert( state );
189 Real E(0.), bestE(0.);
192 state->run_packer( rot_to_pack );
194 ( *
scorefxn() )( state->nonconst_pose() );
195 E = state->fitness_function()->evaluate(state->nonconst_pose());
196 if (
E < bestE || i == 0 ) {
198 if ( dynamic_cast< protocols::multistate_design::MultiStateEntity * >( &entity ) ) {
206 iter->second.get(state->pose())
226 Size const nrotamers( rotsets.nrotamers() );
228 for (
Size rot_i(1); rot_i <= nrotamers; ++rot_i ) {
230 Size const rot_pos( rotsets.res_for_rotamer( rot_i ) );
235 it( seq.begin() ),
end( seq.end() );
238 utility_exit_with_message(
"Null pointer in EntityElement array" );
240 PosTypeCOP postype( dynamic_cast< PosType const * > ( it->get() ) );
242 utility_exit_with_message(
"Dynamic cast to PosType failed for object of type " + (*it)->name() );
244 if ( postype->index() == rot_pos ) { seq_type = postype->type();
break; }
251 rot_to_pack.push_back( rot_i );
255 if ( rot_type->aa() == seq_type ) rot_to_pack.push_back( rot_i );
268 Size const nrot( rotsets.nrotamers() );
270 for (
Size i(1); i <= nrot; ++i ) {
274 if (
rot.type().name3() ==
276 rot_to_pack.push_back(i);
279 else rot_to_pack.push_back(i);