added post proc stuff
[physik/posic.git] / moldyn.h
index 86444f4..484c456 100644 (file)
--- a/moldyn.h
+++ b/moldyn.h
@@ -111,6 +111,9 @@ typedef struct s_moldyn {
        double gp_sum;          /* sum over all gp */
        double mean_gp;         /* mean value of gp */
 
+       double mean_v;          /* mean of virial */
+       double virial_sum;      /* sum over all calculated virials */
+
        double p_ref;           /* reference pressure */
        double p;               /* actual pressure (computed by virial) */
        double p_sum;           /* sum over all p */
@@ -136,9 +139,22 @@ typedef struct s_moldyn {
        double tau_square;      /* delta t squared */
        int total_steps;        /* total steps */
 
+       /* energy */
        double energy;          /* potential energy */
        double ekin;            /* kinetic energy */
 
+       /* energy averages & fluctuations */
+       double k_m;
+       double p_m;
+       double t_m;
+       double dk2_m;           /* mean square kinetic energy fluctuations */
+       double dp2_m;           /* mean square potential energy fluctuations */
+       double dt2_m;           /* mean square fluctuations in total energy */
+       
+       /* response functions */
+       double c_v_nve;         /* constant volume heat capacity (nve) */
+       double c_v_nvt;         /* constant volume heat capacity (nvt) */
+
        char vlsdir[128];       /* visualization/log/save directory */
        t_visual vis;           /* visualization interface structure */
        u8 vlsprop;             /* log/vis/save properties */
@@ -206,7 +222,9 @@ typedef struct s_moldyn {
 #define PASCAL (NEWTON/(METER*METER))                  /* N / A^2 */
 #define BAR    ((1.0e5*PASCAL))                        /* N / A^2 */
 #define K_BOLTZMANN    (1.380650524e-23*METER*NEWTON)  /* NA/K */
+#define K_B2           (K_BOLTZMANN*K_BOLTZMANN)       /* (NA)^2/K^2 */
 #define EV             (1.6021765314e-19*METER*NEWTON) /* NA */
+#define JOULE          (NEWTON*METER)                  /* NA */
 
 #define MOLDYN_TEMP                    273.0
 #define MOLDYN_TAU                     1.0
@@ -234,6 +252,10 @@ typedef struct s_moldyn {
 #define VERBOSE                                1
 #define QUIET                          0
 
+#define SCALE_UP                       'u'
+#define SCALE_DOWN                     'd'
+#define SCALE_DIRECT                   'D'
+
 /*
  * potential related phsical values / constants
  *
@@ -242,8 +264,7 @@ typedef struct s_moldyn {
 #define ONE_THIRD              (1.0/3.0)
 
 #define C                      0x06
-//#define LC_C                 3.567                           /* A */
-#define LC_C                   3.560                           /* A */
+#define LC_C                   3.567                           /* A */
 #define M_C                    12.011                          /* amu */
 
 #define SI                     0x0e
@@ -254,7 +275,7 @@ typedef struct s_moldyn {
 
 #define LJ_SIGMA_SI            ((0.25*sqrt(3.0)*LC_SI)/1.122462)       /* A */
 //#define LJ_SIGMA_SI          (LC_SI/1.122462)                        /* A */
-//#define LJ_SIGMA_SI          (0.5*sqrt(2.0)*LC_SI/1.122462)                  /* A */
+//#define LJ_SIGMA_SI          (0.5*sqrt(2.0)*LC_SI/1.122462)          /* A */
 #define LJ_EPSILON_SI          (2.1678*EV)                             /* NA */
 
 #define TM_R_SI                        2.7                             /* A */
@@ -297,6 +318,8 @@ typedef struct s_moldyn {
 #define ALBE_D_SI              0.81472
 #define ALBE_H_SI              0.259
 
+#define LC_SI_ALBE             5.429
+
 #define ALBE_R_C               (2.00-0.15)
 #define ALBE_S_C               (2.00+0.15)
 #define ALBE_A_C               (6.00*EV/1.167)
@@ -309,6 +332,8 @@ typedef struct s_moldyn {
 #define ALBE_D_C               6.28433
 #define ALBE_H_C               0.5556
 
+#define LC_C_ALBE              3.566
+
 #define ALBE_R_SIC             (2.40-0.20)
 #define ALBE_S_SIC             (2.40+0.10)
 #define ALBE_A_SIC             (4.36*EV/0.847)
@@ -321,10 +346,11 @@ typedef struct s_moldyn {
 #define ALBE_D_SIC             180.314
 #define ALBE_H_SIC             0.68
 
-#define ALBE_CHI_SIC           1.0
+#define LC_SIC_ALBE            4.359
+
 
 /*
- * lattice constants
+ * lattice types
  */
 
 #define CUBIC                  0x01
@@ -384,8 +410,8 @@ double pressure_calc(t_moldyn *moldyn);
 double thermodynamic_pressure_calc(t_moldyn *moldyn);
 double get_pressure(t_moldyn *moldyn);
 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);
+int scale_dim(t_moldyn *moldyn,u8 dir,double scale,u8 x,u8 y,u8 z);
+int scale_atoms(t_moldyn *moldyn,u8 dir,double scale,u8 x,u8 y,u8 z);
 
 double e_kin_calc(t_moldyn *moldyn);
 double get_total_energy(t_moldyn *moldyn);
@@ -416,4 +442,8 @@ int check_per_bound(t_moldyn *moldyn,t_3dvec *a);
 
 int moldyn_bc_check(t_moldyn *moldyn);
 
+int get_line(int fd,char *line,int max);
+int calc_fluctuations(double start,double end,t_moldyn *moldyn);
+int get_heat_capacity(t_moldyn *moldyn);
+
 #endif