libmove3d  3.13.0
/home/slemaign/softs-local/BioMove3D-git/include/bio.h
Go to the documentation of this file.
00001 /****************************************************************************/
00008 #ifndef BIO_H
00009 #define BIO_H
00010 
00011 #define SUPRESSION
00012 #define HYDROGEN_COMPILATION
00013 
00014 //#define HYDROGEN_BOND
00015 
00016 
00017 /*-----------------------------------------------------------------------------*/
00018 /* BIO JOINT TYPES */
00019 #define BIO_OMEGA_JNT 1
00020 #define BIO_PHI_JNT 2
00021 #define BIO_PSI_JNT 3
00022 #define BIO_GAMMA_JNT 4
00023 //#define BIO_FF_JNT 5
00024 //#define BIO_LIG_JNT 6
00025 #define BIO_OTHER_JNT 7
00026 
00027 /*-----------------------------------------------------------------------------*/
00028 /* ATOMIC MASS */
00029 #define C_MASS 12.0107
00030 #define O_MASS 15.9994
00031 #define N_MASS 14.00674
00032 #define H_MASS 1.00794
00033 #define S_MASS 32.066
00034 #define P_MASS 30.973761
00035 #define Br_MASS 79.904
00036 #define F_MASS 18.9984032
00037 #define Cl_MASS 35.4527
00038 #define I_MASS 126.90447
00039 
00040 /*-----------------------------------------------------------------------------*/
00041 /* FOR POLYNOMIALS !!! */
00042 
00043 #ifdef USE_GSL
00044 #include <gsl/gsl_poly.h>
00045 #endif
00046 #ifdef USE_CLAPACK
00047 // WARNING : ONLY FOR Mac OS X !!!
00048 #ifdef MACOSX
00049 #include <vecLib/vecLib.h>
00050 //#include <f2c.h>
00051 #endif
00052 #endif
00053 
00054 #include <p3d.h>
00055 //#include <device.h>
00056 
00057 typedef double poly2_coefs [3];
00058 
00059 typedef struct s_poly_max16_coefs {
00060   int order;
00061   double a_i[17];  // a0 + a1*x + a2*x² + a3*x³ ...
00062 } poly_max16_coefs;
00063 
00064 /*-----------------------------------------------------------------------------*/
00065 
00066 #define BIO_IK_ERROR_TOL 0.001
00067 
00068 /*-----------------------------------------------------------------------------*/
00072 typedef struct s_bio_6R_ik_data {
00073   /* constant params */
00074   double r2, r3, r4, r5, r6, rE;
00075   double al1, al2, al3, al4, al5, alE;
00076   double sal1,cal1,sal2,cal2,sal3,cal3,sal4,cal4,sal5,cal5;
00077   double cal1sal2,sal1sal2,cal1cal2,sal1cal2;
00078   double r2sal1,r2cal1,r2sal2,r2cal2,sqr_r2_05;
00079   double r5sal4,r5cal4,cal3sal4,sal3sal4,sal3cal4,cal3cal4,r4cal3sal4,r4sal3sal4,cal5sal5,sqrr4,sqrr5,sqrsal5;
00080   double coef45_1,coef543_1,coef543_2;
00081   /* variable params */
00082   double th7, r7, al7, a7, r0;
00083   double th1_i;
00084   double sal7,cal7,sth7,cth7;
00085   double cth7sal7,sth7sal7,cth7cal7,sth7cal7;
00086   double coef70_1,coef70_2,coef70_3,coef730_1,coef730_2;
00087   /* variables for coefs */
00088   double palcc,palcs,palc1,palsc,palss,pal1c,pal1s,pal11;
00089   double pbecc,pbec1,pbess,pbe1c,pbe11;
00090   double pgacc,pgacs,pgac1,pgasc,pgass,pga1c,pga1s,pga11;
00091   double paet1c,paet1s,paet11;
00092   double pacc,pacs,pac1,pasc,pass,pa1c,pa1s,pa11_,pa11;
00093   double pbet1c,pbet11;
00094   double pbcc,pbc1,pbss,pb1c,pb11_,pb11;
00095   double pcet1c,pcet1s,pcet11;
00096   double pccc,pccs,pcc1,pcsc,pcss,pc1c,pc1s,pc11_,pc11;
00097   double pset11;
00098   double pscc,pscs,psc1,pssc,psss,ps1c,ps1s,ps11;
00099   double psiet11;
00100   double psicc,psics,psic1,psisc,psiss,psi1c,psi1s,psi11;
00101   double puetcc,puetcs,puetsc,puetss,puets1;
00102   double pucc,pucs,puc1,pusc,puss,pus1,pu1c,pu1s,pu11;
00103   double pvetcs,pvetsc,pvets1;
00104   double pvcc,pvcs,pvc1,pvsc,pvss,pvs1,pv1c,pv1s,pv11;
00105   double pwetcc,pwetcs,pwetsc,pwetss,pwets1;
00106   double pwcc,pwcs,pwc1,pwsc,pwss,pws1,pw1c,pw1s,pw11;
00107   double pletcc,pletcs,pletc1,pletsc,pletss,plet1c,plet1s,plet11;
00108   double plcc,plcs,plc1,plsc,plss,pls1,pl1c,pl1s,pl11;
00109   double pmetcc,pmetc1,pmetss,pmet1c,pmet11;
00110   double pmcc,pmcs,pmc1,pmsc,pmss,pms1,pm1c,pm1s,pm11;
00111   double pnetcc,pnetcs,pnetc1,pnetsc,pnetss,pnet1c,pnet1s,pnet11;
00112   double pncc,pncs,pnc1,pnsc,pnss,pns1,pn1c,pn1s,pn11;  
00113 } bio_6R_ik_data;
00114 
00115 typedef struct SideChainBBox {
00116     double min[3];
00117     double max[3];
00118 } SideChainBBox, *SideChainBBoxPt;
00119 
00120 
00121 typedef struct Joint_Tables {
00122   struct jnt* bb_joints[3]; /* pointers to backbone joints */
00123   struct jnt* sc_joints[6];  /* pointers to side chain joints */
00124   int namino;
00125   int n_bb_joints;                              /* number of backbone joints */
00126   int n_sc_joints;                      /* number of side chain joints */
00127   SideChainBBox SC_BBox;    /* Bounding Box of the Side chain of the AA*/
00128 } Joint_tables,*Joint_tablespt;
00129 
00130 
00131 
00132 enum aminoacidos {ALA, ARG, ASN, ASP, CYS, GLN, GLU, GLY, HIS, ILE, LEU,
00133 LYS, MET, PHE, PRO, SER, THR, TRP, TYR, VAL,
00134 ALAH, ARGH, ASNH, ASPH, CYSH, GLNH, GLUH, GLYH, HISH,
00135 ILEH, LEUH,
00136 LYSH, METH, PHEH, PROH, SERH, THRH, TRPH, TYRH, VALH};
00137 
00138 typedef struct BBox {
00139     char name[6];
00140     double min[3];
00141     double max[3];
00142     p3d_poly **lpoly;
00143     short int bb;
00144     enum aminoacidos aminotype;
00145     int namino;
00146     int natoms;
00147     int loop;
00148 /*
00149 #ifdef SUPRESSION    
00150 int active; 
00151 #endif 
00152 */
00153 } Bbox, *Bboxpt;
00154 
00155 
00156 typedef struct TBox {
00157     double min[3];
00158     double max[3];
00159     Bboxpt *lbox;
00160     int nbox;
00161     struct TBox *left;
00162     struct TBox *right;
00163     short int leaf;
00164     short int level;
00165 /*
00166 #ifdef SUPRESSION    
00167 int active; 
00168 #endif 
00169 */
00170     //int name;
00171 } boxnode;
00172 
00173 typedef boxnode *boxnodept;
00174 
00175 
00176 
00177 
00178 /* Structure whose purpose is the test of Short (topological) Distances
00179 interactions 
00180 All topologically posible interactions between the two lists of atoms
00181  lA and lB will be tested */
00182 typedef struct s_SD_struct {
00183         void (*function)(struct s_SD_struct*);
00184         p3d_poly **lA; /* first atom list coming from rigid A*/
00185         p3d_poly **lB; /* second atom list  coming from rigid B*/
00186         int tobefreededA; /* indicates if lA points to a new space of memory and,
00187         therefore, must be freeded. */
00188 
00189 /* CRITICAL POINTS: 
00190 lA points always to a  meaningful memory space.Instead,
00191 lB can be NULL. 
00192 Also, only lB points always to a new fresh memory space that
00193 must be ALLWAYS freeded in free_SD. Instead, lA can point to a new memory
00194 space or not, and must be freeded or not. This is the purpose of
00195 tobefreededA. Thus, lists that must
00196  not be freeded must be put in lA. Otherwise another field 
00197  tobefreededB must be created
00198 There is not any subtle purpose in these facts. You can remove
00199 these assumptions with a little of care from the code without
00200 colateral effects */
00201 /*      int tobefreededB;  indicates if lB points to a new space of memory and,
00202         therefore, must be freeded */
00203         struct rigid_structure *rigidA; /* rigid to which lA belongs */
00204         struct rigid_structure *rigidB; /* rigid to which lB belongs */
00205 
00206         
00207 #ifdef SUPRESSION
00208         int active;             /* whether the SD is active */
00209 /*      int activeA;     rigid A active 
00210         int activeB;     rigid B active */
00211 #endif  
00212         int tA1; /* number of atoms of A at topol. distance 1 from B */
00213         int tA4; /* number of atoms of A at topol. distance 4 or more from B */
00214         int tA12; /* number of atoms of A at topol. distance 1 or 2 from B */
00215         int tA34; /* number of atoms of A at topol. distance 3 or more from B */
00216         int tA123; /* number of atoms of A at topol. distance 1 or 2  or 3 from B */
00217         int tA234; /* number of atoms of A at topol. distance 2 or more from B */
00218         int nA;         /* number of atoms of A */
00219         
00220         int tB1; /* number of atoms of B at topol. distance 1 from A */
00221         int tB2; /* number of atoms of B at topol. distance 2 from A */
00222         int tB3; /* number of atoms of B at topol. distance 3 from A */
00223         int tB4; /* number of atoms of B at topol. distance 4 or more from A */
00224         int tB12; /* number of atoms of B at topol. distance 1 or 2 from A */
00225         int tB123; /* number of atoms of B at topol. distance 1, 2 or 3 from A */
00226 
00227 
00228 } SD_struct;
00229 
00230 typedef SD_struct *SDpt;
00231 
00232 
00233 /* especialized function in charge of executing the collision tests
00234 of a given type of SD structure */
00235 typedef void (*SD_function) (SD_struct *SD);
00236 
00237 typedef struct rigid_structure {
00238 #ifdef SUPRESSION
00239 int active;
00240 /*
00241 int index; 
00242  for rigids containing at least a backbone box: index of autocol with the
00243                 preceding rigid (or -1 if there is no one)
00244         for rigids containing a side chain, the autocol index of the chain
00245 */
00246 #endif
00247 int nboxes;
00248 Bboxpt *lbox;
00249 /*double *reference_vec;
00250 double (*reference)[4];
00251 */
00252 p3d_poly *reference; /* atom whose motion reveals the motion of the rigid */
00253 SDpt *lSD; /* list of SD_struct  in which the rigid participates */
00254 int nSD; /* number of SD structures in which the rigid participates */
00255 #ifdef HYDROGEN_COMPILATION
00256 /* Some rigids have two sentinel atoms. If the rigid changes its configuration
00257 at least one of them moves */
00258 p3d_poly *reference2;
00259 #endif
00260 boxnodept root;
00261 
00262 }Rigid_structure;
00263 
00264 
00265 typedef struct SupBox {
00266     double min[3];
00267     double max[3];
00268                 boxnodept *lnode;
00269     int nnodes;
00270     struct SupBox *left;
00271     struct SupBox *right;
00272                 struct SupBox *leftbrother; /*only filled for the right brothers */
00273     short int leaf;
00274     short int level;
00275     int name;
00276 } supnode;
00277 
00278 typedef supnode *supnodept;
00279 
00280 /*
00281 enum SD_type {bb_intercol, bb_bb_disulphur, bb_sc_disulphur,
00282 sc_bb_disulphur, sc_sc_disulphur,
00283 bb_sc_ala, bb_sc_arg, bb_sc_asn, bb_sc_asp,
00284 bb_sc_cys, bb_sc_gln, bb_sc_glu, bb_sc_gly, bb_sc_his,
00285  bb_sc_ile, bb_sc_leu, bb_sc_lys, bb_sc_met, bb_sc_phe, bb_sc_pro
00286  , bb_sc_ser, bb_sc_thr, bb_sc_trp, bb_sc_tyr, bb_sc_val,
00287  bb_sc_alaH , bb_sc_argH, bb_sc_asnH, bb_sc_aspH,
00288 bb_sc_cysH, bb_sc_glnH, bb_sc_gluH, bb_sc_glyH, bb_sc_hisH,
00289  bb_sc_ileH, bb_sc_leuH, bb_sc_lysH, bb_sc_metH, bb_sc_pheH, bb_sc_proH
00290  , bb_sc_serH, bb_sc_thrH, bb_sc_trpH, bb_sc_tyrH, bb_sc_valH};
00291 */
00292 
00293 
00294 
00295 typedef struct robot_structure {
00296 
00297 int polypep;
00298 int to_be_rebuilt;
00299 struct rob  *p3d_robot; /* introduced to allow many robots in a p3d_robot */
00300 int init_joint; /* number of joint at which the robot begins
00301                                                                         one p3d_robot can have several "true robots" */
00302 
00303 int colliding;
00304 int nrigids;
00305 Rigid_structure **rigids;
00306 SDpt *inter_bb;
00307 SDpt *intra_res;
00308 //SDpt *autocol_bb;
00309 //SDpt *autocol_cl;
00310 SDpt *loops;
00311 int loop_index;
00312 int intercol_index;
00313 int autocol_index;
00314 boxnodept *roots; 
00315 #ifdef SUPRESSION
00316 int n_active_rigids;
00317 int n_aminos;
00318 Rigid_structure **amino_rigidbb; /* pointers to the rigids that contain the residual bb's */
00319 Rigid_structure **amino_rigidcl; /* pointers to the rigids that contain the residual sc's 
00320 if the amino number does not exist NULL. If the the residual does not own a sc NULL*/
00321 Joint_tablespt *joint_tables;
00322 #endif
00323 supnode *superroot;
00324 }Robot_structure;
00325 
00326 typedef struct autocol_struc {
00327 
00328 int size;
00329 int nrigid;
00330 p3d_poly **list;
00331 }autocol_struc;
00332 
00333 typedef void (*check_pair_function) (p3d_poly *,p3d_poly *);
00334 typedef int (*check_all_function) (p3d_poly **,int,p3d_poly **,int);
00335 typedef short int (*donatouch_function) (double *, double *, double *, double *);
00336 
00337 #define NORMAL_BIOCOL_MODE 0
00338 #define SURFACE_DISTANCE_BIOCOL_MODE 1
00339 #define MINIMUM_DISTANCE_BIOCOL_MODE 2
00340 
00341 struct bcd_init_structure {
00342 short int sc_free;
00343 short int bb_free;
00344 short int prev_bb_free;
00345 short int loop;
00346 short int new_disulphur;
00347 Rigid_structure *rigid;
00348 Rigid_structure *prev_rigid;
00349 Rigid_structure *sc_rigid;
00350 SDpt *inter_bb;
00351 SDpt *intra_res;
00352 SDpt *loops;
00353 int autocol_index;
00354 int intercol_index;
00355 int loop_index;
00356 Bboxpt last_bb_box;
00357 Bboxpt prev_bb_box;
00358 Bboxpt last_sc_box;
00359 };
00360 
00361 typedef struct {
00362   int *tab;
00363   int size;
00364 } int_tab;
00365 
00366 typedef struct ligandBBox {
00367     double min[3];
00368     double max[3];
00369 } ligandBBox, *ligandBBoxPt;
00370 
00371 
00372 typedef struct ligand {
00373   ligandBBox ligBBox; // ligand Axes oriented Bounding box
00374   double current_u_inv; //last invalid parameter  for a ligand localpath motion  
00375 } ligand, *ligandPt;
00376 
00377 
00378 extern ligand *LIGAND_PT;
00379 
00380 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines