165 lines
4.3 KiB
Diff
165 lines
4.3 KiB
Diff
diff --git a/.gitignore b/.gitignore
|
|
index 28ac6ef..a401160 100644
|
|
--- a/.gitignore
|
|
+++ b/.gitignore
|
|
@@ -6,6 +6,8 @@ doc.toc
|
|
wham-dist.tar.gz
|
|
|
|
*.o
|
|
+*~
|
|
|
|
wham/wham
|
|
wham-2d/wham-2d
|
|
+/build
|
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
new file mode 100644
|
|
index 0000000..b4f0fe6
|
|
--- /dev/null
|
|
+++ b/CMakeLists.txt
|
|
@@ -0,0 +1,38 @@
|
|
+# Custom minimal -*- CMake -*- file for wham
|
|
+
|
|
+cmake_minimum_required(VERSION 3.16)
|
|
+project(wham VERSION 2.0.11
|
|
+ DESCRIPTION "WHAM: a fast, memory efficient implementation of the Weighted Histogram Analysis Method"
|
|
+ LANGUAGES C
|
|
+ HOMEPAGE_URL http://membrane.urmc.rochester.edu/content/wham/)
|
|
+
|
|
+include(GNUInstallDirs)
|
|
+
|
|
+add_executable(wham
|
|
+ nr/ran2.c
|
|
+ nr/locate.c
|
|
+ wham/wham.c
|
|
+ wham/file_read.c
|
|
+ wham/histogram.c
|
|
+ wham/bootstrap.c
|
|
+)
|
|
+target_include_directories(wham PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/wham)
|
|
+target_link_libraries(wham PRIVATE m)
|
|
+install(TARGETS wham DESTINATION ${CMAKE_INSTALL_BINDIR})
|
|
+
|
|
+add_executable(wham-2d
|
|
+ nr/ran2.c
|
|
+ nr/locate.c
|
|
+ wham-2d/wham-2d.c
|
|
+ wham-2d/file_read.c
|
|
+ wham-2d/histogram.c
|
|
+ wham/bootstrap.c
|
|
+)
|
|
+target_include_directories(wham-2d PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/wham)
|
|
+target_link_libraries(wham-2d PRIVATE m)
|
|
+install(TARGETS wham-2d DESTINATION ${CMAKE_INSTALL_BINDIR})
|
|
+
|
|
+install(FILES doc/doc.pdf
|
|
+ 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"
|
|
|
|
|
|
-#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;
|
|
+double k_B = k_B_DEFAULT;
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
@@ -117,6 +118,61 @@ else
|
|
PERIODIC = 0;
|
|
}
|
|
|
|
+// 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;
|
|
+ }
|
|
+
|
|
// Parse command line arguments
|
|
if (argc != 9 && argc !=11)
|
|
{
|
|
diff --git a/wham/wham.h b/wham/wham.h
|
|
index aacc1e8..7d509f2 100644
|
|
--- a/wham/wham.h
|
|
+++ b/wham/wham.h
|
|
@@ -15,14 +15,16 @@ extern double kT;
|
|
extern int NUM_BINS;
|
|
extern int PERIODIC;
|
|
extern double PERIOD;
|
|
+extern double k_B;
|
|
+
|
|
|
|
// Some 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
|
|
|
|
|
|
// global (untrimmed) histogram, global to prevent reallocation
|