#include "../headers/atom.h"
Go to the source code of this file.
Functions | |
float | get_mol_mass (s_atm *latoms, int natoms) |
float | get_mol_mass_ptr (s_atm **latoms, int natoms) |
void | set_mol_barycenter_ptr (s_atm **latoms, int natoms, float bary[3]) |
float | get_mol_volume_ptr (s_atm **atoms, int natoms, int niter) |
int | is_in_lst_atm (s_atm **lst_atm, int nb_atm, int atm_id) |
float | atm_corsp (s_atm **al1, int nal1, s_atm **al2, int nal2) |
void | print_atoms (FILE *f, s_atm *atoms, int natoms) |
## FUNCTION: atm_corsp
## SPECIFICATION: Calculate correspondance between two list of atoms, using the first list as reference.
## PARAMETRES: @ s_atm **al1 : First list @ int nal1 : Number of atoms of the first list @ s_atm **al2 : Second list @ int nal2 : Number of atoms of the second list
## RETURN: float: % of atoms of the first list present in the second list
Definition at line 287 of file atom.c.
References s_atm::id, s_atm::name, and s_atm::res_id.
Referenced by check_pockets(), and desc_pocket().
00288 { 00289 int i, j, 00290 nb_atm_found = 0 ; 00291 s_atm *cural = NULL, 00292 *curap ; 00293 00294 if(nal1 <=0 || nal2 <= 0){ 00295 return 0.0 ; 00296 } 00297 00298 for(i = 0 ; i < nal1 ; i++) { 00299 for(j = 0 ; j < nal2 ; j++) { 00300 cural = al1[i] ; 00301 curap = al2[j] ; 00302 00303 if(curap->res_id == cural->res_id && 00304 ( (curap->id == cural->id) || strcmp(cural->name, curap->name) == 0 ) ) { 00305 nb_atm_found++ ; 00306 break ; 00307 } 00308 } 00309 } 00310 00311 00312 return ((float)nb_atm_found)/((float)nal1)*100.0 ; 00313 }
float get_mol_mass | ( | s_atm * | latoms, | |
int | natoms | |||
) |
## FUNCTION: get_mol_mass
## SPECIFICATION: Calculate mass of a molecule represented by a list of atoms. (structure) Perform a simple sum of atoms mass.
## PARAMETRES: @ s_atm *atoms : List of atoms structures @ int natoms : Number of atoms
## RETURN: float: mass of the molecule
Definition at line 85 of file atom.c.
References s_atm::mass.
00086 { 00087 float mass = 00.0 ; 00088 int i ; 00089 if(latoms) { 00090 for(i = 0 ; i < natoms ; i++) { 00091 mass += latoms[i].mass ; 00092 } 00093 } 00094 return mass ; 00095 }
float get_mol_mass_ptr | ( | s_atm ** | latoms, | |
int | natoms | |||
) |
## FUNCTION: get_mol_mass_ptr
## SPECIFICATION: Same as previous, but using different input type (array of pointers)
## PARAMETRES: @ s_atm **atoms : List of pointers to atom structures @ int natoms : Number of atoms
## RETURN: float: mass of the molecule
Definition at line 112 of file atom.c.
References s_atm::mass.
Referenced by test_set().
00113 { 00114 float mass = 00.0 ; 00115 int i ; 00116 if(latoms) { 00117 00118 for(i = 0 ; i < natoms ; i++) { 00119 mass += latoms[i]->mass ; 00120 } 00121 } 00122 return mass ; 00123 }
float get_mol_volume_ptr | ( | s_atm ** | atoms, | |
int | natoms, | |||
int | niter | |||
) |
## FUNCTION: get_mol_volume_ptr
## SPECIFICATION: Get an monte carlo approximation of the volume occupied by the atoms given in argument (list of pointers).
## PARAMETRES: @ s_atm **atoms : List of pointer to atoms @ int natoms : Number of atoms @ int niter : Number of monte carlo iteration to perform
## RETURN: float: calculated volume (approximation).
Definition at line 179 of file atom.c.
References s_atm::radius, rand_uniform(), s_atm::x, s_atm::y, and s_atm::z.
Referenced by desc_pocket(), and test_set().
00180 { 00181 int i = 0, j = 0, 00182 nb_in = 0; 00183 00184 float xmin = 0.0, xmax = 0.0, 00185 ymin = 0.0, ymax = 0.0, 00186 zmin = 0.0, zmax = 0.0, 00187 xtmp = 0.0, ytmp = 0.0, ztmp = 0.0, 00188 xr = 0.0, yr = 0.0, zr = 0.0, 00189 vbox = 0.0 ; 00190 00191 s_atm *acur = NULL ; 00192 00193 /* First, search extrems coordinates to get a contour box of the molecule */ 00194 for(i = 0 ; i < natoms ; i++) { 00195 acur = atoms[i] ; 00196 00197 if(i == 0) { 00198 xmin = acur->x - acur->radius ; xmax = acur->x + acur->radius ; 00199 ymin = acur->y - acur->radius ; ymax = acur->y + acur->radius ; 00200 zmin = acur->z - acur->radius ; zmax = acur->z + acur->radius ; 00201 } 00202 else { 00203 /* Update the minimum and maximum extreme point */ 00204 if(xmin > (xtmp = acur->x - acur->radius)) xmin = xtmp ; 00205 else if(xmax < (xtmp = acur->x + acur->radius)) xmax = xtmp ; 00206 00207 if(ymin > (ytmp = acur->y - acur->radius)) ymin = ytmp ; 00208 else if(ymax < (ytmp = acur->y + acur->radius)) ymax = ytmp ; 00209 00210 if(zmin > (ztmp = acur->z - acur->radius)) zmin = ztmp ; 00211 else if(zmax < (ztmp = acur->z + acur->radius)) zmax = ztmp ; 00212 } 00213 } 00214 00215 /* Next calculate the contour box volume */ 00216 vbox = (xmax - xmin)*(ymax - ymin)*(zmax - zmin) ; 00217 00218 /* Then apply monte carlo approximation of the volume. */ 00219 for(i = 0 ; i < niter ; i++) { 00220 xr = rand_uniform(xmin, xmax) ; 00221 yr = rand_uniform(ymin, ymax) ; 00222 zr = rand_uniform(zmin, zmax) ; 00223 00224 for(j = 0 ; j < natoms ; j++) { 00225 acur = atoms[j] ; 00226 xtmp = acur->x - xr ; 00227 ytmp = acur->y - yr ; 00228 ztmp = acur->z - zr ; 00229 00230 /* Compare r^2 and dist(center, random_point)^2 */ 00231 if((acur->radius*acur->radius) > (xtmp*xtmp + ytmp*ytmp + ztmp*ztmp)) { 00232 /* The point is inside one of the vertice!! */ 00233 nb_in ++ ; break ; 00234 } 00235 } 00236 } 00237 00238 /* Ok lets just return the volume Vpok = Nb_in/Niter*Vbox */ 00239 return ((float)nb_in)/((float)niter)*vbox; 00240 }
int is_in_lst_atm | ( | s_atm ** | lst_atm, | |
int | nb_atm, | |||
int | atm_id | |||
) |
## FUNCTION: is_in_lst_atm
## SPECIFICATION: Says wether an atom of id atm_id is in a list of atoms or not
## PARAMETRES: @ s_atm **lst_atm : List of atoms @ int nb_atms : Number of atoms in the list @ int atm_id : ID of the atom to look for.
## RETURN: 1 if the atom is in the tab, 0 if not
Definition at line 258 of file atom.c.
Referenced by get_mol_atm_neigh(), and write_pocket_pdb().
00259 { 00260 int i ; 00261 for(i = 0 ; i < nb_atm ; i++) { 00262 if(atm_id == lst_atm[i]->id) return 1 ; 00263 } 00264 00265 return 0 ; 00266 }
void print_atoms | ( | FILE * | f, | |
s_atm * | atoms, | |||
int | natoms | |||
) |
## FUNCTION: void print_atoms(FILE *f, s_atm *atoms, int natoms)
## SPECIFICATION: Print list of atoms...
## PARAMETRES: @ FILE *f : File to write in. @ s_atm *atoms : List of atoms @ int natoms : Number of atoms
## RETURN:
Definition at line 330 of file atom.c.
References s_atm::bfactor, s_atm::chain, s_atm::charge, s_atm::id, s_atm::mass, s_atm::name, s_atm::occupancy, s_atm::radius, s_atm::res_id, s_atm::res_name, s_atm::symbol, s_atm::type, s_atm::x, s_atm::y, and s_atm::z.
00331 { 00332 s_atm *atom = NULL ; 00333 int i ; 00334 for(i = 0 ; i < natoms ; i++) { 00335 atom = atoms + i ; 00336 fprintf(f, "======== Atom %s (%d) ========\n", atom->name, atom->id) ; 00337 fprintf(f, "Type: '%s', Residu: '%s' (%d), Chain: '%s'\n", 00338 atom->type, atom->res_name, atom->res_id, atom->chain); 00339 fprintf(f, "x: %f, y: %f, z: %f, occ: %f, bfact: %f\n", 00340 atom->x, atom->y, atom->z, atom->occupancy, atom->bfactor); 00341 fprintf(f, "symbol: '%s', charge: %d, mass: %f, vdw: %f\n", 00342 atom->symbol, atom->charge, atom->mass, atom->radius); 00343 } 00344 }
void set_mol_barycenter_ptr | ( | s_atm ** | latoms, | |
int | natoms, | |||
float | bary[3] | |||
) |
## FUNCTION: set_mol_barycenter_ptr
## SPECIFICATION: Calculate the barycenter of a molecule represented by a list of atoms pointers.
## PARAMETRES: @ s_atm **atoms : List of pointers to atoms structures @ int natoms : Number of atoms @ float bary[3] : OUTPUT: Where to store the calculated barycenter
## RETURN: void (the OUTPUT is set using the input parameter bary)
Definition at line 142 of file atom.c.
References s_atm::x, s_atm::y, and s_atm::z.
00143 { 00144 float xsum = 0.0, 00145 ysum = 0.0, 00146 zsum = 0.0 ; 00147 int i ; 00148 if(latoms) { 00149 00150 for(i = 0 ; i < natoms ; i++) { 00151 xsum += latoms[i]->x ; 00152 ysum += latoms[i]->y ; 00153 zsum += latoms[i]->z ; 00154 } 00155 } 00156 00157 bary[0] = xsum / natoms ; 00158 bary[1] = xsum / natoms ; 00159 bary[2] = xsum / natoms ; 00160 }