GLYLIB  0.3.0b
dprint_X.c
Go to the documentation of this file.
00001 /* The following is a set of functions intended primarily to facilitate 
00002 debugging.  But, they could easily be used for verbose data output within
00003 the program.  They all follow the same basic format:
00004 
00005 print_X(X x, int level)
00006 
00007 where   X = one of the structures defined above (e.g., molecule, residue, 
00008                 bondset, atom, bond, atype, plane, vectormag_3D, coord_3D).
00009         *x = pointer to your structure
00010         level = the depth to print.  This is only available on structures 
00011                 likely to contain arrays of other structures.  level=0 only
00012                 prints the top-level information.  level=1 prints one level 
00013                 down of other structures, lists, etc. level=2 prints two 
00014                 levels down, etc.   The value of level can be larger than 
00015                 the depth available -- the function will stop when it runs
00016                 out of structures to print.  
00017   Author: Lachele Foley
00018 */
00019 #include <mylib.h>
00020 #include <molecules.h>
00021 //#include "../inc/mylib.h"
00022 //#include "../inc/molecules.h"
00023 void dprint_coord_3D(coord_3D *c){
00024         printf("coord i j k \t%20.12f \t%20.12f \t%20.12f\n",c[0].i,c[0].j,c[0].k);
00025 return;
00026 }
00027 
00028 void dprint_vectormag_3D(vectormag_3D *v){
00029         printf("vectormag i j k d \t%20.12f \t%20.12f \t%20.12f \t%20.12f\n",v[0].i,v[0].j,v[0].k,v[0].d); 
00030 return;
00031 }
00032 
00033 void dprint_plane(plane *p){
00034         printf("plane A B C D \t%20.12f \t%20.12f \t%20.12f \t%20.12f\n",p[0].A,p[0].B,p[0].C,p[0].D); 
00035 return;
00036 }
00037 
00038 void dprint_atype(atype *t,int i){
00039         int pa=0,psz=0,puse=0,pbins=0;
00040         printf("atype \tn=%d ; N=>>%s<< ; NT=>>%s<< ; m=%20.12f ; nb=%d\n",t[0].n,t[0].N,t[0].NT,t[0].m,t[0].nb);
00041         printf("\tdesc=>>%s<<\n",t[0].desc);
00042         if(i>0){ 
00043                 puse=malloc_usable_size(t[0].bo);
00044                 psz=sizeof(double);
00045                 pbins=puse/psz; 
00046                 printf("\t%d bond orders have been allocated: ",pbins);
00047                 for(pa=0;((pa<i)&&(pa<t[0].nb)&&(pa<pbins));pa++){
00048                         printf("\t%20.12f",t[0].bo[pa]);
00049                         }
00050                 printf("\n");
00051                 }
00052 return;
00053 }
00054 
00055 void dprint_molbond(molbond *mb){
00056         printf("molbond s (m,r,a=%d,%d,%d) t (m,r,a=%d,%d,%d) o %20.12f\n",\
00057                 mb[0].s.m,mb[0].s.r,mb[0].s.a,mb[0].t.m,mb[0].t.r,mb[0].t.a,mb[0].o);
00058 return;
00059 }
00060 void dprint_bond(bond *b){
00061         printf("bond s (m,r,a=%d,%d,%d) t (m,r,a=%d,%d,%d) o %20.12f\n",\
00062                 b[0].s.m,b[0].s.r,b[0].s.a,b[0].t.m,b[0].t.r,b[0].t.a,b[0].o);
00063 return;
00064 }
00065 
00066 void dprint_atom(atom *a,int i){
00067         int pa=0,psz=0,puse=0,pbins=0;
00068         printf("atom \tn=%d ; N=>>%s<< ; t=%d ; nb=%d ; nalt=%d ; nvec=%d\n",a[0].n,a[0].N,\
00069                 a[0].t,a[0].nb,a[0].nalt,a[0].nvec);
00070         printf("\tT=>>%s<< ; E=>>%s<< ; cID=>>%s<< ; m=%f \n",a[0].T,a[0].E,\
00071                 a[0].cID,a[0].m);
00072         printf("\tD=>>%s<< \n",a[0].D);
00073         printf("\tcoords x y z \t%20.12f \t%20.12f \t%20.12f\n",a[0].x.i,a[0].x.j,a[0].x.k); 
00074         if(i>0){
00075                 puse=malloc_usable_size(a[0].mb);
00076                 psz=sizeof(molbond);
00077                 pbins=puse/psz; 
00078                 printf("\t%d molbonds have been allocated: \n",pbins);
00079                 for(pa=0;((pa<i)&&(pa<a[0].nmb)&&(pa<pbins));pa++){
00080                         printf("\tmolbond set %d:  ",pa);
00081                         dprint_molbond(&(a[0].mb[pa])); 
00082                         }
00083                 puse=malloc_usable_size(a[0].xa);
00084                 psz=sizeof(coord_3D);
00085                 pbins=puse/psz; 
00086                 printf("\t%d alternate coordinates have been allocated: \n",pbins);
00087                 for(pa=0;((pa<i)&&(pa<a[0].nalt)&&(pa<pbins));pa++){
00088                         printf("\talt coord set %d:  ",pa);
00089                         dprint_coord_3D(&(a[0].xa[pa])); 
00090                         }
00091                 puse=malloc_usable_size(a[0].v);
00092                 psz=sizeof(vectormag_3D);
00093                 pbins=puse/psz; 
00094                 printf("\t%d vectors have been allocated: \n",pbins);
00095                 for(pa=0;((pa<i)&&(pa<a[0].nvec)&&(pa<pbins));pa++){
00096                         printf("\tset %d:  ",pa);
00097                         dprint_vectormag_3D(&(a[0].v[pa])); 
00098                         }
00099                 } 
00100 return;
00101 }
00102 
00103 void dprint_molbondset(molbondset *bs,int i){
00104         printf("NEED TO WRITE dprint_molbondset\n");
00105 return;
00106 }
00107 void dprint_bondset(bondset *bs,int i){
00108         int pa=0,psz=0,puse=0,pbins=0;
00109         printf("bondset contains n=%d bonds\n",bs[0].n);
00110         if(i>0){
00111                 puse=malloc_usable_size(bs[0].b);
00112                 psz=sizeof(bond);
00113                 pbins=puse/psz; 
00114                 printf("\t%d consecutive bonds have been allocated: \n",pbins);
00115                 for(pa=0;((pa<i)&&(pa<bs[0].n)&&(pa<pbins));pa++){
00116                         printf("\tconsec bonds set %d : \t",pa);
00117                         dprint_bond(&(bs[0].b[pa]));
00118                         }
00119                 }
00120 return;
00121 }
00122 
00123 void dprint_residue(residue *r,int i){
00124         int pa=0,psz=0,puse=0,pbins=0;
00125         if(r[0].IC==NULL){printf("residue \tn=%d (no IC);",r[0].n);}
00126         else{printf("residue \tn=%d ; N=>>%s<< ; IC=%s;",r[0].n,r[0].N,r[0].IC);}
00127         printf("\tT=>>%s<< ; cID=>>%s<< ; m=%f \n",r[0].T,r[0].cID,r[0].m);
00128         printf("\tD=>>%s<< \n",r[0].D);
00129         printf("\tna=%d ; nbs=%d ; nring=%d \n",r[0].na,r[0].nbs,r[0].nring); 
00130         if(i>0){
00131                 puse=malloc_usable_size(r[0].a);
00132                 psz=sizeof(atom);
00133                 pbins=puse/psz; 
00134                 //printf("usable return is %d, size is %d, bins is %d\n",puse,psz,pbins);
00135                 printf("\t%d atoms have been allocated: \n",pbins);
00136                 for(pa=0;((pa<i)&&(pa<r[0].na)&&(pa<pbins));pa++){
00137                         printf("\tatom set %d\n",pa);
00138                         dprint_atom(&(r[0].a[pa]),i); 
00139                         }
00140                 puse=malloc_usable_size(r[0].bs);
00141                 psz=sizeof(molbondset);
00142                 pbins=puse/psz; 
00143                 printf("\t%d consecutive, linear bonds have been allocated: \n",pbins);
00144                 for(pa=0;((pa<i)&&(pa<r[0].nbs)&&(pa<pbins));pa++){
00145                         printf("\tconsec. lin, bondset set %d\n",pa);
00146                         dprint_molbondset(&(r[0].bs[pa]),i); 
00147                         } 
00148                 puse=malloc_usable_size(r[0].rc);
00149                 psz=sizeof(coord_3D);
00150                 pbins=puse/psz; 
00151                 printf("\t%d ring center coordinates have been allocated: \n",pbins);
00152                 for(pa=0;((pa<i)&&(pa<r[0].nrc)&&(pa<pbins));pa++){
00153                         printf("\tconsec ring coords set %d:  ",pa);
00154                         dprint_coord_3D(&(r[0].rc[pa])); 
00155                         }
00156                 puse=malloc_usable_size(r[0].rp);
00157                 psz=sizeof(plane);
00158                 pbins=puse/psz; 
00159                 printf("\t%d ring plane equations have been allocated: \n",pbins);
00160                 for(pa=0;((pa<i)&&(pa<r[0].nrp)&&(pa<pbins));pa++){
00161                         printf("\tring plane set %d:  ",pa);
00162                         dprint_plane(&(r[0].rp[pa])); 
00163                         }
00164                 } 
00165 return;
00166 }
00167 
00168 void dprint_molecule(molecule *m,int i){
00169         int pa=0,psz=0,puse=0,pbins=0;
00170         printf("molecule \ti=%d ; N=>>%s<< ; nr=%d \n",m[0].i,m[0].N,m[0].nr); 
00171         if(i>0){
00172                 puse=malloc_usable_size(m[0].r);
00173                 psz=sizeof(residue);
00174                 pbins=puse/psz; 
00175                 printf("\t%d residues have been allocated: \n",pbins);
00176                 for(pa=0;((pa<i)&&(pa<m[0].nr)&&(pa<pbins));pa++){
00177                         printf("\t\tset %d\n",pa);
00178                         dprint_residue(&(m[0].r[pa]),i); 
00179                         }
00180                 }
00181 return;
00182 }
00183 
 All Classes Files Functions Variables Typedefs Defines