42 #include <numeric/conversions.hh>
45 #include <utility/exit.hh>
48 #include <utility/vector1.hh>
61 hbondoptions_( new hbonds::HBondOptions ),
62 hb_database_( scoring::hbonds::HBondDatabase::get_database())
90 Real h2o_hbond_score( 0.0 );
93 static Real const HO_dist( 0.96 );
94 static Real const theta( numeric::conversions::radians( 107.0 ) );
95 static Real const HO_x_dist( HO_dist * std::cos( theta ) );
96 static Real const HO_y_dist( HO_dist * std::sin( theta ) );
99 for(
Size i = 1, ei = h2o_rsd.
natoms() ; i <= ei ; ++i ) {
102 Size const h2o_index( i );
104 Vector const h2o_coord( h2o_rsd.
xyz( i ) );
107 Vector const normal_from_base(
Vector( h2o_coord - h2o_base_coord ).normalized() );
110 for(
Size j = 1, ej = other_rsd.
Hpos_polar().size() ; j <= ej ; ++j ) {
113 Vector const hyd_coord( other_rsd.
xyz( hyd_index ) );
114 Vector const donor_coord( other_rsd.
xyz( donor_index ) );
118 Vector const separation( hyd_coord - h2o_coord );
123 Real h2o_hbond_energy( 0.0 );
124 bool const eval_deriv(
false );
126 hbe_type, donor_coord, hyd_coord, h2o_coord, h2o_base_coord, h2o_base2_coord,
127 h2o_hbond_energy, eval_deriv, deriv );
129 if( h2o_hbond_energy < 0.0 ) {
130 h2o_hbond_score += h2o_hbond_energy;
136 for(
Size j = 1, ej = other_rsd.
accpt_pos().size() ; j <= ej ; ++j ) {
138 Vector accpt_coord( other_rsd.
xyz( accpt_index ) );
140 Vector const separation( accpt_coord - h2o_coord );
144 Vector accpt_base_coord( other_rsd.
xyz( accpt_base_index ) );
145 Size accpt_base2_index( other_rsd.
abase2( accpt_index ) );
146 Vector accpt_base2_coord( other_rsd.
xyz( accpt_base2_index ) );
150 Vector const z( cross( normal_from_base, separation ).normalized() );
151 Vector const y( cross( z, normal_from_base ) );
152 Vector const faux_hyd_coord( h2o_coord + HO_x_dist * normal_from_base + HO_y_dist * y );
154 Real h2o_hbond_energy( 0.0 );
155 bool const eval_deriv(
false );
158 hbe_type, h2o_coord, faux_hyd_coord, accpt_coord, accpt_base_coord, accpt_base2_coord,
159 h2o_hbond_energy, eval_deriv, deriv );
161 if( h2o_hbond_energy < 0.0 ) {
162 h2o_hbond_score += h2o_hbond_energy;
167 return h2o_hbond_score;
200 iru = energy_graph.get_node(res1)->const_upper_edge_list_begin(),
202 iru != irue; ++iru ) {
204 int const res2( (*iru)->get_second_node_ind() );
208 int const nb2 = tenA_neighbor_graph.get_node( res2 )->num_neighbors_counting_self();
243 static Real const HO_dist( 0.96 );
244 static Real const theta( numeric::conversions::radians( 107.0 ) );
245 static Real const HO_x_dist( HO_dist * std::cos( theta ) );
246 static Real const HO_y_dist( HO_dist * std::sin( theta ) );
249 for(
Size i = 1, ei = h2o_rsd.
natoms() ; i <= ei ; ++i ) {
252 Size const h2o_index( i );
254 Vector const h2o_coord( h2o_rsd.
xyz( i ) );
257 Vector const normal_from_base(
Vector( h2o_coord - h2o_base_coord ).normalized() );
260 for(
Size j = 1, ej = other_rsd.
Hpos_polar().size() ; j <= ej ; ++j ) {
263 Vector const hyd_coord( other_rsd.
xyz( hyd_index ) );
264 Vector const donor_coord( other_rsd.
xyz( donor_index ) );
268 Vector const separation( hyd_coord - h2o_coord );
273 Real h2o_hbond_energy( 0.0 );
274 bool const eval_deriv(
true );
276 hbe_type, donor_coord, hyd_coord, h2o_coord, h2o_base_coord, h2o_base2_coord,
277 h2o_hbond_energy, eval_deriv, deriv );
279 if( h2o_hbond_energy < 0.0 ) {
281 Real const weight ( 1.0 );
283 hyd_index, other_rsd, h2o_index, h2o_rsd, hbe_type,
284 h2o_hbond_energy, weight, deriv );
301 for(
Size j = 1, ej = other_rsd.
accpt_pos().size() ; j <= ej ; ++j ) {
303 Vector accpt_coord( other_rsd.
xyz( accpt_index ) );
305 Vector const separation( accpt_coord - h2o_coord );
309 Vector accpt_base_coord( other_rsd.
xyz( accpt_base_index ) );
310 Size accpt_base2_index( other_rsd.
abase2( accpt_index ) );
311 Vector accpt_base2_coord( other_rsd.
xyz( accpt_base2_index ) );
315 Vector const z( cross( normal_from_base, separation ).normalized() );
316 Vector const y( cross( z, normal_from_base ) );
317 Vector const faux_hyd_coord( h2o_coord + HO_x_dist * normal_from_base + HO_y_dist * y );
319 Real h2o_hbond_energy( 0.0 );
320 bool const eval_deriv(
true );
322 hbe_type, h2o_coord, faux_hyd_coord,
323 accpt_coord, accpt_base_coord, accpt_base2_coord,
324 h2o_hbond_energy, eval_deriv, deriv );
326 if( h2o_hbond_energy < 0.0 ) {
328 Real const weight ( 1.0 );
329 hbond_set.
append_hbond( h2o_index, h2o_rsd, accpt_index, other_rsd, hbe_type,
330 h2o_hbond_energy, weight, deriv );