+#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 */
+} t_linkcell;
+
+#include "visual/visual.h"
+
+/* moldyn schedule structure */
+typedef struct s_moldyn_schedule {
+ int count;
+ int total_sched;
+ int *runs;
+ double *tau;
+ int (*hook)(void *moldyn,void *hook_params);
+ 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 */
+ double volume; /* volume of sim cell (dim.x*dim.y*dim.z) */
+
+ /* 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);
+ int (*func2b_post)(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 */
+ double nnd; /* nearest neighbour distance (optional) */
+
+ t_linkcell lc; /* linked cell list interface */
+
+ double t_ref; /* reference temperature */
+ double t; /* actual temperature */
+
+ double p_ref; /* reference pressure */
+ double p; /* actual pressure (computed by virial) */
+ t_3dvec tp; /* thermodynamic pressure dU/dV */
+ double dv; /* dV for thermodynamic pressure calc */
+
+ /* pressure and temperature control (velocity/volume scaling) */
+ /* (t_tc in units of tau, p_tc in units of tau * isoth. compressib.) */
+ unsigned char pt_scale; /* type of p and t scaling */
+ double t_tc; /* t berendsen control time constant */
+ double p_tc; /* p berendsen control time constant */
+
+ /* 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 */
+
+ char vlsdir[128]; /* visualization/log/save directory */
+ t_visual vis; /* visualization interface structure */
+ u8 vlsprop; /* log/vis/save 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 */
+ unsigned int swrite; /* how often to create a save file */
+ int rfd; /* report file descriptor */
+ char rtitle[64]; /* report title */
+ char rauthor[64]; /* report author */
+ int pfd; /* gnuplot script file descriptor */
+
+ u8 status; /* general moldyn properties */
+
+ t_random random; /* random interface */
+
+ int debug; /* debugging stuff, ignore */
+} t_moldyn;
+
+#define MOLDYN_STAT_PBX 0x01 /* periodic boudaries in x */
+#define MOLDYN_STAT_PBY 0x02 /* y */
+#define MOLDYN_STAT_PBZ 0x04 /* and z direction */
+
+#define MOLDYN_PSCALE 0x08 /* size controlled by piston */
+
+#define MOLDYN_1BP 0x10 /* care about single */
+#define MOLDYN_2BP 0x20 /* 2 body */
+#define MOLDYN_3BP 0x40 /* and 3 body particle pots */
+
+#define T_SCALE_BERENDSEN 0x01 /* berendsen t control */
+#define T_SCALE_DIRECT 0x02 /* direct t control */
+#define P_SCALE_BERENDSEN 0x04 /* berendsen p control */
+#define P_SCALE_DIRECT 0x08 /* direct p control */
+
+/*
+ *
+ * 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;
+ double uc;
+} 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_ij2;
+ double d_ij;
+
+ double chi;
+
+ double *beta_i;
+ double *beta_j;
+ double *n_i;
+ double *n_j;
+ double *c_i;
+ double *c_j;
+ double *d_i;
+ double *d_j;
+ double *h_i;
+ double *h_j;
+
+ double ci2;
+ double cj2;
+ double di2;
+ double dj2;
+ double ci2di2;
+ double cj2dj2;
+ double betaini;
+ double betajnj;
+
+ u8 run3bp;
+ u8 run2bp_post;
+ u8 d_ij_between_rs;
+
+ double zeta_ij;
+ double zeta_ji;
+ t_3dvec dzeta_ij;
+ t_3dvec dzeta_ji;
+} t_tersoff_exchange;
+
+/* tersoff multi (2!) potential parameters */
+typedef struct s_tersoff_mult_params {
+ double S[2]; /* tersoff cutoff radii */
+ double S2[2]; /* tersoff cutoff radii squared */
+ double R[2]; /* tersoff cutoff radii */
+ double Smixed; /* mixed S radius */
+ double S2mixed; /* mixed S radius squared */
+ double Rmixed; /* mixed R radius */
+ double A[2]; /* factor of tersoff attractive part */
+ double B[2]; /* factor of tersoff repulsive part */
+ double Amixed; /* mixed A factor */
+ double Bmixed; /* mixed B factor */
+ double lambda[2]; /* tersoff lambda */
+ double lambda_m; /* mixed lambda */
+ double mu[2]; /* tersoff mu */
+ double mu_m; /* mixed mu */
+
+ double chi;