#include "math/math.h"
#include "random/random.h"
-//#include "visual/visual.h"
/* datatypes */
} t_atom;
typedef struct s_moldyn {
+ /* atoms, amount, dimensions */
int count;
t_atom *atom;
+ t_3dvec dim;
+ /* potential, force & parameters */
double (*potential)(struct s_moldyn *moldyn);
- void *pot_params;
int (*force)(struct s_moldyn *moldyn);
+ void *pot_params;
double cutoff;
double cutoff_square;
- t_3dvec dim;
+ /* temperature */
+ double t;
+ /* integration of newtons equations */
int (*integrate)(struct s_moldyn *moldyn);
int time_steps;
double tau;
+ /* logging & visualization */
+ unsigned char lvstat;
+ unsigned int ewrite;
+ char efb[64];
+ int efd;
+ unsigned int mwrite;
+ char mfb[64];
+ int mfd;
+ unsigned int swrite;
+ char sfb[64];
+ int sfd;
+ unsigned int dwrite;
+ char dfb[64];
+ int dfd;
+ unsigned int vwrite;
+ char vfb[64];
void *visual;
- int write;
+ /* moldyn general status */
unsigned char status;
} t_moldyn;
/* general defines */
+#define MOLDYN_LVSTAT_TOTAL_E 0x01
+#define MOLDYN_LVSTAT_TOTAL_M 0x02
+#define MOLDYN_LVSTAT_SAVE 0x04
+#define MOLDYN_LVSTAT_DUMP 0x08
+#define MOLDYN_LVSTAT_VISUAL 0x10
+#define MOLDYN_LVSTAT_INITIALIZED 0x80
+
#define MOLDYN_STAT_POTENTIAL 0x01
#define MOLDYN_STAT_FORCE 0x02
+#define MOLDYN_TEMP 273.0
+#define MOLDYN_TAU 1.0e-15
+#define MOLDYN_RUNS 1000000
+
/* phsical values */
#define K_BOLTZMANN 1.3807e-27 /* Nm/K */
/* function prototypes */
+int moldyn_usage(char **argv);
+int moldyn_parse_argv(t_moldyn *moldyn,int argc,char **argv);
+int moldyn_log_init(t_moldyn *moldyn,void *v);
+int moldyn_shutdown(t_moldyn *moldyn);
+
int create_lattice(unsigned char type,int element,double mass,double lc,
int a,int b,int c,t_atom **atom);
int destroy_lattice(t_atom *atom);
-int thermal_init(t_atom *atom,t_random *random,int count,double t);
-int scale_velocity(t_atom *atom,int count,double t);
+int thermal_init(t_moldyn *moldyn,t_random *random,int count);
+int scale_velocity(t_moldyn *moldyn,int count);
double get_e_kin(t_atom *atom,int count);
double get_e_pot(t_moldyn *moldyn);
double get_total_energy(t_moldyn *moldyn);