From 617548d9d0b6a9b562b1bbf474d0cb541bd05879 Mon Sep 17 00:00:00 2001 From: Joe Jordan Date: Mon, 7 Jun 2021 09:16:35 +0000 Subject: [PATCH] Miscellaneous updates from nblib --- api/nblib/CMakeLists.txt | 11 ++++++ api/nblib/basicdefinitions.h | 5 --- api/nblib/interactions.h | 6 --- api/nblib/particletype.h | 6 +++ api/nblib/tests/testhelpers.cpp | 70 --------------------------------- api/nblib/vector.h | 1 - 6 files changed, 17 insertions(+), 82 deletions(-) delete mode 100644 api/nblib/tests/testhelpers.cpp diff --git a/api/nblib/CMakeLists.txt b/api/nblib/CMakeLists.txt index 90038702a7..6cbc8f9124 100644 --- a/api/nblib/CMakeLists.txt +++ b/api/nblib/CMakeLists.txt @@ -99,6 +99,16 @@ set_target_properties(nblib PROPERTIES LINKER_LANGUAGE CXX OUTPUT_NAME "nblib") +if (GMX_GPU_CUDA) + if(${CMAKE_VERSION} VERSION_LESS "3.17.0") + find_package(CUDA) + target_include_directories(nblib PRIVATE "${CUDA_INCLUDE_DIRS}") + else() + find_package(CUDAToolkit) + target_link_libraries(nblib PRIVATE CUDA::cudart) + endif() +endif() + target_sources(nblib PRIVATE box.cpp @@ -118,6 +128,7 @@ target_sources(nblib gmx_target_compile_options(nblib) target_link_libraries(nblib PRIVATE libgromacs) +target_include_directories(nblib SYSTEM BEFORE PRIVATE ${PROJECT_SOURCE_DIR}/src/external/thread_mpi/include) target_include_directories(nblib PRIVATE ${PROJECT_SOURCE_DIR}/api) include_directories(BEFORE ${CMAKE_SOURCE_DIR}/api) target_link_libraries(nblib PRIVATE common) diff --git a/api/nblib/basicdefinitions.h b/api/nblib/basicdefinitions.h index ebb4d3f43d..88c0764aba 100644 --- a/api/nblib/basicdefinitions.h +++ b/api/nblib/basicdefinitions.h @@ -88,11 +88,6 @@ constexpr const int N_IVEC = (N_BOX_Z * N_BOX_Y * N_BOX_X); //! Needed for generating Bolzmann velocity distribution (kJ/(mol K)) constexpr const real BOLTZ = (detail::RGAS / detail::KILO); /* */ -#ifndef M_PI -//! Required work-around for platforms that don't implement POSIX-style cmath header -# define M_PI 3.14159265358979323846 -#endif - //! Charge multiplication factor for Coulomb interactions constexpr const real ONE_4PI_EPS0 = (1.0 / (4.0 * M_PI * detail::EPSILON0)); diff --git a/api/nblib/interactions.h b/api/nblib/interactions.h index fd563d0cd1..f9d77a9bc7 100644 --- a/api/nblib/interactions.h +++ b/api/nblib/interactions.h @@ -56,12 +56,6 @@ namespace nblib { -//! Shorthand for a map used for looking up non-bonded parameters using particle types -//! Named type for the C6 parameter in the Lennard-Jones potential -using C6 = StrongType; -//! Named type for the C12 parameter in the Lennard-Jones potential -using C12 = StrongType; - using NonBondedInteractionMapImpl = std::map, std::tuple>; diff --git a/api/nblib/particletype.h b/api/nblib/particletype.h index 2fd4127a51..f5d86bb39e 100644 --- a/api/nblib/particletype.h +++ b/api/nblib/particletype.h @@ -62,6 +62,12 @@ using ParticleTypeName = StrongType; +// Shorthand for a map used for looking up non-bonded parameters using particle types +//! Named type for the C6 parameter in the Lennard-Jones potential +using C6 = StrongType; +//! Named type for the C12 parameter in the Lennard-Jones potential +using C12 = StrongType; + /*! \brief Class that represents the particle type. * * The particle type is used in lookup tables for masses, non-bonded parameters, etc. diff --git a/api/nblib/tests/testhelpers.cpp b/api/nblib/tests/testhelpers.cpp deleted file mode 100644 index 0884a06d26..0000000000 --- a/api/nblib/tests/testhelpers.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * This file is part of the GROMACS molecular simulation package. - * - * Copyright (c) 2020, by the GROMACS development team, led by - * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, - * and including many others, as listed in the AUTHORS file in the - * top-level source directory and at http://www.gromacs.org. - * - * GROMACS is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 - * of the License, or (at your option) any later version. - * - * GROMACS is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with GROMACS; if not, see - * http://www.gnu.org/licenses, or write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * If you want to redistribute modifications to GROMACS, please - * consider that scientific software is very special. Version - * control is crucial - bugs must be traceable. We will be happy to - * consider code for inclusion in the official distribution, but - * derived work must not be called official GROMACS. Details are found - * in the README & COPYING files - if they are missing, get the - * official version at http://www.gromacs.org. - * - * To help us fund GROMACS development, we humbly ask that you cite - * the research papers on the package. Check out http://www.gromacs.org. - */ -/*! \internal \file - * \brief - * This implements basic nblib test systems - * - * \author Victor Holanda - * \author Joe Jordan - * \author Prashanth Kanduri - * \author Sebastian Keller - */ -#include "nblib/tests/testhelpers.h" - -namespace nblib -{ -namespace test -{ - -//! Compare between two instances of the Box object -bool operator==(const Box& a, const Box& b) -{ - if (a.legacyMatrix()[XX][XX] != b.legacyMatrix()[XX][XX]) - { - return false; - } - if (a.legacyMatrix()[YY][YY] != b.legacyMatrix()[YY][YY]) - { - return false; - } - if (a.legacyMatrix()[ZZ][ZZ] != b.legacyMatrix()[ZZ][ZZ]) - { - return false; - } - return true; -} - -} // namespace test -} // namespace nblib diff --git a/api/nblib/vector.h b/api/nblib/vector.h index eb32f4c075..8a23666292 100644 --- a/api/nblib/vector.h +++ b/api/nblib/vector.h @@ -45,7 +45,6 @@ #define NBLIB_BASICVECTOR_H #include "gromacs/math/vectypes.h" -#include "nblib/basicdefinitions.h" namespace nblib { -- 2.22.0