GLYLIB
0.3.0b
|
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 dXprint_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 dXprint_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 dXprint_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 dXprint_atype(atype *t,int i){ 00039 int pa=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 for(pa=0;((pa<i)&&(pa<t[0].nb));pa++){ 00044 printf("\t%20.12f",t[0].bo[pa]); 00045 } 00046 printf("\n"); 00047 } 00048 return; 00049 } 00050 00051 void dXprint_molbond(molbond *mb){ 00052 printf("molbond s (m,r,a=%d,%d,%d) t (m,r,a=%d,%d,%d) o %20.12f\n",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); 00053 return; 00054 } 00055 void dXprint_bond(bond *b){ 00056 printf("bond s (m,r,a=%d,%d,%d) t (m,r,a=%d,%d,%d) o %20.12f\n",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); 00057 return; 00058 } 00059 00060 00061 00062 void dXprint_atom(atom *a,int i){ 00063 int pa=0; 00064 printf("atom \tn=%d ; N=>>%s<< ; t=%d ; nb=%d ; nalt=%d ; nvec=%d\n",a[0].n,a[0].N,\ 00065 a[0].t,a[0].nb,a[0].nalt,a[0].nvec); 00066 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); 00067 if(i>0){ 00068 for(pa=0;((pa<i)&&(pa<a[0].nmb));pa++){ 00069 printf("\tmolbond set %d: ",pa); 00070 dXprint_molbond(&(a[0].mb[pa])); 00071 } 00072 for(pa=0;((pa<i)&&(pa<a[0].nalt));pa++){ 00073 printf("\talt coord set %d: ",pa); 00074 dXprint_coord_3D(&(a[0].xa[pa])); 00075 } 00076 for(pa=0;((pa<i)&&(pa<a[0].nvec));pa++){ 00077 printf("\tset %d: ",pa); 00078 dXprint_vectormag_3D(&(a[0].v[pa])); 00079 } 00080 } 00081 return; 00082 } 00083 00084 void dXprint_molbondset(molbondset *bs,int i){ 00085 printf("NEED TO WRITE dXprint_molbondset\n"); 00086 return; 00087 } 00088 void dXprint_bondset(bondset *bs,int i){ 00089 int pa=0; 00090 printf("bondset contains n=%d bonds\n",bs[0].n); 00091 if(i>0){ 00092 for(pa=0;((pa<i)&&(pa<bs[0].n));pa++){ 00093 printf("\tconsec bonds set %d : \t",pa); 00094 dXprint_bond(&(bs[0].b[pa])); 00095 } 00096 } 00097 return; 00098 } 00099 00100 void dXprint_residue(residue *r,int i){ 00101 int pa=0; 00102 if(r[0].IC==NULL){printf("residue \tn=%d (no IC);",r[0].n);} 00103 else{printf("residue \tn=%d IC=%s;",r[0].n,r[0].IC);} 00104 printf(" N=>>%s<< ; na=%d ; nbs=%d ; nring=%d \n",r[0].N,\ 00105 r[0].na,r[0].nbs,r[0].nring); 00106 if(i>0){ 00107 for(pa=0;((pa<i)&&(pa<r[0].na));pa++){ 00108 printf("\tatom set %d\n",pa); 00109 dXprint_atom(&(r[0].a[pa]),i); 00110 } 00111 for(pa=0;((pa<i)&&(pa<r[0].nbs));pa++){ 00112 printf("\tconsec. lin, bondset set %d\n",pa); 00113 dXprint_molbondset(&(r[0].bs[pa]),i); 00114 } 00115 for(pa=0;((pa<i)&&(pa<r[0].nrc));pa++){ 00116 printf("\tconsec ring coords set %d: ",pa); 00117 dXprint_coord_3D(&(r[0].rc[pa])); 00118 } 00119 for(pa=0;((pa<i)&&(pa<r[0].nrp));pa++){ 00120 printf("\tring plane set %d: ",pa); 00121 dXprint_plane(&(r[0].rp[pa])); 00122 } 00123 } 00124 return; 00125 } 00126 00127 void dXprint_molecule(molecule *m,int i){ 00128 int pa=0; 00129 printf("molecule \ti=%d ; N=>>%s<< ; nr=%d \n",m[0].i,m[0].N,m[0].nr); 00130 if(i>0){ 00131 for(pa=0;((pa<i)&&(pa<m[0].nr));pa++){ 00132 printf("\t\tset %d\n",pa); 00133 dXprint_residue(&(m[0].r[pa]),i); 00134 } 00135 } 00136 return; 00137 } 00138