27 #ifndef INCLUDED_core_scoring_memb_etable_BaseMembEtableEnergy_hh
28 #define INCLUDED_core_scoring_memb_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);
477 Energy atr(0.0), rep(0.0), solv(0.0), bb(0.0);
488 Energy atr(0.0), rep(0.0), solv(0.0), bb(0.0);
499 Energy atr(0.0), rep(0.0), solv(0.0), bb(0.0);
510 Energy atr(0.0), rep(0.0), solv(0.0), bb(0.0);
680 ObjexxFCL::FArray3D< Real >
const &
ljatr_;
681 ObjexxFCL::FArray3D< Real >
const &
ljrep_;
682 ObjexxFCL::FArray3D< Real >
const &
solv1_;
683 ObjexxFCL::FArray3D< Real >
const &
solv2_;
684 ObjexxFCL::FArray3D< Real >
const &
dljatr_;
685 ObjexxFCL::FArray3D< Real >
const &
dljrep_;
686 ObjexxFCL::FArray3D< Real >
const &
dsolv_;
720 template <
class Derived >
731 d2 = atom1.
xyz().distance_squared( atom2.
xyz() );
733 if ( ( d2 >= safe_max_dis2 ) || ( d2 ==
Real(0.0) ) ) {
738 Real const d2_bin = d2 * etable_bins_per_A2;
739 disbin =
static_cast< int >( d2_bin ) + 1;
741 frac = d2_bin - ( disbin - 1 );
748 template <
class Derived>
752 conformation::Atom
const & atom1,
753 conformation::Atom
const & atom2,
762 assert( ljatr_.active() );
764 int disbin;
Real frac;
765 atr = rep = solv = bb = 0.0;
766 if (interpolate_bins(atom1,atom2,d2,disbin,frac)) {
772 int const l1 = ljatr_.index( disbin, atom1.type(), atom2.type()),
777 atr = weight * ( e1 + frac * ( ljatr_[
l2 ] - e1 ) );
780 rep = weight * ( e1 + frac * ( ljrep_[
l2 ] - e1 ) );
782 e1 = solv1_[
l1 ] + solv2_[
l1 ];
783 solv = weight * ( e1 + frac * ( solv1_[
l2 ] + solv2_[
l2] - e1 ) );
792 template <
class Derived>
795 BaseEtableEnergy< Derived>::fast_memb_env_energy_(
796 conformation::Atom
const & atom1,
808 Real z = dot(atom1.xyz(),normal)+30;
809 z = fabs(z-center_FA);
811 Real zn = std::pow( z, steepness );
812 Real f = zn/(1 + zn);
813 mbenvE = (1 - f) * (memb_lk_dgrefce(attype1) - lk_dgrefce(attype1));
818 template <
class Derived>
822 conformation::Atom
const & atom1,
823 conformation::Atom
const & atom2,
832 assert( ljatr_.active() );
834 int disbin;
Real frac;
835 atr = rep = solv = bb = 0.0;
836 if (interpolate_bins(atom1,atom2,d2,disbin,frac)) {
842 int const l1 = ljatr_.index( disbin, atom1.type(), atom2.type()),
847 atr = weight * ( e1 + frac * ( ljatr_[
l2 ] - e1 ) );
850 rep = weight * ( e1 + frac * ( ljrep_[
l2 ] - e1 ) );
862 Real z = dot(atom1.xyz(),normal)+30;
863 z = fabs(z-center_FA);
865 Real zn = std::pow( z, steepness );
866 Real f = zn/(1 + zn);
868 e11 = f * solv1_[
l1 ] + (1 - f) * memb_solv1_[ l1 ];
869 e12 = f * solv1_[
l2 ] + (1 - f) * memb_solv1_[
l2 ];
873 z = dot(atom2.xyz(),normal)+30;
874 z = fabs(z-center_FA);
876 zn = std::pow( z, steepness );
879 e21 = f * solv2_[
l1 ] + (1 - f) * memb_solv2_[ l1 ];
880 e22 = f * solv2_[
l2 ] + (1 - f) * memb_solv2_[
l2 ];
885 solv = weight * ( e1 + frac * ( e2 - e1 ) );
893 template <
class Derived>
897 conformation::Atom
const & atom1,
898 conformation::Atom
const & atom2,
904 assert( dljatr_.active() );
906 f1 = atom1.xyz().cross( atom2.xyz() );
907 f2 = atom1.xyz() - atom2.xyz();
911 if ( interpolate_bins(atom1,atom2,d2,disbin,frac) ) {
918 int const l1 = dljatr_.index( disbin, atom1.type(), atom2.type()),
922 deriv = weights[ st_atr_] * ( e1 + frac * ( dljatr_[
l2 ] - e1 ) );
925 deriv += weights[ st_rep_ ] * ( e1 + frac * ( dljrep_[
l2 ] - e1 ) );
937 Real z = dot(atom1.xyz(),normal)+30;
938 z = fabs(z-center_FA);
940 Real zn = std::pow( z, steepness );
941 Real f = zn/(1 + zn);
943 e1 = f * dsolv1_[
l1 ] + (1 - f) * memb_dsolv1_[ l1 ];
947 z = dot(atom2.xyz(),normal)+30;
948 z = fabs(z-center_FA);
950 zn = std::pow( z, steepness );
953 Real e2 = f * dsolv2_[
l2 ] + (1 - f) * memb_dsolv2_[
l2 ];
955 deriv += weights[ st_sol_ ] * ( e1 + frac * ( e2 - e1 ) );
957 return deriv / std::sqrt( d2 );
965 template <
class Derived>
969 conformation::Atom
const & atom1,
970 conformation::Atom
const & atom2,
976 assert( dljatr_.active() );
978 f1 = atom1.xyz().cross( atom2.xyz() );
979 f2 = atom1.xyz() - atom2.xyz();
983 if ( interpolate_bins(atom1,atom2,d2,disbin,frac) ) {
990 int const l1 = dljatr_.index( disbin, atom1.type(), atom2.type()),
994 deriv = weights[ st_atr_] * ( e1 + frac * ( dljatr_[
l2 ] - e1 ) );
997 deriv += weights[ st_rep_ ] * ( e1 + frac * ( dljrep_[
l2 ] - e1 ) );
1000 deriv += weights[ st_sol_ ] * ( e1 + frac * ( dsolv_[
l2 ] - e1 ) );
1003 return deriv / std::sqrt( d2 );
1010 template <
class Derived >
1014 conformation::Atom
const & atom1,
1015 conformation::Atom
const & atom2,
1023 pair_energy_H(atom1,atom2,weight,atr,rep,solv,bb);
1026 emap[st_sol_]+=solv;
1033 template <
class Derived >
1037 conformation::Atom
const & atom1,
1038 conformation::Atom
const & atom2,
1046 assert( ljrep_.active() );
1049 atr = rep = solv = bb = 0.0;
1050 if (interpolate_bins(atom1,atom2,d2,disbin,frac)) {
1058 int l1 = ljrep_.index( disbin, atom1.type(), atom2.type() );
1061 Real const rep_e1( ljrep_[ l1 ] );
1062 rep = weight * ( rep_e1 + frac * ( ljrep_[
l2 ] - rep_e1 ) );
1064 Real const atr_e1 = ljatr_[
l1 ];
1065 atr = weight * ( atr_e1 + frac * ( ljatr_[
l2 ] - atr_e1 ) );
1075 #endif // INCLUDED_core_scoring_EtableEnergy_HH