GLYLIB  0.3.0b
geometry.h
Go to the documentation of this file.
00001 #ifndef GEOMETRY_H
00002 #define GEOMETRY_H
00003 
00004 #include <math.h>
00005 
00006 typedef coord_3D vector;
00007 
00008 typedef coord_3D coord;
00009 
00010 /* Get angle abc
00011  */
00012 double get_angle(coord a, coord b, coord c);
00013 
00014 /* Get the dihedral angle between planes abc and bcd
00015  */
00016 double get_dihedral(coord a, coord b, coord c, coord d);
00017 
00018 /* Magnitude
00019  */
00020 double norm(vector a);
00021 
00022 /* Multiply vector by scalar
00023  */
00024 vector scale(vector v, double c);
00025 
00026 /* Cross product
00027  */
00028 vector cross(vector a, vector b);
00029 
00030 /* Get the unit vector in given direction
00031  */
00032 vector normalize(vector v);
00033 
00034 /* Dot product
00035  */
00036 double dot(vector a, vector b);
00037 
00038 /* Euclidean distance from x to y
00039  */
00040 double dist(coord x, coord y);
00041 
00042 vector subtract(vector a, vector b);
00043 
00044 vector
00045 add(vector a, vector b);
00046 
00047 #define get_vector(a,b) subtract(b,a)
00048 
00049 /* Translate a list of coordinates
00050  */
00051 void translate_coords(coord **coords, int num_coords, coord shift);
00052 
00053 /* Create a rotation matrix for a rotation of theta degrees
00054  * about an axis through the given point in the given direction
00055  */
00056 double *create_rotation_matrix(coord point, vector direction, 
00057                                double theta);
00058 
00059 /* Deallocate the rotation matrix
00060  */
00061 void destroy_rotation_matrix(double *matrix);
00062 
00063 /* Apply the rotation matrix to the given coordinate
00064  */
00065 void apply_rotation_matrix(coord *c, double *matrix);
00066 
00067 /* Rotate a list of coordinates theta degrees about an axis through 
00068  * the given coordinate in the given direction
00069  */
00070 void rotate_coords(coord **coords, int num_coords, coord point,
00071                    vector direction, double theta);
00072 
00073 /* Calculate coordinate d, where 
00074  * (1) d is distance units from c
00075  * (2) angle bcd is theta
00076  * (3) dihedral between planes abc and bcd is phi
00077  *
00078  * Link to derivation: 
00079  *
00080  * Note: should probably change the name of this
00081  */
00082 coord find_attachment_point(coord a, coord b, coord c,
00083                             double theta, double phi, double distance);
00084 
00085 /* Note: change name/parameter names 
00086  */
00087 void fix_coords(coord **coords, int num_coords,
00088           const coord *bond_atom_a, coord *bond_atom_b, double distance,
00089           const coord *angle_atom_a, double theta,
00090           coord *angle_atom_b, double rho,
00091           const coord *dih_atom_a, coord *dih_atom_b, double tau,
00092           const coord *tor_atom_a, const coord *ref_angle_a, double phi,
00093           coord *tor_atom_b, coord *ref_atom_b, double omega);
00094 
00095 /* Get a list of pointers to coordinates within the given list of atoms.
00096  * The list needs to be freed.
00097  */
00098 //coord **atoms_to_coord_list(atom **atoms, int num_atoms);
00099 
00100 #endif
 All Classes Files Functions Variables Typedefs Defines