-
Notifications
You must be signed in to change notification settings - Fork 0
/
mol.h
76 lines (52 loc) · 1.75 KB
/
mol.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef _mol_h
#define _mol_h
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
#ifndef pi
#define PI 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679
typedef struct atom
{
char element[3];
double x, y, z;
} atom;
typedef struct bond
{
unsigned short a1, a2;
unsigned char epairs;
atom *atoms;
double x1, x2, y1, y2, z, len, dx, dy;
} bond;
typedef struct molecule
{
unsigned short atom_max, atom_no;
atom *atoms, **atom_ptrs;
unsigned short bond_max, bond_no;
bond *bonds, **bond_ptrs;
} molecule;
typedef double xform_matrix[3][3];
typedef struct mx_wrapper
{
xform_matrix xform_matrix;
} mx_wrapper;
void atomset(atom *atom, char element[3], double *x, double *y, double *z);
void atomget(atom *atom, char element[3], double *x, double *y, double *z);
void bondset(bond *bond, unsigned short *a1, unsigned short *a2, atom **atoms, unsigned char *epairs);
void bondget(bond *bond, unsigned short *a1, unsigned short *a2, atom **atoms, unsigned char *epairs);
void compute_coords(bond *bond);
molecule *molmalloc(unsigned short atom_max, unsigned short bond_max);
void molfree(molecule *ptr);
void molappend_atom(molecule *molecule, atom *atom);
void molappend_bond(molecule *molecule, bond *bond);
molecule *molcopy(molecule *src);
int atom_ptrs_cmp(const void *a, const void *b);
int bond_ptrs_cmp(const void *a, const void *b);
void molsort(molecule *molecule);
void xrotation(xform_matrix xform_matrix, unsigned short deg);
void yrotation(xform_matrix xform_matrix, unsigned short deg);
void zrotation(xform_matrix xform_matrix, unsigned short deg);
void mol_xform(molecule *molecule, xform_matrix matrix);
#endif
#endif