33 #include <utility/vector1.hh>
34 #include <utility/io/izstream.hh>
35 #include <basic/Tracer.hh>
36 #include <basic/database/open.hh>
39 namespace ObjexxFCL {
namespace fmt { } }
using namespace ObjexxFCL::fmt;
43 static basic::Tracer
TR(
"core.scoring.methods.MembraneEnvSmoothEnergy",basic::t_info);
53 MembraneEnvSmoothEnergyCreator::create_energy_method(
60 MembraneEnvSmoothEnergyCreator::score_types_for_method()
const {
74 MembraneEnvSmoothEnergy::MembraneEnvSmoothEnergy() :
77 Size const max_aa( 20 );
78 Size const env_log_table_cen10_bins( 40 );
79 Size const max_mem_layers( 3 );
82 mem_env_log10_.dimension( max_aa, max_mem_layers, env_log_table_cen10_bins );
83 utility::io::izstream stream;
84 basic::database::open( stream,
"scoring/score_functions/MembranePotential/CEN10_Menv_smooth_log.txt" );
85 for (
Size i=1; i<= max_aa; ++i ){
86 getline( stream, line );
87 std::istringstream l(line);
89 if ( l.fail() || tag !=
"MENV_SMOOTH_LOG_CEN10:" ) utility_exit_with_message(
"bad format for scoring/score_functions/MembranePotential/CEN10_Menv_smooth_log.txt (Menv_smooth)");
90 for(
Size j=1;j<=max_mem_layers;++j) {
91 for(
Size k=1;k<=env_log_table_cen10_bins;++k) {
133 for (
Size i = 1; i <= nres; ++i ) {
138 if(! rsd.is_protein() )
continue;
151 ir = graph.get_node(i)->const_edge_list_begin(),
154 Size const j( (*ir)->get_other_ind( i ) );
156 Size atomindex_j( rsd_j.type().nbr_atom() );
160 Real sqdist = atom_i.
xyz().distance_squared(atom_j.xyz());
209 using namespace ObjexxFCL::fmt;
212 ir = graph.get_node( rsd.
seqpos() )->const_edge_list_begin(),
213 ire = graph.get_node( rsd.
seqpos() )->const_edge_list_end();
215 Size const j( (*ir)->get_other_ind( rsd.
seqpos() ) );
221 Size atomindex_j( rsd_j.nbr_atom() );
225 Real sqdist = atom_i.
xyz().distance_squared( atom_j.xyz() );
268 bool const input_atom_is_nbr( i_nbr_atom ==
Size (atom_id.
atomno()) );
269 bool const input_atom_is_rep( i_rep_atom ==
Size ( atom_id.
atomno() ));
274 ir = graph.get_node(i)->const_edge_list_begin(),
277 Size const j( (*ir)->get_other_ind( i ) );
283 if ( input_atom_is_nbr && input_atom_is_rep && rsd_j.is_protein() ) {
285 Size const resj_nbr_atom = rsd_j.nbr_atom();
286 if ( resj_rep_atom == resj_nbr_atom ) {
289 atom_i, rsd_j.atom( resj_rep_atom ),
294 atom_i, rsd_j.atom( resj_rep_atom ),
299 atom_i, rsd_j.atom( resj_nbr_atom ),
303 }
else if ( input_atom_is_nbr && rsd_j.is_protein() ) {
307 atom_i, rsd_j.atom( resj_rep_atom ),
312 Size const resj_nbr_atom = rsd_j.nbr_atom();
314 atom_i, rsd_j.atom( resj_nbr_atom ),
365 utility_exit_with_message(
"ERROR: Failed to find amino acid " +
chemical::name_from_aa( aa ) +
" in EnvSmooth::representative_atom_name" );
370 return calpha_string;
394 Real & dscore_dneighbor_count
397 Size low_bin =
static_cast< Size > ( floor(neighbor_count));
398 Size high_bin =
static_cast< Size > ( ceil(neighbor_count));
399 Real inter = neighbor_count - low_bin;
400 if (neighbor_count <= 1) {
401 low_bin = high_bin = 1; inter = 0;
406 Real thickness = 2.0;
408 int layer1,layer2,layer;
409 Real f,z,zn,layer_edge;
411 Real const env10_weight=1.0;
414 if ( ( MembraneDepth < 11.0 ) || ( MembraneDepth > 49.0 ) ) {
418 score = env10_weight *
mem_env_log10_( aa, layer, low_bin ) * (1.0-inter) +
421 dscore_dneighbor_count = env10_weight *
mem_env_log10_( aa, layer, high_bin ) -
424 }
else if ( ( MembraneDepth >= 11.0 && MembraneDepth <= 13.0 ) || ( MembraneDepth >= 47.0 && MembraneDepth <= 49.0 ) ) {
429 if ( MembraneDepth <= 13.0 ) {
434 z = 2*std::abs( (MembraneDepth - layer_edge ) ) / thickness;
435 zn = std::pow( z, slope );
438 score = f * ( env10_weight *
mem_env_log10_( aa, layer2, low_bin ) * (1.0-inter) +
439 env10_weight *
mem_env_log10_( aa, layer2, high_bin ) * (inter) ) +
440 ( 1 - f ) * ( env10_weight *
mem_env_log10_( aa, layer1, low_bin ) * (1.0-inter) +
441 env10_weight *
mem_env_log10_( aa, layer1, high_bin ) * (inter) );
443 dscore_dneighbor_count = f * ( env10_weight *
mem_env_log10_( aa, layer2, high_bin ) -
445 ( 1 - f ) * ( env10_weight *
mem_env_log10_( aa, layer1, high_bin ) -
448 if ( MembraneDepth <= 12.0 || MembraneDepth >= 48.0 ) {
454 }
else if ( ( MembraneDepth > 13.0 && MembraneDepth < 17.0 ) || ( MembraneDepth > 43.0 && MembraneDepth < 47.0 ) ) {
458 score = env10_weight *
mem_env_log10_( aa, layer, low_bin ) * (1.0-inter) +
461 dscore_dneighbor_count = env10_weight *
mem_env_log10_( aa, layer, high_bin ) -
464 }
else if ( ( MembraneDepth >= 17.0 && MembraneDepth <= 19.0 ) || ( MembraneDepth >= 41.0 && MembraneDepth <= 43.0 ) ) {
469 if ( MembraneDepth <= 19.0 ) {
474 z = 2*std::abs( (MembraneDepth - layer_edge ) ) / thickness;
475 zn = std::pow( z, slope );
478 score = f * ( env10_weight *
mem_env_log10_( aa, layer2, low_bin ) * (1.0-inter) +
479 env10_weight *
mem_env_log10_( aa, layer2, high_bin ) * (inter) ) +
480 ( 1 - f ) * ( env10_weight *
mem_env_log10_( aa, layer1, low_bin ) * (1.0-inter) +
481 env10_weight *
mem_env_log10_( aa, layer1, high_bin ) * (inter) );
483 dscore_dneighbor_count = f * ( env10_weight *
mem_env_log10_( aa, layer2, high_bin ) -
485 ( 1 - f ) * ( env10_weight *
mem_env_log10_( aa, layer1, high_bin ) -
492 score = env10_weight *
mem_env_log10_( aa, layer, low_bin ) * (1.0-inter) +
495 dscore_dneighbor_count = env10_weight *
mem_env_log10_( aa, layer, high_bin ) -
501 dscore_dneighbor_count = 0;
503 if ( ( MembraneDepth < 11.0 ) || ( MembraneDepth > 49.0 ) ) {
509 }
else if ( ( MembraneDepth >= 11.0 && MembraneDepth <= 13.0 ) || ( MembraneDepth >= 47.0 && MembraneDepth <= 49.0 ) ) {
514 if ( MembraneDepth <= 13.0 ) {
519 z = 2*std::abs( (MembraneDepth - layer_edge ) ) / thickness;
520 zn = std::pow( z, slope );
526 if ( MembraneDepth <= 12.0 || MembraneDepth >= 48.0 ) {
532 }
else if ( ( MembraneDepth > 13.0 && MembraneDepth < 17.0 ) || ( MembraneDepth > 43.0 && MembraneDepth < 47.0 ) ) {
538 }
else if ( ( MembraneDepth >= 17.0 && MembraneDepth <= 19.0 ) || ( MembraneDepth >= 41.0 && MembraneDepth <= 43.0 ) ) {
543 if ( MembraneDepth <= 19.0 ) {
548 z = 2*std::abs( (MembraneDepth - layer_edge ) ) / thickness;
549 zn = std::pow( z, slope );
565 dscore_dneighbor_count *= 2.019;
577 Real dist = sqrt( sqdist );
587 Real weighted_dScore_dN,
601 dist = sqrt( dist2 );
606 Real dscoredd = ( weighted_dScore_dN ) * dNdd;
607 if ( dscoredd != 0 ) {