23 #include <basic/database/open.hh>
26 #include <basic/datacache/BasicDataCache.hh>
27 #include <basic/prof.hh>
28 #include <utility/io/izstream.hh>
30 #include <utility/vector1.hh>
43 y += q[0] / (1 + exp( -q[2]*x - q[1] ));
47 y += n[0] * exp( -(x-n[1])*(x-n[1]) / (2*n[2]*n[2]) );
57 Real e = exp( -q[2]*x - q[1] );
59 dy += q[0]*q[2]*e / (d*d);
63 dy += n[0] * (n[1]-x) / (n[2]*n[2]) * exp( -(n[1]-x)*(n[1]-x) / (2*n[2]*n[2]) );
74 Size const max_aa( 20 );
81 utility::io::izstream stream;
82 basic::database::open( stream,
"scoring/score_functions/centroid_smooth/cen_smooth_params.txt");
84 while ( getline( stream, line ) ) {
85 std::istringstream l(line);
87 if (tag ==
"CBETA6:") {
91 Real shift; l >> shift;
93 }
else if (tag ==
"GAUSSIAN" || tag ==
"SIGMOID") {
94 Size ngauss; l >> ngauss;
97 l >> g[0] >> g[1] >> g[2];
98 if (tag ==
"GAUSSIAN")
104 }
else if (tag ==
"CBETA12:") {
107 if (tag ==
"SHIFT") {
108 Real shift; l >> shift;
110 }
else if (tag ==
"GAUSSIAN" || tag ==
"SIGMOID") {
111 Size ngauss; l >> ngauss;
114 l >> g[0] >> g[1] >> g[2];
115 if (tag ==
"GAUSSIAN")
121 }
else if (tag ==
"CENPACK:") {
124 if (tag ==
"SHIFT") {
125 Real shift; l >> shift;
127 }
else if (tag ==
"GAUSSIAN" || tag ==
"SIGMOID") {
128 Size ngauss; l >> ngauss;
131 l >> g[0] >> g[1] >> g[2];
132 if (tag ==
"GAUSSIAN")
138 }
else if (tag ==
"ENV:") {
144 if (tag ==
"SHIFT") {
145 Real shift; l >> shift;
146 currEnv.
shift(shift);
147 }
else if (tag ==
"GAUSSIAN" || tag ==
"SIGMOID") {
148 Size ngauss; l >> ngauss;
151 l >> g[0] >> g[1] >> g[2];
152 if (tag ==
"GAUSSIAN")
158 }
else if (tag ==
"PAIR:") {
163 pair_[std::min(aa1,aa2)][std::max(aa1,aa2)];
166 if (tag ==
"SHIFT") {
167 Real shift; l >> shift;
168 currPair.
shift(shift);
169 }
else if (tag ==
"GAUSSIAN" || tag ==
"SIGMOID") {
170 Size ngauss; l >> ngauss;
173 l >> g[0] >> g[1] >> g[2];
174 if (tag ==
"GAUSSIAN")
180 }
else if (tag !=
"#") {
181 utility_exit_with_message(
"bad format for cen_smooth_params.txt");
184 if ( l.fail() ) utility_exit_with_message(
"bad format for cen_smooth_params.txt");
196 Real const SIGMOID_SLOPE = 6.0;
199 Real interp6 = 1 / (1+exp(SIGMOID_SLOPE*(cendist-6)));
200 cenlist.
fcen6(res1) += interp6;
201 cenlist.
fcen6(res2) += interp6;
203 Real interp10 = 1 / (1+exp(SIGMOID_SLOPE*(cendist-10)));
204 cenlist.
fcen10(res1) += interp10;
205 cenlist.
fcen10(res2) += interp10;
207 Real interp12 = 1 / (1+exp(SIGMOID_SLOPE*(cendist-12)));
208 cenlist.
fcen12(res1) += interp12 - interp6;
209 cenlist.
fcen12(res2) += interp12 - interp6;
220 Real const SIGMOID_SLOPE = 6.0;
222 Real x = cenvec.length();
225 Real e6 = exp(SIGMOID_SLOPE*(x-6));
226 Real d6 = e6 / ((1-e6)*(1-e6));
227 dcenlist.fcen6(res1) += d6*gradx;
228 dcenlist.fcen6(res2) -= d6*gradx;
230 Real e10 = exp(SIGMOID_SLOPE*(x-10));
231 Real d10 = e10 / ((1-e10)*(1-e10));
232 dcenlist.fcen10(res1) += d10*gradx;
233 dcenlist.fcen10(res2) -= d10*gradx;
235 Real e12 = exp(SIGMOID_SLOPE*(x-12));
236 Real d12 = e12 / ((1-e12)*(1-e12));
237 dcenlist.fcen12(res1) += (d12-d6)*gradx;
238 dcenlist.fcen12(res2) -= (d12-d6)*gradx;
251 Size const nres( energy_graph.num_nodes() );
257 for (
Size i = 1; i < nres; ++i ) {
259 if ( !rsd1.is_protein() )
continue;
261 iru = energy_graph.get_node(i)->const_upper_edge_list_begin(),
263 iru != irue; ++iru ) {
264 EnergyEdge const * edge( static_cast< EnergyEdge const *> (*iru) );
267 if ( !rsd2.is_protein() )
continue;
289 Size const nres( energy_graph.num_nodes() );
294 for (
Size i = 1; i < nres; ++i ) {
296 if ( !rsd1.is_protein() )
continue;
298 iru = energy_graph.get_node(i)->const_upper_edge_list_begin(),
300 iru != irue; ++iru ) {
301 EnergyEdge const * edge( static_cast< EnergyEdge const *> (*iru) );
304 if ( !rsd2.is_protein() )
continue;
307 rsd1.atom( rsd1.nbr_atom() ).
xyz() - rsd2.atom( rsd2.nbr_atom() ).
xyz();
340 int const position ( rsd.
seqpos() );
342 Real const fcen6 ( cenlist.
fcen6( position) );
343 Real const fcen10 ( cenlist.
fcen10(position) );
344 Real const fcen12 ( cenlist.
fcen12(position) );
347 env_score =
env_[ rsd.
aa() ].func( fcen10 );
363 Real & pair_contribution,
364 Real & cenpack_contribution
368 pair_contribution = 0.0;
369 cenpack_contribution = 0.0;
384 Real cendist = sqrt(cendist2);
386 pair_contribution = currPair.
func( cendist );
389 Real const SIGMOID_SLOPE = 6.0;
390 pair_contribution *= 1 / (1+exp(SIGMOID_SLOPE*(cendist-10.5)));
392 cenpack_contribution =
cenpack_.
func( cendist * 10 + 0.5 );
415 int const position ( rsd.
seqpos() );
423 Real const fcen6 ( cenlist.
fcen6( position) );
424 Real const fcen10 ( cenlist.
fcen10(position) );
425 Real const fcen12 ( cenlist.
fcen12(position) );
426 d_env_score =
env_[ rsd.
aa() ].dfunc( fcen10 ) * dcentroids6_dx;
456 Real cendist = sqrt(cendist2);
459 Real const SIGMOID_SLOPE = 6.0;
460 Real e = exp(SIGMOID_SLOPE*(cendist-10.5));
463 Real d_sigmoid = -SIGMOID_SLOPE*e / (d*d);
464 d_pair = sigmoid * currPair.
dfunc( cendist ) + pair * d_sigmoid;
475 using namespace core::pose::datacache;
497 using namespace core::pose::datacache;
499 ( pose.
data().get_const_ptr( CacheableDataType::SIGMOID_WEIGHTED_D_CEN_LIST )() ));