49 #include <basic/datacache/BasicDataCache.hh>
59 #include <basic/Tracer.hh>
60 #include <basic/datacache/CacheableData.hh>
68 #include <numeric/numeric.functions.hh>
78 #include <utility/vector1.hh>
84 class HBondResidueMinData;
101 virtual basic::datacache::CacheableDataOP
clone()
const
129 virtual basic::datacache::CacheableDataOP
clone()
const
209 static basic::Tracer
tr(
"core.scoring.hbonds.HbondEnergy");
238 database_(
HBondDatabase::get_database(opts.params_database_tag()) ),
239 memb_potential_(
ScoringManager::get_instance()->get_Membrane_FAPotential() )
246 database_( src.database_),
247 memb_potential_( src.memb_potential_)
282 hbond_set->setup_for_residue_pair_energies( pose );
285 using namespace trie;
286 using namespace hbtrie;
295 tries->trie( ii, one_rotamer_trie );
306 using namespace hbtrie;
319 using namespace trie;
320 using namespace hbtrie;
327 trie_collection.trie( resid, one_rotamer_trie );
350 hbond_set->setup_for_residue_pair_energies( pose );
355 hbond_set->copy_bb_donor_acceptor_arrays( existing_set );
400 ( static_cast< hbonds::HBondSet const & >
424 bool exclude_bsc =
false, exclude_scb =
false;
435 !
options_->decompose_bb_hb_into_pair_energies(), exclude_bsc, exclude_scb,
false,
440 exclude_bsc = exclude_scb =
false;
448 !options_->decompose_bb_hb_into_pair_energies(), exclude_bsc, exclude_scb,
false,
459 !
options_->decompose_bb_hb_into_pair_energies(), exclude_bsc, exclude_scb,
false,
463 exclude_bsc = exclude_scb =
false;
471 !options_->decompose_bb_hb_into_pair_energies(), exclude_bsc, exclude_scb,
false,
481 bool res_moving_wrt_eachother
484 return res_moving_wrt_eachother;
523 bool exclude_scb( ! hb_pair_dat.res1_data().bb_don_avail() );
525 bool exclude_bsc( ! hb_pair_dat.res2_data().bb_acc_avail() );
530 hb_pair_dat.res1_data().nneighbors(), hb_pair_dat.res2_data().nneighbors(),
532 false, exclude_bsc, exclude_scb,
false,
540 bool exclude_scb( ! hb_pair_dat.res2_data().bb_don_avail() );
542 bool exclude_bsc( ! hb_pair_dat.res1_data().bb_acc_avail() );
547 hb_pair_dat.res2_data().nneighbors(), hb_pair_dat.res1_data().nneighbors(),
549 false, exclude_bsc, exclude_scb,
false,
559 bool exclude_scb( ! hb_pair_dat.res1_data().bb_don_avail() );
561 bool exclude_bsc( ! hb_pair_dat.res2_data().bb_acc_avail() );
566 hb_pair_dat.res1_data().nneighbors(), hb_pair_dat.res2_data().nneighbors(),
568 false, exclude_bsc, exclude_scb,
false,
576 bool exclude_scb( ! hb_pair_dat.res2_data().bb_don_avail() );
578 bool exclude_bsc( ! hb_pair_dat.res1_data().bb_acc_avail() );
583 hb_pair_dat.res2_data().nneighbors(), hb_pair_dat.res1_data().nneighbors(),
585 false, exclude_bsc, exclude_scb,
false,
617 hbresdata->set_nneighbors( hbondset.
nbrs( rsd.
seqpos() ) );
624 hbresdata->set_natoms( rsd.
natoms() );
652 hbpairdat->set_res2_data( static_cast< HBondResidueMinData const * > ( res2_data_cache.
get_data(
hbond_res_data )() ));
681 bool const exclude_bsc,
682 bool const exclude_scb,
695 if(don_rsd.
is_RNA()==
false)
return;
696 if(don_rsd.
is_RNA()!=acc_rsd.
is_RNA()) utility_exit_with_message(
"don_rsd.is_RNA()!=acc_rsd.is_RNA()");
703 for ( chemical::AtomIndices::const_iterator
705 hnum != hnume; ++hnum ) {
706 Size const hatm( *hnum );
719 for ( chemical::AtomIndices::const_iterator
721 anum != anume; ++anum ) {
723 Size const aatm( *anum );
727 if( acc_rsd.
path_distance( aatm, datm ) < 4) utility_exit_with_message(
"rsd.path_distance(aatm, datm) < 4");
732 if ( ! datm_is_bb && exclude_bsc )
continue;
734 if (datm_is_bb && exclude_scb)
continue;
738 if ( hatm_xyz.distance_squared( acc_rsd.
xyz( aatm ) ) >
MAX_R2 )
continue;
740 Real unweighted_energy( 0.0 );
742 HBEvalTuple hbe_type( datm, don_rsd, aatm, acc_rsd);
744 int const base ( acc_rsd.
atom_base( aatm ) );
745 int const base2( acc_rsd.
abase2( aatm ) );
746 assert( base2 > 0 && base != base2 );
752 unweighted_energy,
true , deriv);
757 Real weighted_energy =
770 don_atom_derivs[ datm ].f1() += weighted_energy * deriv.
don_deriv.
f1();
771 don_atom_derivs[ datm ].f2() += weighted_energy * deriv.
don_deriv.
f2();
772 don_atom_derivs[ hatm ].f1() += weighted_energy * deriv.
h_deriv.
f1();
773 don_atom_derivs[ hatm ].f2() += weighted_energy * deriv.
h_deriv.
f2();
774 acc_atom_derivs[ aatm ].f1() += weighted_energy * deriv.
acc_deriv.
f1();
775 acc_atom_derivs[ aatm ].f2() += weighted_energy * deriv.
acc_deriv.
f2();
781 acc_atom_derivs[ base2 ].f1() += weighted_energy * deriv.
abase2_deriv.
f1();
782 acc_atom_derivs[ base2 ].f2() += weighted_energy * deriv.
abase2_deriv.
f2();
831 using EnergiesCacheableDataType::HBOND_SET;
833 HBondSet const & hbondset = static_cast< HBondSet const & > (pose.energies().data().get( HBOND_SET ));
835 assert( dynamic_cast< HBondResPairMinData * > ( data_cache.get_data( hbond_respair_data )() ));
836 HBondResPairMinData & hb_pair_dat = static_cast< HBondResPairMinData & > ( data_cache.get_data_ref( hbond_respair_data ) );
837 hb_pair_dat.clear_hbonds();
839 Size const rsd1nneighbs( hb_pair_dat.res1_data().nneighbors() );
840 Size const rsd2nneighbs( hb_pair_dat.res2_data().nneighbors() );
845 bool exclude_scb( ! hb_pair_dat.res1_data().bb_don_avail() );
847 bool exclude_bsc( ! hb_pair_dat.res2_data().bb_acc_avail() );
849 identify_hbonds_1way( hbondset, database_, rsd1, rsd2, rsd1nneighbs, rsd2nneighbs, exclude_bsc, exclude_scb, hb_pair_dat );
855 bool exclude_scb( ! hb_pair_dat.res2_data().bb_don_avail() );
857 bool exclude_bsc( ! hb_pair_dat.res1_data().bb_acc_avail() );
860 identify_hbonds_1way( hbondset, database_, rsd2, rsd1, rsd2nneighbs, rsd1nneighbs, exclude_bsc, exclude_scb, hb_pair_dat );
882 bool exclude_scb=
false;
884 hbond_derivs_1way( weights, hbondset,
database_, rsd, rsd, 1, 1, exclude_scb, exclude_scb, atom_derivs, atom_derivs );
917 Size const rsd1nneighbs( hb_pair_dat.res1_data().nneighbors() );
918 Size const rsd2nneighbs( hb_pair_dat.res2_data().nneighbors() );
923 bool exclude_scb( ! hb_pair_dat.res1_data().bb_don_avail() );
925 bool exclude_bsc( ! hb_pair_dat.res2_data().bb_acc_avail() );
927 hbond_derivs_1way( weights, hbondset,
database_, rsd1, rsd2, rsd1nneighbs, rsd2nneighbs, exclude_bsc, exclude_scb, r1_atom_derivs, r2_atom_derivs );
933 bool exclude_scb( ! hb_pair_dat.res2_data().bb_don_avail() );
935 bool exclude_bsc( ! hb_pair_dat.res1_data().bb_acc_avail() );
938 hbond_derivs_1way( weights, hbondset,
database_, rsd2, rsd1, rsd2nneighbs, rsd1nneighbs, exclude_bsc, exclude_scb, r2_atom_derivs, r1_atom_derivs );
969 id::AtomID atom( atom_index, rsd1.seqpos() );
971 for ( Size ii = 1; ii <= hbonds.size(); ++ii ) {
972 HBond const & hbond( hbonds[ ii ] );
973 Real sign_factor( 0.0 );
974 if ( hbond.atom_is_donorH( atom ) ) sign_factor = 1.0;
976 assert( hbond.atom_is_acceptor( atom ) );
979 // get the appropriate type of hbond weight
980 Real const weight(sign_factor * hbond.weight() * hb_eval_type_weight(hbond.eval_type(), weights));
981 F1 += weight * hbond.deriv().first;
982 F2 += weight * hbond.deriv().second;
1001 if ( !
options_->decompose_bb_hb_into_pair_energies() )
return;
1018 false,
true,
true,
true,
1026 false,
true,
true,
true,
1036 false,
true,
true,
true,
1044 false,
true,
true,
true,
1082 true,
true,
false,
true,
1094 true,
false,
true,
true,
1107 true,
true,
false,
true,
1119 true,
false,
true,
true,
1143 rsd1, rsd2, nbrs1, nbrs2,
1145 true,
true,
true,
false, *
options_, emap,
1149 rsd2, rsd1, nbrs2, nbrs1,
1151 true,
true,
true,
false, *
options_, emap,
1158 rsd1, rsd2, nbrs1, nbrs2,
1160 true,
true,
true,
false, *
options_, emap);
1163 rsd2, rsd1, nbrs2, nbrs1,
1165 true,
true,
true,
false, *
options_, emap);
1178 ObjexxFCL::FArray2D< core::PackerEnergy > & energy_table
1185 using namespace methods;
1186 using namespace hbtrie;
1187 using namespace trie;
1190 ObjexxFCL::FArray2D< core::PackerEnergy > temp_table1( energy_table );
1191 ObjexxFCL::FArray2D< core::PackerEnergy > temp_table2( energy_table );
1193 temp_table1 = 0; temp_table2 = 0;
1205 ( static_cast< hbonds::HBondSet const & >
1228 trie1->trie_vs_trie( *trie2, *cp, *
this, temp_table1, temp_table2 );
1232 energy_table += temp_table1;
1272 using namespace methods;
1273 using namespace hbtrie;
1274 using namespace trie;
1292 ( static_cast< hbonds::HBondSet const & >
1312 trie1->trie_vs_path( *trie2, *cp, *
this, temp_vector1, temp_vector2 );
1316 energy_vector[ ii ] += temp_vector1[ ii ];
1353 if (
options_->decompose_bb_hb_into_pair_energies())
return;
1398 HBondEnergy::eval_atom_derivative(
1399 id::AtomID const & atom_id,
1400 pose::Pose const & pose,
1401 kinematics::DomainMap const &,
1402 ScoreFunction const &,
1403 EnergyMap const & weights,
1408 using EnergiesCacheableDataType::HBOND_SET;
1410 hbonds::HBondSet const & hbond_set
1411 ( static_cast< hbonds::HBondSet const & >
1412 ( pose.energies().data().get( HBOND_SET ) ) );
1414 hbonds::get_atom_hbond_derivative( atom_id, hbond_set, weights, f1, f2 );
1431 return MAX_R + 1.35;
1455 bool condition_1= (weights[
hbond_intra]>0.0001) ?
true :
false;
1457 bool condition_2= (
options_->include_intra_res_RNA()) ?
true:
false;
1459 return (condition_1 && condition_2);
1487 using namespace trie;
1488 using namespace hbtrie;
1494 for (
Size jj = 1; jj <= res.
natoms(); ++jj ) {
1497 add_to_trie[ jj ] = 1;
1501 add_to_trie[ jj ] = 1;
1507 for (
Size jj = 1; jj <= res.
natoms(); ++jj ) {
1508 if ( add_to_trie[ jj ] == 1 ){
1515 if ( n_to_add == 0 ) {
1518 add_to_trie[ 1 ] = 1; ++n_to_add;
1520 rotamer_descriptor.
natoms( n_to_add );
1522 Size count_added_atoms = 0;
1524 if ( add_to_trie[ jj ] == 0 )
continue;
1529 newatom.xyz( res.
atom(jj).
xyz() );
1531 newatom.is_hydrogen(
false );
1536 newatom.is_dna( res.
is_DNA() );
1543 newatom.base2_xyz( res.
xyz( res.
abase2( jj )) );
1556 RotamerDescriptorAtom< HBAtom, HBCPData > rdatom( newatom, cpdata );
1557 rotamer_descriptor.
atom( ++count_added_atoms, rdatom );
1561 kk <= kk_end; ++kk ) {
1562 if ( add_to_trie[ kk ] == 0 )
continue;
1565 newhatom.xyz( res.
atom(kk).
xyz() );
1567 newhatom.base2_xyz(
Vector( 0.0, 0.0, 0.0 ) );
1570 newhatom.is_hydrogen(
true );
1575 newhatom.is_dna( res.
is_DNA() );
1583 ! hcpdata.is_sc() &&
1587 RotamerDescriptorAtom< HBAtom, HBCPData > hrdatom( newhatom, hcpdata );
1588 rotamer_descriptor.
atom( ++count_added_atoms, hrdatom );
1600 using namespace trie;
1601 using namespace hbtrie;
1605 ( static_cast< hbonds::HBondSet const & >
1615 rotamer_descriptors[ ii ].rotamer_id( ii );
1618 sort( rotamer_descriptors.begin(), rotamer_descriptors.end() );
1630 using namespace trie;
1631 using namespace hbtrie;
1635 ( static_cast< hbonds::HBondSet const & >
1641 rotamer_descriptors[ 1 ].rotamer_id( 1 );
1682 Real envweight( 1.0 );
1690 Real membrane_depth_dependent_weight( 1.0 );
1698 envweight = membrane_depth_dependent_weight;
1704 return weighted_energy;