basic integration method and functions added
[physik/posic.git] / moldyn.h
1 /*
2  * moldyn.h - molecular dynamics library header file
3  *
4  * author: Frank Zirkelbach <frank.zirkelbach@physik.uni-augsburg.de>
5  *
6  */
7
8 #ifndef MOLDYN_H
9 #define MOLDYN_H
10
11 #include "math/math.h"
12 #include "random/random.h"
13 //#include "visual/visual.h"
14
15 /* datatypes */
16
17 typedef struct s_atom {
18         t_3dvec r;      /* positions */
19         t_3dvec v;      /* velocities */
20         t_3dvec f;      /* forces */
21         int element;    /* number of element in pse */
22         double mass;    /* atom mass */
23 } t_atom;
24
25 typedef struct s_moldyn {
26         int count;
27         t_atom *atom;
28         double (*potential)(struct s_moldyn *moldyn);
29         void *pot_params;
30         int (*force)(struct s_moldyn *moldyn);
31         double cutoff_square;
32         t_3dvec dim;
33         int (*integrate)(struct s_moldyn *moldyn);
34         int time_steps;
35         double tau;
36         void *visual;
37         unsigned char status;
38 } t_moldyn;
39
40 typedef struct s_lj_params {
41         double sigma6;
42         double sigma12;
43         double epsilon;
44 } t_lj_params;
45
46 /*
47  *  defines
48  */
49
50 /* general defines */
51
52 #define MOLDYN_STAT_POTENTIAL           0x01
53 #define MOLDYN_STAT_FORCE               0x02
54
55 /* phsical values */
56
57 //#define K_BOLTZMANN           1.3807E-23
58 #define K_BOLTZMANN             1.0
59
60 #define FCC                     0x01
61 #define DIAMOND                 0x02
62
63 #define C                       0x06
64 #define M_C                     6.0
65
66 #define Si                      0x0e
67 #define M_SI                    14.0
68 #define LC_SI                   5.43105
69
70 /* function prototypes */
71
72 int create_lattice(unsigned char type,int element,double mass,double lc,
73                    int a,int b,int c,t_atom **atom);
74 int destroy_lattice(t_atom *atom);
75 int thermal_init(t_atom *atom,t_random *random,int count,double t);
76 int scale_velocity(t_atom *atom,int count,double t);
77 double get_e_kin(t_atom *atom,int count);
78 double get_e_pot(t_moldyn *moldyn);
79 double get_total_energy(t_moldyn *moldyn);
80 t_3dvec get_total_p(t_atom *atom,int count);
81
82 int moldyn_integrate(t_moldyn *moldyn);
83 int velocity_verlet(t_moldyn *moldyn);
84
85 double potential_lennard_jones(t_moldyn *moldyn);
86 int force_lennard_jones(t_moldyn *moldyn);
87
88 #endif