Add basic LJ potential*

- Add PairPotential Abstract class
- Add Lennard-Jones potential that should work with both CUDA and C++
  code
- Add tests on HOST side for LJ potential
This commit is contained in:
Alex Selimov 2025-04-17 16:07:26 -04:00
parent f15eb0cf51
commit 5155ec21aa
11 changed files with 114 additions and 154 deletions

View file

@ -8,9 +8,19 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Default settings
add_compile_options(-Wall -Wextra -Wpedantic)
add_compile_options($<$<COMPILE_LANGUAGE:CUDA>:-Wno-pedantic>)
# Add pedantic just for
set(CMAKE_CXX_STANDARD 17)
# Cuda Settings
set(CMAKE_CUDA_ARCHITECTURES 61)
set(CUDA_SEPARABLE_COMPILATION ON)
# Cuda settings to get correct compile_commands.json
set(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_INCLUDES 0)
set(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_LIBRARIES 0)
set(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_OBJECTS 0)
# Add Vec3 as a dependency
include(FetchContent)
@ -24,9 +34,9 @@ if(NOT Vec3_POPULATED)
include_directories(${Vec3_SOURCE_DIR})
endif()
include_directories(/usr/local/cuda-12.8/include)
include_directories(src)
include_directories(kernels)
include_directories(/usr/local/cuda-12.8/include)
add_subdirectory(src)
add_subdirectory(kernels)
@ -35,21 +45,19 @@ add_subdirectory(tests)
add_executable(${NAME} main.cpp)
install(DIRECTORY src/ DESTINATION src/)
target_link_libraries(
${NAME}
PRIVATE
${NAME}_lib
${NAME}_cuda_lib
${CUDA_LIBRARIES}
)
# Doxygen Build
option(BUILD_DOC "Build Documentation" ON)
option(BUILD_DOC "Build Documentation" OFF)
find_package(Doxygen)
if(DOXYGEN_FOUND)
if(DOXYGEN_FOUND AND BUILD_DOC)
set(BUILD_DOC_DIR ${CMAKE_SOURCE_DIR}/build/docs)
if(NOT EXISTS ${BUILD_DOC_DIR})
file(MAKE_DIRECTORY ${BUILD_DOC_DIR})
@ -65,6 +73,6 @@ if(DOXYGEN_FOUND)
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen"
VERBATIM)
else(DOXYGEN_FOUND)
else(DOXYGEN_FOUND AND BUILD_DOC)
message("Doxygen needs to be installed to generate the documentation.")
endif(DOXYGEN_FOUND)
endif(DOXYGEN_FOUND AND BUILD_DOC)