/*************************************************************************** sasaenefunc.c - description ------------------- begin : Fri Oct 15 12:20:37 2004 copyright : (C) 2002 by Cavalli Andrea email : cavalli@bioc.unizh.ch **************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #define COOR_DIM 4 #include #include # define M_PI 3.14159265358979323846 //rssnsasa void energy_rssnsasa_d(const int * first, const int * second, const int * boundarry, const int natoms, const double * coor, const double c2, const double * charge, const int * type_code, const int type_size, const double * vdw_data, const int * sasa_ignore, const double * sasa_vdw, const double * sasa_surf, const double * sasa_solv, double * surf, double * ene_vdw, double * ene_cul, double r_water){ int f; int fpos; int s; int spos; double dx,dy,dz; double ix,iy,iz; double jx,jy,jz; double d; double d2; double d6; double dinv; double d2inv; double d6inv; double d12inv; double shiftf; double A,B,q1,q2; int tc1,tc2; int data_pos; double nb6; double nb12; double si; double sj; double pi; double pj; double pij; double ri; double rj; double bi; double bj; double tmp; double evdw =0, ecul=0; const double c2inv = 1.0/c2; const double c6inv = c2inv*c2inv*c2inv; const double c12inv = c6inv*c6inv; const double one = 1.0; const double two = 2.0; int i,j; for(i = 0;ic2) continue; // if(d2>c2){ cout<<"AHHHHHHHHHH"<= d2){ dinv = invsqrt(d2); d = d2*dinv; si = sasa_surf[f]; sj = sasa_surf[s]; pi = sasa_solv[f]; pj = sasa_solv[s]; pij = 0.3516; bi = M_PI*(ri+r_water); bj = M_PI*(rj+r_water); tmp = tmp -d; bi = bi*tmp; bj = bj*tmp; tmp = (rj-ri)*dinv; bi = bi*(one+tmp); bj = bj*(one-tmp); surf[f] = surf[f]*(one-pi*pij*bi/si); surf[s] = surf[s]*(one-pj*pij*bj/sj); } } } } *ene_vdw = *ene_vdw + evdw; *ene_cul = *ene_cul+ ecul; } //rssnsasa void energy_rssnsasa_f(const int * first, const int * second, const int * boundarry, const int natoms, const float * coor, const float c2, const float * charge, const int * type_code, const int type_size, const float * vdw_data, const int * sasa_ignore, const float * sasa_vdw, const float * sasa_surf, const float * sasa_solv, float * surf, float * ene_vdw, float * ene_cul, float r_water){ int f; int fpos; int s; int spos; float dx,dy,dz; float ix,iy,iz; float jx,jy,jz; float d; float d2; float d6; float dinv; float d2inv; float d6inv; float d12inv; float shiftf; float A,B,q1,q2; int tc1,tc2; int data_pos; float nb6; float nb12; float si; float sj; float pi; float pj; float pij; float ri; float rj; float bi; float bj; float tmp; float evdw =0, ecul=0; const float c2inv = 1.0/c2; const float c6inv = c2inv*c2inv*c2inv; const float c12inv = c6inv*c6inv; const float one = 1.0; const float two = 2.0; int i,j; for(i = 0;ic2) continue; // if(d2>c2){ cout<<"AHHHHHHHHHH"<= d2){ dinv = invsqrt(d2); d = d2*dinv; si = sasa_surf[f]; sj = sasa_surf[s]; pi = sasa_solv[f]; pj = sasa_solv[s]; pij = 0.3516; bi = M_PI*(ri+r_water); bj = M_PI*(rj+r_water); tmp = tmp -d; bi = bi*tmp; bj = bj*tmp; tmp = (rj-ri)*dinv; bi = bi*(one+tmp); bj = bj*(one-tmp); surf[f] = surf[f]*(one-pi*pij*bi/si); surf[s] = surf[s]*(one-pj*pij*bj/sj); } } } } *ene_vdw = *ene_vdw + evdw; *ene_cul = *ene_cul+ ecul; }