GLYLIB
0.3.0b
|
00001 /** \file location_utilities.c 00002 * Purpose: Functions for finding atoms and molecules 00003 * Begin 20110428 BLFoley 00004 * 00005 */ 00006 #include <mylib.h> 00007 #include <molecules.h> 00008 00009 /* 00010 Find atoms named N -- searches for a.N 00011 */ 00012 molindex_set find_residue_atoms_by_N(residue *r, const char *name) 00013 { 00014 molindex_set moli_set; 00015 int i,*match,matches=0; 00016 00017 match=(int*)calloc(r[0].na,sizeof (int)); 00018 for(i=0;i<r[0].na;i++) 00019 { 00020 if(strcmp(r[0].a[i].N,name)==0) 00021 { 00022 match[i]=1; 00023 matches++; 00024 } 00025 } 00026 moli_set.nP=matches; 00027 moli_set.P=(molindex*)calloc(matches,sizeof(molindex)); 00028 matches=0; 00029 for(i=0;i<r[0].na;i++) 00030 { 00031 if(match[i]==1) 00032 { 00033 moli_set.P[matches]=r[0].a[i].moli; 00034 matches++; 00035 } 00036 if(matches==moli_set.nP){break;} 00037 } 00038 return moli_set; 00039 } 00040 00041 molindex_set find_molecule_atoms_by_N(molecule *m, const char *name) 00042 { 00043 molindex_set moli_set; 00044 mywhine("The function find_molecule_atoms_by_N has not been written yet.\n"); 00045 return moli_set; 00046 } 00047 molindex_set find_molecule_residues_by_N(molecule *m, const char *name) 00048 { 00049 molindex_set moli_set; 00050 mywhine("The function find_molecule_residues_by_N has not been written yet.\n"); 00051 return moli_set; 00052 } 00053 molindex_set find_assembly_top_level_atoms_by_N(assembly *A, const char *name) 00054 { 00055 molindex_set moli_set; 00056 mywhine("The function find_assembly_top_level_atoms_by_N has not been written yet.\n"); 00057 return moli_set; 00058 } 00059 /* 00060 Find atoms numbered n -- searches for a.n 00061 */ 00062 molindex_set find_residue_atoms_by_n(residue *r, int number) 00063 { 00064 molindex_set moli_set; 00065 mywhine("The function find_residue_atoms_by_n has not been written yet.\n"); 00066 return moli_set; 00067 } 00068 molindex_set find_molecule_atoms_by_n(molecule *m, int number) 00069 { 00070 molindex_set moli_set; 00071 mywhine("The function find_molecule_atoms_by_n has not been written yet.\n"); 00072 return moli_set; 00073 } 00074 molindex_set find_molecule_residues_by_n(molecule *m, int number) 00075 { 00076 molindex_set moli_set; 00077 mywhine("The function find_molecule_residues_by_n has not been written yet.\n"); 00078 return moli_set; 00079 } 00080 molindex_set find_assembly_top_level_atoms_by_n(assembly *A, int number) 00081 { 00082 molindex_set moli_set; 00083 int i,*match,matches=0; 00084 00085 match=(int*)calloc(A[0].na,sizeof (int)); 00086 for(i=0;i<A[0].na;i++) 00087 { 00088 if(A[0].a[i][0].n==number) 00089 { 00090 match[i]=1; 00091 matches++; 00092 } 00093 } 00094 moli_set.nP=matches; 00095 moli_set.P=(molindex*)calloc(matches,sizeof(molindex)); 00096 matches=0; 00097 for(i=0;i<A[0].na;i++) 00098 { 00099 if(match[i]==1) 00100 { 00101 moli_set.P[matches]=A[0].a[i][0].moli; 00102 moli_set.P[matches].i=i; 00103 matches++; 00104 } 00105 if(matches==moli_set.nP){break;} 00106 } 00107 return moli_set; 00108 }