18 #include <numeric/random/random.hh>
20 #include <basic/Tracer.hh>
22 #include <utility/vector1.hh>
24 static basic::Tracer
tr(
"core.io.constraints");
28 namespace constraints {
48 if (
tr.Debug.visible() ) {
50 tr.Debug << std::endl;
53 tr.Error <<
"ERROR: " <<
type() <<
" read_def: no constraints defined! " << ct <<
" " <<
size() << std::endl;
63 if( !dynamic_cast< MultiConstraint const * > ( &other_cst ) )
return false;
65 MultiConstraint const & other( static_cast< MultiConstraint const & > (other_cst) );
84 (*member_it)->score( xyz_func, weights, emap );
91 report_this_as_effective_sequence_separation_( 0 )
93 for( ConstraintCOPs::const_iterator it = cst_in.begin(); it != cst_in.end(); it++ ) {
105 for(
Size i = 1; i <= cst_in->natoms(); i++){
106 AtomID cur_atomid = cst_in->atom(i);
112 std::map< AtomID, ConstraintCOPs >::iterator map_it =
AtomID_to_Csts_.find(cur_atomid);
118 cst_vect.push_back( cst_in );
120 AtomID_to_Csts_.insert( std::pair< AtomID, ConstraintCOPs > (cur_atomid, cst_vect) );
122 map_it->second.push_back( cst_in );
130 (*cst_it)->setup_for_scoring( xyz, scfxn );
140 ConstraintOP new_cst = (*cst_it)->remap_resid( seqmap );
141 if( new_cst ) new_csts.push_back( new_cst );
143 if( new_csts.size() > 0 ){
157 new_multi->add_individual_constraint( (*it)->remapped_clone( src, dest, map ) );
181 std::map< AtomID, ConstraintCOPs >::const_iterator map_it =
AtomID_to_Csts_.find(atom);
187 for( ConstraintCOPs::const_iterator cst_it = cur_csts.begin(); cst_it != cur_csts.end(); cst_it++ ){
189 (*cst_it)->fill_f1_f2(atom, xyz, F1, F2, weights);
199 out <<
"MultiConstraint containing the following " <<
member_constraints_.size() <<
" constraints: "
202 (*cst_it)->show(out);
205 out <<
" ...all member constraints of this MultiConstraint shown." << std::endl;
209 out <<
type() << std::endl;
211 (*cst_it)->show_def( out, pose );
213 out <<
"End_"<<
type() << std::endl;
219 if( verbose_level > 80 ) out <<
"Violations for MultiConstraint: " << std::endl;
223 core::Size cur_viol = (*cst_it)->show_violations( out, pose, verbose_level, threshold);
224 if (cur_viol > biggest_violation ) biggest_violation = cur_viol;
226 return biggest_violation;
232 numeric::random::RandomGenerator&
RG
236 for ( ConstraintCOPs::const_iterator cst_it = cst_list.begin(); cst_it != cst_list.end(); ++cst_it ) {
240 collected_seq_separations.push_back( seq_sep );
242 Size index =
static_cast< Size >( collected_seq_separations.size()*RG.uniform() ) + 1;