00001 #include "../headers/mdpout.h"
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095 void write_md_grid(s_mdgrid *g, FILE *f, FILE *fiso,s_mdparams *par,float isovalue)
00096 {
00097 int cx,cy,cz;
00098 float cv;
00099 float rx,ry,rz;
00100 size_t cnt=0;
00101
00102 fprintf(f,"# Data calculated by mdpocket, part of the fpocket package\n");
00103 fprintf(f,"# This is a standard DX file of occurences of cavities within MD trajectories.\n");
00104 fprintf(f,"# The file can be visualised using the freely available VMD software\n");
00105 fprintf(f,"# fpocket parameters used to create this dx file : \n");
00106 fprintf(f,"# \t-m %2.f (min alpha sphere size) -M %.2f (max alpha sphere size)\n",par->fpar->asph_min_size, par->fpar->asph_max_size);
00107 fprintf(f,"# \t-i %d (min number of alpha spheres per pocket)\n",par->fpar->min_pock_nb_asph);
00108 fprintf(f,"# \t-D %.2f (Max distance for 1st clustering algo)\n#\t-r %.2f (Max dist for 2nd clustering algo)\n#\t-s %.2f (Max dist for third clustering algo)\n",par->fpar->clust_max_dist, par->fpar->refine_clust_dist, par->fpar->sl_clust_max_dist);
00109 fprintf(f,"# \t-n %d (Min neighbour atoms for multi linkage clustering)\n",par->fpar->sl_clust_min_nneigh);
00110 if(par->flag_scoring) fprintf(f,"# \t-S (Map drug score to density map!)\n");
00111 fprintf(f,"object 1 class gridpositions counts %d %d %d\n",g->nx,g->ny,g->nz);
00112 fprintf(f,"origin %.2f %.2f %.2f\n",g->origin[0],g->origin[1],g->origin[2]);
00113 fprintf(f,"delta %.2f 0 0\n",g->resolution);
00114 fprintf(f,"delta 0 %.2f 0\n",g->resolution);
00115 fprintf(f,"delta 0 0 %.2f\n",g->resolution);
00116 fprintf(f,"object 2 class gridconnections counts %d %d %d\n",g->nx,g->ny,g->nz);
00117 fprintf(f,"object 3 class array type double rank 0 items %d data follows\n",g->nx*g->ny*g->nz);
00118 int i=0;
00119 for(cx=0;cx<g->nx;cx++){
00120 for(cy=0;cy<g->ny;cy++){
00121 for(cz=0;cz<g->nz;cz++){
00122 if(i==3) {
00123 i=0;
00124 fprintf(f,"\n");
00125 }
00126 cv=g->gridvalues[cx][cy][cz];
00127 fprintf(f,"%.3f ",cv);
00128 if(cv>=isovalue){
00129 cnt++;
00130 rx=g->origin[0]+cx*g->resolution;
00131 ry=g->origin[1]+cy*g->resolution;
00132 rz=g->origin[2]+cz*g->resolution;
00133 fprintf(fiso,"ATOM %5d C PTH 1 %8.3f%8.3f%8.3f%6.2f%6.2f\n",(int)cnt,rx,ry,rz,0.0,0.0);
00134 }
00135 i++;
00136 }
00137 }
00138 }
00139 }
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162 void write_md_pocket_atoms(FILE *f,int *ids,s_pdb *prot, int nids, int sn){
00163 s_atm *cura;
00164 int i,j,flag;
00165 i=0;
00166 j=0;
00167 fprintf(f,"MODEL %d\n",sn);
00168 for(i=0;i<nids;i++){
00169 flag=0;
00170 while(flag==0 && j<prot->natoms){
00171 cura=prot->latoms_p[j];
00172 if(cura->id==ids[i]){
00173 flag=1;
00174 write_pdb_atom_line(f, "ATOM", cura->id, cura->name,
00175 cura->pdb_aloc, cura->res_name, cura->chain,
00176 cura->res_id, cura->pdb_insert, cura->x, cura->y, cura->z, cura->occupancy,
00177 cura->bfactor, cura->symbol, cura->charge);
00178 }
00179 j++;
00180 }
00181 }
00182 fprintf(f,"ENDMDL\n");
00183
00184 }
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203 void write_first_bfactor_density(FILE *f,s_pdb *prot){
00204 s_atm *cura;
00205 int i;
00206
00207 for(i=0;i<prot->natoms;i++){
00208 cura=prot->latoms_p[i];
00209 write_pdb_atom_line(f, "ATOM", cura->id, cura->name,
00210 cura->pdb_aloc, cura->res_name, cura->chain,
00211 cura->res_id, cura->pdb_insert, cura->x, cura->y, cura->z, cura->occupancy,
00212 cura->bfactor, cura->symbol, cura->charge);
00213 }
00214 fprintf(f,"TER\n");
00215 fprintf(f,"END\n");
00216
00217 }