Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
Younes Nejahi committed Jun 11, 2017
2 parents 6e04671 + 0ed7e24 commit 5fc359b
Show file tree
Hide file tree
Showing 171 changed files with 51,458 additions and 2,033 deletions.
157 changes: 157 additions & 0 deletions CMake/FileLists.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
set(sources
src/BlockOutput.cpp
src/BoxDimensions.cpp
src/CBMC.cpp
src/CellList.cpp
src/ConfigSetup.cpp
src/ConsoleOutput.cpp
src/Coordinates.cpp
src/CPUSide.cpp
src/CalculateEnergy.cpp
src/EnPartCntSampleOutput.cpp
src/Ewald.cpp
src/EwaldCached.cpp
src/FFConst.cpp
src/FFDihedrals.cpp
src/FFParticle.cpp
src/FFSetup.cpp
src/Forcefield.cpp
src/Geometry.cpp
src/HistOutput.cpp
src/InputFileReader.cpp
src/Main.cpp
src/MoleculeKind.cpp
src/MoleculeLookup.cpp
src/Molecules.cpp
src/MolSetup.cpp
src/MoveConst.cpp
src/MoveSettings.cpp
src/NoEwald.cpp
src/OutConst.cpp
src/OutputVars.cpp
src/PDBSetup.cpp
src/PDBOutput.cpp
src/PRNGSetup.cpp
src/PSFOutput.cpp
src/Reader.cpp
src/Simulation.cpp
src/StaticVals.cpp
src/System.cpp
src/cbmc/DCGraph.cpp
src/cbmc/DCFreeHedron.cpp
src/cbmc/DCLinkedHedron.cpp
src/cbmc/DCHedron.cpp
src/cbmc/DCLinear.cpp
src/cbmc/DCLink.cpp
src/cbmc/DCLinkNoDih.cpp
src/cbmc/DCOnSphere.cpp
src/cbmc/DCSingle.cpp
src/cbmc/TrialMol.cpp)

set(headers
src/BlockOutput.h
src/BoxDimensions.h
src/CalculateEnergy.h
src/CBMC.h
src/CellList.h
src/Clock.h
src/COM.h
src/ConfigSetup.h
src/ConsoleOutput.h
src/ConstField.h
src/Coordinates.h
src/CoordinateSetup.h
src/CPUSide.h
src/EnergyTypes.h
src/EnPartCntSampleOutput.h
src/EnsemblePreprocessor.h
src/Ewald.h
src/EwaldCached.h
src/FFAngles.h
src/FFBonds.h
src/FFConst.h
src/FFDihedrals.h
src/FFParticle.h
src/FFSetup.h
src/FFShift.h
src/FFSwitch.h
src/FFSwitchMartini.h
src/FixedWidthReader.h
src/Forcefield.h
src/FxdWidthWrtr.h
src/Geometry.h
src/HistOutput.h
src/InputAbstracts.h
src/InputFileReader.h
src/IntraSwap.h
src/MersenneTwister.h
src/MoleculeKind.h
src/MoleculeLookup.h
src/MoleculeTransfer.h
src/Molecules.h
src/MolPick.h
src/MolSetup.h
src/MoveBase.h
src/MoveConst.h
src/MoveSettings.h
src/NoEwald.h
src/OutConst.h
src/OutputAbstracts.h
src/OutputVars.h
src/PDBConst.h
src/PDBOutput.h
src/PDBSetup.h
src/PRNG.h
src/PRNGSetup.h
src/PSFOutput.h
src/Reader.h
src/SeedReader.h
src/Setup.h
src/SimEventFrequency.h
src/Simulation.h
src/StaticVals.h
src/SubdividedArray.h
src/System.h
src/TransformMatrix.h
src/Writer.h
src/XYZArray.h
src/cbmc/DCComponent.h
src/cbmc/DCData.h
src/cbmc/DCFreeHedron.h
src/cbmc/DCLinkedHedron.h
src/cbmc/DCGraph.h
src/cbmc/DCHedron.h
src/cbmc/DCLinear.h
src/cbmc/DCLink.h
src/cbmc/DCLinkNoDih.h
src/cbmc/DCOnSphere.h
src/cbmc/DCSingle.h
src/cbmc/TrialMol.h)

set(libHeaders
lib/BasicTypes.h
lib/BitLib.h
lib/GeomLib.h
lib/NumLib.h
lib/StrLib.h
lib/StrStrmLib.h
lib/VectorLib.h)

set(cudaHeaders
src/GPU/ConstantDefinitionsCUDAKernel.cuh
src/GPU/CalculateMinImageCUDAKernel.cuh
src/GPU/CalculateEnergyCUDAKernel.cuh
src/GPU/CalculateForceCUDAKernel.cuh
src/GPU/CalculateEwaldCUDAKernel.cuh
src/GPU/VariablesCUDA.cuh)

set(cudaSources
src/GPU/CalculateEnergyCUDAKernel.cu
src/GPU/CalculateForceCUDAKernel.cu
src/GPU/CalculateEwaldCUDAKernel.cu
src/GPU/ConstantDefinitionsCUDAKernel.cu)

source_group("Header Files" FILES ${headers})
source_group("Lib Headers" FILES ${libHeaders})
source_group("CUDA Header Files" FILES ${cudaHeaders})
source_group("CUDA Source Files" FILES ${cudaSources})
44 changes: 44 additions & 0 deletions CMake/GOMCCPUSetup.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
if(ENSEMBLE_NVT)
add_executable(NVT ${sources} ${headers} ${libHeaders})
set_target_properties(NVT PROPERTIES
OUTPUT_NAME ${NVT_name}
COMPILE_FLAGS "${NVT_flags}")
if(WIN32)
#needed for hostname
target_link_libraries(NVT ws2_32)
endif()
endif()

if(ENSEMBLE_GEMC)
add_executable(GEMC ${sources} ${headers} ${libHeaders})
set_target_properties(GEMC PROPERTIES
OUTPUT_NAME ${GE_name}
COMPILE_FLAGS "${GE_flags}")
if(WIN32)
#needed for hostname
target_link_libraries(GEMC ws2_32)
endif()
endif()

if(ENSEMBLE_GCMC)
add_executable(GCMC ${sources} ${headers} ${libHeaders})
set_target_properties(GCMC PROPERTIES
OUTPUT_NAME ${GC_name}
COMPILE_FLAGS "${GC_flags}")
if(WIN32)
#needed for hostname
target_link_libraries(GCMC ws2_32)
endif()
endif()

if(ENSEMBLE_NPT)
add_executable(NPT ${sources} ${headers} ${libHeaders})
set_target_properties(NPT PROPERTIES
OUTPUT_NAME ${NPT_name}
COMPILE_FLAGS "${NPT_flags}")
if(WIN32)
#needed for hostname
target_link_libraries(NPT ws2_32)
endif()
endif()

70 changes: 70 additions & 0 deletions CMake/GOMCCUDASetup.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Find CUDA is enabled, set it up

set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-DGOMC_CUDA)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-Wno-deprecated-gpu-targets)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-Xcompiler -std=c++98)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-Xcompiler -D__CORRECT_ISO_CPP11_MATH_H_PROTO)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-gencode arch=compute_20,code=sm_20)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-gencode arch=compute_20,code=sm_21)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-gencode arch=compute_30,code=sm_30)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-gencode arch=compute_35,code=sm_35)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-gencode arch=compute_50,code=sm_50)
include_directories(src/GPU)

set(GPU_NPT_flags "-DENSEMBLE=4 -DGOMC_CUDA")
set(GPU_NPT_name "GOMC_GPU_NPT")
set(GPU_GC_flags "-DENSEMBLE=3 -DGOMC_CUDA")
set(GPU_GC_name "GOMC_GPU_GCMC")
set(GPU_GE_flags "-DENSEMBLE=2 -DGOMC_CUDA")
set(GPU_GE_name "GOMC_GPU_GEMC")
set(GPU_NVT_flags "-DENSEMBLE=1 -DGOMC_CUDA")
set(GPU_NVT_name "GOMC_GPU_NVT")

#####################################
if(ENSEMBLE_GPU_NVT)
cuda_add_executable(GPU_NVT ${cudaSources} ${cudaHeaders}
${sources} ${headers} ${libHeaders})
set_target_properties(GPU_NVT PROPERTIES
OUTPUT_NAME ${GPU_NVT_name}
COMPILE_FLAGS "${GPU_NVT_flags}")
if(WIN32)
#needed for hostname
target_link_libraries(GPU_NVT ws2_32)
endif()
endif()

if(ENSEMBLE_GPU_GEMC)
cuda_add_executable(GPU_GEMC ${cudaSources} ${cudaHeaders} ${sources}
${headers} ${libHeaders})
set_target_properties(GPU_GEMC PROPERTIES
OUTPUT_NAME ${GPU_GE_name}
COMPILE_FLAGS "${GPU_GE_flags}")
if(WIN32)
#needed for hostname
target_link_libraries(GPU_GEMC ws2_32)
endif()
endif()

if(ENSEMBLE_GPU_GCMC)
cuda_add_executable(GPU_GCMC ${cudaSources} ${cudaHeaders} ${sources}
${headers} ${libHeaders})
set_target_properties(GPU_GCMC PROPERTIES
OUTPUT_NAME ${GPU_GC_name}
COMPILE_FLAGS "${GPU_GC_flags}")
if(WIN32)
#needed for hostname
target_link_libraries(GPU_GCMC ws2_32)
endif()
endif()

if(ENSEMBLE_GPU_NPT)
cuda_add_executable(GPU_NPT ${cudaSources} ${cudaHeaders} ${sources}
${headers} ${libHeaders})
set_target_properties(GPU_NPT PROPERTIES
OUTPUT_NAME ${GPU_NPT_name}
COMPILE_FLAGS "${GPU_NPT_flags}")
if(WIN32)
#needed for hostname
target_link_libraries(GPU_NPT ws2_32)
endif()
endif()
34 changes: 27 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ include_directories(src/cbmc)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})

#Versioning
set (GOMC_VERSION_MAJOR 1)
set (GOMC_VERSION_MINOR 17)
set (GOMC_VERSION_MAJOR 2)
set (GOMC_VERSION_MINOR 00)

IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Release CACHE STRING
Expand All @@ -22,6 +22,11 @@ ENDIF(NOT CMAKE_BUILD_TYPE)
set(ENSEMBLE_NVT ON CACHE BOOL "Build NVT version")
set(ENSEMBLE_GEMC ON CACHE BOOL "Build GEMC version")
set(ENSEMBLE_GCMC ON CACHE BOOL "Build GCMC version")
set(ENSEMBLE_NPT ON CACHE BOOL "Build NPT version")
set(ENSEMBLE_GPU_NVT ON CACHE BOOL "Build GPU NVT version")
set(ENSEMBLE_GPU_GEMC ON CACHE BOOL "Build GPU GEMC version")
set(ENSEMBLE_GPU_GCMC ON CACHE BOOL "Build GPU GCMC version")
set(ENSEMBLE_GPU_NPT ON CACHE BOOL "Build GPU NPT version")

#enable config header
configure_file(
Expand All @@ -42,18 +47,33 @@ elseif(MSVC)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "${CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT} /MT /Zi /O2 /Ob1 /D NDEBUG")
endif()

#EnsemblePreprocessor defines NVT = 1, GEMC = 2, GCMC = 3, NPT = 4

#NPT (Isothermal-Isobaric) Ensemble
set(NPT_flags "-DENSEMBLE=4")
set(NPT_name "GOMC_CPU_NPT")

#EnsemblePreprocessor defines NVT = 1, GEMC = 2, GCMC = 3
#Grand Canonical Monte Carlo
set(GC_flags "-DENSEMBLE=3")
set(GC_name "GOMC_Serial_GCMC")
set(GC_name "GOMC_CPU_GCMC")

#Gibbs Ensemble Monte Carlo
set(GE_flags "-DENSEMBLE=2")
set(GE_name "GOMC_Serial_GEMC")
set(GE_name "GOMC_CPU_GEMC")

#NVT (Canonical) Ensemble
set(NVT_flags "-DENSEMBLE=1")
set(NVT_name "GOMC_Serial_NVT")
set(NVT_name "GOMC_CPU_NVT")

# Set Source and Header files
include(${PROJECT_SOURCE_DIR}/CMake/FileLists.cmake)

# Setup Serial version
include(${PROJECT_SOURCE_DIR}/CMake/GOMCCPUSetup.cmake)

add_subdirectory(src)
# find CUDA and set it up
set(CUDA_SEPARABLE_COMPILATION ON)
find_package(CUDA)
IF(CUDA_FOUND)
include(${PROJECT_SOURCE_DIR}/CMake/GOMCCUDASetup.cmake)
ENDIF(CUDA_FOUND)
13 changes: 13 additions & 0 deletions lib/BasicTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,16 @@ struct XYZ
XYZ() : x(0.0), y(0.0), z(0.0) {}
XYZ(double xVal, double yVal, double zVal) : x(xVal), y(yVal), z(zVal) {}

XYZ& operator=(XYZ const& rhs)
{ x = rhs.x; y = rhs.y; z = rhs.z; return *this; }
XYZ& operator+=(XYZ const& rhs)
{ x += rhs.x; y += rhs.y; z += rhs.z; return *this; }
XYZ& operator-=(XYZ const& rhs)
{ x -= rhs.x; y -= rhs.y; z -= rhs.z; return *this; }
XYZ& operator*=(XYZ const& rhs)
{ x *= rhs.x; y *= rhs.y; z *= rhs.z; return *this; }
XYZ& operator/=(XYZ const& rhs)
{ x /= rhs.x; y /= rhs.y; z /= rhs.z; return *this; }

XYZ& operator*=(const double a)
{ x *= a; y *= a; z *= a; return *this; }
Expand All @@ -39,13 +43,22 @@ struct XYZ
{ return XYZ(*this) -= rhs; }
XYZ operator*(XYZ const& rhs) const
{ return XYZ(*this) *= rhs; }
XYZ operator/(XYZ const& rhs) const
{ return XYZ(*this) /= rhs; }


XYZ operator*(const double a) const
{ return XYZ(*this) *= a; }

XYZ operator-() const { return XYZ(*this) * -1.0; }

void Inverse()
{
x = 1.0 / x;
y = 1.0 / y;
z = 1.0 / z;
}

double Length() const { return sqrt(LengthSq()); }
double LengthSq() const { return x * x + y * y + z * z; }
XYZ& Normalize()
Expand Down
4 changes: 3 additions & 1 deletion lib/NumLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ along with this program, also can be found at <http://www.gnu.org/licenses/>.
#include <vector> //for vector average
#include "BasicTypes.h" //For uint, XYZ

#define DBL_MAX 1.7976931348623158e+308

namespace num
{
static const double dbl_margin = 0.00001;
static const double qqFact = 167000.00;
static const double BIGNUM = 10E40;
static const double BIGNUM = DBL_MAX;
static const uint VDW_STD_KIND = 0, VDW_SHIFT_KIND = 1, VDW_SWITCH_KIND = 2;

template <typename T>
Expand Down
Loading

0 comments on commit 5fc359b

Please sign in to comment.