31 #include <basic/Tracer.hh>
34 #include <numeric/deriv/distance_deriv.hh>
41 #include <utility/vector1.hh>
44 static basic::Tracer
tr(
"core.io.constraints");
49 namespace constraints {
70 return func( xyz1.distance( xyz2 ) );
86 if ( atom1.
rsd() == 0 || atom2.
rsd() == 0 )
return NULL;
101 if( !dynamic_cast< AtomPairConstraint const * > ( &other_cst ) )
return false;
103 AtomPairConstraint const & other( static_cast< AtomPairConstraint const & > (other_cst) );
114 out <<
"AtomPairConstraint ("
122 func_->show_definition( out );
135 std::cerr <<
"AtomPairConstraint: atom1 out of bounds" <<
atom1_ << std::endl;
139 std::cerr <<
"AtomPairConstraint: atom2 out of bounds" <<
atom2_ << std::endl;
146 std::cerr <<
"AtomPairConstraint: cannot find atom " <<
atom1_ << std::endl;
149 std::cerr <<
"AtomPairConstraint: cannot find atom " <<
atom2_ << std::endl;
153 Vector const f2( xyz1 - xyz2 );
171 if ( verbose_level > 80 ) {
172 out <<
"AtomPairConstraint ("
178 if ( verbose_level > 120 ) {
180 Vector const & xyz1( conformation.xyz(
atom1_ ) ), xyz2( conformation.xyz(
atom2_ ) );
181 out <<
"\ncoords1: " << xyz1[ 1 ] <<
" " << xyz1[ 2 ] <<
" " << xyz1[ 3 ] <<
" --- ";
182 out <<
"coords1: " << xyz2[ 1 ] <<
" " << xyz2[ 2 ] <<
" " << xyz2[ 3 ] <<
"\n";
185 return func_->show_violations( out,
dist( pose ), verbose_level, threshold );
222 numeric::deriv::distance_f1_f2_deriv(
xyz( atom ),
xyz( other_atom ), dist, f1, f2 );
262 tr.Debug <<
"read: " << name1 <<
" " << name2 <<
" " << res1 <<
" " << res2 <<
" func: " << func_type << std::endl;
264 tr.Warning <<
"ignored constraint (requested residue numbers exceed numbers of residues in pose): " <<
"Total in Pose: " << pose.
total_residue() <<
" "
265 << name1 <<
" " << name2 <<
" " << res1 <<
" " << res2 << std::endl;
266 data.setstate( std::ios_base::failbit );
270 if ( name1 ==
"H" && res1 == 1 && pose.
is_fullatom() ) name1 =
"1H";
271 if ( name2 ==
"H" && res2 == 1 && pose.
is_fullatom() ) name2 =
"1H";
277 tr.Warning <<
"Error reading atoms: read in atom names("
278 << name1 <<
"," << name2 <<
"), "
279 <<
"and found AtomIDs (" <<
atom1_ <<
"," <<
atom2_ <<
")" << std::endl;
280 data.setstate( std::ios_base::failbit );
281 runtime_assert(
false );
286 func_->read_data( data );
290 while( data.good() && (data.get() !=
'\n') ) {}
291 if ( !data.good() ) data.setstate( std::ios_base::eofbit );
294 if (
tr.Debug.visible() ) {
295 func_->show_definition(
tr.Debug );
296 tr.Debug << std::endl;