started potentials
[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
14 /* datatypes */
15
16 typedef struct s_atom {
17         t_3dvec r;      /* positions */
18         t_3dvec v;      /* velocities */
19         t_3dvec f;      /* forces */
20         int element;    /* number of element in pse */
21         double mass;    /* atom mass */
22 } t_atom;
23
24
25 typedef struct s_moldyn {
26         int count;
27         t_atom *atom;
28         double (*potential)(void *ptr);
29         int (*force)(struct s_moldyn *moldyn,void *ptr);
30         unsigned char status;
31 } t_moldyn;
32
33 typedef struct s_lj_params {
34         double sigma6;
35         double sigma12;
36         double epsilon;
37 } t_lj_params;
38
39 /*
40  *  defines
41  */
42
43 /* general defines */
44
45 #define MOLDYN_STAT_POTENTIAL           0x01
46 #define MOLDYN_STAT_FORCE               0x02
47
48 /* phsical values */
49
50 //#define K_BOLTZMANN           1.3807E-23
51 #define K_BOLTZMANN             1.0
52
53 #define FCC                     0x01
54 #define DIAMOND                 0x02
55
56 #define C                       0x06
57 #define M_C                     6.0
58
59 #define Si                      0x0e
60 #define M_SI                    14.0
61 #define LC_SI                   5.43105
62
63 /* function prototypes */
64
65 int create_lattice(unsigned char type,int element,double mass,double lc,
66                    int a,int b,int c,t_atom **atom);
67 int destroy_lattice(t_atom *atom);
68 int thermal_init(t_atom *atom,t_random *random,int count,double t);
69 int scale_velocity(t_atom *atom,int count,double t);
70 double get_e_kin(t_atom *atom,int count);
71 t_3dvec get_total_p(t_atom *atom,int count);
72
73 double potential_lennard_jones_2(t_moldyn *moldyn,void *ptr);
74
75 #endif