25 #include <ObjexxFCL/format.hh>
28 #include <basic/Tracer.hh>
29 #include <utility/exit.hh>
31 #include <basic/MetricValue.hh>
36 #include <utility/vector1.hh>
40 using namespace core::pose;
41 using namespace core::pose::metrics;
43 static basic::Tracer
tr(
"protocols.metrics.ClashCountCalculator");
47 namespace pose_metric_calculators {
48 ClashCountCalculator::ClashCountCalculator(
core::Real clash_threshold ) :
49 clash_threshold_( clash_threshold ),
50 vdw_scale_factor_( 0.8 )
54 if ( key ==
"total" ) {
55 basic::check_cast( valptr, &
total_clashes_,
"total_clashes expects to return a Real" );
56 (
static_cast< basic::MetricValue<core::Size> *
>(valptr))->set(
total_clashes_ );
57 }
else if ( key ==
"bb" ) {
58 basic::check_cast( valptr, &
bb_clashes_,
"bb_clashes expects to return a Size" );
59 (
static_cast< basic::MetricValue<core::Size> *
>(valptr))->set(
bb_clashes_ );
61 basic::Error() <<
"This Calculator cannot compute metric " << key << std::endl;
104 if (!( rsd1.is_bonded( rsd2 ) || rsd1.is_pseudo_bonded( rsd2 ) )) {
105 for (
Size i = 1, i_end = rsd1.natoms(); i <= i_end; ++i ) {
106 Vector const & i_xyz( rsd1.xyz(i) );
107 Size const i_type( rsd1.atom_type_index(i) );
109 for (
Size j = 1, j_end = rsd2.natoms(); j <= j_end; ++j ) {
110 Real const bump_dsq( i_atom_vdw[ rsd2.atom_type_index(j) ] );
111 Real const clash( bump_dsq - i_xyz.distance_squared( rsd2.xyz(j) ) );
115 using namespace ObjexxFCL::fmt;
116 std::string const TAG( ( i <= 4 && j <= 4 ) ?
"BB BUMP: " :
" BUMP: ");
117 tr.Info << TAG << I(4,rsd1.seqpos() ) << I(4,rsd2.seqpos() )
118 <<
' ' << rsd1.atom_name(i) <<
' ' << rsd2.atom_name(j) <<
' '
119 << ( clash * clash ) / bump_dsq * vdw_scale_factor_
120 <<
' ' << i_xyz.distance_squared( rsd2.xyz(j) ) << std::endl;