Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ script:
--prefix=$HOME/Software/pcmsolver
- cd build
- ../.ci/ci_build.sh
- travis_wait python ../.ci/ci_test.py ctest --output-on-failure --verbose --parallel 2
- travis_wait 40 python ../.ci/ci_test.py ctest --output-on-failure --verbose --parallel 2
- python ../.ci/ci_print_failing.py
after_success:
- |
Expand Down
2 changes: 2 additions & 0 deletions src/bin/run_pcm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <string>
Expand Down Expand Up @@ -88,6 +89,7 @@ int main(int argc, char * argv[]) {
TIMER_OFF("Computing ASC");
// Compute energy and print it out
pcmsolver_out << "Solvation energy = "
<< std::setprecision(std::numeric_limits<long double>::digits10)
<< context_.computePolarizationEnergy("MEP", "ASC") << std::endl;
pcmsolver_out << "DONE!" << std::endl;

Expand Down
57 changes: 57 additions & 0 deletions tests/benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Copy input files to ${PROJECT_BINARY_DIR}/tests/standalone (aka ${CMAKE_CURRENT_BINARY_DIR})
file(
COPY
standalone_bubble.pcm
standalone_water-in-oil.pcm
standalone_water-fake.pcm
DESTINATION
${CMAKE_CURRENT_BINARY_DIR}
)

add_test(
NAME
pcmsolver_standalone-bubble
COMMAND
${PYTHON_EXECUTABLE} ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/go_pcm.py
--exe=${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}
--inp=standalone_bubble.pcm
WORKING_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}
)
set_tests_properties(pcmsolver_standalone-bubble
PROPERTIES
LABELS "pcmsolver;standalone;bubble"
ENVIRONMENT PYTHONPATH=${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/${PYMOD_INSTALL_LIBDIR}:$ENV{PYTHONPATH}
)

add_test(
NAME
pcmsolver_standalone-water-in-oil
COMMAND
${PYTHON_EXECUTABLE} ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/go_pcm.py
--exe=${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}
--inp=standalone_water-in-oil.pcm
WORKING_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}
)
set_tests_properties(pcmsolver_standalone-water-in-oil
PROPERTIES
LABELS "pcmsolver;standalone;water-in-oil"
ENVIRONMENT PYTHONPATH=${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/${PYMOD_INSTALL_LIBDIR}:$ENV{PYTHONPATH}
)

add_test(
NAME
pcmsolver_standalone-water-fake
COMMAND
${PYTHON_EXECUTABLE} ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/go_pcm.py
--exe=${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}
--inp=standalone_water-fake.pcm
WORKING_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}
)
set_tests_properties(pcmsolver_standalone-water-fake
PROPERTIES
LABELS "pcmsolver;standalone;water-fake"
ENVIRONMENT PYTHONPATH=${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/${PYMOD_INSTALL_LIBDIR}:$ENV{PYTHONPATH}
)
36 changes: 36 additions & 0 deletions tests/benchmark/standalone_bubble.pcm
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
UNITS = ANGSTROM
CODATA = 1998
MEDIUM
{
PROBERADIUS = 1.385
SOLVENT = EXPLICIT
GREEN<INSIDE>
{
TYPE=VACUUM
DER = NUMERICAL
}
GREEN<OUTSIDE>
{
CENTER = 3.0
WIDTH = 1.0
TYPE = SPHERICALDIFFUSE
PROFILE = LOG
EPS1 = 1.
EPS2 = 80.
DER = NUMERICAL
INTERFACEORIGIN = [0.0, 0.0, 0.0]
MAXL = 30
}
}

MOLECULE
{
# X, Y, Z, Q
GEOMETRY = [0.0, 0.0, 0.0, 1.0]
}

CAVITY
{
TYPE = GEPOL
SPHERES = [ 0.00, 0.00, 0.00, 1.80]
}
36 changes: 36 additions & 0 deletions tests/benchmark/standalone_water-fake.pcm
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
UNITS = ANGSTROM
CODATA = 1998
MEDIUM
{
PROBERADIUS = 1.385
SOLVENT = EXPLICIT
GREEN<INSIDE>
{
TYPE=VACUUM
DER = NUMERICAL
}
GREEN<OUTSIDE>
{
CENTER = 3.0
WIDTH = 1.0
TYPE = SPHERICALDIFFUSE
PROFILE = LOG
EPS1 = 80.
EPS2 = 80.
DER = NUMERICAL
INTERFACEORIGIN = [0.0, 0.0, 0.0]
MAXL = 30
}
}

MOLECULE
{
# X, Y, Z, Q
GEOMETRY = [3.0, 0.0, 0.0, 1.0]
}

CAVITY
{
TYPE = GEPOL
SPHERES = [ 0.00, 0.00, 0.00, 1.80]
}
36 changes: 36 additions & 0 deletions tests/benchmark/standalone_water-in-oil.pcm
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
UNITS = ANGSTROM
CODATA = 1998
MEDIUM
{
PROBERADIUS = 1.385
SOLVENT = EXPLICIT
GREEN<INSIDE>
{
TYPE=VACUUM
DER = NUMERICAL
}
GREEN<OUTSIDE>
{
CENTER = 3.0
WIDTH = 1.0
TYPE = SPHERICALDIFFUSE
PROFILE = LOG
EPS1 = 80.
EPS2 = 2.
DER = NUMERICAL
INTERFACEORIGIN = [0.0, 0.0, 0.0]
MAXL = 30
}
}

MOLECULE
{
# X, Y, Z, Q
GEOMETRY = [6.0, 0.0, 0.0, 1.0]
}

CAVITY
{
TYPE = GEPOL
SPHERES = [ 0.00, 0.00, 0.00, 1.80]
}
12 changes: 8 additions & 4 deletions tests/bi_operators/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@ endif()

# Copy reference files to ${PROJECT_BINARY_DIR}/tests/bi_operators (aka ${CMAKE_CURRENT_BINARY_DIR})
list(APPEND reference_files
erfsphericaldiffuse_D_collocation.npy
erfsphericaldiffuse_S_collocation.npy
logsphericaldiffuse_D_collocation.npy
logsphericaldiffuse_S_collocation.npy
tanhsphericaldiffuse_D_collocation.npy
uniformdielectric_D_purisima.npy
vacuum_D_purisima.npy
tanhsphericaldiffuse_S_collocation.npy
uniformdielectric_S_collocation.npy
vacuum_S_collocation.npy
uniformdielectric_D_collocation.npy
uniformdielectric_D_purisima.npy
uniformdielectric_S_collocation.npy
vacuum_D_collocation.npy
vacuum_D_purisima.npy
vacuum_S_collocation.npy
)
file(COPY ${reference_files} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})

Expand Down
68 changes: 68 additions & 0 deletions tests/bi_operators/bi_operators_collocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@
#include "green/SphericalDiffuse.hpp"
#include "green/UniformDielectric.hpp"
#include "green/Vacuum.hpp"
#include "green/dielectric_profile/OneLayerErf.hpp"
#include "green/dielectric_profile/OneLayerTanh.hpp"
#include "utils/MathUtils.hpp"

using namespace pcm;
using bi_operators::Collocation;
using cavity::GePolCavity;
using dielectric_profile::OneLayerErf;
using dielectric_profile::OneLayerTanh;
using green::SphericalDiffuse;
using green::UniformDielectric;
Expand Down Expand Up @@ -116,6 +118,39 @@ SCENARIO("A collocation integrator with approximate diagonal elements",
}
}

/*! \class Collocation
* \test \b CollocationTest_logsphericaldiffuse tests the evaluation
* by collocation of the spherical diffuse matrix representations of S and D
*/
AND_WHEN("the spherical diffuse with a log profile Green's function is used") {
double epsilon1 = 2.0;
double epsilon2 = 80.0;
double width = 5.0;
double sphereRadius = 20.0;
SphericalDiffuse<> gf(
epsilon1, epsilon2, width, sphereRadius, Eigen::Vector3d::Zero(), 5);
THEN("the matrix elements of S are") {
results = op.computeS(cavity, gf);
reference =
cnpy::custom::npy_load<double>("logsphericaldiffuse_S_collocation.npy");
for (int i = 0; i < cavity.size(); ++i) {
for (int j = 0; j < cavity.size(); ++j) {
REQUIRE(reference(i, j) == Approx(results(i, j)));
}
}
}
AND_THEN("the matrix elements of D are") {
results = op.computeD(cavity, gf);
reference =
cnpy::custom::npy_load<double>("logsphericaldiffuse_D_collocation.npy");
for (int i = 0; i < cavity.size(); ++i) {
for (int j = 0; j < cavity.size(); ++j) {
REQUIRE(reference(i, j) == Approx(results(i, j)));
}
}
}
}

/*! \class Collocation
* \test \b CollocationTest_tanhsphericaldiffuse tests the evaluation
* by collocation of the spherical diffuse matrix representations of S and D
Expand Down Expand Up @@ -148,5 +183,38 @@ SCENARIO("A collocation integrator with approximate diagonal elements",
}
}
}

/*! \class Collocation
* \test \b CollocationTest_erfsphericaldiffuse tests the evaluation
* by collocation of the spherical diffuse matrix representations of S and D
*/
AND_WHEN("the spherical diffuse with a erf profile Green's function is used") {
double epsilon1 = 2.0;
double epsilon2 = 80.0;
double width = 5.0;
double sphereRadius = 20.0;
SphericalDiffuse<OneLayerErf> gf(
epsilon1, epsilon2, width, sphereRadius, Eigen::Vector3d::Zero(), 5);
THEN("the matrix elements of S are") {
results = op.computeS(cavity, gf);
reference =
cnpy::custom::npy_load<double>("erfsphericaldiffuse_S_collocation.npy");
for (int i = 0; i < cavity.size(); ++i) {
for (int j = 0; j < cavity.size(); ++j) {
REQUIRE(reference(i, j) == Approx(results(i, j)));
}
}
}
AND_THEN("the matrix elements of D are") {
results = op.computeD(cavity, gf);
reference =
cnpy::custom::npy_load<double>("erfsphericaldiffuse_D_collocation.npy");
for (int i = 0; i < cavity.size(); ++i) {
for (int j = 0; j < cavity.size(); ++j) {
REQUIRE(reference(i, j) == Approx(results(i, j)));
}
}
}
}
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified tests/bi_operators/tanhsphericaldiffuse_D_collocation.npy
Binary file not shown.
Binary file modified tests/bi_operators/tanhsphericaldiffuse_S_collocation.npy
Binary file not shown.
Binary file modified tests/bi_operators/uniformdielectric_D_collocation.npy
Binary file not shown.
Binary file modified tests/bi_operators/uniformdielectric_D_purisima.npy
Binary file not shown.
Binary file modified tests/bi_operators/uniformdielectric_S_collocation.npy
Binary file not shown.
Loading