21 #include <basic/Tracer.hh>
23 #include <numeric/xyz.functions.hh>
24 #include <numeric/trig.functions.hh>
25 #include <numeric/deriv/dihedral_deriv.hh>
27 #include <utility/exit.hh>
33 #include <utility/vector1.hh>
37 namespace constraints {
39 static basic::Tracer
TR(
"core.io.constraints");
62 remap_a1, remap_a2, remap_a3, remap_a4,
63 remap_b1, remap_b2, remap_b3, remap_b4,
125 utility_exit_with_message(
"DihedralPairConstraint::atom() bad argument" );
140 Size res1, res2, res3, res4, res5, res6, res7, res8;
141 std::string tempres1, tempres2, tempres3, tempres4, tempres5, tempres6, tempres7, tempres8;
142 std::string name1, name2, name3, name4, name5, name6, name7, name8;
166 TR.Debug <<
"read: " << name1 <<
" " << name2 <<
" " << name3 <<
" " << name4 <<
" "
167 << res1 <<
" " << res2 <<
" " << res3 <<
" " << res4 <<
" func: " << func_type
173 TR.Warning <<
"ignored constraint (no such atom in pose!)"
174 << name1 <<
" " << name2 <<
" " << name3 <<
" " << name4 <<
" "
175 << res1 <<
" " << res2 <<
" " << res3 <<
" " << res4 <<
" func: " << func_type
177 in.setstate( std::ios_base::failbit );
192 TR.Warning <<
"Error reading atoms: read in atom names("
193 << name1 <<
"," << name2 <<
"," << name3 <<
"," << name4 <<
","
194 << name5 <<
"," << name6 <<
"," << name7 <<
"," << name8 <<
"), "
197 in.setstate( std::ios_base::failbit );
202 func_->read_data( in );
204 while( in.good() && (in.get() !=
'\n') ) {}
206 if (
TR.Debug.visible() ) {
207 func_->show_definition( std::cout );
208 std::cout << std::endl;
243 core::Real difference = dihedral_degrees( p1, p2, p3, p4 ) - dihedral_degrees( p5, p6, p7, p8 ) ;
244 if (difference > 180) difference -=360;
245 if (difference < -180) difference +=360;
246 TR.Debug <<
"difference of " << difference <<
" degrees" << std::endl;
247 return func(difference);
259 using namespace numeric::deriv;
263 Real theta(0.0), theta0;
267 }
else if ( atom ==
atomA2_ ) {
270 }
else if ( atom ==
atomA3_ ) {
273 }
else if ( atom ==
atomA4_ ) {
276 }
else if ( atom ==
atomB1_ ) {
279 }
else if ( atom ==
atomB2_ ) {
282 }
else if ( atom ==
atomB3_ ) {
285 }
else if ( atom ==
atomB4_ ) {
292 core::Real difference = numeric::conversions::degrees( theta ) - theta0;
293 if (difference > 180) difference -=360;
294 if (difference < -180) difference +=360;
295 Real const dE_dtheta( numeric::conversions::degrees(
dfunc( difference ) ) );
297 F1 += dE_dtheta * weights[ this->
score_type() ] * f1;
298 F2 += dE_dtheta * weights[ this->
score_type() ] * f2;
304 if( !dynamic_cast< DihedralPairConstraint const * > ( &other_cst ) )
return false;
324 out <<
"DihedralPairConstraint";
327 out <<
' ' <<
id.rsd() <<
' ' <<
id.atomno();
330 func_->show_definition(out);
340 if ( verbose_level > 80 ) {
341 out <<
"DihedralPair ("
351 return func_->show_violations( out, 0.0, verbose_level, threshold );
357 return func_->func( theta );
362 return func_->dfunc( theta );