+#define ATOM_ATTR_FP 0x01 /* fixed position (bulk material) */
+#define ATOM_ATTR_HB 0x02 /* coupled to heat bath (velocity scaling) */
+
+#define ATOM_ATTR_1BP 0x10 /* single paricle potential */
+#define ATOM_ATTR_2BP 0x20 /* pair potential */
+#define ATOM_ATTR_3BP 0x40 /* 3 body potential */
+
+/* cell lists */
+typedef struct s_linkcell {
+ int nx,ny,nz; /* amount of cells in x, y and z direction */
+ int cells; /* total amount of cells */
+ double len; /* prefered cell edge length */
+ double x,y,z; /* the actual cell lengthes */
+ t_list *subcell; /* pointer to the cell lists */
+ int dnlc; /* direct neighbour lists counter */
+ int countn; /* amount of neighbours */
+} t_linkcell;
+
+#include "visual/visual.h"
+
+/* moldyn schedule structure */
+typedef struct s_moldyn_schedule {
+ int content_count;
+ int *runs;
+ double *tau;
+ int (*hook)(void *moldyn,void *hook);
+ void *hook_params;
+} t_moldyn_schedule;
+
+/* moldyn main structure */
+typedef struct s_moldyn {
+ int count; /* total amount of atoms */
+ t_atom *atom; /* pointer to the atoms */
+
+ t_3dvec dim; /* dimensions of the simulation volume */
+
+ /* potential force function and parameter pointers */
+ int (*func1b)(struct s_moldyn *moldyn,t_atom *ai);
+ void *pot1b_params;
+ int (*func2b)(struct s_moldyn *moldyn,t_atom *ai,t_atom *aj,u8 bc);
+ void *pot2b_params;
+ int (*func3b)(struct s_moldyn *moldyn,t_atom *ai,t_atom *aj,t_atom *ak,
+ u8 bck);
+ void *pot3b_params;
+ //int (*potential_force_function)(struct s_moldyn *moldyn);
+
+ double cutoff; /* cutoff radius */
+ double cutoff_square; /* square of the cutoff radius */
+
+ t_linkcell lc; /* linked cell method */
+
+ double t; /* temperature */
+
+ /* simulation schedule */
+ t_moldyn_schedule schedule;
+ int current; /* current position in schedule */
+
+ /* integration function pointer */
+ int (*integrate)(struct s_moldyn *moldyn);
+ int time_steps; /* amount of iterations */
+ double tau; /* delta t */
+ double time; /* absolute time */
+ double tau_square; /* delta t squared */
+ double elapsed; /* total elapsed time */
+
+ double energy; /* potential energy */
+ double ekin; /* kinetic energy */
+
+ t_visual vis; /* visualization/log/save interface structure */
+ u8 lvstat; /* log & vis properties */
+ unsigned int ewrite; /* how often to log energy */
+ int efd; /* fd for energy log */
+ unsigned int mwrite; /* how often to log momentum */
+ int mfd; /* fd for momentum log */
+ unsigned int vwrite; /* how often to visualize atom information */
+ char vfb[64]; /* visualization file name base */
+ //void *visual; /* pointer (hack!) */
+ unsigned int swrite; /* how often to create a save file */
+ char sfb[64]; /* visualization file name base */
+
+ u8 status; /* general moldyn properties */
+
+ t_random random; /* random interface */
+} t_moldyn;
+
+#define MOLDYN_STAT_PBX 0x08 /* periodic boudaries in x */
+#define MOLDYN_STAT_PBY 0x10 /* y */
+#define MOLDYN_STAT_PBZ 0x20 /* and z direction */
+
+#define MOLDYN_1BP 0x00
+#define MOLDYN_2BP 0x01
+#define MOLDYN_3BP 0x02
+
+
+/*
+ *
+ * potential parameter structures
+ *
+ */
+
+/*
+ * harmonic oscillator potential parameter structure
+ */
+
+typedef struct s_ho_params {
+ double spring_constant;
+ double equilibrium_distance;
+} t_ho_params;
+
+/*
+ * lennard jones potential parameter structure
+ */
+
+typedef struct s_lj_params {
+ double sigma6;
+ double sigma12;
+ double epsilon4;
+} t_lj_params;
+
+/*
+ * tersoff
+ */
+
+/* tersoff exchange structure to exchange 2bp and 3bp calculated values */
+typedef struct s_tersoff_exchange {
+ double f_c,df_c;
+ double f_a,df_a;
+
+ t_3dvec dist_ij;
+ double d_ij;
+ double d_ij2;
+
+ double chi;