GLYLIB  0.3.0b
get_rms_alt_X.c
Go to the documentation of this file.
00001 // Function written by B. Lachele Foley, starting 20071017
00002 #include <mylib.h>
00003 #include <molecules.h>
00004 //#include "../inc/mylib.h"
00005 //#include "../inc/molecules.h"
00006 /* These functions determine the RMS between atoms in the 
00007  * relevant structures (assembly, molecule, residue, etc.).
00008  * This is a work in progress -- all functions may not be complete.
00009  *
00010 
00011  Functional form:
00012 
00013         double get_alt_rms_X(X-struct *X, int xs, int xt);
00014 
00015         X-struct is molecule, assembly, etc.
00016         X is an abbreviation (mol, res, etc.)
00017         xs is the location of the source coords (-1 for main, 0+ for alt)
00018         xt is the location of the target coords (must be an alternate coord) 
00019 */
00020 /******************* get_alt_rms_res(residue *r, int xs, int xt) *****************/
00021 double get_alt_rms_res(residue *r, int xs, int xt){
00022 int ai=0;
00023 double RMS=0;
00024 coord_3D c;
00025 
00026 if(xt<0){mywhine("get_alt_rms_res: target coord cannot be main set");}
00027 if(xs<0){mywhine("get_alt_rms_res: main set source coords not written yet");}
00028 for(ai=0;ai<r[0].na;ai++){
00029         c=subtract_coord(r[0].a[ai].xa[xs],r[0].a[ai].xa[xt]);
00030         RMS+=c.i*c.i+c.j*c.j+c.k*c.k;
00031         }
00032 RMS/=r[0].na;
00033 RMS=sqrt(RMS);
00034 return RMS;
00035 }
00036 
00037 /******************* get_alt_rms_mol(molecule *m, int xs, int xt) *****************/
00038 double get_alt_rms_mol(molecule *m, int xs, int xt){
00039 int ai=0,ri=0,nat=0;
00040 double RMS=0;
00041 coord_3D c;
00042 
00043 if(xt<0){mywhine("get_alt_rms_mol: target coord cannot be main set");}
00044 if(xs<0){mywhine("get_alt_rms_mol: main set source coords not written yet");}
00045 
00046 for(ri=0;ri<m[0].nr;ri++){
00047         nat+=m[0].r[ri].na;
00048         for(ai=0;ai<m[0].r[ri].na;ai++){
00049                 c=subtract_coord(m[0].r[ri].a[ai].xa[xs],m[0].r[ri].a[ai].xa[xt]);
00050                 RMS+=c.i*c.i+c.j*c.j+c.k*c.k;
00051         }}
00052 RMS/=nat;
00053 RMS=sqrt(RMS);
00054 return RMS;
00055 }
00056 
 All Classes Files Functions Variables Typedefs Defines