lennard jones force
[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 typedef struct s_moldyn {
25         int count;
26         t_atom *atom;
27         double (*potential)(struct s_moldyn *moldyn);
28         void *pot_params;
29         int (*force)(struct s_moldyn *moldyn);
30         double cutoff_square;
31         t_3dvec dim;
32         unsigned char status;
33 } t_moldyn;
34
35 typedef struct s_lj_params {
36         double sigma6;
37         double sigma12;
38         double epsilon;
39 } t_lj_params;
40
41 /*
42  *  defines
43  */
44
45 /* general defines */
46
47 #define MOLDYN_STAT_POTENTIAL           0x01
48 #define MOLDYN_STAT_FORCE               0x02
49
50 /* phsical values */
51
52 //#define K_BOLTZMANN           1.3807E-23
53 #define K_BOLTZMANN             1.0
54
55 #define FCC                     0x01
56 #define DIAMOND                 0x02
57
58 #define C                       0x06
59 #define M_C                     6.0
60
61 #define Si                      0x0e
62 #define M_SI                    14.0
63 #define LC_SI                   5.43105
64
65 /* function prototypes */
66
67 int create_lattice(unsigned char type,int element,double mass,double lc,
68                    int a,int b,int c,t_atom **atom);
69 int destroy_lattice(t_atom *atom);
70 int thermal_init(t_atom *atom,t_random *random,int count,double t);
71 int scale_velocity(t_atom *atom,int count,double t);
72 double get_e_kin(t_atom *atom,int count);
73 double get_e_pot(t_moldyn *moldyn);
74 double get_total_energy(t_moldyn *moldyn);
75 t_3dvec get_total_p(t_atom *atom,int count);
76
77 double potential_lennard_jones(t_moldyn *moldyn);
78 int force_lennard_jones(t_moldyn *moldyn);
79
80 #endif