29 #include <ObjexxFCL/FArray2D.hh>
30 #include <ObjexxFCL/string.functions.hh>
35 #include <utility/exit.hh>
37 #include <basic/Tracer.hh>
55 #include <numeric/model_quality/rms.hh>
58 #include <utility/vector1.hh>
59 #include <numeric/xyz.functions.hh>
60 #include <ObjexxFCL/format.hh>
67 using namespace ObjexxFCL;
68 using namespace ObjexxFCL::fmt;
70 static basic::Tracer
tr(
"core.io.silent");
155 bool success(
false );
159 if ( iter->substr(0,9) !=
"SEQUENCE:" ) {
170 energy_names_ = enames ->energy_names();
176 std::istringstream line_stream( *iter );
178 tr.Debug <<
"reading sequence from " << *iter << std::endl;
182 line_stream >> tag >> temp_seq;
183 if ( line_stream.fail() || tag !=
"SEQUENCE:" ) {
184 tr.Error <<
"bad format in sequence line of silent file" << std::endl;
185 tr.Error <<
"line = " << *iter << std::endl;
186 tr.Error <<
"tag = " << tag << std::endl;
192 std::istringstream score_line_stream( *iter );
193 tr.Debug <<
"reading score names from " << *iter << std::endl;
196 score_line_stream >> tag;
197 if ( score_line_stream.fail() || tag !=
"SCORE:" ) {
198 tr.Error <<
"bad format in second line of silent file" << std::endl;
199 tr.Error <<
"tag = " << tag << std::endl;
200 tr.Error <<
"line = " << *iter << std::endl;
203 score_line_stream >> tag;
204 while ( ! score_line_stream.fail() ) {
205 energy_names_.push_back( tag );
206 score_line_stream >> tag;
212 enames ->energy_names( energy_names_ );
213 seqdata->set_sequence(
sequence() );
224 std::istringstream line_stream( *iter );
226 if ( iter->substr(0,7) ==
"SCORE: " ) {
231 if ( line_stream.fail() || tag !=
"SCORE:" ) {
232 tr.Error <<
"bad format in first score line of silent file" << std::endl;
233 tr.Error <<
"line = " << *iter << std::endl;
234 tr.Error <<
"tag = " << tag << std::endl;
238 for ( energy_iter = energy_names_.begin(); energy_iter != energy_names_.end(); ++energy_iter ) {
240 if ( *energy_iter !=
"description" ) {
241 Real score_val = (
Real) float_of( tag );
250 if ( iter->substr(0,10) ==
"FOLD_TREE " ) {
254 tr.Debug <<
"read fold-tree " << f;
255 tr.Debug <<
"reading " << f.num_jump() <<
" jumps " << std::endl;
257 }
else if ( iter->substr(0,2) ==
"RT" ) {
260 tr.Debug <<
"read jump " << jump << std::endl;
263 }
else if ( iter->substr(0,9) ==
"SEQUENCE:" ) {
266 }
else if ( iter->substr(0,6) ==
"REMARK" ) {
269 }
else if ( iter->substr(0,6) ==
"REMARK" ) {
275 Real x, y, z, torsion_value;
280 if ( !is_int( tag ) ) {
281 tr.Error <<
"ERROR: !is_int( " << tag <<
" ) from line (" << *iter <<
")\n";
283 runtime_assert( is_int( tag ) );
284 seqpos = int_of( tag );
292 line_stream >> torsion_value;
293 temp_mainchain_torsions.push_back( torsion_value );
297 line_stream >> torsion_value;
298 temp_chi_torsions.push_back( torsion_value );
304 line_stream >> x >> y >> z;
305 Vector temp_vec( x, y, z );
309 if ( is_float( tag ) ){
311 vecs.push_back( temp_vec );
314 line_stream >> y >> z;
315 temp_vec =
Vector( x, y, z );
316 vecs.push_back( temp_vec );
318 line_stream >> x >> y >> z;
319 temp_vec =
Vector( x, y, z );
320 vecs.push_back( temp_vec );
324 line_stream >> x >> y >> z;
325 temp_vec =
Vector( x, y, z );
337 tr.Warning <<
"parse error(" << *iter <<
") " << tag <<
" != " <<
decoy_tag() << std::endl;
346 tr.Debug <<
" generating simple fold-tree " <<
fold_tree();
371 using namespace core::chemical;
383 using namespace core::chemical;
385 bool const use_input_pose(
false );
386 if (use_input_pose) {
387 tr.Info <<
"Using bond lengths and angles from an input pose." << std::endl;
389 tr.Info <<
"Using ideal geometry from params files..." << std::endl;
408 for (
Size seqpos = 1; seqpos <=
nres(); ++seqpos ) {
439 for (
Size seqpos = 1; seqpos <=
nres(); ++seqpos ) {
452 out <<
"REMARK RNA \n";
461 output <<
jump( i ) <<
"\n";
466 for (
Size i = 1; i <=
nres(); ++i ) {
469 if (this_secstr < 'A' || this_secstr >
'Z')
472 output << I( 4, i ) <<
' '
473 << this_secstr <<
' ';
493 output << F( 9, 3,
coords_[i].x() )
504 FArray2D< Real > rebuilt_coords (3,
coords_.size() ), original_coords( 3,
coords_.size() );
511 for (
Size k = 1; k <= 3; ++k ) {
512 rebuilt_coords (k,i) = temp_pose.
residue(i).
xyz( atom_name )[k-1];
513 original_coords(k,i) =
coords_[i][k-1];
517 Real rmsd = numeric::model_quality::rms_wrapper( temp_pose.
total_residue(), rebuilt_coords, original_coords );
521 ObjexxFCL::FArray2D< Real >
524 FArray2D< Real > my_coords( 3, n_residues );
525 for (
Size i = 1; i <= n_residues; ++i ) {
526 for (
Size k = 1; k <= 3; ++k ) {
527 my_coords(k,i) =
coords_[i][k-1];
536 FArray2D< Real > other_coords = other_pss.
get_CA_xyz();
537 Real rmsd = numeric::model_quality::rms_wrapper(
nres(), my_coords, other_coords );
546 utility_exit_with_message(
"called ProteinSilentStruct::operator=)" );