Merge release-4-6 into master
[alexxy/gromacs.git] / src / gromacs / mdlib / mdebin_bar.h
index bb4ffd21ed607e4fac913ce3cd36d513a371ba97..1db14b6d8361c3305edb84f6aed5a338a113a49f 100644 (file)
 extern "C" {
 #endif
 
+
 /* The functions & data structures here describe writing
    energy differences (or their histogram )for use with g_bar */
 
 /* Data for one foreign lambda, or derivative. */
 typedef struct
 {
-    real *dh; /* the raw energy difference data -- actually, store more in here. */
+    real *dh; /* the raw energy data. */
     float *dhf; /* raw difference data -- in floats, for storage. */
     unsigned int ndh; /* number of data points */
     unsigned int ndhmax; /* the maximum number of points */
@@ -66,13 +67,21 @@ typedef struct
                               of the histogram */
     unsigned int maxbin[2]; /* highest bin number with data */
 
-    gmx_bool derivative; /* whether this delta_h contains derivatives */
-    double lambda; /* current lambda */
+    int type;       /* the block type according to dhbtDH, etc. */
+    int derivative; /* The derivative direction (as an index in the lambda
+                       vector) if this delta_h contains derivatives */
+    double *lambda; /* lambda vector (or NULL if not applicable) */
+    int nlambda;    /* length of the lambda vector */
     gmx_bool written;    /* whether this data has already been written out */
 
-    double subblock_d[4]; /* data for an mdebin subblock for I/O. */
-    gmx_large_int_t subblock_l[4]; /* data for an mdebin subblock for I/O.  */
-    int subblock_i[4]; /* data for an mdebin subblock for I/O.  */
+    gmx_large_int_t subblock_meta_l[5]; /* metadata for an mdebin subblock for
+                                           I/O: for histogram counts, etc.*/
+    double *subblock_meta_d; /* metadata subblock for I/O, used for
+                                communicating doubles (i.e. the lambda
+                                vector) */
+    int subblock_meta_i[4]; /* metadata subblock for I/O, used for
+                               communicating ints (i.e. derivative indices,
+                               etc.) */
 } t_mde_delta_h;
 
 /* the type definition is in mdebin_bar.h */
@@ -80,13 +89,39 @@ struct t_mde_delta_h_coll
 {
     t_mde_delta_h *dh; /* the delta h data */
     int ndh; /* the number of delta_h structures */
+
+    int nlambda; /* number of bar dU delta_h structures */
+    t_mde_delta_h *dh_du; /* the delta h data (pointer into dh) */
+
+    int ndhdl; /* number of bar dU delta_h structures */
+    t_mde_delta_h *dh_dhdl; /* the dhdl data (pointer into dh) */
+
+    t_mde_delta_h *dh_energy; /* energy output block (pointer into dh) */
+    t_mde_delta_h *dh_pv; /* pV output block (pointer into dh) */
+    t_mde_delta_h *dh_expanded; /* expanded ensemble output block (pointer 
+                                   into dh) */
+
     double start_time; /* start time of the current dh collection */
     double delta_time; /* time difference between samples */
     gmx_bool start_time_set; /* whether the start time has been set */
     double start_lambda; /* starting lambda for continuous motion of state*/
     double delta_lambda; /* delta lambda, for continuous motion of state */
     double temperature; /* the temperature of the samples*/
-    double subblock_d[5]; /* data for writing an mdebin subblock for I/O */
+
+    double *native_lambda_vec; /* The lambda vector describing the current
+                                  lambda state if it is set (NULL otherwise) */
+    int n_lambda_vec; /* the size of the native lambda vector */
+    int *native_lambda_components; /* the native lambda (and by extension,
+                                      foreign lambda) components in terms
+                                      of efptFEP, efptMASS, etc. */
+    int lambda_index; /* the lambda_fep_state */
+
+    double *subblock_d; /* for writing a metadata mdebin subblock for I/O */
+    int *subblock_i; /* for writing a metadata mdebin subblock for I/O */
+
+    double *lambda_vec_subblock; /* native lambda vector data subblock for
+                                    I/O */
+    int *lambda_index_subblock; /* lambda vector index data subblock for I/O */
 };
 
 
@@ -112,11 +147,6 @@ void mde_delta_h_coll_add_dh(t_mde_delta_h_coll *dhc,
                              double fep_state,
                              double energy,
                              double pV,
-                             int bExpanded,
-                             int bPrintEnergy,
-                             int bPressure,
-                             int ndhdl,
-                             int nlambda,
                              double *dhdl,
                              double *foreign_dU,
                              double time);