diff --git a/.scripts/ci_build.sh b/.scripts/ci_build.sh index 67e64928c..1f5e9f777 100755 --- a/.scripts/ci_build.sh +++ b/.scripts/ci_build.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # The return code will capture an error from ANY of the functions in the pipe -set -o pipefail +set -euo pipefail cmake --build . -- --jobs=2 VERBOSE=1 | tee build.log | grep "Building" RESULT=$? diff --git a/.travis.yml b/.travis.yml index 47e47844f..22abd3eef 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,152 +20,49 @@ branches: matrix: include: - os: linux - compiler: clang + compiler: gcc addons: &1 apt: sources: - - llvm-toolchain-precise-3.5 - ubuntu-toolchain-r-test - boost-latest - george-edison55-precise-backports packages: - cmake - cmake-data - - clang-3.5 - - libboost1.55-all-dev - - gfortran - env: - - CXX_COMPILER='clang++-3.5' - - C_COMPILER='clang-3.5' - - Fortran_COMPILER='gfortran' - - BUILD_TYPE='release' - - PYTHON_VER='2.7' - - os: osx - osx_image: xcode7.3 - compiler: clang - env: - - CXX_COMPILER='clang++' - - C_COMPILER='clang' - - Fortran_COMPILER='gfortran-4.8' - - BUILD_TYPE='release' - - PYTHON_VER='2.7' - - HOMEBREW_GCC='homebrew/versions/gcc48' - - os: linux - compiler: clang - addons: &2 - apt: - sources: - - llvm-toolchain-precise-3.6 - - ubuntu-toolchain-r-test - - boost-latest - - george-edison55-precise-backports - packages: - - cmake - - cmake-data - - clang-3.6 + - g++-4.6 + - gcc-4.6 - libboost1.55-all-dev - - gfortran - env: - - CXX_COMPILER='clang++-3.6' - - C_COMPILER='clang-3.6' - - Fortran_COMPILER='gfortran' - - BUILD_TYPE='release' - - STATIC='--static' - - PYTHON_VER='3.5' - - os: osx - osx_image: xcode7.3 - compiler: gcc + - gfortran-4.6 env: - - CXX_COMPILER='g++-4.8' - - C_COMPILER='gcc-4.8' - - Fortran_COMPILER='gfortran-4.8' + - CXX_COMPILER='g++-4.6' + - C_COMPILER='gcc-4.6' + - Fortran_COMPILER='gfortran-4.6' - BUILD_TYPE='release' - PYTHON_VER='2.7' - - HOMEBREW_GCC='homebrew/versions/gcc48' - os: linux compiler: clang - addons: &3 + addons: apt: sources: - - llvm-toolchain-precise-3.7 + - llvm-toolchain-precise-3.5 - ubuntu-toolchain-r-test - boost-latest - george-edison55-precise-backports packages: - cmake - cmake-data - - clang-3.7 + - clang-3.5 - libboost1.55-all-dev - gfortran env: - - CXX_COMPILER='clang++-3.7' - - C_COMPILER='clang-3.7' + - CXX_COMPILER='clang++-3.5' + - C_COMPILER='clang-3.5' - Fortran_COMPILER='gfortran' - - PYTHON_VER='2.7' - - BUILD_TYPE='release' - - os: osx - osx_image: xcode7.3 - compiler: clang - env: - - CXX_COMPILER='clang++' - - C_COMPILER='clang' - - Fortran_COMPILER='gfortran-4.9' - BUILD_TYPE='release' - PYTHON_VER='3.5' - - HOMEBREW_GCC='homebrew/versions/gcc49' - STATIC='--static' - - os: linux - compiler: clang - addons: &4 - apt: - sources: - - llvm-toolchain-precise-3.8 - - ubuntu-toolchain-r-test - - boost-latest - - george-edison55-precise-backports - packages: - - cmake - - cmake-data - - clang-3.8 - - libboost1.55-all-dev - - gfortran - env: - - CXX_COMPILER='clang++-3.8' - - C_COMPILER='clang-3.8' - - Fortran_COMPILER='gfortran' - - BUILD_TYPE='release' - - PYTHON_VER='3.5' - - os: osx - osx_image: xcode7.3 - compiler: gcc - env: - - CXX_COMPILER='g++-4.9' - - C_COMPILER='gcc-4.9' - - Fortran_COMPILER='gfortran-4.9' - - BUILD_TYPE='release' - - PYTHON_VER='3.5' - - HOMEBREW_GCC='homebrew/versions/gcc49' - - os: linux - compiler: gcc - addons: &5 - apt: - sources: - - ubuntu-toolchain-r-test - - boost-latest - - george-edison55-precise-backports - packages: - - cmake - - cmake-data - - g++-4.6 - - gcc-4.6 - - libboost1.55-all-dev - - gfortran-4.6 - env: - - CXX_COMPILER='g++-4.6' - - C_COMPILER='gcc-4.6' - - Fortran_COMPILER='gfortran-4.6' - - BUILD_TYPE='release' - - PYTHON_VER='2.7' + - os: osx osx_image: xcode7.3 compiler: clang @@ -176,91 +73,7 @@ matrix: - BUILD_TYPE='release' - PYTHON_VER='2.7' - HOMEBREW_GCC='homebrew/versions/gcc5' - - os: linux - compiler: gcc - addons: &6 - apt: - sources: - - ubuntu-toolchain-r-test - - boost-latest - - george-edison55-precise-backports - packages: - - cmake - - cmake-data - - g++-4.7 - - gcc-4.7 - - libboost1.55-all-dev - - gfortran-4.7 - env: - - CXX_COMPILER='g++-4.7' - - C_COMPILER='gcc-4.7' - - Fortran_COMPILER='gfortran-4.7' - - BUILD_TYPE='release' - - STATIC='--static' - - PYTHON_VER='3.5' - - os: osx - osx_image: xcode7.3 - compiler: gcc - env: - - CXX_COMPILER='g++-5' - - C_COMPILER='gcc-5' - - Fortran_COMPILER='gfortran-5' - - BUILD_TYPE='release' - - PYTHON_VER='2.7' - - HOMEBREW_GCC='homebrew/versions/gcc5' - STATIC='--static' - - os: linux - compiler: gcc - addons: &7 - apt: - sources: - - ubuntu-toolchain-r-test - - boost-latest - - george-edison55-precise-backports - packages: - - cmake - - cmake-data - - g++-4.8 - - gcc-4.8 - - libboost1.55-all-dev - - gfortran-4.8 - env: - - CXX_COMPILER='g++-4.8' - - C_COMPILER='gcc-4.8' - - Fortran_COMPILER='gfortran-4.8' - - BUILD_TYPE='release' - - PYTHON_VER='2.7' - - os: osx - osx_image: xcode7.3 - compiler: clang - env: - - CXX_COMPILER='clang++' - - C_COMPILER='clang' - - Fortran_COMPILER='gfortran-6' - - BUILD_TYPE='release' - - PYTHON_VER='3.5' - - HOMEBREW_GCC='homebrew/versions/gcc6' - - os: linux - compiler: gcc - addons: &8 - apt: - sources: - - ubuntu-toolchain-r-test - - boost-latest - - george-edison55-precise-backports - packages: - - cmake - - cmake-data - - g++-4.9 - - gcc-4.9 - - libboost1.55-all-dev - - gfortran-4.9 - env: - - CXX_COMPILER='g++-4.9' - - C_COMPILER='gcc-4.9' - - Fortran_COMPILER='gfortran-4.9' - - BUILD_TYPE='release' - - PYTHON_VER='3.5' - os: osx osx_image: xcode7.3 compiler: gcc @@ -271,48 +84,28 @@ matrix: - BUILD_TYPE='release' - PYTHON_VER='3.5' - HOMEBREW_GCC='homebrew/versions/gcc6' + - os: linux compiler: gcc - addons: &9 - apt: - sources: - - ubuntu-toolchain-r-test - - boost-latest - - george-edison55-precise-backports - packages: - - cmake - - cmake-data - - g++-5 - - gcc-5 - - libboost1.55-all-dev - - gfortran-5 + addons: *1 env: - - CXX_COMPILER='g++-5' - - C_COMPILER='gcc-5' - - Fortran_COMPILER='gfortran-5' + - CXX_COMPILER='g++-4.6' + - C_COMPILER='gcc-4.6' + - Fortran_COMPILER='gfortran-4.6' - BUILD_TYPE='release' - PYTHON_VER='2.7' - - os: linux - compiler: gcc - addons: *9 - env: - - CXX_COMPILER='g++-5' - - C_COMPILER='gcc-5' - - Fortran_COMPILER='gfortran-5' - - BUILD_TYPE='release' - COVERAGE='--coverage' - - PYTHON_VER='2.7' allow_failures: - os: linux compiler: gcc - addons: *9 + addons: *1 env: - - CXX_COMPILER='g++-5' - - C_COMPILER='gcc-5' - - Fortran_COMPILER='gfortran-5' + - CXX_COMPILER='g++-4.6' + - C_COMPILER='gcc-4.6' + - Fortran_COMPILER='gfortran-4.6' - BUILD_TYPE='release' - - COVERAGE='--coverage' - PYTHON_VER='2.7' + - COVERAGE='--coverage' install: - | if [[ "${PYTHON_VER}" == "2.7" ]]; then @@ -342,17 +135,15 @@ before_script: - python -V - cmake --version - cd ${TRAVIS_BUILD_DIR} -- export CXX=${CXX_COMPILER} +- echo 'Build set up summary' - ${CXX_COMPILER} --version -- export CC=${C_COMPILER} - ${C_COMPILER} --version -- export FC=${Fortran_COMPILER} - ${Fortran_COMPILER} --version - python setup.py --cxx=${CXX_COMPILER} --cc=${C_COMPILER} --fc=${Fortran_COMPILER} --type=${BUILD_TYPE} --cmake-options='-Hprojects/CMake' ${STATIC} ${COVERAGE} - cd build - ../.scripts/ci_build.sh script: -- python ../.scripts/ci_test.py ctest --parallel 2 --output-on-failure --verbose --dashboard Experimental --track TravisCI +- python ../.scripts/ci_test.py ctest --output-on-failure --verbose - python ../.scripts/ci_print_failing.py after_success: - | diff --git a/README.md b/README.md index ced323dd8..2f8f4d673 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,6 @@ Continuous integration builds All CI builds are triggered by push events to any branch. Travis CI runs release builds using [ccache](https://ccache.samba.org/) to speed up compilation. -The outcome of the CI builds is deployed to the [build dashboard](https://testboard.org/cdash/index.php?project=PCMSolver) - Ubuntu 12.04 LTS 64-bit with CMake 3.3.2 and Boost 1.55.0 this is the environment offered by [Travis CI](https://travis-ci.org) pulling in various @@ -37,29 +36,21 @@ The outcome of the CI builds is deployed to the [build dashboard](https://testbo an environment defined in the `.pcmsolver-travis.yml` file. The following compilers are used: - 1. GCC 4.6, Python 2.7 - 2. GCC 4.7, Python 3.5 - 3. GCC 4.8, Python 2.7 - 4. GCC 4.9, Python 3.5 - 5. GCC 5.1, Python 2.7, with and without coverage analysis - 6. Clang 3.5, GFortran 4.6, Python 2.7 - 7. Clang 3.6, GFortran 4.6, Python 3.5 - 8. Clang 3.7, GFortran 4.6, Python 2.7 - 9. Clang 3.8, GFortran 4.6, Python 3.5 + 1. GCC 4.6, Python 2.7 This build generates _both_ the shared and static + libraries, linking executables to the former. The build is run with and + without coverage analysis. + 2. Clang 3.5, GFortran 4.6, Python 3.5 This build generates _only_ the static + library. - Mac OS X 10.11 with CMake 3.6.2 and Boost 1.61.0 this is the environment offered by [Travis CI](https://travis-ci.org) with their Xcode 7.3.1 image. The following compilers are used: - 1. Apple LLVM 7.3.0, GFortran 4.8.5, Python 2.7 - 2. GCC 4.8.5, Python 2.7 - 3. Apple LLVM 7.3.0, GFortran 4.9.3, Python 3.5 - 4. GCC 4.9.3, Python 3.5 - 5. Apple LLVM 7.3.0, GFortran 5.4.0, Python 2.7 - 6. GCC 5.4.0, Python 2.7 - 7. Apple LLVM 7.3.0, GFortran 6.2.0, Python 3.5 - 8. GCC 6.2.0, Python 3.5 + 1. Apple LLVM 7.3.0, GFortran 5.4.0, Python 2.7 This build generates _only_ + the static library. + 2. GCC 6.2.0, Python 3.5 This build generates _both_ the shared and static + libraries, linking executables to the former. The build needed for submission to [Coverity scan](https://scan.coverity.com/) is triggered by pushes to the `coverity_scan` branch. It is run on diff --git a/src/cavity/CavityData.hpp b/src/cavity/CavityData.hpp index cb605094b..9880c958d 100644 --- a/src/cavity/CavityData.hpp +++ b/src/cavity/CavityData.hpp @@ -45,20 +45,11 @@ struct CavityData { /*! The minimal distance between two sampling points on different spheres. Relevant * for TsLessCavity */ double minDistance; - /*! The maximum derivative order to be used in the definition of the smoothing - * function. Relevant for TsLessCavity */ - int derOrder; /*! Triggers the addition of spheres not centered on atoms, relevant for * GePolCavity */ double minimalRadius; - /*! Patch level, relevant for WaveletCavity */ - int patchLevel; - /*! Relevant for WaveletCavity */ - double coarsity; /*! Name of the .npz file containing the cavity specification for a restart */ std::string filename; - /*! Name of the text file with list of points for a wavelet cavityr restart */ - std::string dyadicFile; /*! Whether the structure was initialized with user input or not */ bool empty; @@ -67,22 +58,14 @@ struct CavityData { double _area, double _probeRadius, double _minDistance, - int _derOrder, double _minRadius, - int _patchLevel, - double _coarsity, - const std::string & _fname, - const std::string & _dyad) + const std::string & _fname) : molecule(_molec), area(_area), probeRadius(_probeRadius), minDistance(_minDistance), - derOrder(_derOrder), minimalRadius(_minRadius), - patchLevel(_patchLevel), - coarsity(_coarsity), - filename(_fname), - dyadicFile(_dyad) { + filename(_fname) { empty = false; } }; diff --git a/src/interface/Input.cpp b/src/interface/Input.cpp index d8c4a11bd..579274b41 100644 --- a/src/interface/Input.cpp +++ b/src/interface/Input.cpp @@ -73,14 +73,9 @@ void Input::reader(const std::string & filename) { type_ = cavity.getStr("TYPE"); area_ = cavity.getDbl("AREA"); - patchLevel_ = cavity.getInt("PATCHLEVEL"); - coarsity_ = cavity.getDbl("COARSITY"); - minDistance_ = cavity.getDbl("MINDISTANCE"); - derOrder_ = cavity.getInt("DERORDER"); if (type_ == "RESTART") { cavFilename_ = cavity.getStr("NPZFILE"); } - dyadicFilename_ = cavity.getStr("DYADICFILE"); scaling_ = cavity.getBool("SCALING"); radiiSet_ = boost::algorithm::to_upper_copy(cavity.getStr("RADIISET")); @@ -168,7 +163,6 @@ void Input::reader(const std::string & filename) { integratorScaling_ = medium.getDbl("DIAGONALSCALING"); solverType_ = medium.getStr("SOLVERTYPE"); - equationType_ = detail::integralEquation(medium.getStr("EQUATIONTYPE")); correction_ = medium.getDbl("CORRECTION"); hermitivitize_ = medium.getBool("MATRIXSYMM"); isDynamic_ = medium.getBool("NONEQUILIBRIUM"); @@ -215,10 +209,7 @@ void Input::reader(const PCMInput & host_input) { type_ = detail::trim_and_upper(host_input.cavity_type); area_ = host_input.area * angstrom2ToBohr2(); - patchLevel_ = host_input.patch_level; - coarsity_ = host_input.coarsity * angstromToBohr(); minDistance_ = host_input.min_distance * angstromToBohr(); - derOrder_ = host_input.der_order; if (type_ == "RESTART") { cavFilename_ = detail::trim(host_input.restart_name); // No case conversion here! } @@ -282,8 +273,6 @@ void Input::reader(const PCMInput & host_input) { integratorScaling_ = 1.07; solverType_ = detail::trim_and_upper(host_input.solver_type); - std::string inteq = detail::trim_and_upper(host_input.equation_type); - equationType_ = detail::integralEquation(inteq); correction_ = host_input.correction; hermitivitize_ = true; isDynamic_ = false; @@ -362,16 +351,8 @@ void Input::initMolecule() { } CavityData Input::cavityParams() const { - return CavityData(molecule_, - area_, - probeRadius_, - minDistance_, - derOrder_, - minimalRadius_, - patchLevel_, - coarsity_, - cavFilename_, - dyadicFilename_); + return CavityData( + molecule_, area_, probeRadius_, minDistance_, minimalRadius_, cavFilename_); } GreenData Input::insideGreenParams() const { @@ -409,7 +390,7 @@ GreenData Input::outsideDynamicGreenParams() const { } SolverData Input::solverParams() const { - return SolverData(correction_, equationType_, hermitivitize_); + return SolverData(correction_, hermitivitize_); } BIOperatorData Input::integratorParams() const { @@ -435,15 +416,6 @@ int profilePolicy(const std::string & name) { return mapStringToInt.find(name)->second; } -int integralEquation(const std::string & name) { - static std::map mapStringToInt; - mapStringToInt.insert(std::map::value_type("FIRSTKIND", 0)); - mapStringToInt.insert(std::map::value_type("SECONDKIND", 1)); - mapStringToInt.insert(std::map::value_type("FULL", 2)); - - return mapStringToInt.find(name)->second; -} - std::string trim(const char * src) { std::string tmp(src); boost::algorithm::trim(tmp); diff --git a/src/interface/Input.hpp b/src/interface/Input.hpp index 8390a1168..9e6f9e76e 100644 --- a/src/interface/Input.hpp +++ b/src/interface/Input.hpp @@ -88,6 +88,7 @@ class Input { /// Cavity section input std::string cavityType() const { return type_; } bool scaling() const { return scaling_; } + double cavityArea() const { return area_; } std::string radiiSet() const { return radiiSet_; } std::string radiiSetName() const { return radiiSetName_; } std::string mode() const { return mode_; } @@ -110,7 +111,6 @@ class Input { Solvent solvent() const { return solvent_; } bool fromSolvent() const { return hasSolvent_; } std::string solverType() const { return solverType_; } - int equationType() const { return equationType_; } double correction() const { return correction_; } bool hermitivitize() const { return hermitivitize_; } bool isDynamic() const { return isDynamic_; } @@ -175,18 +175,10 @@ class Input { std::string type_; /// Filename for the .npz cavity restart file std::string cavFilename_; - /// Filename for the wavelet cavity dyadic file - std::string dyadicFilename_; - /// Wavelet cavity patch level - int patchLevel_; - /// Wavelet cavity coarsity - double coarsity_; /// GePol and TsLess cavities average element area double area_; /// TsLess cavity minimal distance between sampling points double minDistance_; - /// TsLess cavity maximum derivative order of switch function - int derOrder_; /// Whether the radii should be scaled by 1.2 bool scaling_; /// The set of radii to be used @@ -211,8 +203,6 @@ class Input { bool hasSolvent_; /// The solver type std::string solverType_; - /// The integral equation type (wavelet solvers) - int equationType_; /// Correction factor (C-PCM) double correction_; /// Whether the PCM matrix should be hermitivitized (collocation solvers) @@ -287,10 +277,6 @@ int derivativeTraits(const std::string & name); */ int profilePolicy(const std::string & name); -/*! A useful map to convert the EquationType string to an integer which will be - * passed to the Solver CTOR. */ -int integralEquation(const std::string & name); - std::string trim(const char * src); std::string trim_and_upper(const char * src); diff --git a/src/utils/Sphere.cpp b/src/utils/Sphere.cpp index 78e879d11..7e4e30f09 100644 --- a/src/utils/Sphere.cpp +++ b/src/utils/Sphere.cpp @@ -33,13 +33,6 @@ namespace pcm { using utils::Sphere; -std::ostream & operator<<(std::ostream & os, Sphere & sph) { - os << "Sphere radius " << sph.radius << std::endl; - os << "Sphere center\n" << sph.center.transpose(); - - return os; -} - void transfer_spheres(const std::vector & spheres, Eigen::Matrix3Xd & sphereCenter, Eigen::VectorXd & sphereRadius) { diff --git a/src/utils/Sphere.hpp b/src/utils/Sphere.hpp index 9147f5e3c..beb1e4b49 100644 --- a/src/utils/Sphere.hpp +++ b/src/utils/Sphere.hpp @@ -51,11 +51,9 @@ struct Sphere { } Eigen::Vector3d center; double radius; - EIGEN_MAKE_ALIGNED_OPERATOR_NEW /* See - http://eigen.tuxfamily.org/dox/group__TopicStructHavingEigenMembers.html - */ - friend std::ostream & - operator<<(std::ostream & os, Sphere & sph) { + /* See http://eigen.tuxfamily.org/dox/group__TopicStructHavingEigenMembers.html */ + EIGEN_MAKE_ALIGNED_OPERATOR_NEW + friend std::ostream & operator<<(std::ostream & os, Sphere & sph) { os << "Sphere radius " << sph.radius << std::endl; os << "Sphere center " << sph.center.transpose(); diff --git a/tests/C_host/C_host-functions.h b/tests/C_host/C_host-functions.h index 6efb3e7f2..57e926845 100644 --- a/tests/C_host/C_host-functions.h +++ b/tests/C_host/C_host-functions.h @@ -53,6 +53,8 @@ typedef enum { false, true } bool; #define M_PI 3.14159265358979323846 +void host_writer(const char * message); + struct PCMInput pcmsolver_input(); /*! \brief calculates nuclear molecular electrostatic potential (MEP) at cavity diff --git a/tests/input/CMakeLists.txt b/tests/input/CMakeLists.txt index 5926579ef..664ca38cb 100644 --- a/tests/input/CMakeLists.txt +++ b/tests/input/CMakeLists.txt @@ -1,12 +1,10 @@ -add_library(input-tests OBJECT input_diffuse.cpp input_restart.cpp input_tsless.cpp input_wavelet.cpp input_multipoles.cpp) +add_library(input-tests OBJECT input_diffuse.cpp input_restart.cpp input_cpcm.cpp input_multipoles.cpp) if(BUILD_CUSTOM_BOOST) add_dependencies(input-tests custom_boost) endif() # Copy input files to ${PROJECT_BINARY_DIR}/tests/input (aka ${CMAKE_CURRENT_BINARY_DIR}) -file(COPY diffuse.inp restart.inp - tsless.inp wavelet.inp - multipoles.inp +file(COPY diffuse.inp restart.inp cpcm.inp multipoles.inp DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) add_test(NAME parser_script-diffuse COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_BINARY_DIR}/${PYMOD_INSTALL_FULLDIR}/pcmsolver.py diffuse.inp @@ -27,14 +25,9 @@ set_tests_properties(parser_script-restart PROPERTIES LABELS "parser;parser_scri add_Catch_test(input_restart "input;input_restart") set_tests_properties(input_restart PROPERTIES DEPENDS parser_script-restart) -add_test(NAME parser_script-tsless COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_BINARY_DIR}/${PYMOD_INSTALL_FULLDIR}/pcmsolver.py tsless.inp +add_test(NAME parser_script-cpcm COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_BINARY_DIR}/${PYMOD_INSTALL_FULLDIR}/pcmsolver.py cpcm.inp WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) -set_tests_properties(parser_script-tsless PROPERTIES LABELS "parser;parser_script" DEPENDS generate-pcmsolver-py) -add_Catch_test(input_tsless "input;input_tsless") -set_tests_properties(input_tsless PROPERTIES DEPENDS parser_script-tsless) +set_tests_properties(parser_script-cpcm PROPERTIES LABELS "parser;parser_script" DEPENDS generate-pcmsolver-py) +add_Catch_test(input_cpcm "input;input_cpcm") +set_tests_properties(input_cpcm PROPERTIES DEPENDS parser_script-cpcm) -add_test(NAME parser_script-wavelet COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_BINARY_DIR}/${PYMOD_INSTALL_FULLDIR}/pcmsolver.py wavelet.inp - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) -set_tests_properties(parser_script-wavelet PROPERTIES LABELS "parser;parser_script" DEPENDS generate-pcmsolver-py) -add_Catch_test(input_wavelet "input;input_wavelet") -set_tests_properties(input_wavelet PROPERTIES DEPENDS parser_script-wavelet) diff --git a/tests/input/tsless.inp b/tests/input/cpcm.inp similarity index 80% rename from tests/input/tsless.inp rename to tests/input/cpcm.inp index 7c7f5c140..bae143679 100644 --- a/tests/input/tsless.inp +++ b/tests/input/cpcm.inp @@ -11,13 +11,11 @@ MEDIUM CAVITY { - TYPE = TSLESS + TYPE = GEPOL AREA = 0.6 SCALING = False - MINDISTANCE = 5.0 - MINRADIUS = 0.1 + MINRADIUS = 0.3 RADIISET = UFF - DERORDER = 25 MODE = ATOMS ATOMS = [1, 2, 4] RADII = [1.4, 4.3, 1.2] diff --git a/tests/input/diffuse.inp b/tests/input/diffuse.inp index b734546e1..b29a07314 100644 --- a/tests/input/diffuse.inp +++ b/tests/input/diffuse.inp @@ -3,10 +3,9 @@ CODATA = 1998 MEDIUM { - SOLVERTYPE = WAVELET - EQUATIONTYPE = FIRSTKIND - PROBERADIUS = 1.385 + SOLVERTYPE = IEFPCM SOLVENT = EXPLICIT + PROBERADIUS = 1.5 GREEN { TYPE=VACUUM @@ -27,10 +26,10 @@ MEDIUM CAVITY { - TYPE = WAVELET - DYADICFILE = benzene2.dat - PATCHLEVEL = 1 - COARSITY = 0.3 + TYPE = GEPOL + AREA = 0.3 + SCALING = True + RADIISET = BONDI MODE = EXPLICIT SPHERES = [ 0.00, 0.00, 0.00, 1.80, 0.00, -0.96, 0.00, 1.44, diff --git a/tests/input/input_tsless.cpp b/tests/input/input_cpcm.cpp similarity index 92% rename from tests/input/input_tsless.cpp rename to tests/input/input_cpcm.cpp index 257fef6cd..89bda0260 100644 --- a/tests/input/input_tsless.cpp +++ b/tests/input/input_cpcm.cpp @@ -48,14 +48,12 @@ TEST_CASE("Input reading using GetKw for an input file for a TsLess cavity", Input parsedInput = Input(filename); std::string units = "ANGSTROM"; int CODATAyear = 2002; - std::string type = "TSLESS"; + std::string type = "GEPOL"; double area = 0.6 * angstrom2ToBohr2(); - double minDistance = 5.0 * angstromToBohr(); - int derOrder = 25; bool scaling = false; double diagonalScaling = 1.0694; std::string radiiSet = "UFF"; - double minimalRadius = 0.1 * angstromToBohr(); + double minimalRadius = 0.3 * angstromToBohr(); std::string mode = "ATOMS"; std::vector atoms; std::vector radii; @@ -79,8 +77,6 @@ TEST_CASE("Input reading using GetKw for an input file for a TsLess cavity", REQUIRE(CODATAyear == parsedInput.CODATAyear()); REQUIRE(type == parsedInput.cavityType()); REQUIRE(area == Approx(parsedInput.cavityParams().area)); - REQUIRE(minDistance == Approx(parsedInput.cavityParams().minDistance)); - REQUIRE(derOrder == parsedInput.cavityParams().derOrder); REQUIRE(scaling == parsedInput.scaling()); REQUIRE(diagonalScaling == Approx(parsedInput.integratorScaling())); REQUIRE(radiiSet == parsedInput.radiiSet()); diff --git a/tests/input/input_diffuse.cpp b/tests/input/input_diffuse.cpp index c88ba9dce..61d0fcea0 100644 --- a/tests/input/input_diffuse.cpp +++ b/tests/input/input_diffuse.cpp @@ -49,9 +49,8 @@ TEST_CASE("Input reading using GetKw for an input file for a diffuse environment Input parsedInput = Input(filename); std::string units = "ANGSTROM"; int CODATAyear = 1998; - std::string type = "WAVELET"; - int patchLevel = 1; - double coarsity = 0.3; + std::string type = "GEPOL"; + double area = 0.3 * angstromToBohr() * angstromToBohr(); bool scaling = true; double diagonalScaling = 1.07; std::string radiiSet = "BONDI"; @@ -69,9 +68,8 @@ TEST_CASE("Input reading using GetKw for an input file for a diffuse environment spheres.push_back(sph1); spheres.push_back(sph2); spheres.push_back(sph3); - std::string solverType = "WAVELET"; - int equationType = 0; - double probeRadius = 1.385 * angstromToBohr(); // The value for water + std::string solverType = "IEFPCM"; + double probeRadius = 1.5 * angstromToBohr(); std::string greenInsideType = "VACUUM"; std::string greenOutsideType = "SPHERICALDIFFUSE"; int derivativeInsideType = 0; @@ -90,8 +88,7 @@ TEST_CASE("Input reading using GetKw for an input file for a diffuse environment REQUIRE(units == parsedInput.units()); REQUIRE(CODATAyear == parsedInput.CODATAyear()); REQUIRE(type == parsedInput.cavityType()); - REQUIRE(patchLevel == parsedInput.cavityParams().patchLevel); - REQUIRE(coarsity == Approx(parsedInput.cavityParams().coarsity)); + REQUIRE(area == Approx(parsedInput.cavityArea())); REQUIRE(scaling == parsedInput.scaling()); REQUIRE(radiiSet == parsedInput.radiiSet()); REQUIRE(mode == parsedInput.mode()); @@ -103,7 +100,6 @@ TEST_CASE("Input reading using GetKw for an input file for a diffuse environment REQUIRE(spheres[i].radius == Approx(parsedInput.spheres(i).radius)); } REQUIRE(solverType == parsedInput.solverType()); - REQUIRE(equationType == parsedInput.equationType()); REQUIRE(probeRadius == Approx(parsedInput.cavityParams().probeRadius)); REQUIRE(greenInsideType == parsedInput.greenInsideType()); REQUIRE(greenOutsideType == parsedInput.greenOutsideType()); diff --git a/tests/input/input_restart.cpp b/tests/input/input_restart.cpp index 39b82f6b9..1ee9235bd 100644 --- a/tests/input/input_restart.cpp +++ b/tests/input/input_restart.cpp @@ -51,11 +51,7 @@ TEST_CASE("Input reading using GetKw for an input file for a restart cavity", int CODATAyear = 2010; std::string type = "RESTART"; std::string cavFilename = "cavity.npz"; - int patchLevel = 2; - double coarsity = 0.5; double area = 0.3; - double minDistance = 0.1; - int derOrder = 4; bool scaling = true; std::string radiiSet = "BONDI"; double minimalRadius = 100.0; @@ -63,7 +59,6 @@ TEST_CASE("Input reading using GetKw for an input file for a restart cavity", std::string mode = "IMPLICIT"; std::string solvent = "Water"; // Name in the Solvent object std::string solverType = "IEFPCM"; - int equationType = 1; double correction = 0.0; bool hermitivitize = true; double probeRadius = 1.385 * angstromToBohr(); // The value for water @@ -76,19 +71,14 @@ TEST_CASE("Input reading using GetKw for an input file for a restart cavity", REQUIRE(CODATAyear == parsedInput.CODATAyear()); REQUIRE(type == parsedInput.cavityType()); REQUIRE(cavFilename == parsedInput.cavityParams().filename); - REQUIRE(patchLevel == parsedInput.cavityParams().patchLevel); - REQUIRE(coarsity == Approx(parsedInput.cavityParams().coarsity)); REQUIRE(area == Approx(parsedInput.cavityParams().area)); - REQUIRE(minDistance == Approx(parsedInput.cavityParams().minDistance)); REQUIRE(diagonalScaling == Approx(parsedInput.integratorScaling())); - REQUIRE(derOrder == parsedInput.cavityParams().derOrder); REQUIRE(scaling == parsedInput.scaling()); REQUIRE(radiiSet == parsedInput.radiiSet()); REQUIRE(minimalRadius == Approx(parsedInput.cavityParams().minimalRadius)); REQUIRE(mode == parsedInput.mode()); REQUIRE(solvent == parsedInput.solvent().name); REQUIRE(solverType == parsedInput.solverType()); - REQUIRE(equationType == parsedInput.equationType()); REQUIRE(correction == Approx(parsedInput.correction())); REQUIRE(hermitivitize == parsedInput.hermitivitize()); REQUIRE(probeRadius == Approx(parsedInput.cavityParams().probeRadius)); diff --git a/tests/input/input_wavelet.cpp b/tests/input/input_wavelet.cpp deleted file mode 100644 index 46da04879..000000000 --- a/tests/input/input_wavelet.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/** - * PCMSolver, an API for the Polarizable Continuum Model - * Copyright (C) 2017 Roberto Di Remigio, Luca Frediani and collaborators. - * - * This file is part of PCMSolver. - * - * PCMSolver 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 3 of the License, or - * (at your option) any later version. - * - * PCMSolver 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 PCMSolver. If not, see . - * - * For information on the complete list of contributors to the - * PCMSolver API, see: - */ - -#include "catch.hpp" - -#include -#include -#include - -#include - -#include "bi_operators/BIOperatorData.hpp" -#include "cavity/CavityData.hpp" -#include "green/GreenData.hpp" -#include "solver/SolverData.hpp" -#include "interface/Input.hpp" -#include "utils/Sphere.hpp" - -using pcm::Input; -using pcm::utils::Sphere; - -/*! \class Input - * \test \b InputWaveletTest_Wavelet tests input reading on an input file parsed by - * pcmsolver.py - */ -TEST_CASE("Input reading using GetKw for an input file for a wavelet cavity", - "[input][input_wavelet]") { - std::string filename = "@wavelet.inp"; - Input parsedInput = Input(filename); - std::string units = "ANGSTROM"; - int CODATAyear = 1998; - std::string type = "WAVELET"; - int patchLevel = 1; - double coarsity = 0.3; - bool scaling = true; - double diagonalScaling = 1.07; - std::string radiiSet = "BONDI"; - std::string mode = "EXPLICIT"; - Eigen::Vector3d c1, c2, c3; - c1 << 0.00, 0.00, 0.00; - c2 << 0.00, -0.96, 0.00; - c3 << -0.905, 0.32, 0.00; - c2 *= angstromToBohr(); - c3 *= angstromToBohr(); - Sphere sph1(c1, 1.80 * angstromToBohr()); - Sphere sph2(c2, 1.44 * angstromToBohr()); - Sphere sph3(c3, 1.44 * angstromToBohr()); - std::vector spheres; - spheres.push_back(sph1); - spheres.push_back(sph2); - spheres.push_back(sph3); - std::string solverType = "WAVELET"; - int equationType = 0; - double probeRadius = 1.385 * angstromToBohr(); // The value for water - std::string greenInsideType = "VACUUM"; - std::string greenOutsideType = "UNIFORMDIELECTRIC"; - int derivativeInsideType = 0; - int derivativeOutsideType = 2; - double epsilonInside = 1.0; - double epsilonStaticOutside = 78.39; - double epsilonDynamicOutside = 10.423; - - REQUIRE(units == parsedInput.units()); - REQUIRE(CODATAyear == parsedInput.CODATAyear()); - REQUIRE(type == parsedInput.cavityType()); - REQUIRE(patchLevel == parsedInput.cavityParams().patchLevel); - REQUIRE(coarsity == Approx(parsedInput.cavityParams().coarsity)); - REQUIRE(scaling == parsedInput.scaling()); - REQUIRE(radiiSet == parsedInput.radiiSet()); - REQUIRE(mode == parsedInput.mode()); - REQUIRE(diagonalScaling == Approx(parsedInput.integratorScaling())); - for (size_t i = 0; i < spheres.size(); ++i) { - for (int j = 0; j < 3; ++j) { - REQUIRE(spheres[i].center(j) == Approx(parsedInput.spheres(i).center(j))); - } - REQUIRE(spheres[i].radius == Approx(parsedInput.spheres(i).radius)); - } - REQUIRE(solverType == parsedInput.solverType()); - REQUIRE(equationType == parsedInput.equationType()); - REQUIRE(probeRadius == Approx(parsedInput.cavityParams().probeRadius)); - REQUIRE(greenInsideType == parsedInput.greenInsideType()); - REQUIRE(greenOutsideType == parsedInput.greenOutsideType()); - REQUIRE(derivativeInsideType == parsedInput.insideGreenParams().howDerivative); - REQUIRE(derivativeOutsideType == - parsedInput.outsideStaticGreenParams().howDerivative); - REQUIRE(epsilonInside == Approx(parsedInput.insideGreenParams().epsilon)); - REQUIRE(epsilonStaticOutside == - Approx(parsedInput.outsideStaticGreenParams().epsilon)); - REQUIRE(epsilonDynamicOutside == - Approx(parsedInput.outsideDynamicGreenParams().epsilon)); -} diff --git a/tests/input/wavelet.inp b/tests/input/wavelet.inp deleted file mode 100644 index 0da6c65a3..000000000 --- a/tests/input/wavelet.inp +++ /dev/null @@ -1,33 +0,0 @@ -UNITS = ANGSTROM -CODATA = 1998 -MEDIUM -{ - - SOLVERTYPE = WAVELET - EQUATIONTYPE = FIRSTKIND - PROBERADIUS = 1.385 - SOLVENT = EXPLICIT - GREEN - { - TYPE=VACUUM - DER = NUMERICAL - } - GREEN - { - TYPE = UNIFORMDIELECTRIC - EPS = 78.39 - EPSDYN = 10.423 - DER = GRADIENT - } -} - -CAVITY -{ - TYPE = WAVELET - PATCHLEVEL = 1 - COARSITY = 0.3 - MODE = EXPLICIT - SPHERES = [ 0.00, 0.00, 0.00, 1.80, - 0.00, -0.96, 0.00, 1.44, - -0.905, 0.32, 0.00, 1.44] -} diff --git a/tools/pcmsolver.py.in b/tools/pcmsolver.py.in index dec928248..00190d9af 100644 --- a/tools/pcmsolver.py.in +++ b/tools/pcmsolver.py.in @@ -121,9 +121,8 @@ def convert_to_upper_case(filename): # "restart" should not be touched, whereas the rest of the file # has to be put in uppercase. npz_file = re.compile('NPZFILE', re.IGNORECASE) - dyadic_file = re.compile('DYADICFILE', re.IGNORECASE) for line in contents: - if (npz_file.search(line)) or (dyadic_file.search(line)): + if (npz_file.search(line)): rst_split = re.split(r"=", line) rst_split = rst_split[0].upper() + ' = ' + rst_split[1] line = ''.join(rst_split) @@ -217,71 +216,47 @@ def setup_keywords(): # Cavity section cavity = getkw.Section('CAVITY', callback = verify_cavity) # Type of the cavity - # Valid values: GEPOL, WAVELET, TSLESS and RESTART + # Valid values: GEPOL and RESTART cavity.add_kw('TYPE', 'STR') # Name of the file containing data for restarting a cavity # Valid for: Restart cavity # Default: empty string cavity.add_kw('NPZFILE', 'STR', '') - # Name of the file containing the list of points for a wavelet cavity - # Valid for: Wavelet cavity - # Default: empty string - cavity.add_kw('DYADICFILE', 'STR', '') - # Patch level - # Valid for: Wavelet cavity - # Valid values: integer strictly greater than 0 - # Default: 2 - cavity.add_kw('PATCHLEVEL', 'INT', 2) - # Coarsity - # Valid for: Wavelet cavity - # Valid values: double in ]0.0, 1.0[ - # Default: 0.5 - cavity.add_kw('COARSITY', 'DBL', 0.5) # Average area (in au^2) - # Valid for: GePol and TsLess cavities - # Valid values: double strictly greater than 0.01 au^2 - # Default: 0.3 au^2 + # Valid for: GePol cavity + # Valid values: double strictly greater than 0.01 Angstrom^2 + # Default: 0.3 Angstrom^2 (later converted to 1.07132... au^2) cavity.add_kw('AREA', 'DBL', 0.3) - # Minimal distance between sampling points (in au) - # Valid for: TsLess cavity - # Valid values: double - # Default: 0.1 au - cavity.add_kw('MINDISTANCE', 'DBL', 0.1) - # Derivative order for the weight function - # Valid for: TsLess cavity - # Valid values: integer - # Default: 4 - cavity.add_kw('DERORDER', 'INT', 4) # Scaling of the atomic radii - # Valid for: GePol, Wavelet and TsLess + # Valid for: GePol # Valid values: boolean # Default: True cavity.add_kw('SCALING', 'BOOL', True) # Built-in radii set - # Valid for: GePol, Wavelet and TsLess + # Valid for: GePol # Valid values: BONDI, UFF or ALLINGER # Default: BONDI cavity.add_kw('RADIISET', 'STR', 'BONDI') # Minimal radius of added spheres (in au) - # Valid for: GePol and TsLess + # Valid for: GePol # Valid values: double greater than 0.4 au # Default: 100.0 au (no added spheres) cavity.add_kw('MINRADIUS', 'DBL', 100.0) # Spheres geometry creation mode - # Valid for: GePol, TsLess and Wavelet + # Valid for: GePol # Valid values: EXPLICIT, ATOMS or IMPLICIT # Default: IMPLICIT cavity.add_kw('MODE', 'STR', 'IMPLICIT') # List of atoms with custom radius - # Valid for: GePol, TsLess and Wavelet in MODE=ATOMS + # Valid for: GePol in MODE=ATOMS # Valid values: array of integers cavity.add_kw('ATOMS', 'INT_ARRAY') # List of custom radii - # Valid for: GePol, TsLess and Wavelet in MODE=ATOMS + # Valid for: GePol in MODE=ATOMS # Valid values: array of doubles cavity.add_kw('RADII', 'DBL_ARRAY') # List of spheres - # Valid for: GePol, TsLess and Wavelet in MODE=EXPLICIT + # Valid for: GePol in MODE=EXPLICIT # Valid values: array of doubles in format [x, y, z, R] cavity.add_kw('SPHERES', 'DBL_ARRAY', callback = verify_spheres) top.add_sect(cavity) @@ -289,22 +264,18 @@ def setup_keywords(): # Medium section medium = getkw.Section('MEDIUM', callback = verify_medium) # Type of solver - # Valid values: IEFPCM, CPCM, WAVELET or LINEAR + # Valid values: IEFPCM, CPCM medium.add_kw('SOLVERTYPE', 'STR', 'IEFPCM') # Whether nonequilibrium response is to be used - # Valid for: IEFPCM, CPCM, WAVELET or LINEAR + # Valid for: IEFPCM, CPCM # Valid values: boolean # Default: False medium.add_kw('NONEQUILIBRIUM', 'BOOL', False) # Solvent - # Valid for: IEFPCM, CPCM, Wavelet and PWL solvers + # Valid for: IEFPCM, CPCM # Valid values: string # Default: Explicit medium.add_kw('SOLVENT', 'STR', 'EXPLICIT') - # Type of integral equation - # Valid for: Wavelet and PWL - # Valid values: FIRSTKIND, SECONDKIND or FULL - medium.add_kw('EQUATIONTYPE', 'STR', 'SECONDKIND') # Symmetrization of the PCM matrix # Valid for: IEFPCM # Valid values: boolean @@ -327,25 +298,10 @@ def setup_keywords(): # Notes: values commonly used in the literature are 1.07 and 1.0694 medium.add_kw('DIAGONALSCALING', 'DBL', 1.07) # Radius of the solvent probe (in au) - # Valid for: IEFPCM, CPCM, Wavelet and PWL + # Valid for: IEFPCM, CPCM # Valid values: double in [0.1, 100.0] au # Default: 1.0 medium.add_kw('PROBERADIUS', 'DBL', 1.0) - # A priori compression parameter a - # Valid for: wavelet solvers - # Valid values: double greater than 1.0 - # Default: 1.25 - medium.add_kw('A', 'DBL', 1.25) - # A priori compression parameter d' - # Valid for: wavelet solvers - # Valid values: double greater than 1.0 - # Default: 1.25 (PWC) or 2.25 (PWL) - medium.add_kw('DPRIME', 'DBL', 0.0) - # A posteriori compression parameter b - # Valid for: wavelet solvers - # Valid values: double in ]0, 1[ - # Default: 0.001 - medium.add_kw('B', 'DBL', 0.001) top.add_sect(medium) # Green's function section @@ -483,7 +439,7 @@ def verify_top(section): sys.exit(1) def verify_cavity(section): - allowed = ('GEPOL', 'WAVELET', 'TSLESS', 'RESTART') + allowed = ('GEPOL', 'RESTART') type = section.get('TYPE') if (type.get() not in allowed): print(('Requested {} cavity is not among the allowed types: {}'.format(type, allowed))) @@ -495,9 +451,6 @@ def verify_cavity(section): convert_area_scalar(section['AREA']) if (section['MINRADIUS'].is_set()): convert_length_scalar(section['MINRADIUS']) - if (section['MINDISTANCE'].is_set()): - convert_length_scalar(section['MINDISTANCE']) - if (type.get() == 'GEPOL'): area = section.get('AREA') @@ -510,33 +463,6 @@ def verify_cavity(section): if ( mr < 0.4 ): print(('Requested minimal radius for added spheres too small: {}. Minimal value is: 0.4 au'.format(mr))) sys.exit(1) - elif (type.get() == 'WAVELET'): - key = section.get('PATCHLEVEL') - if (key.get() < 1): - print(('Invalid patch level requested: {}. Patch level must be greater than 0'.format(key.get()))) - sys.exit(1) - key = section.get('COARSITY') - if (key.get() < 0.0 or key.get() >= 1.0): - print(('Invalid coarsity requested: {}. Coarsity has to be within ]0, 1['.format(key.get()))) - sys.exit(1) - elif (type.get() == 'TSLESS'): - area = section.get('AREA') - a = area.get() - if (a < 0.01): - print(('Requested area value too small: {}. Minimal value is: 0.01 au^2'.format(a))) - sys.exit(1) - minDistance = section.get('MINDISTANCE') - md = minDistance.get() - # Insert a sanity check on minimal distance! - #if ( md < 0.4 ): - # print("Requested minimal distance between sampling points too small: {}. Minimal value is: 0.4 au".format(md)) - # sys.exit(1) - derOrder = section.get('DERORDER') - do = derOrder.get() - # Insert a check on derivative order - #if ( do > 4 ): - # print("Invalid derivative order requested: {}. Derivative order has to be within [1, 5]".format(md)) - # sys.exit(1) elif (type.get() == 'RESTART'): npzfile = section.get('NPZFILE') # Restart string is the filename, with extension, where the cavity specs were saved. @@ -623,35 +549,12 @@ def verify_medium(section): print('Probe radius has to be within [0.1,100] Atomic Units') sys.exit(1) - allowed_types = ('IEFPCM', 'CPCM', 'WAVELET', 'LINEAR') + allowed_types = ('IEFPCM', 'CPCM') key = section.get('SOLVERTYPE') val = key.get() if (val not in allowed_types): print(('Allowed types are: {}'.format(allowed_types))) sys.exit(1) - allowed_equations = ('FIRSTKIND', 'SECONDKIND', 'FULL') - key = section.get('EQUATIONTYPE') - val = key.get() - if (val not in allowed_equations): - print(('Allowed equations are: {}'.format(allowed_equations))) - sys.exit(1) - - a = section.get('A') - if (a.get() < 1.0): - print('A priori compression parameter a has to be greater than 1.0') - sys.exit(1) - dprime = section.get('DPRIME') - solver = section.get('SOLVERTYPE') - if (dprime.get() == 0.0): - if (solver.get() == 'WAVELET'): - dprime.set(1.25) - elif (solver.get() == 'LINEAR'): - dprime.set(2.25) - - b = section.get('B') - if (b.get() >= 1.0 and b.get() <= 0.0): - print('A posteriori compression parameter has to be in ]0.0, 1.0[') - sys.exit(1) def verify_green(section): allowed = ('VACUUM', 'UNIFORMDIELECTRIC', 'SPHERICALDIFFUSE', 'ALTERNATESPHERICALDIFFUSE', 'METALSPHERE', 'GREENSFUNCTIONSUM')