00001 #include "../headers/mdpmem.h" 00002 00003 00004 /* 00005 00006 ## GENERAL INFORMATION 00007 ## 00008 ## FILE mdpmem.c 00009 ## AUTHORS P. Schmidtke and V. Le Guilloux 00010 ## LAST MODIFIED 04-08-09 00011 ## 00012 ## SPECIFICATIONS 00013 ## 00014 ## This file contains all main routines of the mdpocket program. 00015 ## Given a set of snapshot PDB files, those routines will 00016 ## calculate cavities on these snapshots and output these in a convenient 00017 ## format. mdpocket currently has two different ways of running. The first 00018 ## allows the user to explore transient and conserved cavities throughout 00019 ## an MD trajectory. This first analysis is performed by the mdpocket_detect 00020 ## function. 00021 ## Once the analysis of the first run is done, the user can specify a zone 00022 ## where he wants to measure some cavity descriptors. This task is performed 00023 ## in a second run, but this time of the mdpocket_characterize function. 00024 ## Both runs do not yield at all the same results and do not serve the same 00025 ## purpose. 00026 ## In order to get more informed about the mdpocket methodology, please refer 00027 ## to the manual shipped with fpocket. 00028 ## 00029 ## MODIFICATIONS HISTORY 00030 ## 00031 ## 00032 ## 07-06-10 (p) Adding header + comments + doc 00033 ## 01-08-09 (vp) Created (random date...) 00034 ## 00035 ## TODO or SUGGESTIONS 00036 ## 00037 00038 */ 00039 00040 00041 /* 00042 COPYRIGHT DISCLAIMER 00043 00044 Vincent Le Guilloux, Peter Schmidtke and Pierre Tuffery, hereby 00045 disclaim all copyright interest in the program “fpocket” (which 00046 performs protein cavity detection) written by Vincent Le Guilloux and Peter 00047 Schmidtke. 00048 00049 Vincent Le Guilloux 28 November 2008 00050 Peter Schmidtke 28 November 2008 00051 Pierre Tuffery 28 November 2008 00052 00053 GNU GPL 00054 00055 This file is part of the fpocket package. 00056 00057 fpocket is free software: you can redistribute it and/or modify 00058 it under the terms of the GNU General Public License as published by 00059 the Free Software Foundation, either version 3 of the License, or 00060 (at your option) any later version. 00061 00062 fpocket is distributed in the hope that it will be useful, 00063 but WITHOUT ANY WARRANTY; without even the implied warranty of 00064 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00065 GNU General Public License for more details. 00066 00067 You should have received a copy of the GNU General Public License 00068 along with fpocket. If not, see <http://www.gnu.org/licenses/>. 00069 00070 **/ 00071 00072 00073 00074 00075 /** 00076 ## FUNCTION: 00077 init_md_concat 00078 00079 ## SPECIFICATION: 00080 Allocate memory for the concatenated voronoi vertice structure 00081 Currently NOT USED 00082 00083 ## PARAMETRES: 00084 void 00085 00086 ## RETURN: 00087 s_mdconcat * : Structure containing allocated memory 00088 */ 00089 00090 s_mdconcat *init_md_concat(void){ 00091 s_mdconcat *m=(s_mdconcat *) my_malloc(sizeof(s_mdconcat)); 00092 m->n_vertpos=0; 00093 m->vertpos=NULL; 00094 m->n_snapshots=0; 00095 return m; 00096 } 00097 00098 00099 00100 00101 /** 00102 ## FUNCTION: 00103 alloc_first_md_concat 00104 00105 ## SPECIFICATION: 00106 Allocate memory for the md concat structure (first snapshot) 00107 00108 ## PARAMETRES: 00109 @ s_mdconcat *m: Pointer to the structure to free, 00110 @ size_t n: Number of vertices in the snapshot to add to m 00111 00112 ## RETURN: 00113 void 00114 */ 00115 void alloc_first_md_concat(s_mdconcat *m,size_t n){ 00116 size_t z; 00117 m->vertpos=(float **) my_malloc(sizeof(float *)*n); 00118 for(z=0;z<n;z++){ 00119 m->vertpos[z]=(float *)my_malloc(sizeof(float)*4); 00120 m->vertpos[z][0]=0.0; 00121 m->vertpos[z][1]=0.0; 00122 m->vertpos[z][2]=0.0; 00123 m->vertpos[z][3]=0.0; 00124 } 00125 m->n_vertpos=n; 00126 } 00127 00128 /** 00129 ## FUNCTION: 00130 realloc_md_concat 00131 00132 ## SPECIFICATION: 00133 Reallocate memory for the md concat structure (to add a new snapshot) 00134 00135 ## PARAMETRES: 00136 @ s_mdconcat *m: Pointer to the structure to free, 00137 @ size_t n: Number of vertices in the snapshot to add to m 00138 00139 ## RETURN: 00140 void 00141 00142 */ 00143 void realloc_md_concat(s_mdconcat *m,size_t n){ 00144 size_t z; 00145 m->vertpos=(float **) my_realloc(m->vertpos,sizeof(float *)*(m->n_vertpos+n)); 00146 for(z=0;z<n;z++){ 00147 m->vertpos[m->n_vertpos+z]=(float *)my_malloc(sizeof(float)*4); 00148 m->vertpos[m->n_vertpos+z][0]=0.0; 00149 m->vertpos[m->n_vertpos+z][1]=0.0; 00150 m->vertpos[m->n_vertpos+z][2]=0.0; 00151 m->vertpos[m->n_vertpos+z][3]=0.0; 00152 } 00153 m->n_vertpos+=n; 00154 } 00155 00156 /** 00157 ## FUNCTION: 00158 free_mdconcat 00159 00160 ## SPECIFICATION: 00161 Free the mdconcat structure 00162 00163 ## PARAMETRES: 00164 @ s_mdconcat *m: Pointer to the structure to free 00165 00166 ## RETURN: 00167 void 00168 00169 */ 00170 void free_mdconcat(s_mdconcat *m){ 00171 size_t i; 00172 for(i=0;i<m->n_vertpos;i++){ 00173 my_free(m->vertpos[i]); 00174 } 00175 my_free(m->vertpos); 00176 my_free(m); 00177 } 00178 00179