27 #ifndef INCLUDED_core_scoring_etable_BaseMembEtableEnergy_hh
28 #define INCLUDED_core_scoring_etable_BaseMembEtableEnergy_hh
53 #include <ObjexxFCL/FArray3D.hh>
59 template <
class Derived >
60 class BaseEtableEnergy :
public methods::ContextIndependentTwoBodyEnergy
70 Etable
const & etable_in,
71 methods::EnergyMethodOptions
const & options,
87 ScoreFunction
const & sfxn,
88 kinematics::MinimizerMapBase
const & min_map
100 ScoreFunction
const &scfxn
116 conformation::RotamerSetBase & set
131 ScoreFunction
const & sfxn
136 conformation::Residue
const & res1,
137 conformation::Residue
const & res2,
139 ScoreFunction
const & sfxn
144 conformation::Residue
const & res,
146 ScoreFunction
const & sfxn
153 conformation::Residue
const & rsd1,
154 conformation::Residue
const & rsd2,
156 ScoreFunction
const & sfxn,
165 conformation::Residue
const & rsd1,
166 conformation::Residue
const & rsd2,
168 ScoreFunction
const & sfxn,
178 conformation::Residue
const & rsd1,
179 conformation::Residue
const & rsd2,
181 ScoreFunction
const & sfxn,
190 conformation::Residue
const & rsd1,
191 conformation::Residue
const & rsd2,
193 ScoreFunction
const & sfxn,
200 conformation::RotamerSetBase
const & set1,
201 conformation::RotamerSetBase
const & set2,
203 ScoreFunction
const & sfxn,
205 ObjexxFCL::FArray2D< core::PackerEnergy > & energy_table
214 conformation::RotamerSetBase
const & set,
215 conformation::Residue
const & residue,
217 ScoreFunction
const & sfxn,
225 conformation::Residue
const & rsd1,
226 conformation::Residue
const & rsd2,
228 ScoreFunction
const & sfxn,
235 conformation::Residue
const & rsd1,
236 conformation::Residue
const & rsd2,
238 ScoreFunction
const & sfxn,
247 ScoreFunction
const &,
260 id::AtomID
const &
id,
263 ScoreFunction
const & sfxn,
299 Energy atr, rep, solv, bb;
300 atr = rep = solv = bb = 0;
321 Energy atr, rep, solv, bb;
322 atr = rep = solv = bb = 0;
360 static_cast< Derived const*
> (
this) ->
atom_pair_energy_(atom1,atom2,weight,atr,rep,solv,bb,dsq);
390 static_cast< Derived const*
> (
this) -> fast_memb_env_energy_(atom1,attype1,mbenvE);
405 return static_cast< Derived const*
> (
this) ->
pair_energy_H_(atom1,atom2,weight,atr,rep,solv,bb);
430 return static_cast< Derived const*
> (
this) ->
eval_dE_dR_over_r_(atom1,atom2,weights,f1,f2);
484 Energy atr(0.0), rep(0.0), solv(0.0), bb(0.0);
495 Energy atr(0.0), rep(0.0), solv(0.0), bb(0.0);
506 Energy atr(0.0), rep(0.0), solv(0.0), bb(0.0);
517 Energy atr(0.0), rep(0.0), solv(0.0), bb(0.0);
687 ObjexxFCL::FArray3D< Real >
const &
ljatr_;
688 ObjexxFCL::FArray3D< Real >
const &
ljrep_;
689 ObjexxFCL::FArray3D< Real >
const &
solv1_;
690 ObjexxFCL::FArray3D< Real >
const &
solv2_;
693 ObjexxFCL::FArray3D< Real >
const &
dsolv_;
727 template <
class Derived >
738 d2 = atom1.
xyz().distance_squared( atom2.
xyz() );
740 if ( ( d2 >= safe_max_dis2 ) || ( d2 ==
Real(0.0) ) ) {
745 Real const d2_bin = d2 * etable_bins_per_A2;
746 disbin =
static_cast< int >( d2_bin ) + 1;
748 frac = d2_bin - ( disbin - 1 );
755 template <
class Derived>
769 assert( ljatr_.active() );
771 int disbin;
Real frac;
772 atr = rep = solv = bb = 0.0;
773 if (interpolate_bins(atom1,atom2,d2,disbin,frac)) {
779 int const l1 = ljatr_.index( disbin, atom1.
type(), atom2.
type()),
784 atr = weight * ( e1 + frac * ( ljatr_[
l2 ] - e1 ) );
787 rep = weight * ( e1 + frac * ( ljrep_[
l2 ] - e1 ) );
789 e1 = solv1_[
l1 ] + solv2_[
l1 ];
790 solv = weight * ( e1 + frac * ( solv1_[
l2 ] + solv2_[
l2] - e1 ) );
799 template <
class Derived>
815 Real z = dot(atom1.
xyz(),normal)+30;
816 z = fabs(z-center_FA);
818 Real zn = std::pow( z, steepness );
819 Real f = zn/(1 + zn);
820 mbenvE = (1 - f) * (memb_lk_dgrefce(attype1) - lk_dgrefce(attype1));
825 template <
class Derived>
839 assert( ljatr_.active() );
841 int disbin;
Real frac;
842 atr = rep = solv = bb = 0.0;
843 if (interpolate_bins(atom1,atom2,d2,disbin,frac)) {
849 int const l1 = ljatr_.index( disbin, atom1.
type(), atom2.
type()),
854 atr = weight * ( e1 + frac * ( ljatr_[
l2 ] - e1 ) );
857 rep = weight * ( e1 + frac * ( ljrep_[
l2 ] - e1 ) );
869 Real z = dot(atom1.
xyz(),normal)+30;
870 z = fabs(z-center_FA);
872 Real zn = std::pow( z, steepness );
873 Real f = zn/(1 + zn);
875 e11 = f * solv1_[
l1 ] + (1 - f) * memb_solv1_[ l1 ];
876 e12 = f * solv1_[
l2 ] + (1 - f) * memb_solv1_[
l2 ];
880 z = dot(atom2.
xyz(),normal)+30;
881 z = fabs(z-center_FA);
883 zn = std::pow( z, steepness );
886 e21 = f * solv2_[
l1 ] + (1 - f) * memb_solv2_[ l1 ];
887 e22 = f * solv2_[
l2 ] + (1 - f) * memb_solv2_[
l2 ];
892 solv = weight * ( e1 + frac * ( e2 - e1 ) );
900 template <
class Derived>
911 assert( dljatr_.active() );
913 f1 = atom1.
xyz().cross( atom2.
xyz() );
914 f2 = atom1.
xyz() - atom2.
xyz();
918 if ( interpolate_bins(atom1,atom2,d2,disbin,frac) ) {
925 int const l1 = dljatr_.index( disbin, atom1.
type(), atom2.
type()),
929 deriv = weights[ st_atr_] * ( e1 + frac * ( dljatr_[
l2 ] - e1 ) );
932 deriv += weights[ st_rep_ ] * ( e1 + frac * ( dljrep_[
l2 ] - e1 ) );
944 Real z = dot(atom1.
xyz(),normal)+30;
945 z = fabs(z-center_FA);
947 Real zn = std::pow( z, steepness );
948 Real f = zn/(1 + zn);
950 e1 = f * dsolv1_[
l1 ] + (1 - f) * memb_dsolv1_[ l1 ];
954 z = dot(atom2.
xyz(),normal)+30;
955 z = fabs(z-center_FA);
957 zn = std::pow( z, steepness );
960 Real e2 = f * dsolv2_[
l2 ] + (1 - f) * memb_dsolv2_[
l2 ];
962 deriv += weights[ st_sol_ ] * ( e1 + frac * ( e2 - e1 ) );
964 return deriv / std::sqrt( d2 );
972 template <
class Derived>
983 assert( dljatr_.active() );
985 f1 = atom1.
xyz().cross( atom2.
xyz() );
986 f2 = atom1.
xyz() - atom2.
xyz();
990 if ( interpolate_bins(atom1,atom2,d2,disbin,frac) ) {
997 int const l1 = dljatr_.index( disbin, atom1.
type(), atom2.
type()),
1001 deriv = weights[ st_atr_] * ( e1 + frac * ( dljatr_[
l2 ] - e1 ) );
1004 deriv += weights[ st_rep_ ] * ( e1 + frac * ( dljrep_[
l2 ] - e1 ) );
1007 deriv += weights[ st_sol_ ] * ( e1 + frac * ( dsolv_[
l2 ] - e1 ) );
1010 return deriv / std::sqrt( d2 );
1017 template <
class Derived >
1030 pair_energy_H(atom1,atom2,weight,atr,rep,solv,bb);
1033 emap[st_sol_]+=solv;
1040 template <
class Derived >
1053 assert( ljrep_.active() );
1056 atr = rep = solv = bb = 0.0;
1057 if (interpolate_bins(atom1,atom2,d2,disbin,frac)) {
1065 int l1 = ljrep_.index( disbin, atom1.
type(), atom2.
type() );
1068 Real const rep_e1( ljrep_[ l1 ] );
1069 rep = weight * ( rep_e1 + frac * ( ljrep_[
l2 ] - rep_e1 ) );
1071 Real const atr_e1 = ljatr_[
l1 ];
1072 atr = weight * ( atr_e1 + frac * ( ljatr_[
l2 ] - atr_e1 ) );
1082 #endif // INCLUDED_core_scoring_EtableEnergy_HH