add another way of calculating tersoff + small moldyn mods
[physik/posic.git] / moldyn.h
index 85a4950..5b12048 100644 (file)
--- a/moldyn.h
+++ b/moldyn.h
@@ -85,11 +85,15 @@ typedef struct s_moldyn {
        /* potential force function and parameter pointers */
        int (*func1b)(struct s_moldyn *moldyn,t_atom *ai);
        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);
-       int (*func3b)(struct s_moldyn *moldyn,t_atom *ai,t_atom *aj,t_atom *ak,
-                     u8 bck);
+       int (*func3b_j1)(struct s_moldyn *moldyn,t_atom *ai,t_atom *aj,u8 bc);
+       int (*func3b_j2)(struct s_moldyn *moldyn,t_atom *ai,t_atom *aj,u8 bc);
+       int (*func3b_j3)(struct s_moldyn *moldyn,t_atom *ai,t_atom *aj,u8 bc);
+       int (*func3b_k1)(struct s_moldyn *moldyn,
+                        t_atom *ai,t_atom *aj,t_atom *ak,u8 bck);
+       int (*func3b_k2)(struct s_moldyn *moldyn,
+                        t_atom *ai,t_atom *aj,t_atom *ak,u8 bck);
        void *pot_params;
-       //int (*potential_force_function)(struct s_moldyn *moldyn);
+       unsigned char run3bp;
 
        double cutoff;          /* cutoff radius */
        double cutoff_square;   /* square of the cutoff radius */
@@ -99,9 +103,18 @@ typedef struct s_moldyn {
 
        double t_ref;           /* reference temperature */
        double t;               /* actual temperature */
+       double t_sum;           /* sum over all t */
+       double mean_t;          /* mean value of t */
+
+       t_virial virial;        /* global virial (absolute coordinates) */
+       double gp;              /* pressure computed from global virial */
+       double gp_sum;          /* sum over all gp */
+       double mean_gp;         /* mean value of gp */
 
        double p_ref;           /* reference pressure */
        double p;               /* actual pressure (computed by virial) */
+       double p_sum;           /* sum over all p */
+       double mean_p;          /* mean value of p */
        t_3dvec tp;             /* thermodynamic pressure dU/dV */
        double dv;              /* dV for thermodynamic pressure calc */
 
@@ -121,7 +134,7 @@ typedef struct s_moldyn {
        double tau;             /* delta t */
        double time;            /* absolute time */
        double tau_square;      /* delta t squared */
-       double elapsed;         /* total elapsed time */
+       int total_steps;        /* total steps */
 
        double energy;          /* potential energy */
        double ekin;            /* kinetic energy */
@@ -175,7 +188,7 @@ typedef struct s_moldyn {
 #define P_SCALE_DIRECT                 0x08    /* direct p control */
 
 /*
- * default values
+ * default values & units
  *
  * - length unit: 1 A (1 A = 1e-10 m)
  * - time unit: 1 fs (1 fs = 1e-15 s)
@@ -191,7 +204,9 @@ typedef struct s_moldyn {
 #define KILOGRAM                       (1.0/AMU)               /* amu */
 #define NEWTON (METER*KILOGRAM/(SECOND*SECOND))        /* A amu / fs^2 */
 #define PASCAL (NEWTON/(METER*METER))                  /* N / A^2 */
-#define ATM    ((1.0133e5*PASCAL))                     /* N / A^2 */
+#define BAR    ((1.0e5*PASCAL))                        /* N / A^2 */
+#define K_BOLTZMANN    (1.380650524e-23*METER*NEWTON)  /* NA/K */
+#define EV             (1.6021765314e-19*METER*NEWTON) /* NA */
 
 #define MOLDYN_TEMP                    273.0
 #define MOLDYN_TAU                     1.0
@@ -220,17 +235,12 @@ typedef struct s_moldyn {
 #define QUIET                          0
 
 /*
- *
- * phsical values / constants
- *
+ * potential related phsical values / constants
  *
  */
 
 #define ONE_THIRD              (1.0/3.0)
 
-#define K_BOLTZMANN            (1.380650524e-23*METER*NEWTON)  /* NA/K */
-#define EV                     (1.6021765314e-19*METER*NEWTON) /* NA */
-
 #define C                      0x06
 #define M_C                    12.011                          /* amu */
 
@@ -284,10 +294,9 @@ typedef struct s_moldyn {
  *
  */
 
-typedef int (*pf_func1b)(t_moldyn *,t_atom *ai);
-typedef int (*pf_func2b)(t_moldyn *,t_atom *,t_atom *,u8 bc);
-typedef int (*pf_func2b_post)(t_moldyn *,t_atom *,t_atom *,u8 bc);
-typedef int (*pf_func3b)(t_moldyn *,t_atom *,t_atom *,t_atom *,u8 bc);
+typedef int (*pf_func1b)(t_moldyn *,t_atom *);
+typedef int (*pf_func2b)(t_moldyn *,t_atom *,t_atom *,u8);
+typedef int (*pf_func3b)(t_moldyn *,t_atom *,t_atom *,t_atom *,u8);
 
 int moldyn_init(t_moldyn *moldyn,int argc,char **argv);
 int moldyn_shutdown(t_moldyn *moldyn);
@@ -302,8 +311,11 @@ int set_nn_dist(t_moldyn *moldyn,double dist);
 int set_pbc(t_moldyn *moldyn,u8 x,u8 y,u8 z);
 int set_potential1b(t_moldyn *moldyn,pf_func1b func);
 int set_potential2b(t_moldyn *moldyn,pf_func2b func);
-int set_potential2b_post(t_moldyn *moldyn,pf_func2b_post func);
-int set_potential3b(t_moldyn *moldyn,pf_func3b func);
+int set_potential3b_j1(t_moldyn *moldyn,pf_func2b func);
+int set_potential3b_j2(t_moldyn *moldyn,pf_func2b func);
+int set_potential3b_j3(t_moldyn *moldyn,pf_func2b func);
+int set_potential3b_k1(t_moldyn *moldyn,pf_func3b func);
+int set_potential3b_k2(t_moldyn *moldyn,pf_func3b func);
 int set_potential_params(t_moldyn *moldyn,void *params);
 
 int moldyn_set_log_dir(t_moldyn *moldyn,char *dir);
@@ -331,8 +343,7 @@ int scale_volume(t_moldyn *moldyn);
 int scale_dim(t_moldyn *moldyn,double scale,u8 x,u8 y,u8 z);
 int scale_atoms(t_moldyn *moldyn,double scale,u8 x,u8 y,u8 z);
 
-double get_e_kin(t_moldyn *moldyn);
-double update_e_kin(t_moldyn *moldyn);
+double e_kin_calc(t_moldyn *moldyn);
 double get_total_energy(t_moldyn *moldyn);
 t_3dvec get_total_p(t_moldyn *moldyn);