GLYLIB  0.3.0b
Geometric Manipulations and Calculations

Classes

struct  coord_3D
struct  vectormag_3D
struct  coord_nD
struct  nD_index
struct  nD_ptrs
struct  coord_nDi
struct  plane
struct  boxinfo

Defines

#define PI   3.1415926535897932384626433832795028
#define get_vector_from_coords(a, b)   coord_to_vec(subtract_coord(b,a))

Functions

void rotate_vector_to_Z_list (coord_3D *, int, vectormag_3D)
coord_3D get_geometric_center (coord_3D *c, int nc)
coord_3D get_geometric_center_dp (coord_3D **c, int nc)
plane get_plane (coord_3D, coord_3D, coord_3D)
plane get_plane_for_ring (int n, coord_3D **r)
double get_signed_distance_from_point_to_plane (plane p, coord_3D pt)
vectormag_3D normalize_vec (vectormag_3D)
vectormag_3D scalarmult_vec (vectormag_3D, double)
vectormag_3D add_vec (vectormag_3D, vectormag_3D)
vectormag_3D subtract_vec (vectormag_3D, vectormag_3D)
coord_3D scalarmult_coord (coord_3D, double)
coord_3D add_coord (coord_3D, coord_3D)
coord_3D subtract_coord (coord_3D, coord_3D)
vectormag_3D get_crossprod (vectormag_3D, vectormag_3D)
double get_dotprod (vectormag_3D, vectormag_3D)
double get_magnitude (vectormag_3D)
vectormag_3D zero_vec ()
coord_3D zero_coord ()
coord_3D vec_to_coord (vectormag_3D)
vectormag_3D coord_to_vec (coord_3D)
void initialize_coord_3D (coord_3D *c)
void initialize_vectormag_3D (vectormag_3D *v)
void initialize_plane (plane *p)
double get_angle_between_vectors (vectormag_3D a, vectormag_3D b)
double get_angle_ABC_points (coord_3D a, coord_3D b, coord_3D c)
double get_dihedral_ABCD_points (coord_3D a, coord_3D b, coord_3D c, coord_3D d)
double get_distance_AB_points (coord_3D a, coord_3D b)
void translate_coords_dp_list (coord_3D **coords, int num_coords, coord_3D shift)
double * create_rotation_matrix (coord_3D point, vectormag_3D direction, double theta)
void destroy_rotation_matrix (double *matrix)
void apply_rotation_matrix_to_coord_p (coord_3D *c, double *matrix)
void rotate_coords_about_axis_dp_list (coord_3D **coords, int num_coords, coord_3D point, vectormag_3D direction, double theta)
coord_3D get_cartesian_point_from_internal_coords (coord_3D a, coord_3D b, coord_3D c, double theta, double phi, double distance)
void orient_coords2_to_coords1_dp_list (coord_3D **coords, int num_coords, const coord_3D *bond_atom_a, coord_3D *bond_atom_b, double distance, const coord_3D *angle_atom_a, double theta, coord_3D *angle_atom_b, double rho, const coord_3D *dih_atom_a, coord_3D *dih_atom_b, double tau, const coord_3D *tor_atom_a, const coord_3D *ref_angle_a, double phi, coord_3D *tor_atom_b, coord_3D *ref_atom_b, double omega)
void translate_residue_by_XYZ (residue *r, int xs, int xd, coord_3D)
void translate_molecule_by_XYZ (molecule *m, int xs, int xd, coord_3D)
void translate_ensemble_by_XYZ (ensemble *e, int xs, int xd, coord_3D)
void translate_zero_to_coord_M (molecule *m, int xs, int xd, coord_3D)
coord_3D ** atoms_to_coord_list (atom **atoms, int num_atoms)
void rotate_vector_to_Z_M (molecule *m, int xs, int xd, int vs, int vd, vectormag_3D vec)
void normalize_molecule_vectors (molecule *m, int vs, int vd)
void normalize_ensemble_vectors (ensemble *e, int vs, int vd)
void shift_molecule_atoms_by_vector_scale (molecule *m, int xs, int xd, int vr, double scale)
vectormag_3D get_molecule_point_charge_dipole (molecule *m, int xs, int chgsrc, atype *AT)
void rollMolecule (molecule *m, double rad)
void pitchMolecule (molecule *m, double rad)
void yawMolecule (molecule *m, double rad)
void rollAssembly (assembly *a, double rad)
void pitchAssembly (assembly *a, double rad)
void yawAssembly (assembly *a, double rad)
double get_distance_from_point_to_plane (plane p, coord_3D pt, int absl)
double get_angle_between_plane_and_vector (plane p, coord_3D pt1, coord_3D pt2)

Detailed Description

For functions that perform geometric manipulations or calculations on the chemical structures (e.g. assembly, molecule, etc.), it is often necessary to indicate which set of coordinates are to be used for the calculation. In most cases, it is also possible to perform the calculation on coordinates in one location, but leave those untouched and save the results to another location. The same applies to velocities and vectors.

Special variable names and meanings:

xs, vs, xvs: These are the source data on which to base the calculation.

xd, vd, xvd: These are the locations to which changed data should be stored. Note that this location can typically be the same as the source.

xt, vt, xvt: In these cases, two sets of coordinates are being compared to

The variables above can take on the following values:

-1 This tells the function to use the main coordinate set. That is, use atom.x or atom.xv. This value is not relevant to vectors, where there is not a "main" vector.

0, 1, 2, ... A number greater than or equal to zero indicates the location in an array. These values apply to atom.xa[i], atom.xva[i] and atom.v[i].

-2 This is not available in all functions. It indicates that the entire array should be used. This applies to atom.xa[i], atom.xva[i] and atom.v[i].

-3 This is not available in all functions. It indicates that the main coordinates and the entire corresponding array should be used. This applies to { atom.x + atom.xa[i] } and to { atom.xv and atom.xva[i] }. It does not apply to atom.v[i].

Information about vectors:

All of the functions that involve vectors will set the magnitude of the resulting vector without relying on the entry in the input vector. So, for example, there is no need to get_magnitude before normalizing or multiplying by a scalar.

This also means that the vector manipulation functions here are inefficient in that they recalculate the magnitude every time they are called. If you are doing many vector manipulations in which the magnitude is not relevant, you might consider making a similar set that does not recalculate the magnitude.


Define Documentation

#define get_vector_from_coords (   a,
 
)    coord_to_vec(subtract_coord(b,a))
#define PI   3.1415926535897932384626433832795028

Function Documentation

Definition at line 7 of file add_coord.c.

References coord_3D::i, coord_3D::j, and coord_3D::k.

Referenced by shift_molecule_atoms_by_vector_scale().

Here is the caller graph for this function:

void apply_rotation_matrix_to_coord_p ( coord_3D c,
double *  matrix 
)

Apply the rotation matrix to the given coordinate

Definition at line 66 of file rotations.c.

References coord_3D::i, coord_3D::j, and coord_3D::k.

Referenced by rotate_coords_about_axis_dp_list().

Here is the caller graph for this function:

coord_3D** atoms_to_coord_list ( atom **  atoms,
int  num_atoms 
)

Definition at line 5 of file atoms_to_coord_list.c.

double* create_rotation_matrix ( coord_3D  point,
vectormag_3D  direction,
double  theta 
)

Create a rotation matrix for a rotation of theta degrees about an axis through the given point in the given direction

Definition at line 16 of file rotations.c.

References vectormag_3D::d, coord_3D::i, vectormag_3D::i, coord_3D::j, vectormag_3D::j, coord_3D::k, vectormag_3D::k, and normalize_vec().

Referenced by rotate_coords_about_axis_dp_list().

Here is the call graph for this function:

Here is the caller graph for this function:

void destroy_rotation_matrix ( double *  matrix)

Deallocate the rotation matrix

Definition at line 60 of file rotations.c.

Referenced by rotate_coords_about_axis_dp_list().

Here is the caller graph for this function:

double get_angle_ABC_points ( coord_3D  a,
coord_3D  b,
coord_3D  c 
)

Get angle abc

Definition at line 17 of file coordinate_manipulations.c.

References coord_to_vec(), get_angle_between_vectors(), and subtract_coord().

Referenced by orient_coords2_to_coords1_dp_list().

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 5 of file get_angle_between_plane_and_vector.c.

References plane::A, plane::B, plane::C, get_dotprod(), coord_3D::i, vectormag_3D::i, coord_3D::j, vectormag_3D::j, coord_3D::k, and vectormag_3D::k.

Here is the call graph for this function:

Get angle between two vectors

Definition at line 12 of file coordinate_manipulations.c.

References get_dotprod(), and normalize_vec().

Referenced by get_angle_ABC(), and get_angle_ABC_points().

Here is the call graph for this function:

Here is the caller graph for this function:

coord_3D get_cartesian_point_from_internal_coords ( coord_3D  a,
coord_3D  b,
coord_3D  c,
double  theta,
double  phi,
double  distance 
)

Calculate coordinate d, where (1) d is distance units from c (2) angle bcd is theta (3) dihedral between planes abc and bcd is phi

Link to derivation:

Note: should probably change the name of this

Definition at line 90 of file rotations.c.

References get_crossprod(), get_vector_from_coords, coord_3D::i, vectormag_3D::i, coord_3D::j, vectormag_3D::j, coord_3D::k, vectormag_3D::k, and normalize_vec().

Referenced by orient_coords2_to_coords1_dp_list().

Here is the call graph for this function:

Here is the caller graph for this function:

double get_dihedral_ABCD_points ( coord_3D  a,
coord_3D  b,
coord_3D  c,
coord_3D  d 
)

Get the dihedral angle between planes abc and bcd

This assumes that the bonding goes as: A-B-C-D or that the input vectors follow an equivalent direction convention. When A and D are eclipsed, the angle is zero.

Definition at line 27 of file coordinate_manipulations.c.

References coord_to_vec(), vectormag_3D::d, get_crossprod(), get_dotprod(), scalarmult_vec(), and subtract_coord().

Referenced by orient_coords2_to_coords1_dp_list().

Here is the call graph for this function:

Here is the caller graph for this function:

double get_distance_AB_points ( coord_3D  a,
coord_3D  b 
)

Euclidean distance from x to y

Definition at line 8 of file coordinate_manipulations.c.

References coord_3D::i, coord_3D::j, and coord_3D::k.

double get_distance_from_point_to_plane ( plane  p,
coord_3D  pt,
int  absl 
)

This function will return the distance from a point pt to a plane pt. If absl is set to 0, it returns a signed distance ("above" or "below"). If set to 1, it returns the absolute value.

Definition at line 6 of file get_distance_from_point_to_plane.c.

References plane::A, plane::B, plane::C, coord_3D::i, coord_3D::j, and coord_3D::k.

coord_3D get_geometric_center ( coord_3D c,
int  nc 
)

Definition at line 9 of file get_geometric_center.c.

References coord_3D::i, coord_3D::j, coord_3D::k, and mywhine().

Here is the call graph for this function:

coord_3D get_geometric_center_dp ( coord_3D **  c,
int  nc 
)

Definition at line 36 of file get_geometric_center.c.

References coord_3D::i, coord_3D::j, coord_3D::k, and mywhine().

Here is the call graph for this function:

Definition at line 7 of file get_magnitude.c.

References vectormag_3D::i, vectormag_3D::j, and vectormag_3D::k.

Referenced by get_molecule_point_charge_dipole(), and rotate_vector_to_Z_M().

Here is the caller graph for this function:

Definition at line 8 of file get_plane.c.

References plane::A, plane::B, plane::C, plane::D, coord_3D::i, coord_3D::j, and coord_3D::k.

plane get_plane_for_ring ( int  n,
coord_3D **  r 
)

Definition at line 6 of file get_ring_pucker_plane.c.

References plane::A, plane::B, plane::C, vectormag_3D::d, plane::D, get_crossprod(), coord_3D::i, vectormag_3D::i, coord_3D::j, vectormag_3D::j, coord_3D::k, vectormag_3D::k, and PI.

Here is the call graph for this function:

Definition at line 22 of file initialize_GLYstruct.c.

References coord_3D::i, coord_3D::j, and coord_3D::k.

void initialize_plane ( plane p)

Definition at line 32 of file initialize_GLYstruct.c.

References plane::A, plane::B, plane::C, and plane::D.

void normalize_ensemble_vectors ( ensemble e,
int  vs,
int  vd 
)

Definition at line 32 of file normalize_X_vectors.c.

References ensemble::nm, and normalize_molecule_vectors().

Here is the call graph for this function:

void normalize_molecule_vectors ( molecule m,
int  vs,
int  vd 
)

Definition at line 11 of file normalize_X_vectors.c.

References residue::a, mywhine(), residue::na, normalize_vec(), molecule::nr, molecule::r, and atom::v.

Referenced by normalize_ensemble_vectors().

Here is the call graph for this function:

Here is the caller graph for this function:

void orient_coords2_to_coords1_dp_list ( coord_3D **  coords,
int  num_coords,
const coord_3D bond_atom_a,
coord_3D bond_atom_b,
double  distance,
const coord_3D angle_atom_a,
double  theta,
coord_3D angle_atom_b,
double  rho,
const coord_3D dih_atom_a,
coord_3D dih_atom_b,
double  tau,
const coord_3D tor_atom_a,
const coord_3D ref_angle_a,
double  phi,
coord_3D tor_atom_b,
coord_3D ref_atom_b,
double  omega 
)
void pitchAssembly ( assembly a,
double  rad 
)

Definition at line 100 of file rotation.c.

References coord_3D::i, coord_3D::j, and coord_3D::k.

void pitchMolecule ( molecule m,
double  rad 
)

Definition at line 27 of file rotation.c.

References coord_3D::i, coord_3D::j, and coord_3D::k.

void rollAssembly ( assembly a,
double  rad 
)

Definition at line 73 of file rotation.c.

References coord_3D::i, coord_3D::j, coord_3D::k, and atom::x.

void rollMolecule ( molecule m,
double  rad 
)

Definition at line 4 of file rotation.c.

References coord_3D::i, coord_3D::j, coord_3D::k, and atom::x.

void rotate_coords_about_axis_dp_list ( coord_3D **  coords,
int  num_coords,
coord_3D  point,
vectormag_3D  direction,
double  theta 
)

Rotate a list of coordinates theta degrees about an axis through the given coordinate in the given direction

Definition at line 76 of file rotations.c.

References apply_rotation_matrix_to_coord_p(), create_rotation_matrix(), and destroy_rotation_matrix().

Referenced by orient_coords2_to_coords1_dp_list().

Here is the call graph for this function:

Here is the caller graph for this function:

void rotate_vector_to_Z_list ( coord_3D ,
int  ,
vectormag_3D   
)

Functions

Definition at line 47 of file rotate_vector_to_Z.c.

References vectormag_3D::d, get_crossprod(), coord_3D::i, vectormag_3D::i, coord_3D::j, vectormag_3D::j, coord_3D::k, vectormag_3D::k, mywhine(), and normalize_vec().

Here is the call graph for this function:

void rotate_vector_to_Z_M ( molecule m,
int  xs,
int  xd,
int  vs,
int  vd,
vectormag_3D  vec 
)

This function rotates the coordinate list such that the vector given by vectormag_3D points along the Z (Y, X, other) axis. The orientation of the orthogonal axes is arbitrary.

Definition at line 94 of file rotate_vector_to_Z.c.

References residue::a, vectormag_3D::d, dprint_coord_3D(), dprint_vectormag_3D(), get_crossprod(), get_magnitude(), coord_3D::i, vectormag_3D::i, coord_3D::j, vectormag_3D::j, coord_3D::k, vectormag_3D::k, mywhine(), residue::na, normalize_vec(), molecule::nr, molecule::r, atom::v, atom::x, and atom::xa.

Here is the call graph for this function:

coord_3D scalarmult_coord ( coord_3D  ,
double   
)

Definition at line 29 of file add_coord.c.

References coord_3D::i, coord_3D::j, and coord_3D::k.

Referenced by shift_molecule_atoms_by_vector_scale().

Here is the caller graph for this function:

Definition at line 5 of file scalarmult_vec.c.

References vectormag_3D::d, vectormag_3D::i, vectormag_3D::j, and vectormag_3D::k.

Referenced by get_dihedral_ABCD_points(), and get_dihedral_bonded_ABCD().

Here is the caller graph for this function:

void shift_molecule_atoms_by_vector_scale ( molecule m,
int  xs,
int  xd,
int  vr,
double  scale 
)

Definition at line 21 of file vector_atom_movements.c.

References residue::a, add_coord(), mywhine(), residue::na, molecule::nr, molecule::r, scalarmult_coord(), vec_to_coord(), atom::x, and atom::xa.

Here is the call graph for this function:

void translate_coords_dp_list ( coord_3D **  coords,
int  num_coords,
coord_3D  shift 
)

Translate a list of coordinates

Definition at line 136 of file geometry.c.

References coord_3D::i, coord_3D::j, and coord_3D::k.

Referenced by orient_coords2_to_coords1_dp_list().

Here is the caller graph for this function:

void translate_ensemble_by_XYZ ( ensemble e,
int  xs,
int  xd,
coord_3D   
)

Definition at line 106 of file translate_by_XYZ.c.

References residue::a, coord_3D::i, coord_3D::j, coord_3D::k, ensemble::m, mywhine(), residue::na, ensemble::nm, molecule::nr, molecule::r, atom::x, and atom::xa.

Here is the call graph for this function:

void translate_molecule_by_XYZ ( molecule m,
int  xs,
int  xd,
coord_3D   
)

Definition at line 61 of file translate_by_XYZ.c.

References residue::a, coord_3D::i, coord_3D::j, coord_3D::k, mywhine(), residue::na, molecule::nr, molecule::r, atom::x, and atom::xa.

Here is the call graph for this function:

void translate_residue_by_XYZ ( residue r,
int  xs,
int  xd,
coord_3D   
)

Definition at line 21 of file translate_by_XYZ.c.

References residue::a, coord_3D::i, coord_3D::j, coord_3D::k, mywhine(), residue::na, atom::x, and atom::xa.

Here is the call graph for this function:

void translate_zero_to_coord_M ( molecule m,
int  xs,
int  xd,
coord_3D   
)

Definition at line 12 of file translate_zero_to_coord.c.

References residue::a, mywhine(), residue::na, molecule::nr, molecule::r, subtract_coord(), atom::x, and atom::xa.

Here is the call graph for this function:

Definition at line 20 of file coord_to_vec.c.

References coord_3D::i, vectormag_3D::i, coord_3D::j, vectormag_3D::j, coord_3D::k, and vectormag_3D::k.

Referenced by shift_molecule_atoms_by_vector_scale().

Here is the caller graph for this function:

void yawAssembly ( assembly a,
double  rad 
)

Definition at line 127 of file rotation.c.

References coord_3D::i, coord_3D::j, and coord_3D::k.

void yawMolecule ( molecule m,
double  rad 
)

Definition at line 50 of file rotation.c.

References coord_3D::i, coord_3D::j, and coord_3D::k.

Definition at line 19 of file zero_vec_crd.c.

References coord_3D::i, coord_3D::j, and coord_3D::k.

Referenced by read_prepres().

Here is the caller graph for this function:

Definition at line 9 of file zero_vec_crd.c.

References vectormag_3D::d, vectormag_3D::i, vectormag_3D::j, and vectormag_3D::k.

Referenced by get_molecule_point_charge_dipole().

Here is the caller graph for this function:

 All Classes Files Functions Variables Typedefs Defines