update patch for WHAM
This commit is contained in:
@ -55,30 +55,31 @@ index 0000000..b4f0fe6
|
||||
+ TYPE DOC
|
||||
+ PERMISSIONS OWNER_READ GROUP_READ WORLD_READ
|
||||
+)
|
||||
diff --git a/wham/wham.c b/wham/wham.c
|
||||
index 487871b..526908e 100644
|
||||
--- a/wham/wham.c
|
||||
+++ b/wham/wham.c
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "wham.h"
|
||||
diff --git a/wham-2d/wham-2d.c b/wham-2d/wham-2d.c
|
||||
index fb6e059..2c5594f 100644
|
||||
--- a/wham-2d/wham-2d.c
|
||||
+++ b/wham-2d/wham-2d.c
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <time.h>
|
||||
#include "wham-2d.h"
|
||||
|
||||
|
||||
-#define COMMAND_LINE "Command line: wham [P|Ppi|Pval] hist_min hist_max num_bins tol temperature numpad metadatafile freefile [num_MC_trials randSeed]\n"
|
||||
+#define COMMAND_LINE "Command line: wham [P|Ppi|Pval] [units <real|metal|lj|...>] hist_min hist_max num_bins tol temperature numpad metadatafile freefile [num_MC_trials randSeed]\n"
|
||||
|
||||
double HIST_MAX,HIST_MIN,BIN_WIDTH,TOL;
|
||||
double *HISTOGRAM;
|
||||
@@ -29,6 +29,7 @@ double kT;
|
||||
int NUM_BINS;
|
||||
int PERIODIC;
|
||||
double PERIOD;
|
||||
-#define COMMAND_LINE "Command line: wham-2d Px[=0|pi|val] hist_min_x hist_max_x num_bins_x Py[=0|pi|val] hist_min_y hist_max_y num_bins_y tol temperature numpad metadatafile freefile use_mask\n"
|
||||
+#define COMMAND_LINE "Command line: wham-2d [units <real|metal|lj|...>] Px[=0|pi|val] hist_min_x hist_max_x num_bins_x Py[=0|pi|val] hist_min_y hist_max_y num_bins_y tol temperature numpad metadatafile freefile use_mask\n"
|
||||
double HIST_MAXx,HIST_MINx,BIN_WIDTHx;
|
||||
double HIST_MAXy,HIST_MINy,BIN_WIDTHy;
|
||||
double TOL;
|
||||
@@ -35,7 +35,7 @@ int NUM_BINSx, NUM_BINSy;
|
||||
int PERIODICx, PERIODICy;
|
||||
double PERIODx, PERIODy;
|
||||
double *data1,**num,***bias;
|
||||
-
|
||||
+double k_B = k_B_DEFAULT;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@@ -117,6 +118,61 @@ else
|
||||
PERIODIC = 0;
|
||||
@@ -76,6 +76,61 @@ for (i=0; i<argc; i++)
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
+// set k_B according to LAMMPS units settings
|
||||
+if (strcmp(argv[1],"units") == 0)
|
||||
@ -135,9 +136,116 @@ index 487871b..526908e 100644
|
||||
+ argv += 2;
|
||||
+ }
|
||||
+
|
||||
// Parse command line arguments
|
||||
if (argc != 9 && argc !=11)
|
||||
PERIODICx = parse_periodic(argv[1], &PERIODx);
|
||||
if (PERIODICx)
|
||||
{
|
||||
diff --git a/wham-2d/wham-2d.h b/wham-2d/wham-2d.h
|
||||
index b17e4bd..5fc17ff 100644
|
||||
--- a/wham-2d/wham-2d.h
|
||||
+++ b/wham-2d/wham-2d.h
|
||||
@@ -20,15 +20,15 @@ extern int NUM_BINSy;
|
||||
|
||||
extern int PERIODICx,PERIODICy; // flags to turn on periodicity
|
||||
extern double PERIODx, PERIODy; // flags to control periodic interval
|
||||
+extern double k_B;
|
||||
|
||||
// A couple of predefined periodic units
|
||||
#define DEGREES 360.0
|
||||
#define RADIANS 6.28318530717959
|
||||
|
||||
-#define k_B 0.001982923700 // Boltzmann's constant in kcal/mol K
|
||||
-//#define k_B 0.0083144621 // Boltzmann's constant kJ/mol-K
|
||||
-//#define k_B 1.0 // Boltzmann's constant in reduced units
|
||||
-
|
||||
+#define k_B_DEFAULT 0.001982923700 // Boltzmann's constant in kcal/mol K
|
||||
+//#define k_B_DEFAULT 0.0083144621 // Boltzmann's constant kJ/mol-K
|
||||
+//#define k_B_DEFAULT 1.0 // Boltzmann's constant in reduced units
|
||||
|
||||
|
||||
// Value inserted for the free energy of masked values
|
||||
diff --git a/wham/wham.c b/wham/wham.c
|
||||
index 487871b..1496eed 100644
|
||||
--- a/wham/wham.c
|
||||
+++ b/wham/wham.c
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "wham.h"
|
||||
|
||||
|
||||
-#define COMMAND_LINE "Command line: wham [P|Ppi|Pval] hist_min hist_max num_bins tol temperature numpad metadatafile freefile [num_MC_trials randSeed]\n"
|
||||
+#define COMMAND_LINE "Command line: wham [units <real|metal|lj|...>] [P|Ppi|Pval] hist_min hist_max num_bins tol temperature numpad metadatafile freefile [num_MC_trials randSeed]\n"
|
||||
|
||||
double HIST_MAX,HIST_MIN,BIN_WIDTH,TOL;
|
||||
double *HISTOGRAM;
|
||||
@@ -29,6 +29,7 @@ double kT;
|
||||
int NUM_BINS;
|
||||
int PERIODIC;
|
||||
double PERIOD;
|
||||
+double k_B = k_B_DEFAULT;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@@ -82,6 +83,61 @@ for (i=0; i<argc; i++)
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
+// set k_B according to LAMMPS units settings
|
||||
+if (strcmp(argv[1],"units") == 0)
|
||||
+ {
|
||||
+ if (argc < 3)
|
||||
+ {
|
||||
+ printf( COMMAND_LINE );
|
||||
+ exit(-1);
|
||||
+ }
|
||||
+
|
||||
+ if (strcmp(argv[2], "lj") == 0)
|
||||
+ {
|
||||
+ k_B = 1.0;
|
||||
+ }
|
||||
+ else if (strcmp(argv[2], "real") == 0)
|
||||
+ {
|
||||
+ k_B = 0.0019872067;
|
||||
+ }
|
||||
+ else if (strcmp(argv[2], "metal") == 0)
|
||||
+ {
|
||||
+ k_B = 8.617343e-5;
|
||||
+ }
|
||||
+ else if (strcmp(argv[2], "si") == 0)
|
||||
+ {
|
||||
+ k_B = 1.3806504e-23;
|
||||
+ }
|
||||
+ else if (strcmp(argv[2], "cgs") == 0)
|
||||
+ {
|
||||
+ k_B = 1.3806504e-16;
|
||||
+ }
|
||||
+ else if (strcmp(argv[2], "electron") == 0)
|
||||
+ {
|
||||
+ k_B = 3.16681534e-6;
|
||||
+ }
|
||||
+ else if (strcmp(argv[2], "micro") == 0)
|
||||
+ {
|
||||
+ k_B = 1.3806504e-8;
|
||||
+ }
|
||||
+ else if (strcmp(argv[2], "nano") == 0)
|
||||
+ {
|
||||
+ k_B = 0.013806504;
|
||||
+ }
|
||||
+ else if (strcmp(argv[2], "default") == 0)
|
||||
+ {
|
||||
+ k_B = k_B_DEFAULT;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ printf("Unknown unit style: %s\n%s", argv[2], COMMAND_LINE);
|
||||
+ exit(-1);
|
||||
+ }
|
||||
+ printf("# Setting value of k_B to = %.15g\n", k_B);
|
||||
+ argc -= 2;
|
||||
+ argv += 2;
|
||||
+ }
|
||||
+
|
||||
if (toupper(argv[1][0]) == 'P')
|
||||
{
|
||||
PERIODIC = 1;
|
||||
diff --git a/wham/wham.h b/wham/wham.h
|
||||
index aacc1e8..7d509f2 100644
|
||||
--- a/wham/wham.h
|
||||
|
||||
Reference in New Issue
Block a user