2 * moldyn.h - molecular dynamics library header file
4 * author: Frank Zirkelbach <frank.zirkelbach@physik.uni-augsburg.de>
11 #include "math/math.h"
12 #include "random/random.h"
13 #include "list/list.h"
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 */
25 typedef struct s_linkcell {
33 #include "visual/visual.h"
35 typedef struct s_moldyn {
36 /* atoms, amount, dimensions */
40 /* potential, force & parameters */
41 int (*potential_force_function)(struct s_moldyn *moldyn);
46 /* linked list / cell method */
50 /* integration of newtons equations */
51 int (*integrate)(struct s_moldyn *moldyn);
57 /* logging & visualization */
75 /* moldyn general status */
81 typedef struct s_ho_params {
82 double spring_constant;
83 double equilibrium_distance;
86 typedef struct s_lj_params {
98 #define MOLDYN_LVSTAT_TOTAL_E 0x01
99 #define MOLDYN_LVSTAT_TOTAL_M 0x02
100 #define MOLDYN_LVSTAT_SAVE 0x04
101 #define MOLDYN_LVSTAT_DUMP 0x08
102 #define MOLDYN_LVSTAT_VISUAL 0x10
103 #define MOLDYN_LVSTAT_INITIALIZED 0x80
105 #define MOLDYN_STAT_POTENTIAL 0x01
106 #define MOLDYN_STAT_FORCE 0x02
108 #define MOLDYN_TEMP 273.0
109 #define MOLDYN_TAU 1.0e-15
110 #define MOLDYN_CUTOFF 10.0e-9
111 #define MOLDYN_RUNS 1000000
113 #define MOLDYN_INTEGRATE_VERLET 0x00
114 #define MOLDYN_INTEGRATE_DEFAULT MOLDYN_INTEGRATE_VERLET
116 #define MOLDYN_POTENTIAL_HO 0x00
117 #define MOLDYN_POTENTIAL_LJ 0x01
118 #define MOLDYN_POTENTIAL_DEFAULT MOLDYN_POTENTIAL_LJ
122 #define K_BOLTZMANN 1.3807e-27 /* Nm/K */
123 #define AMU 1.660540e-27 /* kg */
129 #define M_C (12.011*AMU)
132 #define LC_SI 0.543105e-9 /* m */
133 #define M_SI (28.085*AMU) /* kg */
134 #define LJ_SIGMA_SI ((0.25*sqrt(3.0)*LC_SI)/1.122462) /* m */
135 #define LJ_EPSILON_SI (2.1678*1.60e-19) /* Nm */
137 /* function prototypes */
139 int moldyn_usage(char **argv);
140 int moldyn_parse_argv(t_moldyn *moldyn,int argc,char **argv);
141 int moldyn_log_init(t_moldyn *moldyn);
142 int moldyn_init(t_moldyn *moldyn,int argc,char **argv);
143 int moldyn_shutdown(t_moldyn *moldyn);
145 int create_lattice(unsigned char type,int element,double mass,double lc,
146 int a,int b,int c,t_atom **atom);
147 int destroy_lattice(t_atom *atom);
148 int thermal_init(t_moldyn *moldyn);
149 int scale_velocity(t_moldyn *moldyn);
150 double get_e_kin(t_atom *atom,int count);
151 double get_e_pot(t_moldyn *moldyn);
152 double get_total_energy(t_moldyn *moldyn);
153 t_3dvec get_total_p(t_atom *atom,int count);
155 double estimate_time_step(t_moldyn *moldyn,double nn_dist,double t);
157 int link_cell_init(t_moldyn *moldyn);
158 int link_cell_update(t_moldyn *moldyn);
159 int link_cell_neighbour_index(t_moldyn *moldyn,int i,int j,int k,t_list *cell);
160 int link_cell_shutdown(t_moldyn *moldyn);
162 int moldyn_integrate(t_moldyn *moldyn);
163 int velocity_verlet(t_moldyn *moldyn);
165 int harmonic_oscillator(t_moldyn *moldyn);
166 int lennard_jones(t_moldyn *moldyn);