changed energy fluctuation calc and heat cap calc
[physik/posic.git] / moldyn.h
index fc9bce7..2d1a438 100644 (file)
--- a/moldyn.h
+++ b/moldyn.h
@@ -77,6 +77,7 @@ typedef struct s_moldyn_schedule {
 /* moldyn main structure */
 typedef struct s_moldyn {
        int count;              /* total amount of atoms */
+       double mass;            /* total system mass */
        t_atom *atom;           /* pointer to the atoms */
 
        t_3dvec dim;            /* dimensions of the simulation volume */
@@ -139,9 +140,26 @@ 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_sum;           /* sum of kinetic energy */
+       double v_sum;           /* sum of potential energy */
+       double k_mean;          /* average of kinetic energy */
+       double v_mean;          /* average of potential energy */
+       double k2_sum;          /* sum of kinetic energy squared */
+       double v2_sum;          /* sum of potential energy squared */
+       double k2_mean;         /* average of kinetic energy squared */
+       double v2_mean;         /* average of potential energy squared */
+       double dk2_mean;        /* mean square kinetic energy fluctuations */
+       double dv2_mean;        /* mean square potential energy fluctuations */
+       
+       /* 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 */
@@ -209,7 +227,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
@@ -388,10 +408,13 @@ int add_atom(t_moldyn *moldyn,int element,double mass,u8 brand,u8 attr,
 int destroy_atoms(t_moldyn *moldyn);
 
 int thermal_init(t_moldyn *moldyn,u8 equi_init);
+double total_mass_calc(t_moldyn *moldyn);
 double temperature_calc(t_moldyn *moldyn);
 double get_temperature(t_moldyn *moldyn);
 int scale_velocity(t_moldyn *moldyn,u8 equi_init);
 double pressure_calc(t_moldyn *moldyn);
+int energy_fluctuation_calc(t_moldyn *moldyn);
+int get_heat_capacity(t_moldyn *moldyn);
 double thermodynamic_pressure_calc(t_moldyn *moldyn);
 double get_pressure(t_moldyn *moldyn);
 int scale_volume(t_moldyn *moldyn);
@@ -427,7 +450,6 @@ int check_per_bound(t_moldyn *moldyn,t_3dvec *a);
 
 int moldyn_bc_check(t_moldyn *moldyn);
 
-int read_line(int fd,char *line);
-int calc_fluctuations(double start,double end,char *file);
+int get_line(int fd,char *line,int max);
 
 #endif