Skip to content

Commit

Permalink
Merge pull request #75 from khavernathy/clean-and-docs
Browse files Browse the repository at this point in the history
Clean and docs
  • Loading branch information
khavernathy authored Apr 21, 2021
2 parents c209050 + 59b9abb commit 97f16e8
Show file tree
Hide file tree
Showing 36 changed files with 8,695 additions and 8,055 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
working-directory: ${{github.workspace}}/build
shell: bash
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config $BUILD_TYPE
run: cmake .; make -j1;

- name: Test
working-directory: ${{github.workspace}}/build
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.idea
Testing
build
CTestTestfile.cmake
*.obj
*.i
#md_test
Expand Down
15 changes: 5 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,14 @@ configure_file (
)

set(CMAKE_BUILD_TYPE Release)

set(CMAKE_CXX_FLAGS "-lm -I. -Ofast -foptimize-sibling-calls -finline-limit=10000 -fexpensive-optimizations -flto -frename-registers")

set(CMAKE_CXX_STANDARD 11)

set(INCLUDE src/)

set(SRC
src/main.cpp
)


if(MPI)
message("-- MPI Enabled")
find_package(MPI REQUIRED)
Expand All @@ -38,7 +34,6 @@ else()
message("-- MPI Disabled")
endif()


if(OMP)
message("-- OpenMP Enabled")
find_package(OPENMP REQUIRED)
Expand All @@ -57,14 +52,14 @@ else()
message("-- CUDA Disabled")
endif()




# make executable

if(CUDA)
cuda_add_executable(${PROJECT_NAME} ${SRC})
else()
add_executable(${PROJECT_NAME} ${SRC})
endif()

enable_testing()
add_test(NAME optimize_RuBpy
CONFIGURATIONS Release
WORKING_DIRECTORY ../examples/optimization/RuBpy
COMMAND mcmd mcmd.inp)
365 changes: 184 additions & 181 deletions src/averages.cpp

Large diffs are not rendered by default.

44 changes: 22 additions & 22 deletions src/boltzmann.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,25 @@ double get_boltzmann_factor(System &system, double e_i, double e_f, int_fast8_t
//fugacity *= 3; // big, but not too big, for biased insertions
system.constants.bias_uptake_switcher=0; // done biasing if we exceed the bias-N
printf("Loading bias deactivated! (Desired N reached).\n");
}
}
}

if (system.constants.ensemble == ENSEMBLE_UVT) {
if (movetype == MOVETYPE_INSERT) {
bf = system.pbc.volume * fugacity *
system.constants.ATM2REDUCED/(system.constants.temp *
(double)(system.stats.count_movables)) *
exp(-energy_delta/system.constants.temp) *
(double)system.proto.size(); // bias for multisorbate (thus no change for single)
bf = system.pbc.volume * fugacity *
system.constants.ATM2REDUCED/(system.constants.temp *
(double)(system.stats.count_movables)) *
exp(-energy_delta/system.constants.temp) *
(double)system.proto.size(); // bias for multisorbate (thus no change for single)
if (bf < MAXVALUE) system.stats.insert_bf_sum += bf;
else system.stats.insert_bf_sum += MAXVALUE;
}
}
else if (movetype == MOVETYPE_REMOVE) {
bf = system.constants.temp *
((double)(system.stats.count_movables) + 1.0)/
(system.pbc.volume* fugacity *system.constants.ATM2REDUCED) *
exp(-energy_delta/system.constants.temp) /
(double)system.proto.size(); // bias for multisorbate (thus no change for single)
bf = system.constants.temp *
((double)(system.stats.count_movables) + 1.0)/
(system.pbc.volume* fugacity *system.constants.ATM2REDUCED) *
exp(-energy_delta/system.constants.temp) /
(double)system.proto.size(); // bias for multisorbate (thus no change for single)
if (bf < MAXVALUE) system.stats.remove_bf_sum += bf;
else system.stats.remove_bf_sum += MAXVALUE;
}
Expand All @@ -64,11 +64,11 @@ double get_boltzmann_factor(System &system, double e_i, double e_f, int_fast8_t
if (movetype == MOVETYPE_VOLUME) {
// Frenkel Smit p118
bf= exp(-( (energy_delta)
+ system.constants.pres * system.constants.ATM2REDUCED *
(system.pbc.volume - system.pbc.old_volume)
- (system.stats.count_movables + 1) * system.constants.temp *
log(system.pbc.volume/system.pbc.old_volume))/system.constants.temp);
+ system.constants.pres * system.constants.ATM2REDUCED *
(system.pbc.volume - system.pbc.old_volume)
- (system.stats.count_movables + 1) * system.constants.temp *
log(system.pbc.volume/system.pbc.old_volume))/system.constants.temp);

if (bf < MAXVALUE) system.stats.volume_change_bf_sum += bf;
else system.stats.volume_change_bf_sum += MAXVALUE;
}
Expand All @@ -82,17 +82,17 @@ double get_boltzmann_factor(System &system, double e_i, double e_f, int_fast8_t
if (movetype == MOVETYPE_DISPLACE) {
double exponent = 3.0*system.stats.count_movables/2.0;
bf = pow(
(system.constants.total_energy - e_f) , exponent) /
pow(
(system.constants.total_energy - e_i) , exponent);
(system.constants.total_energy - e_f), exponent) /
pow(
(system.constants.total_energy - e_i), exponent);
if (bf < MAXVALUE) system.stats.displace_bf_sum += bf;
else system.stats.displace_bf_sum += MAXVALUE;
}
}

if (bf > MAXVALUE) {
bf = MAXVALUE;
}
}
else if (std::isinf(bf)) {
printf("GOT INF! bf = %f\n", bf);
}
Expand Down
Loading

0 comments on commit 97f16e8

Please sign in to comment.