49 #include <utility/io/ozstream.hh>
51 #include <basic/Tracer.hh>
53 #include <numeric/random/random.hh>
61 #include <utility/vector1.hh>
64 #include <ObjexxFCL/FArray2D.hh>
68 static basic::Tracer
tr(
"protocols.topo_broker",basic::t_info);
69 static numeric::random::RandomGenerator
RG(1882234234);
72 namespace topology_broker {
75 using namespace scoring::constraints;
76 using namespace ObjexxFCL;
79 filename_(
"NO_FILE"),
82 bRegenerateFromInputPose_ ( false ),
90 filename_( filename ),
93 bRegenerateFromInputPose_ ( false ),
104 if ( !
cst_pose_ )
throw EXCN_Input(
"CoordConstraintClaimer::new_decoy(): in broker setup provide PDB_FILE or say USE_XYZ_FROM_CSTFILE");
125 tr.Info <<
label() <<
" got a returned message: " << msg << std::endl;
128 else throw EXCN_Input(
"no fixed region (looked for "+
root_from_label_+
") found to use as reference for CoordinateConstraints");
136 if ( new_root !=
root_ ) {
138 tr.Info <<
"set new root for CoordinateConstraints to " <<
root_ << std::endl;
141 runtime_assert(
root_ != 0 );
166 tr.Debug <<
"new sequence -- remap constraints " << std::endl;
170 in broker setup either provide PDB_FILE or set CST_FROM_INPUT_POSE");
187 if (
tr.Trace.visible() ) {
188 utility::io::ozstream dump_cst(
label()+
"_coord_claimer.cst" );
195 tr.Debug <<
"add constraints "<<
label() << std::endl;
208 for ( ConstraintCOPs::const_iterator it = all_cst.begin(), eit = all_cst.end(); it!=eit; ++it ) {
211 runtime_assert( ll_cst );
212 ll_cst->set_fixed_stub( cst_fix_stub_ID );
213 new_set->add_constraint( ll_cst );
232 for (
Size pos = it->start(); pos <= it->stop(); ++pos ) {
243 Vector xyz( rsd.xyz( cst_atomID.atomno() ) + ai );
261 if (
tr.Debug.visible() ) {
262 tr.Debug <<
"CoordConstraintClaimer generate constraints" << std::endl;
271 if (
tr.Debug.visible() ) {
272 tr.Debug <<
"CoordConstraintClaimer: have read constraints from file:" << std::endl;
282 ObjexxFCL::FArray1D_double weights( natoms, 1.0 );
287 for (
Size i = 1; i<=natoms; ++i ) {
297 if (
tr.Trace.visible() ) {
298 utility::io::ozstream dump_cst(
label()+
"_before_fit.cst" );
302 for ( ConstraintCOPs::const_iterator it = all_cst.begin(), eit = all_cst.end(); it!=eit; ++it, ++n ) {
305 runtime_assert( ll_cst );
306 Vector xyz_ref( pose.
xyz( ll_cst->atom( 1 ) ) );
308 tr.Trace <<
"constraint for atom " << ll_cst->atom( 1 ) << std::endl;
309 Vector xyz_cst( ll_cst->xyz_target( pose ) );
310 for (
Size d=1; d<=3; ++d ) {
311 ref_coords( d, n ) = xyz_ref( d );
312 coords( d, n ) = xyz_cst( d );
317 FArray1D_double transvec( 3 );
318 FArray1D_double ref_transvec( 3 );
334 for ( ConstraintCOPs::const_iterator it = all_cst.begin(), eit = all_cst.end(); it!=eit; ++it, ++n ) {
339 for (
Size d=1; d<=3; ++d ) {
340 xyz_cst( d ) = coords( d, n ) - ref_transvec( d );
342 ll_cst->set_xyz_target( xyz_cst, pose );
343 new_set->add_constraint( ll_cst );
372 bool const strict =
false;
374 if ( tag ==
"pdb_file" || tag ==
"PDB_FILE" ) {
377 }
else if ( tag ==
"CST_FILE" ) {
379 }
else if ( tag ==
"REGION" ) {
382 }
else if ( tag ==
"region_file" ) {
385 std::ifstream infile( file.c_str() );
387 if (!infile.good()) {
388 utility_exit_with_message(
"[ERROR] Error opening RBSeg file '" + file +
"'" );
392 }
else if ( tag ==
"ROOT" ) {
394 }
else if ( tag ==
"ASK_FOR_ROOT" ) {
398 }
else if ( tag ==
"CST_FROM_INPUT_POSE" ) {
400 }
else if ( tag ==
"USE_XYZ_FROM_CSTFILE" ) {
402 }
else if ( tag ==
"NO_CENTROID" ) {
404 }
else if ( tag ==
"FULLATOM" ) {
406 }
else if ( tag ==
"PERTURB" ) {
408 }
else if ( tag ==
"SUPERIMPOSE" ) {
410 }
else if ( tag ==
"SUPERIMPOSE_REGION" ) {
413 }
else if ( tag ==
"SUPERIMPOSE_REGION_FILE" ) {
416 std::ifstream infile( file.c_str() );
418 if (!infile.good()) {
419 utility_exit_with_message(
"[ERROR] Error opening RBSeg file '" + file +
"'" );
423 }
else if ( tag ==
"POTENTIAL" ) {