#include "../headers/refine.h"
Go to the source code of this file.
Functions | |
void | refinePockets (c_lst_pockets *pockets, s_fparams *params) |
void | dropSmallNpolarPockets (c_lst_pockets *pockets, s_fparams *params) |
void | drop_tiny (c_lst_pockets *pockets) |
void | reIndexPockets (c_lst_pockets *pockets) |
void drop_tiny | ( | c_lst_pockets * | pockets | ) |
## FUNCTION: drop_tiny -- ## SPECIFICATION: Drop really tiny pockets (< 5 alpha spheres)
## PARAMETRES: @ c_lst_pockets *pockets : The list of pockets.
## RETURN: void
Definition at line 176 of file refine.c.
References dropPocket(), c_lst_pockets::first, c_lst_pockets::n_pockets, c_lst_vertices::n_vertices, node_pocket::next, node_pocket::pocket, and s_pocket::v_lst.
00177 { 00178 node_pocket *npcur = pockets->first, 00179 *npnext = NULL ; 00180 while(npcur) { 00181 npnext = npcur->next ; 00182 00183 if(npcur->pocket->v_lst->n_vertices < 2){ 00184 /* If the pocket is really small, drop it */ 00185 dropPocket(pockets, npcur); 00186 } 00187 00188 if(pockets->n_pockets <= 0) fprintf(stderr, "! No Pockets Found while refining\n"); 00189 npcur = npnext ; 00190 } 00191 }
void dropSmallNpolarPockets | ( | c_lst_pockets * | pockets, | |
s_fparams * | params | |||
) |
## FUNCTION: dropSmallNpolarPockets -- ## SPECIFICATION: Refine algorithm: will remove small pockets (depends on the corresponding parameters in params), pockets containing less than NB apolar alpha spheres (given in params)..
## PARAMETRES: @ c_lst_pockets *pockets : The list of pockets. @ s_fparams *params : Parameters
## RETURN: void
Definition at line 130 of file refine.c.
References dropPocket(), c_lst_pockets::first, s_fparams::min_pock_nb_asph, c_lst_pockets::n_pockets, c_lst_vertices::n_vertices, s_pocket::nAlphaApol, node_pocket::next, node_pocket::pocket, s_fparams::refine_min_apolar_asphere_prop, and s_pocket::v_lst.
Referenced by search_pocket().
00131 { 00132 double pasph = 0.0 ; 00133 node_pocket *npcur = NULL, 00134 *nextPocket1 = NULL; 00135 s_pocket *pcur = NULL ; 00136 00137 if(pockets) { 00138 npcur = pockets->first ; 00139 while(npcur) { 00140 pcur = npcur->pocket ; 00141 nextPocket1 = npcur->next ; 00142 pasph = (float)((float)pcur->nAlphaApol/(float)pcur->v_lst->n_vertices) ; 00143 00144 00145 if(pcur->v_lst->n_vertices < (size_t) params->min_pock_nb_asph 00146 || pasph < (params->refine_min_apolar_asphere_prop)){ 00147 /* If the pocket is too small or has not enough apolar alpha 00148 * spheres, drop it */ 00149 dropPocket(pockets, npcur); 00150 } 00151 00152 if(pockets->n_pockets <= 0) fprintf(stderr, "! No Pockets Found while refining\n"); 00153 npcur = nextPocket1 ; 00154 } 00155 } 00156 else { 00157 fprintf(stderr, "! No pockets to drop from (argument NULL: %p).\n", pockets) ; 00158 } 00159 00160 }
void refinePockets | ( | c_lst_pockets * | pockets, | |
s_fparams * | params | |||
) |
## FUNCTION: refinePockets
## SPECIFICATION: Refine algorithm: will merge two pockets whose barycenters are close together (distance criteria given in params).
## PARAMETRES: @ c_lst_pockets *pockets : The list of pockets. @ s_fparams *params : Parameters
## RETURN: void
Definition at line 78 of file refine.c.
References s_pocket::bary, dist(), c_lst_pockets::first, mergePockets(), node_pocket::next, and node_pocket::pocket.
Referenced by search_pocket().
00079 { 00080 node_pocket *nextPocket; 00081 node_pocket *curMobilePocket; 00082 00083 node_pocket *pcur = NULL ; 00084 00085 float *pbary = NULL, 00086 *mpbary = NULL, dst ; 00087 00088 if(pockets) { 00089 pcur = pockets->first ; 00090 while(pcur) { 00091 pbary = pcur->pocket->bary ; 00092 curMobilePocket = pcur->next ; 00093 00094 while(curMobilePocket) { 00095 mpbary = curMobilePocket->pocket->bary ; 00096 nextPocket = curMobilePocket->next ; 00097 dst = dist(pbary[0], pbary[1], pbary[2], mpbary[0], mpbary[1], mpbary[2]) ; 00098 if(dst < params->refine_clust_dist) { 00099 // Merge pockets if barycentres are close to each other 00100 mergePockets(pcur, curMobilePocket, pockets); 00101 } 00102 curMobilePocket = nextPocket ; 00103 } 00104 00105 pcur = pcur->next ; 00106 } 00107 } 00108 else { 00109 fprintf(stderr, "! No pocket to refine! (argument NULL: %p).\n", pockets) ; 00110 } 00111 }
void reIndexPockets | ( | c_lst_pockets * | pockets | ) |
## FUNCTION: reIndexPockets
## SPECIFICATION: Reindex pockets, after dropping and merging operations on pockets and recalculate barycentres in the same loop
## PARAMETRES: @ c_lst_pockets *pockets: The list of pockets.
## RETURN: void
Definition at line 208 of file refine.c.
References s_pocket::bary, c_lst_vertices::first, c_lst_pockets::first, c_lst_pockets::n_pockets, node_pocket::next, node_vertice::next, node_pocket::pocket, s_vvertice::resid, s_pocket::v_lst, node_vertice::vertice, s_vvertice::x, s_vvertice::y, and s_vvertice::z.
Referenced by search_pocket().
00209 { 00210 node_vertice *vcur = NULL ; 00211 node_pocket *pcur = NULL ; 00212 s_pocket *pock_cur = NULL ; 00213 00214 int curPocket = 0, 00215 n_vert ; 00216 00217 float posSum[3]; 00218 00219 if(pockets && pockets->n_pockets > 0) { 00220 pcur = pockets->first ; 00221 while(pcur) { 00222 curPocket++ ; //new index counter 00223 n_vert = 0 ; 00224 00225 pock_cur = pcur->pocket ; 00226 pock_cur->bary[0]=0 ; 00227 pock_cur->bary[1]=0 ; 00228 pock_cur->bary[2]=0 ; 00229 00230 posSum[0]=0; posSum[1]=0; posSum[2]=0; 00231 if(pock_cur->v_lst){ 00232 vcur = pock_cur->v_lst->first; 00233 00234 while(vcur){ 00235 posSum[0] += vcur->vertice->x; 00236 posSum[1] += vcur->vertice->y; 00237 posSum[2] += vcur->vertice->z; 00238 n_vert++; 00239 00240 vcur->vertice->resid = curPocket; //set new index 00241 vcur = vcur->next ; 00242 } 00243 } 00244 else { 00245 fprintf(stderr, "! Empty Pocket...something might be wrong over here ;).\n") ; 00246 } 00247 //set new barycentre 00248 pock_cur->bary[0] = posSum[0]/(float)n_vert; 00249 pock_cur->bary[1] = posSum[1]/(float)n_vert; 00250 pock_cur->bary[2] = posSum[2]/(float)n_vert; 00251 pcur = pcur->next ; 00252 } 00253 } 00254 else { 00255 fprintf(stderr, "! No pocket to reindex.\n") ; 00256 } 00257 }