From c05f483a37e78c2f09188263a0f7c94f170121df Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Fri, 18 Aug 2017 19:30:58 +0200 Subject: [PATCH 01/31] Use 4 points in splineInterpolation We also check if we are either end of the sorted array of input parameters, so that we don't fall off of it when interpolating. --- src/utils/MathUtils.hpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/utils/MathUtils.hpp b/src/utils/MathUtils.hpp index 8b6aeae97..753bd4d13 100644 --- a/src/utils/MathUtils.hpp +++ b/src/utils/MathUtils.hpp @@ -294,14 +294,26 @@ inline double splineInterpolation(const double point, const std::vector & grid, const std::vector & function) { // Find nearest points on grid to the arbitrary point given - size_t index = std::distance(grid.begin(), - std::lower_bound(grid.begin(), grid.end(), point)) - - 1; + int index = + std::distance(grid.begin(), std::lower_bound(grid.begin(), grid.end(), point)); + + int imax = grid.size() - 1; + if (index <= 0) + index = 1; + if (index >= imax - 1) + index = imax - 2; // Parameters for the interpolating spline - Eigen::Vector3d x, y; - x << grid[index - 1], grid[index], grid[index + 1]; - y << function[index - 1], function[index], function[index + 1]; + Eigen::Vector4d x = (Eigen::Vector4d() << grid[index - 1], + grid[index], + grid[index + 1], + grid[index + 2]) + .finished(); + Eigen::Vector4d y = (Eigen::Vector4d() << function[index - 1], + function[index], + function[index + 1], + function[index + 2]) + .finished(); SplineFunction s(x, y); return s(point); From 20d36780a3c36f655b4a57b2850afaeb111ad64c Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Fri, 18 Aug 2017 19:32:11 +0200 Subject: [PATCH 02/31] Use Runge-Kutta-Fehlberg 7(8) integrator Runge-Kutta-Fehlberg 7(8) replaces the Bulirsch-Stoer integrator. RKF78 is non-adaptive and is cheaper than BS. It is possible to use more spherical harmonics in the expansion of the Green's function radial part. --- CHANGELOG.md | 2 ++ src/green/InterfacesImpl.hpp | 12 +++++----- src/green/SphericalDiffuse.cpp | 4 ++-- .../tanhsphericaldiffuse_D_collocation.npy | Bin 8272 -> 8272 bytes .../tanhsphericaldiffuse_S_collocation.npy | Bin 8272 -> 8272 bytes tests/green/green_spherical_diffuse.cpp | 22 +++++++++--------- tests/iefpcm/iefpcm_diffuse-gepol-point.cpp | 7 ++++-- 7 files changed, 26 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 06367eb91..566c46164 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,8 @@ - The uppercased contents of the `.pcm` input file are written to a temporary file, instead of overwriting the user provided file. The temporary file is removed after it has been parsed. Fixes #91 as noted by @ilfreddy. +- Use Runge-Kutta-Fehlberg 7(8) ODE solver to integrate the radial equation + in the spherical diffuse Green's function class. ### Fixed diff --git a/src/green/InterfacesImpl.hpp b/src/green/InterfacesImpl.hpp index 2e770d296..00506f558 100644 --- a/src/green/InterfacesImpl.hpp +++ b/src/green/InterfacesImpl.hpp @@ -225,15 +225,15 @@ template class Zeta __final { */ void compute(const ProfileEvaluator & eval, const IntegratorParameters & parms) { namespace odeint = boost::numeric::odeint; - odeint::bulirsch_stoer_dense_out stepper( - parms.eps_abs_, parms.eps_rel_, parms.factor_x_, parms.factor_dxdt_); + odeint::runge_kutta_fehlberg78 stepper; + ODESystem system(eval, L_); // Holds the initial conditions StateVariable init_zeta(2); // Set initial conditions init_zeta[0] = L_ * std::log(r_0_); init_zeta[1] = L_ / r_0_; - odeint::integrate_adaptive( + odeint::integrate_const( stepper, system, init_zeta, @@ -329,8 +329,8 @@ template class Omega __final { */ void compute(const ProfileEvaluator & eval, const IntegratorParameters & parms) { namespace odeint = boost::numeric::odeint; - odeint::bulirsch_stoer_dense_out stepper( - parms.eps_abs_, parms.eps_rel_, parms.factor_x_, parms.factor_dxdt_); + odeint::runge_kutta_fehlberg78 stepper; + ODESystem system(eval, L_); // Holds the initial conditions StateVariable init_omega(2); @@ -338,7 +338,7 @@ template class Omega __final { init_omega[0] = -(L_ + 1) * std::log(r_infinity_); init_omega[1] = -(L_ + 1) / r_infinity_; // Notice that we integrate BACKWARDS, so we pass -step to integrate_adaptive - boost::numeric::odeint::integrate_adaptive( + odeint::integrate_const( stepper, system, init_omega, diff --git a/src/green/SphericalDiffuse.cpp b/src/green/SphericalDiffuse.cpp index c07015208..7e474c106 100644 --- a/src/green/SphericalDiffuse.cpp +++ b/src/green/SphericalDiffuse.cpp @@ -272,10 +272,10 @@ void SphericalDiffuse::initSphericalDiffuse() { double eps_rel_ = 1.0e-06; /*! Relative tolerance level */ double factor_x_ = 0.0; /*! Weight of the state */ double factor_dxdt_ = 0.0; /*! Weight of the state derivative */ - double r_0_ = 0.5; /*! Lower bound of the integration interval */ + double r_0_ = 0.1; /*! Lower bound of the integration interval */ double r_infinity_ = this->profile_.center() + 200.0; /*! Upper bound of the integration interval */ - double observer_step_ = 1.0e-03; /*! Time step between observer calls */ + double observer_step_ = 1.0e-02; /*! Time step between observer calls */ IntegratorParameters params_(eps_abs_, eps_rel_, factor_x_, diff --git a/tests/bi_operators/tanhsphericaldiffuse_D_collocation.npy b/tests/bi_operators/tanhsphericaldiffuse_D_collocation.npy index 99ee729f6ac1284ec1d9c251b97be787463a06a1..2995dabc2a26bd05b04659110bea1c002341cbbc 100644 GIT binary patch literal 8272 zcmc)PO^B6s7zOajP2;$b2y_-1ccEOh5p|};q%OoDFvx6dN(b=+XG92^;g03Nkeav* z6r+Nug-+>|7+TEMcUG=igo_XoQbd?mxl^$qz4!k9iz6{h+dRA<&w0-|&vX8I?elGe zZ*AZ8T*n(7ll9?|@dJ(ehFX2o!Tx$rt$uK{ak#Pn!@Z-8;gKiz-)(#}^7!`nq5Wec zk1tpD_4d^IdRO(-KB@Vy>#vu#?OyTn&8q+8-4AvT|59rAtN-3uy>_;mdw=rG^LNfw z{nKlQW{&?*>b{AG1DglVSGPXhdH>kp)pGxG&mYy#?_I7Y7I$9y_}44d_N6mNj&`1_ zYHPl!jqdrb+Wgw0^QTW-s8;S+zj48}snV~{cd}pK*u55x{@*6wnOZnLQ*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S;z<8|L@_u!_VeV(&lA07Sn9IxvC13z?C`Z&y2#Vv1pqVi#$=3|d= z%Uk~D%!ht`bh2L`9sTyrdlk2Rupg@2@MaF?j5mGq$FH0`%ZFb%@W(%H`ufe=`Q*gs zJ$?7l$D29W6a1(m$U#_}8b(G4s=p6QAF4=X?CB9Prz7ys8}dz^nTH gJUfTmdp=d%zCZo?=w!b>I{NeXd~eV3s{TLx1B{`+d;kCd diff --git a/tests/green/green_spherical_diffuse.cpp b/tests/green/green_spherical_diffuse.cpp index ba55ea854..81480a5b2 100644 --- a/tests/green/green_spherical_diffuse.cpp +++ b/tests/green/green_spherical_diffuse.cpp @@ -43,7 +43,7 @@ using dielectric_profile::OneLayerTanh; SCENARIO("Evaluation of the spherical diffuse Green's function and its derivatives", "[green][green_spherical_diffuse]") { GIVEN("A permittivity profile modelled by the hyperbolic tangent function") { - int maxL = 3; + int maxL = 10; // High dielectric constant inside double eps1 = 80.0; // Low dielectric constant outside @@ -79,7 +79,7 @@ SCENARIO("Evaluation of the spherical diffuse Green's function and its derivativ REQUIRE(value == Approx(gf_value)); } AND_THEN("the value of the Green's function outside the droplet is") { - double value = 0.50004567416494572; + double value = 0.49987476890456245; double gf_value = gf.kernelS(source2, probe2); INFO("ref_value = " << std::setprecision( std::numeric_limits::digits10) @@ -103,7 +103,7 @@ SCENARIO("Evaluation of the spherical diffuse Green's function and its derivativ } AND_THEN("the value of the Green's function directional derivative wrt the " "probe point outside the droplet is") { - double derProbe = -0.29005549287308696; + double derProbe = -0.289952813654903441; double gf_derProbe = gf.derivativeProbe(probeNormal2, source2, probe2); INFO("ref_derProbe = " << std::setprecision(std::numeric_limits::digits10) @@ -127,7 +127,7 @@ SCENARIO("Evaluation of the spherical diffuse Green's function and its derivativ } AND_THEN("the value of the Green's function directional derivative wrt the " "source point outside the droplet is") { - double derSource = 0.28879776627577236; + double derSource = 0.288676184370117994; double gf_derSource = gf.derivativeSource(sourceNormal2, source2, probe2); INFO("ref_derSource = " << std::setprecision(std::numeric_limits::digits10) @@ -155,7 +155,7 @@ SCENARIO("Evaluation of the spherical diffuse Green's function and its derivativ REQUIRE(value == Approx(gf_value)); } AND_THEN("the value of the Green's function outside the droplet is") { - double value = 0.5000329900631173; + double value = 0.499902162204405809; double gf_value = gf.kernelS(source2, probe2); INFO("ref_value = " << std::setprecision( std::numeric_limits::digits10) @@ -179,7 +179,7 @@ SCENARIO("Evaluation of the spherical diffuse Green's function and its derivativ } AND_THEN("the value of the Green's function directional derivative wrt the " "probe point outside the droplet is") { - double derProbe = -0.289999709125188243; + double derProbe = -0.289953098676354326; double gf_derProbe = gf.derivativeProbe(probeNormal2, source2, probe2); INFO("ref_derProbe = " << std::setprecision(std::numeric_limits::digits10) @@ -203,7 +203,7 @@ SCENARIO("Evaluation of the spherical diffuse Green's function and its derivativ } AND_THEN("the value of the Green's function directional derivative wrt the " "source point outside the droplet is") { - double derSource = 0.288657584958107449; + double derSource = 0.288675899050294671; double gf_derSource = gf.derivativeSource(sourceNormal2, source2, probe2); INFO("ref_derSource = " << std::setprecision(std::numeric_limits::digits10) @@ -254,7 +254,7 @@ SCENARIO("Evaluation of the spherical diffuse Green's function and its derivativ REQUIRE(value == Approx(gf_value)); } AND_THEN("the value of the Green's function outside the droplet is") { - double value = 0.49991229576650942; + double value = 0.499874677668854961; double gf_value = gf.kernelS(source2, probe2); INFO("ref_value = " << std::setprecision( std::numeric_limits::digits10) @@ -278,7 +278,7 @@ SCENARIO("Evaluation of the spherical diffuse Green's function and its derivativ } AND_THEN("the value of the Green's function directional derivative wrt the " "probe point outside the droplet is") { - double derProbe = -0.28997553534915177; + double derProbe = -0.289951551978862021; double gf_derProbe = gf.derivativeProbe(probeNormal2, source2, probe2); INFO("ref_derProbe = " << std::setprecision(std::numeric_limits::digits10) @@ -302,7 +302,7 @@ SCENARIO("Evaluation of the spherical diffuse Green's function and its derivativ } AND_THEN("the value of the Green's function directional derivative wrt the " "source point outside the droplet is") { - double derSource = 0.28871292628573908; + double derSource = 0.288674990983894819; double gf_derSource = gf.derivativeSource(sourceNormal2, source2, probe2); INFO("ref_derSource = " << std::setprecision(std::numeric_limits::digits10) @@ -379,7 +379,7 @@ SCENARIO("Evaluation of the spherical diffuse Green's function and its derivativ } AND_THEN("the value of the Green's function directional derivative wrt the " "source point outside the droplet is") { - double derSource = 0.28869402146192158; + double derSource = 0.288675321960529807; double gf_derSource = gf.derivativeSource(sourceNormal2, source2, probe2); INFO("ref_derSource = " << std::setprecision(std::numeric_limits::digits10) diff --git a/tests/iefpcm/iefpcm_diffuse-gepol-point.cpp b/tests/iefpcm/iefpcm_diffuse-gepol-point.cpp index fb704a8a0..35ef935c1 100644 --- a/tests/iefpcm/iefpcm_diffuse-gepol-point.cpp +++ b/tests/iefpcm/iefpcm_diffuse-gepol-point.cpp @@ -74,7 +74,9 @@ SCENARIO("Test solver for the IEFPCM for a point charge in a spherical diffuse " double minRadius = 100.0; GePolCavity cavity(point, area, probeRadius, minRadius); - SphericalDiffuse<> gf_o(eps1, eps2, width, center, Eigen::Vector3d::Zero(), 3); + int maxL = 5; + SphericalDiffuse<> gf_o( + eps1, eps2, width, center, Eigen::Vector3d::Zero(), maxL); IEFSolver solver(symm); solver.buildSystemMatrix(cavity, gf_i, gf_o, op); int size = cavity.size(); @@ -105,7 +107,8 @@ SCENARIO("Test solver for the IEFPCM for a point charge in a spherical diffuse " double minRadius = 100.0; GePolCavity cavity(point, area, probeRadius, minRadius); - SphericalDiffuse<> gf_o(eps1, eps2, width, center, origin, 3); + int maxL = 5; + SphericalDiffuse<> gf_o(eps1, eps2, width, center, origin, maxL); IEFSolver solver(symm); solver.buildSystemMatrix(cavity, gf_i, gf_o, op); From e015e3ef71887bb8bdc124fe8ee6d845eafc8983 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Sat, 26 Aug 2017 14:14:26 +0200 Subject: [PATCH 03/31] Update gems for Danger --- .ci/Dangerfile | 4 +++- .ci/Gemfile | 2 +- .ci/Gemfile.lock | 7 ++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.ci/Dangerfile b/.ci/Dangerfile index ed4f63ea4..98b91d3a3 100644 --- a/.ci/Dangerfile +++ b/.ci/Dangerfile @@ -20,7 +20,9 @@ end commit_lint.check disable: [:subject_cap, :subject_period] # Check code style with clang-format -code_style_validation.check file_extensions: ['.hpp', '.cpp', '.h'], ignore_file_patterns: [/^external\//] +code_style_validation.check validator: 'clang-format-3.9', + file_extensions: ['.hpp', '.cpp', '.h'], + ignore_file_patterns: [/^external\//] # ------------------------------------------------------------------------------ # What changed? diff --git a/.ci/Gemfile b/.ci/Gemfile index 5a2c20523..4a89badb8 100644 --- a/.ci/Gemfile +++ b/.ci/Gemfile @@ -4,4 +4,4 @@ source "https://rubygems.org" gem "danger" gem "danger-commit_lint" gem "danger-lgtm" -gem 'danger-code_style_validation', '0.1.0' , :git => 'https://github.com/flix-tech/danger-code_style_validation.git' +gem 'danger-code_style_validation', :git => 'https://github.com/robertodr/danger-code_style_validation.git', :branch => 'pass-exe' diff --git a/.ci/Gemfile.lock b/.ci/Gemfile.lock index 53654267c..98a4d2107 100644 --- a/.ci/Gemfile.lock +++ b/.ci/Gemfile.lock @@ -1,6 +1,7 @@ GIT - remote: https://github.com/flix-tech/danger-code_style_validation.git - revision: 05925775fa1ba9cd3eda09437c8c7efba31ef59e + remote: https://github.com/robertodr/danger-code_style_validation.git + revision: 49cb68348ff8e5440cdeb3512f85a2c602a9db83 + branch: pass-exe specs: danger-code_style_validation (0.1.0) danger-plugin-api (~> 1.0) @@ -59,7 +60,7 @@ PLATFORMS DEPENDENCIES danger - danger-code_style_validation (= 0.1.0)! + danger-code_style_validation! danger-commit_lint danger-lgtm From 302a8a74e2249c52ff0511c6fd6760a33bd3c45a Mon Sep 17 00:00:00 2001 From: Luca Frediani Date: Thu, 12 Oct 2017 13:42:48 +0200 Subject: [PATCH 04/31] WIP: The spherical diffuse interface does not yield the expected results In particular, with a cavity inside a bubble, the result is identical to vacuum (no dielectric effect) I suspect this is connected to the removal of the L=0 component from the image part of the Green's function. Additional note: the integration of the radial part of the green's function can be significantly simplified by making heavilly use of the asymptotic solutions Moreover I believe that an additional change of variable would make the integration even faster, because, in a logarithmic scale all components are straight lines, except for a small deviation in the interfacial region. Maybe solving directly for Gimg could indeed help. --- src/green/GreensFunction.hpp | 5 ++- src/green/InterfacesImpl.hpp | 4 +-- src/green/SphericalDiffuse.cpp | 66 ++++++++++++++++------------------ src/green/SphericalDiffuse.hpp | 21 ++++++++++- src/interface/Meddle.cpp | 3 ++ src/interface/Meddle.hpp | 21 +++++++++++ src/solver/SolverImpl.cpp | 1 + 7 files changed, 82 insertions(+), 39 deletions(-) diff --git a/src/green/GreensFunction.hpp b/src/green/GreensFunction.hpp index 24c199bca..d63b60abc 100644 --- a/src/green/GreensFunction.hpp +++ b/src/green/GreensFunction.hpp @@ -147,12 +147,14 @@ class GreensFunction : public IGreensFunction { } protected: + /*! Evaluates the Green's function given a pair of points * \param[in] source the source point * \param[in] probe the probe point */ virtual DerivativeTraits operator()(DerivativeTraits * source, DerivativeTraits * probe) const = 0; + /*! Returns value of the kernel of the \f$\mathcal{S}\f$ integral operator, i.e. * the value of the Greens's function for the pair of points p1, p2: * \f$ G(\mathbf{p}_1, \mathbf{p}_2)\f$ @@ -171,8 +173,9 @@ class GreensFunction : public IGreensFunction { pp[0] = p2(0); pp[1] = p2(1); pp[2] = p2(2); - return this->operator()(sp, pp)[0]; + return this->operator()(sp, pp)[0]; } + virtual std::ostream & printObject(std::ostream & os) __override { os << "Green's Function" << std::endl; return os; diff --git a/src/green/InterfacesImpl.hpp b/src/green/InterfacesImpl.hpp index 00506f558..82d3b90a3 100644 --- a/src/green/InterfacesImpl.hpp +++ b/src/green/InterfacesImpl.hpp @@ -225,7 +225,7 @@ template class Zeta __final { */ void compute(const ProfileEvaluator & eval, const IntegratorParameters & parms) { namespace odeint = boost::numeric::odeint; - odeint::runge_kutta_fehlberg78 stepper; + odeint::runge_kutta4 stepper; ODESystem system(eval, L_); // Holds the initial conditions @@ -329,7 +329,7 @@ template class Omega __final { */ void compute(const ProfileEvaluator & eval, const IntegratorParameters & parms) { namespace odeint = boost::numeric::odeint; - odeint::runge_kutta_fehlberg78 stepper; + odeint::runge_kutta4 stepper; ODESystem system(eval, L_); // Holds the initial conditions diff --git a/src/green/SphericalDiffuse.cpp b/src/green/SphericalDiffuse.cpp index 7e474c106..86909266e 100644 --- a/src/green/SphericalDiffuse.cpp +++ b/src/green/SphericalDiffuse.cpp @@ -164,12 +164,14 @@ Stencil SphericalDiffuse::operator()(Stencil * sp, double Cr12 = this->coefficient_impl(source, probe); double gr12 = 0.0; - for (int L = 1; L <= maxLGreen_; ++L) { + for (int L = 0; L <= maxLGreen_; ++L) { gr12 += this->imagePotentialComponent_impl(L, source, probe, Cr12); } double r12 = (source - probe).norm(); - return (1.0 / (Cr12 * r12) + gr12); + double gf = (1.0 / (Cr12 * r12) + gr12); + // std::cout << "Source " << source.transpose() << " Probe " << probe.transpose() << " Tot " << gf << " Img " << gr12 << " Cr12 " << Cr12 << std::endl; + return gf; } template @@ -266,15 +268,14 @@ template void SphericalDiffuse::initSphericalDiffuse() { using namespace detail; - LOG("SphericalDiffuse::initSphericalDiffuse"); // Parameters for the numerical solution of the radial differential equation double eps_abs_ = 1.0e-10; /*! Absolute tolerance level */ double eps_rel_ = 1.0e-06; /*! Relative tolerance level */ double factor_x_ = 0.0; /*! Weight of the state */ double factor_dxdt_ = 0.0; /*! Weight of the state derivative */ - double r_0_ = 0.1; /*! Lower bound of the integration interval */ + double r_0_ = 0.3; /*! Lower bound of the integration interval */ double r_infinity_ = - this->profile_.center() + 200.0; /*! Upper bound of the integration interval */ + this->profile_.center() + 20.0; /*! Upper bound of the integration interval */ double observer_step_ = 1.0e-02; /*! Time step between observer calls */ IntegratorParameters params_(eps_abs_, eps_rel_, @@ -286,49 +287,45 @@ void SphericalDiffuse::initSphericalDiffuse() { ProfileEvaluator eval_ = pcm::bind(&ProfilePolicy::operator(), this->profile_, pcm::_1); - LOG("Computing coefficient for the separation of the Coulomb singularity"); - LOG("Computing first radial solution L = " + pcm::to_string(maxLC_)); - TIMER_ON("computeZeta for coefficient"); zetaC_ = RadialFunction( maxLC_, r_0_, r_infinity_, eval_, params_); - TIMER_OFF("computeZeta for coefficient"); - LOG("DONE: Computing first radial solution L = " + pcm::to_string(maxLC_)); - - LOG("Computing second radial solution L = " + pcm::to_string(maxLC_)); - TIMER_ON("computeOmega for coefficient"); omegaC_ = RadialFunction( maxLC_, r_0_, r_infinity_, eval_, params_); - TIMER_OFF("computeOmega for coefficient"); - LOG("Computing second radial solution L = " + pcm::to_string(maxLC_)); - LOG("DONE: Computing coefficient for the separation of the Coulomb singularity"); - - LOG("Computing radial solutions for Green's function"); - TIMER_ON("SphericalDiffuse: Looping over angular momentum"); zeta_.reserve(maxLGreen_ + 1); omega_.reserve(maxLGreen_ + 1); + // std::cout << " ZETA " << std::endl; for (int L = 0; L <= maxLGreen_; ++L) { - // First radial solution - LOG("Computing first radial solution L = " + pcm::to_string(L)); - TIMER_ON("computeZeta L = " + pcm::to_string(L)); - // Create an empty RadialSolution RadialFunction tmp_zeta_( L, r_0_, r_infinity_, eval_, params_); + // std::cout << tmp_zeta_ << std::endl << std::endl;; zeta_.push_back(tmp_zeta_); - TIMER_OFF("computeZeta L = " + pcm::to_string(L)); - LOG("DONE: Computing first radial solution L = " + pcm::to_string(L)); - - // Second radial solution - LOG("Computing second radial solution L = " + pcm::to_string(L)); - TIMER_ON("computeOmega L = " + pcm::to_string(L)); - // Create an empty RadialSolution + } + // std::cout << " OMEGA " << std::endl; + for (int L = 0; L <= maxLGreen_; ++L) { RadialFunction tmp_omega_( L, r_0_, r_infinity_, eval_, params_); + // std::cout << tmp_omega_ << std::endl << std::endl;; omega_.push_back(tmp_omega_); - TIMER_OFF("computeOmega L = " + pcm::to_string(L)); - LOG("DONE: Computing second radial solution L = " + pcm::to_string(L)); } - TIMER_OFF("SphericalDiffuse: Looping over angular momentum"); - LOG("DONE: Computing radial solutions for Green's function"); + + /* + Eigen::Vector3d sp, pp, step; + sp << 0.0, 0.0, 2.8; + pp << 0.0, 2.8, -5.0; + step << 0.0, 0.0, 0.1; + for (int i = 0; i < 101; i++) { + double cr12 = coefficient_impl(sp, pp); + double Gc = Coulomb(sp, pp); + double Gi = imagePotential(sp, pp); + double d = (sp - pp).norm(); + std::cout << pp(2) << " " << d << " " << cr12 << " " << Gc << " " << Gi << " " << Gi * d << std:: endl; + for (int L = 0; L <= maxLGreen_; ++L) { + double gr12L = imagePotentialComponent_impl(L, sp, pp, cr12); + std::cout << L << " " << gr12L << std::endl; + } + pp = pp + step; + } + */ } template @@ -387,7 +384,6 @@ double SphericalDiffuse::imagePotentialComponent_impl( } gr12 = (gr12 - f_L / (r1 * Cr12)) * pl_x; } - return gr12; } diff --git a/src/green/SphericalDiffuse.hpp b/src/green/SphericalDiffuse.hpp index d44c914d2..671234214 100644 --- a/src/green/SphericalDiffuse.hpp +++ b/src/green/SphericalDiffuse.hpp @@ -92,24 +92,28 @@ class SphericalDiffuse __final : public GreensFunction { friend std::ostream & operator<<(std::ostream & os, SphericalDiffuse & gf) { return gf.printObject(os); } + /*! \brief Returns Coulomb singularity separation coefficient * \param[in] source location of the source charge * \param[in] probe location of the probe charge */ double coefficientCoulomb(const Eigen::Vector3d & source, const Eigen::Vector3d & probe) const; + /*! \brief Returns singular part of the Green's function * \param[in] source location of the source charge * \param[in] probe location of the probe charge */ double Coulomb(const Eigen::Vector3d & source, const Eigen::Vector3d & probe) const; + /*! \brief Returns non-singular part of the Green's function (image potential) * \param[in] source location of the source charge * \param[in] probe location of the probe charge */ double imagePotential(const Eigen::Vector3d & source, const Eigen::Vector3d & probe) const; + /*! Returns value of the directional derivative of the * Coulomb singularity separation coefficient for the pair of points p1, p2: * \f$ \nabla_{\mathbf{p_2}}G(\mathbf{p}_1, \mathbf{p}_2)\cdot @@ -124,6 +128,7 @@ class SphericalDiffuse __final : public GreensFunction { double coefficientCoulombDerivative(const Eigen::Vector3d & direction, const Eigen::Vector3d & p1, const Eigen::Vector3d & p2) const; + /*! Returns value of the directional derivative of the * singular part of the Greens's function for the pair of points p1, p2: * \f$ \nabla_{\mathbf{p_2}}G(\mathbf{p}_1, \mathbf{p}_2)\cdot @@ -138,6 +143,7 @@ class SphericalDiffuse __final : public GreensFunction { double CoulombDerivative(const Eigen::Vector3d & direction, const Eigen::Vector3d & p1, const Eigen::Vector3d & p2) const; + /*! Returns value of the directional derivative of the * non-singular part (image potential) of the Greens's function for the pair of *points p1, p2: @@ -153,11 +159,13 @@ class SphericalDiffuse __final : public GreensFunction { double imagePotentialDerivative(const Eigen::Vector3d & direction, const Eigen::Vector3d & p1, const Eigen::Vector3d & p2) const; + /*! Handle to the dielectric profile evaluation */ pcm::tuple epsilon(const Eigen::Vector3d & point) const; void toFile(const std::string & prefix = ""); EIGEN_MAKE_ALIGNED_OPERATOR_NEW private: + /*! Evaluates the Green's function given a pair of points * \param[in] sp the source point * \param[in] pp the probe point @@ -165,6 +173,7 @@ class SphericalDiffuse __final : public GreensFunction { * \note This takes care of the origin shift */ virtual Stencil operator()(Stencil * sp, Stencil * pp) const __override; + /*! Returns value of the kernel of the \f$\mathcal{D}\f$ integral operator for the * pair of points p1, p2: * \f$ [\boldsymbol{\varepsilon}\nabla_{\mathbf{p_2}}G(\mathbf{p}_1, @@ -182,13 +191,17 @@ class SphericalDiffuse __final : public GreensFunction { const Eigen::Vector3d & p2) const __override; virtual KernelS exportKernelS_impl() const __override; + virtual KernelD exportKernelD_impl() const __override; + virtual DerivativeProbe exportDerivativeProbe_impl() const __override; virtual double singleLayer_impl(const Element & e, double factor) const __override; + virtual double doubleLayer_impl(const Element & e, double factor) const __override; virtual std::ostream & printObject(std::ostream & os) __override; + /*! Initializes a one-layer profile * \param[in] e1 left-side dielectric constant * \param[in] e2 right-side dielectric constant @@ -196,6 +209,7 @@ class SphericalDiffuse __final : public GreensFunction { * \param[in] c center of the diffuse layer */ void initProfilePolicy(double e1, double e2, double w, double c); + /*! This calculates all the components needed to evaluate the Green's function */ void initSphericalDiffuse(); @@ -207,16 +221,19 @@ class SphericalDiffuse __final : public GreensFunction { /*! Maximum angular momentum in the __final summation over Legendre polynomials to * obtain G */ int maxLGreen_; + /*! \brief First independent radial solution, used to build Green's function. * \note The vector has dimension maxLGreen_ and has r^l behavior */ std::vector > zeta_; + /*! \brief Second independent radial solution, used to build Green's function. * \note The vector has dimension maxLGreen_ and has r^(-l-1) behavior */ std::vector > omega_; + /*! \brief Returns L-th component of the radial part of the Green's function * \param[in] L angular momentum * \param[in] sp source point @@ -231,21 +248,23 @@ class SphericalDiffuse __final : public GreensFunction { const Eigen::Vector3d & pp, double Cr12) const; /*! @}*/ - /*! @{ Parameters and functions for the calculation of the Coulomb singularity * separation coefficient */ /*! Maximum angular momentum to obtain C(r, r'), needed to separate the Coulomb * singularity */ int maxLC_; // = 2 * maxLGreen_; + /*! \brief First independent radial solution, used to build coefficient. * \note This is needed to separate the Coulomb singularity and has r^l behavior */ RadialFunction zetaC_; + /*! \brief Second independent radial solution, used to build coefficient. * \note This is needed to separate the Coulomb singularity and has r^(-l-1) * behavior */ RadialFunction omegaC_; + /*! \brief Returns coefficient for the separation of the Coulomb singularity * \param[in] sp first point * \param[in] pp second point diff --git a/src/interface/Meddle.cpp b/src/interface/Meddle.cpp index 399befed2..7e4e4e9ca 100644 --- a/src/interface/Meddle.cpp +++ b/src/interface/Meddle.cpp @@ -89,6 +89,7 @@ void Meddle::CTORBody() { TIMER_ON("Meddle::initStaticSolver"); initStaticSolver(); + // exit(-1); TIMER_OFF("Meddle::initStaticSolver"); if (input_.isDynamic()) { @@ -188,6 +189,8 @@ double pcm::Meddle::computePolarizationEnergy(const char * mep_name, // Dot product of MEP and ASC surface function double energy = functions_[std::string(mep_name)].dot(functions_[std::string(asc_name)]); + std::cout << functions_[std::string(mep_name)] << std::endl; + std::cout << functions_[std::string(asc_name)] << std::endl; return (energy / 2.0); } diff --git a/src/interface/Meddle.hpp b/src/interface/Meddle.hpp index 7a0be6ebe..3a4e31027 100644 --- a/src/interface/Meddle.hpp +++ b/src/interface/Meddle.hpp @@ -71,6 +71,7 @@ void print(const PCMInput &); */ class Meddle __final { public: + /*! \brief CTOR from Input object * \param[in] input an Input object * \param[in] write the global HostWriter object @@ -78,6 +79,7 @@ class Meddle __final { * executable only */ Meddle(const Input & input, const HostWriter & write); + /*! \brief CTOR from own input reader * \param[in] inputFileName name of the parsed, machine-readable input file * \param[in] write the global HostWriter object @@ -85,6 +87,7 @@ class Meddle __final { * executable only */ Meddle(const std::string & inputFileName, const HostWriter & write); + /*! \brief Constructor * \param[in] input_reading input processing strategy * \param[in] nr_nuclei number of atoms in the molecule @@ -105,38 +108,46 @@ class Meddle __final { const PCMInput & host_input, const HostWriter & write); ~Meddle(); + /*! \brief Getter for the molecule object */ Molecule molecule() const attribute(pure); + /*! \brief Getter for the number of finite elements composing the molecular cavity * \return the size of the cavity */ PCMSolverIndex getCavitySize() const attribute(pure); + /*! \brief Getter for the number of irreducible finite elements composing the * molecular cavity * \return the number of irreducible finite elements */ PCMSolverIndex getIrreducibleCavitySize() const attribute(pure); + /*! \brief Getter for the centers of the finite elements composing the molecular * cavity * \param[out] centers array holding the coordinates of the finite elements * centers */ void getCenters(double centers[]) const; + /*! \brief Getter for the center of the i-th finite element * \param[in] its index of the finite element * \param[out] center array holding the coordinates of the finite element center */ void getCenter(int its, double center[]) const; + /*! \brief Getter for the centers of the finite elements composing the molecular * cavity * \return a matrix with the finite elements centers (dimensions 3 x number of * finite elements) */ Eigen::Matrix3Xd getCenters() const attribute(pure); + /*! \brief Getter for the areas/weights of the finite elements * \param[out] areas array holding the weights/areas of the finite elements */ void getAreas(double areas[]) const; + /*! \brief Computes ASC given a MEP and the desired irreducible representation * \param[in] mep_name label of the MEP surface function * \param[in] asc_name label of the ASC surface function @@ -146,6 +157,7 @@ class Meddle __final { * and computes the corresponding ASC. */ void computeASC(const char * mep_name, const char * asc_name, int irrep) const; + /*! \brief Computes response ASC given a MEP and the desired irreducible * representation * \param[in] mep_name label of the MEP surface function @@ -159,6 +171,7 @@ class Meddle __final { void computeResponseASC(const char * mep_name, const char * asc_name, int irrep) const; + /*! \brief Computes the polarization energy * \param[in] mep_name label of the MEP surface function * \param[in] asc_name label of the ASC surface function @@ -173,6 +186,7 @@ class Meddle __final { * \return the ASC dipole, i.e. \sqrt{\sum_i \mu_i^2} */ double getASCDipole(const char * asc_name, double dipole[]) const; + /*! \brief Retrieves data wrapped in a given surface function * \param[in] size the size of the surface function * \param[in] values the values wrapped in the surface function @@ -181,6 +195,7 @@ class Meddle __final { void getSurfaceFunction(PCMSolverIndex size, double values[], const char * name) const; + /*! \brief Sets a surface function given data and label * \param[in] size the size of the surface function * \param[in] values the values to be wrapped in the surface function @@ -189,14 +204,17 @@ class Meddle __final { void setSurfaceFunction(PCMSolverIndex size, double values[], const char * name) const; + /*! \brief Prints surface function contents to host output * \param[in] name label of the surface function */ void printSurfaceFunction(const char * name) const; + /*! \brief Dumps all currently saved surface functions to NumPy arrays in .npy * files */ void saveSurfaceFunctions() const; + /*! \brief Dumps a surface function to NumPy array in .npy file * \param[in] name label of the surface function * @@ -204,6 +222,7 @@ class Meddle __final { * **without** .npy extension */ void saveSurfaceFunction(const char * name) const; + /*! \brief Loads a surface function from a .npy file * \param[in] name label of the surface function * @@ -211,9 +230,11 @@ class Meddle __final { * **without** .npy extension */ void loadSurfaceFunction(const char * name) const; + /*! \brief Prints citation and set up information */ void printInfo() const; + /*! \brief Writes timing results for the API */ void writeTimings() const; diff --git a/src/solver/SolverImpl.cpp b/src/solver/SolverImpl.cpp index 6ef9e27b6..161bc7b33 100644 --- a/src/solver/SolverImpl.cpp +++ b/src/solver/SolverImpl.cpp @@ -51,6 +51,7 @@ Eigen::MatrixXd anisotropicTEpsilon(const ICavity & cav, TIMER_OFF("Computing DI"); TIMER_ON("Computing SE"); Eigen::MatrixXd SE = op.computeS(cav, gf_o); + // exit(-1); TIMER_OFF("Computing SE"); TIMER_ON("Computing DE"); Eigen::MatrixXd DE = op.computeD(cav, gf_o); From de90ed004d619eacfea4754958f03378148c0e19 Mon Sep 17 00:00:00 2001 From: Luca Frediani Date: Fri, 27 Oct 2017 13:51:52 +0200 Subject: [PATCH 05/31] Minor modification to the integration boundaries --- src/green/SphericalDiffuse.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/green/SphericalDiffuse.cpp b/src/green/SphericalDiffuse.cpp index 86909266e..cea3c0af0 100644 --- a/src/green/SphericalDiffuse.cpp +++ b/src/green/SphericalDiffuse.cpp @@ -273,9 +273,9 @@ void SphericalDiffuse::initSphericalDiffuse() { double eps_rel_ = 1.0e-06; /*! Relative tolerance level */ double factor_x_ = 0.0; /*! Weight of the state */ double factor_dxdt_ = 0.0; /*! Weight of the state derivative */ - double r_0_ = 0.3; /*! Lower bound of the integration interval */ + double r_0_ = 0.5; /*! Lower bound of the integration interval */ double r_infinity_ = - this->profile_.center() + 20.0; /*! Upper bound of the integration interval */ + this->profile_.center() + 30.0; /*! Upper bound of the integration interval */ double observer_step_ = 1.0e-02; /*! Time step between observer calls */ IntegratorParameters params_(eps_abs_, eps_rel_, From 3b84d22632bd6fb74e4fc2ca3f71b7fd94676462 Mon Sep 17 00:00:00 2001 From: Luca Frediani Date: Tue, 14 Nov 2017 11:31:10 +0100 Subject: [PATCH 06/31] WIP: double logarithmic scale for the resolution of the differential equations --- src/green/InterfacesImpl.hpp | 98 +++++++++++++++++----------------- src/green/SphericalDiffuse.cpp | 59 +++++++++----------- 2 files changed, 73 insertions(+), 84 deletions(-) diff --git a/src/green/InterfacesImpl.hpp b/src/green/InterfacesImpl.hpp index 82d3b90a3..cb59a0cb0 100644 --- a/src/green/InterfacesImpl.hpp +++ b/src/green/InterfacesImpl.hpp @@ -111,17 +111,16 @@ class LnTransformedRadial { * \param[out] drhodr state vector holding the first and second derivative * \param[in] r position on the integration grid */ - void operator()(const StateType & rho, StateType & drhodr, const double r) { + void operator()(const StateType & rho, StateType & drhodr, const double y) { // Evaluate the dielectric profile double eps = 0.0, epsPrime = 0.0; - pcm::tie(eps, epsPrime) = eval_(r); + pcm::tie(eps, epsPrime) = eval_(exp(y)); if (utils::numericalZero(eps)) throw std::domain_error("Division by zero!"); - double gamma_epsilon = epsPrime / eps; + double gamma_epsilon = exp(y) * epsPrime / eps; // System of equations is defined here drhodr[0] = rho[1]; - drhodr[1] = -rho[1] * (rho[1] + 2.0 / r + gamma_epsilon) + - l_ * (l_ + 1) / std::pow(r, 2); + drhodr[1] = -rho[1] * (rho[1] + 1.0 + gamma_epsilon) + l_ * (l_ + 1); } }; } // namespace detail @@ -145,13 +144,13 @@ class RadialFunction __final { public: RadialFunction() : solution_(IndependentSolution()) {} RadialFunction(int l, - double r0, - double rinf, + double y0, + double yinf, const ProfileEvaluator & eval, const IntegratorParameters & parms) : solution_(IndependentSolution(l, - r0, - rinf, + y0, + yinf, eval, parms)) {} ~RadialFunction() {} @@ -182,13 +181,13 @@ class RadialFunction __final { */ template class Zeta __final { public: - Zeta() : L_(0), r_0_(0.0), r_infinity_(0.0) {} + Zeta() : L_(0), y_0_(0.0), y_infinity_(0.0) {} Zeta(int l, - double r0, - double rinf, + double y0, + double yinf, const ProfileEvaluator & eval, const IntegratorParameters & parms) - : L_(l), r_0_(r0), r_infinity_(rinf) { + : L_(l), y_0_(y0), y_infinity_(yinf) { compute(eval, parms); } ~Zeta() {} @@ -208,14 +207,14 @@ template class Zeta __final { /// Angular momentum of the solution int L_; /// Lower bound of the integration interval - double r_0_; + double y_0_; /// Upper bound of the integration interval - double r_infinity_; + double y_infinity_; /// The actual data: grid, function value and first derivative values RadialSolution function_; /*! Reports progress of differential equation integrator */ - void push_back(const StateVariable & x, double r) { - function_[0].push_back(r); + void push_back(const StateVariable & x, double y) { + function_[0].push_back(y); function_[1].push_back(x[0]); function_[2].push_back(x[1]); } @@ -231,14 +230,14 @@ template class Zeta __final { // Holds the initial conditions StateVariable init_zeta(2); // Set initial conditions - init_zeta[0] = L_ * std::log(r_0_); - init_zeta[1] = L_ / r_0_; + init_zeta[0] = L_ * y_0_; + init_zeta[1] = L_; odeint::integrate_const( stepper, system, init_zeta, - r_0_, - r_infinity_, + y_0_, + y_infinity_, parms.observer_step_, pcm::bind( &Zeta::push_back, this, pcm::_1, pcm::_2)); @@ -246,28 +245,27 @@ template class Zeta __final { /*! \brief Returns value of function at given point * \param[in] point evaluation point * - * We first check if point is below r_0_, if yes we use - * the asymptotic form L*log(r) in point. + * We first check if point is below y_0_, if yes we use + * the asymptotic form L*y in point. */ double function_impl(double point) const { - double zeta = 0.0; - if (point <= r_0_) { - zeta = L_ * std::log(point); - } else { - zeta = utils::splineInterpolation(point, function_[0], function_[1]); - } - return zeta; + double zeta = 0.0; + if (point <= y_0_) { + zeta = L_ * point; + } else { + zeta = utils::splineInterpolation(point, function_[0], function_[1]); + } + return zeta; } /*! \brief Returns value of 1st derivative of function at given point * \param[in] point evaluation point * - * We first check if point is below r_0_, if yes we use - * the asymptotic form L / r in point. + * Below y_0_, the as asymptotic form L is used. Otherwise we interpolate. */ double derivative_impl(double point) const { double zeta = 0.0; - if (point <= r_0_) { - zeta = L_ / point; + if (point <= y_0_) { + zeta = L_; } else { zeta = utils::splineInterpolation(point, function_[0], function_[2]); } @@ -286,13 +284,13 @@ template class Zeta __final { */ template class Omega __final { public: - Omega() : L_(0), r_0_(0.0), r_infinity_(0.0) {} + Omega() : L_(0), y_0_(0.0), y_infinity_(0.0) {} Omega(int l, - double r0, - double rinf, + double y0, + double yinf, const ProfileEvaluator & eval, const IntegratorParameters & parms) - : L_(l), r_0_(r0), r_infinity_(rinf) { + : L_(l), y_0_(y0), y_infinity_(yinf) { compute(eval, parms); } ~Omega() {} @@ -312,14 +310,14 @@ template class Omega __final { /// Angular momentum of the solution int L_; /// Lower bound of the integration interval - double r_0_; + double y_0_; /// Upper bound of the integration interval - double r_infinity_; + double y_infinity_; /// The actual data: grid, function value and first derivative values RadialSolution function_; /*! Reports progress of differential equation integrator */ void push_back(const StateVariable & x, double r) { - function_[0].push_back(r); + function_[0].push_back(y); function_[1].push_back(x[0]); function_[2].push_back(x[1]); } @@ -335,15 +333,15 @@ template class Omega __final { // Holds the initial conditions StateVariable init_omega(2); // Set initial conditions - init_omega[0] = -(L_ + 1) * std::log(r_infinity_); - init_omega[1] = -(L_ + 1) / r_infinity_; + init_omega[0] = -(L_ + 1) * y_infinity_; + init_omega[1] = -(L_ + 1); // Notice that we integrate BACKWARDS, so we pass -step to integrate_adaptive odeint::integrate_const( stepper, system, init_omega, - r_infinity_, - r_0_, + y_infinity_, + y_0_, -parms.observer_step_, pcm::bind( &Omega::push_back, this, pcm::_1, pcm::_2)); @@ -358,12 +356,12 @@ template class Omega __final { * \param[in] point evaluation point * * We first check if point is above r_infinity_, if yes we use - * the asymptotic form -(L+1)*log(r) in point. + * the asymptotic form -(L+1)*y in point. */ double function_impl(double point) const { double omega = 0.0; - if (point >= r_infinity_) { - omega = -(L_ + 1) * std::log(point); + if (point >= y_infinity_) { + omega = -(L_ + 1) * point; } else { omega = utils::splineInterpolation(point, function_[0], function_[1]); } @@ -373,12 +371,12 @@ template class Omega __final { * \param[in] point evaluation point * * We first check if point is above r_infinity_, if yes we use - * the asymptotic form -(L+1)/r in point. + * the asymptotic form -(L+1) in point. */ double derivative_impl(double point) const { double omega = 0.0; if (point >= r_infinity_) { - omega = -(L_ + 1) / point; + omega = -(L_ + 1); } else { omega = utils::splineInterpolation(point, function_[0], function_[2]); } diff --git a/src/green/SphericalDiffuse.cpp b/src/green/SphericalDiffuse.cpp index cea3c0af0..575a9b386 100644 --- a/src/green/SphericalDiffuse.cpp +++ b/src/green/SphericalDiffuse.cpp @@ -276,56 +276,39 @@ void SphericalDiffuse::initSphericalDiffuse() { double r_0_ = 0.5; /*! Lower bound of the integration interval */ double r_infinity_ = this->profile_.center() + 30.0; /*! Upper bound of the integration interval */ - double observer_step_ = 1.0e-02; /*! Time step between observer calls */ + + double y_0_ = log(r_0_); + double y_infinity_ = log(r_infinity_); + double observer_step_ = 1.0e-2 * this->profile_.width / this->profile_.center(); /*! Time step between observer calls */ + + + IntegratorParameters params_(eps_abs_, eps_rel_, factor_x_, factor_dxdt_, - r_0_, - r_infinity_, + y_0_, + y_infinity_, observer_step_); ProfileEvaluator eval_ = pcm::bind(&ProfilePolicy::operator(), this->profile_, pcm::_1); zetaC_ = RadialFunction( - maxLC_, r_0_, r_infinity_, eval_, params_); + maxLC_, y_0_, y_infinity_, eval_, params_); omegaC_ = RadialFunction( - maxLC_, r_0_, r_infinity_, eval_, params_); + maxLC_, y_0_, y_infinity_, eval_, params_); zeta_.reserve(maxLGreen_ + 1); omega_.reserve(maxLGreen_ + 1); - // std::cout << " ZETA " << std::endl; for (int L = 0; L <= maxLGreen_; ++L) { RadialFunction tmp_zeta_( - L, r_0_, r_infinity_, eval_, params_); - // std::cout << tmp_zeta_ << std::endl << std::endl;; + L, y_0_, y_infinity_, eval_, params_); zeta_.push_back(tmp_zeta_); } - // std::cout << " OMEGA " << std::endl; for (int L = 0; L <= maxLGreen_; ++L) { RadialFunction tmp_omega_( - L, r_0_, r_infinity_, eval_, params_); - // std::cout << tmp_omega_ << std::endl << std::endl;; + L, y_0_, y_infinity_, eval_, params_); omega_.push_back(tmp_omega_); } - - /* - Eigen::Vector3d sp, pp, step; - sp << 0.0, 0.0, 2.8; - pp << 0.0, 2.8, -5.0; - step << 0.0, 0.0, 0.1; - for (int i = 0; i < 101; i++) { - double cr12 = coefficient_impl(sp, pp); - double Gc = Coulomb(sp, pp); - double Gi = imagePotential(sp, pp); - double d = (sp - pp).norm(); - std::cout << pp(2) << " " << d << " " << cr12 << " " << Gc << " " << Gi << " " << Gi * d << std:: endl; - for (int L = 0; L <= maxLGreen_; ++L) { - double gr12L = imagePotentialComponent_impl(L, sp, pp, cr12); - std::cout << L << " " << gr12L << std::endl; - } - pp = pp + step; - } - */ } template @@ -348,19 +331,27 @@ double SphericalDiffuse::imagePotentialComponent_impl( cos_gamma = -1.0; double pl_x = boost::math::legendre_p(L, cos_gamma); + /* Zeta and Omega are now on a logarithmic scale We need to pass the + arguments in the correct scale and then use the chain rule to get + the proper derivative */ + double y1 = log(r1); + double y2 = log(r2); + double dy1 = 1/r1; + double dy2 = 1/r2; + /* Sample zeta_[L] */ double zeta1 = 0.0, zeta2 = 0.0, d_zeta2 = 0.0; /* Value of zeta_[L] at point with index 1 */ - pcm::tie(zeta1, pcm::ignore) = zeta_[L](r1); + pcm::tie(zeta1, pcm::ignore) = zeta_[L](y1); /* Value of zeta_[L] and its first derivative at point with index 2 */ - pcm::tie(zeta2, d_zeta2) = zeta_[L](r2); + pcm::tie(zeta2, d_zeta2 * dy2) = zeta_[L](y2); /* Sample omega_[L] */ double omega1 = 0.0, omega2 = 0.0, d_omega2 = 0.0; /* Value of omega_[L] at point with index 1 */ - pcm::tie(omega1, pcm::ignore) = omega_[L](r1); + pcm::tie(omega1, pcm::ignore) = omega_[L](y1); /* Value of omega_[L] and its first derivative at point with index 2 */ - pcm::tie(omega2, d_omega2) = omega_[L](r2); + pcm::tie(omega2, d_omega2 * dy2) = omega_[L](y2); double eps_r2 = 0.0; pcm::tie(eps_r2, pcm::ignore) = this->profile_(pp_shift.norm()); From cb656a1e3c6c1ffa5cb5472024d5c9529df2a468 Mon Sep 17 00:00:00 2001 From: Luca Frediani Date: Tue, 14 Nov 2017 14:02:49 +0100 Subject: [PATCH 07/31] Emacs garbage files are now ignored --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 1ebd5bd69..a29cbad25 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,7 @@ # Autocmake stuff cmake/lib/*.pyc + +# Emacs backup files +*~ + From 75f19f05e9e652023c59a2e0c5d7df3a6773d284 Mon Sep 17 00:00:00 2001 From: Luca Frediani Date: Tue, 14 Nov 2017 14:03:58 +0100 Subject: [PATCH 08/31] Implemented logarithmic interface. Need some help to make sure we can use the class --- src/green/SphericalDiffuse.cpp | 3 + src/green/dielectric_profile/CMakeLists.txt | 2 +- src/green/dielectric_profile/OneLayerLog.hpp | 99 +++++++++++++++++++ src/green/dielectric_profile/ProfileTypes.hpp | 6 +- tools/pcmsolver.py.in | 4 +- 5 files changed, 110 insertions(+), 4 deletions(-) create mode 100644 src/green/dielectric_profile/OneLayerLog.hpp diff --git a/src/green/SphericalDiffuse.cpp b/src/green/SphericalDiffuse.cpp index 575a9b386..c4ef206ba 100644 --- a/src/green/SphericalDiffuse.cpp +++ b/src/green/SphericalDiffuse.cpp @@ -431,6 +431,9 @@ template class SphericalDiffuse; using dielectric_profile::OneLayerErf; template class SphericalDiffuse; +using dielectric_profile::OneLayerLog; +template class SphericalDiffuse; + IGreensFunction * createSphericalDiffuse(const GreenData & data) { detail::buildSphericalDiffuse build; return for_id( diff --git a/src/green/dielectric_profile/CMakeLists.txt b/src/green/dielectric_profile/CMakeLists.txt index 4abf423ab..d04b693a1 100644 --- a/src/green/dielectric_profile/CMakeLists.txt +++ b/src/green/dielectric_profile/CMakeLists.txt @@ -1,5 +1,5 @@ # List of headers -list(APPEND _headers_list Anisotropic.hpp MembraneTanh.hpp Metal.hpp OneLayerErf.hpp OneLayerTanh.hpp ProfileTypes.hpp Sharp.hpp Uniform.hpp Yukawa.hpp) +list(APPEND _headers_list Anisotropic.hpp MembraneTanh.hpp Metal.hpp OneLayerErf.hpp OneLayerTanh.hpp ProfileTypes.hpp Sharp.hpp Uniform.hpp Yukawa.hpp OneLayerLog.hpp) # Sets install directory for all the headers in the list foreach(_header ${_headers_list}) diff --git a/src/green/dielectric_profile/OneLayerLog.hpp b/src/green/dielectric_profile/OneLayerLog.hpp new file mode 100644 index 000000000..e71b25774 --- /dev/null +++ b/src/green/dielectric_profile/OneLayerLog.hpp @@ -0,0 +1,99 @@ +/** + * 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: + */ + +#pragma once + +#include +#include + +#include "Config.hpp" + +#include + +/*! \file OneLayerLog.hpp + * \class OneLayerLog + * \brief A dielectric profile based on the Harrison and Fosso-Tande work + * \author Luca Frediani + * \date 2017 + */ + +namespace pcm { +namespace dielectric_profile { +class OneLayerLog { +private: + /// Dielectric constant on the left of the interface + double epsilon1_; + /// Dielectric constant one the right of the interface + double epsilon2_; + /// Width of the transition layer + double width_; + /// Center of the transition layer + double center_; + /*! Returns value of dielectric profile at given point + * \param[in] point where to evaluate the profile + */ + double value(double point) const { + double epsLog = std::log(epsilon2/epsilon1); + double val = (1.0 + boost::math::erf(point - center_) / width_) / 2.0; + return std::eps1 * std::exp(epsLog * val); // epsilon(r) + } + /*! Returns value of derivative of dielectric profile at given point + * \param[in] point where to evaluate the derivative + */ + double derivative(double point) const { + double functionValue = value(point); + double epsLog = std::log(epsilon2/epsilon1); + double factor = epsLog / (width * std::sqrt(M_PI)); + double t = (point - center_) / width_; + double val = std::exp(-std::pow(t, 2)); + return functionValue * factor * val; // first derivative of epsilon(r) + } + std::ostream & printObject(std::ostream & os) { + os << "Profile functional form: erf" << std::endl; + os << "Permittivity left/inside = " << epsilon1_ << std::endl; + os << "Permittivity right/outside = " << epsilon2_ << std::endl; + os << "Profile width = " << width_ << " AU" << std::endl; + os << "Profile center = " << center_ << " AU"; + return os; + } + +public: + OneLayerErf() {} + OneLayerErf(double e1, double e2, double w, double c) + : epsilon1_(e1), epsilon2_(e2), width_(w / 6.0), center_(c) {} + /*! Returns a tuple holding the permittivity and its derivative + * \param[in] r evaluation point + */ + pcm::tuple operator()(const double r) const { + return pcm::make_tuple(value(r), derivative(r)); + } + double epsilon1() const { return epsilon1_; } + double epsilon2() const { return epsilon2_; } + double width() const { return width_; } + double center() const { return center_; } + friend std::ostream & operator<<(std::ostream & os, OneLayerErf & th) { + return th.printObject(os); + } +}; +} // namespace dielectric_profile +} // namespace pcm diff --git a/src/green/dielectric_profile/ProfileTypes.hpp b/src/green/dielectric_profile/ProfileTypes.hpp index 61b806bc2..67d752b84 100644 --- a/src/green/dielectric_profile/ProfileTypes.hpp +++ b/src/green/dielectric_profile/ProfileTypes.hpp @@ -33,6 +33,7 @@ #include "MembraneTanh.hpp" #include "Metal.hpp" #include "OneLayerErf.hpp" +#include "OneLayerLog.hpp" #include "OneLayerTanh.hpp" #include "Sharp.hpp" #include "Uniform.hpp" @@ -46,13 +47,14 @@ typedef boost::mpl::vector profile_types; /*! One-layer diffuse profile types */ -typedef boost::mpl::vector onelayer_diffuse_profile_types; + typedef boost::mpl::vector onelayer_diffuse_profile_types; /*! Two-layer (aka membrane-like) diffuse profile types */ typedef boost::mpl::vector membrane_diffuse_profile_types; @@ -68,6 +70,7 @@ class isUniform : public boost::static_visitor { bool operator()(const Anisotropic & /* arg */) const { return false; } bool operator()(const OneLayerTanh & /* arg */) const { return false; } bool operator()(const OneLayerErf & /* arg */) const { return false; } + bool operator()(const OneLayerLog & /* arg */) const { return false; } bool operator()(const MembraneTanh & /* arg */) const { return false; } bool operator()(const Metal & /* arg */) const { return false; } bool operator()(const Sharp & /* arg */) const { return false; } @@ -86,6 +89,7 @@ class epsilonValue : public boost::static_visitor { bool operator()(const Anisotropic & /* arg */) const { return false; } bool operator()(const OneLayerTanh & /* arg */) const { return false; } bool operator()(const OneLayerErf & /* arg */) const { return false; } + bool operator()(const OneLayerLog & /* arg */) const { return false; } bool operator()(const MembraneTanh & /* arg */) const { return false; } std::complex operator()(const Metal & arg) const { return arg.epsilon; } double operator()(const Sharp & arg) const { return arg.epsilon; } diff --git a/tools/pcmsolver.py.in b/tools/pcmsolver.py.in index 3568163db..bb5ba8ffd 100644 --- a/tools/pcmsolver.py.in +++ b/tools/pcmsolver.py.in @@ -405,7 +405,7 @@ def setup_keywords(): green.add_kw('SPHEREPOSITION', 'DBL_ARRAY', [0.0, 0.0, 0.0]) # Dielectric profile type # Valid for: SPHERICALDIFFUSE - # Valid values: TANH, ERF + # Valid values: TANH, ERF, LOG # Default: TANH green.add_kw('PROFILE', 'STR', 'TANH') # Static dielectric permittivity inside the interface @@ -676,7 +676,7 @@ def verify_green(section): allowed = ('VACUUM', 'UNIFORMDIELECTRIC', 'SPHERICALDIFFUSE', 'ALTERNATESPHERICALDIFFUSE', 'METALSPHERE', 'GREENSFUNCTIONSUM') allowed_der = ('NUMERICAL', 'DERIVATIVE', 'GRADIENT', 'HESSIAN') - allowed_profiles = ('TANH', 'ERF') + allowed_profiles = ('TANH', 'ERF', 'LOG') green1 = section.fetch_sect('GREEN') green2 = section.fetch_sect('GREEN') From 0aaab0928e2ea43319d2ae16ea78c0eab4664bf0 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Tue, 14 Nov 2017 15:33:54 +0100 Subject: [PATCH 09/31] Make OneLayerLog usable --- src/green/dielectric_profile/ProfileTypes.hpp | 3 ++- src/interface/Input.cpp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/green/dielectric_profile/ProfileTypes.hpp b/src/green/dielectric_profile/ProfileTypes.hpp index 67d752b84..488163581 100644 --- a/src/green/dielectric_profile/ProfileTypes.hpp +++ b/src/green/dielectric_profile/ProfileTypes.hpp @@ -54,7 +54,8 @@ typedef boost::mpl::vector onelayer_diffuse_profile_types; +typedef boost::mpl::vector + onelayer_diffuse_profile_types; /*! Two-layer (aka membrane-like) diffuse profile types */ typedef boost::mpl::vector membrane_diffuse_profile_types; diff --git a/src/interface/Input.cpp b/src/interface/Input.cpp index 6bc64909c..b728cb505 100644 --- a/src/interface/Input.cpp +++ b/src/interface/Input.cpp @@ -432,6 +432,7 @@ int profilePolicy(const std::string & name) { static std::map mapStringToInt; mapStringToInt.insert(std::map::value_type("TANH", 0)); mapStringToInt.insert(std::map::value_type("ERF", 1)); + mapStringToInt.insert(std::map::value_type("LOG", 2)); return mapStringToInt.find(name)->second; } From 342b52518e7fbe02d319011751824d593468eac6 Mon Sep 17 00:00:00 2001 From: Luca Frediani Date: Tue, 21 Nov 2017 11:57:40 +0100 Subject: [PATCH 10/31] Fixed cut&paste error --- src/green/dielectric_profile/OneLayerLog.hpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/green/dielectric_profile/OneLayerLog.hpp b/src/green/dielectric_profile/OneLayerLog.hpp index e71b25774..1ef6d7c69 100644 --- a/src/green/dielectric_profile/OneLayerLog.hpp +++ b/src/green/dielectric_profile/OneLayerLog.hpp @@ -53,17 +53,17 @@ class OneLayerLog { * \param[in] point where to evaluate the profile */ double value(double point) const { - double epsLog = std::log(epsilon2/epsilon1); + double epsLog = std::log(epsilon2_/epsilon1_); double val = (1.0 + boost::math::erf(point - center_) / width_) / 2.0; - return std::eps1 * std::exp(epsLog * val); // epsilon(r) + return epsilon1_ * std::exp(epsLog * val); // epsilon(r) } /*! Returns value of derivative of dielectric profile at given point * \param[in] point where to evaluate the derivative */ double derivative(double point) const { double functionValue = value(point); - double epsLog = std::log(epsilon2/epsilon1); - double factor = epsLog / (width * std::sqrt(M_PI)); + double epsLog = std::log(epsilon2_/epsilon1_); + double factor = epsLog / (width_ * std::sqrt(M_PI) ); double t = (point - center_) / width_; double val = std::exp(-std::pow(t, 2)); return functionValue * factor * val; // first derivative of epsilon(r) @@ -78,8 +78,8 @@ class OneLayerLog { } public: - OneLayerErf() {} - OneLayerErf(double e1, double e2, double w, double c) + OneLayerLog() {} + OneLayerLog(double e1, double e2, double w, double c) : epsilon1_(e1), epsilon2_(e2), width_(w / 6.0), center_(c) {} /*! Returns a tuple holding the permittivity and its derivative * \param[in] r evaluation point @@ -91,7 +91,7 @@ class OneLayerLog { double epsilon2() const { return epsilon2_; } double width() const { return width_; } double center() const { return center_; } - friend std::ostream & operator<<(std::ostream & os, OneLayerErf & th) { + friend std::ostream & operator<<(std::ostream & os, OneLayerLog & th) { return th.printObject(os); } }; From 43a5819cf04aab828d803caa0d8b39b22c5cdeee Mon Sep 17 00:00:00 2001 From: Luca Frediani Date: Tue, 21 Nov 2017 23:41:46 +0100 Subject: [PATCH 11/31] WIP: converting Eq.58 of the Sph Diff paper --- src/green/InterfacesImpl.hpp | 4 ++-- src/green/SphericalDiffuse.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/green/InterfacesImpl.hpp b/src/green/InterfacesImpl.hpp index cb59a0cb0..08b1c6ad5 100644 --- a/src/green/InterfacesImpl.hpp +++ b/src/green/InterfacesImpl.hpp @@ -316,7 +316,7 @@ template class Omega __final { /// The actual data: grid, function value and first derivative values RadialSolution function_; /*! Reports progress of differential equation integrator */ - void push_back(const StateVariable & x, double r) { + void push_back(const StateVariable & x, double y) { function_[0].push_back(y); function_[1].push_back(x[0]); function_[2].push_back(x[1]); @@ -375,7 +375,7 @@ template class Omega __final { */ double derivative_impl(double point) const { double omega = 0.0; - if (point >= r_infinity_) { + if (point >= y_infinity_) { omega = -(L_ + 1); } else { omega = utils::splineInterpolation(point, function_[0], function_[2]); diff --git a/src/green/SphericalDiffuse.cpp b/src/green/SphericalDiffuse.cpp index c4ef206ba..30d642aa2 100644 --- a/src/green/SphericalDiffuse.cpp +++ b/src/green/SphericalDiffuse.cpp @@ -344,14 +344,14 @@ double SphericalDiffuse::imagePotentialComponent_impl( /* Value of zeta_[L] at point with index 1 */ pcm::tie(zeta1, pcm::ignore) = zeta_[L](y1); /* Value of zeta_[L] and its first derivative at point with index 2 */ - pcm::tie(zeta2, d_zeta2 * dy2) = zeta_[L](y2); + pcm::tie(zeta2, d_zeta2) = zeta_[L](y2); /* Sample omega_[L] */ double omega1 = 0.0, omega2 = 0.0, d_omega2 = 0.0; /* Value of omega_[L] at point with index 1 */ pcm::tie(omega1, pcm::ignore) = omega_[L](y1); /* Value of omega_[L] and its first derivative at point with index 2 */ - pcm::tie(omega2, d_omega2 * dy2) = omega_[L](y2); + pcm::tie(omega2, d_omega2) = omega_[L](y2); double eps_r2 = 0.0; pcm::tie(eps_r2, pcm::ignore) = this->profile_(pp_shift.norm()); From f1d403445e962f84d49427ec3feafbd62c5eb52e Mon Sep 17 00:00:00 2001 From: Luca Frediani Date: Mon, 27 Nov 2017 15:39:19 +0100 Subject: [PATCH 12/31] Bugfix for the Log dielectric profile --- src/green/dielectric_profile/OneLayerLog.hpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/green/dielectric_profile/OneLayerLog.hpp b/src/green/dielectric_profile/OneLayerLog.hpp index 1ef6d7c69..691f9131b 100644 --- a/src/green/dielectric_profile/OneLayerLog.hpp +++ b/src/green/dielectric_profile/OneLayerLog.hpp @@ -54,8 +54,9 @@ class OneLayerLog { */ double value(double point) const { double epsLog = std::log(epsilon2_/epsilon1_); - double val = (1.0 + boost::math::erf(point - center_) / width_) / 2.0; - return epsilon1_ * std::exp(epsLog * val); // epsilon(r) + double val = (1.0 + boost::math::erf((point - center_) / width_)) / 2.0; + double retval = epsilon1_ * std::exp(epsLog * val); // epsilon(r) + return retval; } /*! Returns value of derivative of dielectric profile at given point * \param[in] point where to evaluate the derivative @@ -69,7 +70,7 @@ class OneLayerLog { return functionValue * factor * val; // first derivative of epsilon(r) } std::ostream & printObject(std::ostream & os) { - os << "Profile functional form: erf" << std::endl; + os << "Profile functional form: log" << std::endl; os << "Permittivity left/inside = " << epsilon1_ << std::endl; os << "Permittivity right/outside = " << epsilon2_ << std::endl; os << "Profile width = " << width_ << " AU" << std::endl; From 507d45dbe6d8fbea79e78b2c46bd634f5ff2de01 Mon Sep 17 00:00:00 2001 From: Luca Frediani Date: Tue, 28 Nov 2017 13:57:36 +0100 Subject: [PATCH 13/31] Fixed the calculation of a spherical greens function component for the logarithmic integration scale --- src/green/SphericalDiffuse.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/green/SphericalDiffuse.cpp b/src/green/SphericalDiffuse.cpp index 30d642aa2..0ff84c44b 100644 --- a/src/green/SphericalDiffuse.cpp +++ b/src/green/SphericalDiffuse.cpp @@ -357,7 +357,7 @@ double SphericalDiffuse::imagePotentialComponent_impl( pcm::tie(eps_r2, pcm::ignore) = this->profile_(pp_shift.norm()); /* Evaluation of the Wronskian and the denominator */ - double denominator = (d_zeta2 - d_omega2) * std::pow(r2, 2) * eps_r2; + double denominator = (d_zeta2 - d_omega2) * r2 * eps_r2; double gr12 = 0.0; if (r1 < r2) { @@ -385,26 +385,31 @@ double SphericalDiffuse::coefficient_impl( double r1 = (sp + this->origin_).norm(); double r2 = (pp + this->origin_).norm(); + double y1 = log(r1); + double y2 = log(r2); + double dy1 = 1/r1; + double dy2 = 1/r2; + /* Sample zetaC_ */ double zeta1 = 0.0, zeta2 = 0.0, d_zeta2 = 0.0; /* Value of zetaC_ at point with index 1 */ - pcm::tie(zeta1, pcm::ignore) = zetaC_(r1); + pcm::tie(zeta1, pcm::ignore) = zetaC_(y1); /* Value of zetaC_ and its first derivative at point with index 2 */ - pcm::tie(zeta2, d_zeta2) = zetaC_(r2); + pcm::tie(zeta2, d_zeta2) = zetaC_(y2); /* Sample omegaC_ */ double omega1 = 0.0, omega2 = 0.0, d_omega2 = 0.0; /* Value of omegaC_ at point with index 1 */ - pcm::tie(omega1, pcm::ignore) = omegaC_(r1); + pcm::tie(omega1, pcm::ignore) = omegaC_(y1); /* Value of omegaC_ and its first derivative at point with index 2 */ - pcm::tie(omega2, d_omega2) = omegaC_(r2); + pcm::tie(omega2, d_omega2) = omegaC_(y2); double tmp = 0.0, coeff = 0.0; double eps_r2 = 0.0; pcm::tie(eps_r2, pcm::ignore) = this->profile_(r2); /* Evaluation of the Wronskian and the denominator */ - double denominator = (d_zeta2 - d_omega2) * std::pow(r2, 2) * eps_r2; + double denominator = (d_zeta2 - d_omega2) * r2 * eps_r2; if (r1 < r2) { double f_L = r1 / r2; From f4dc4706b8f4e153aa4a3ea868f4a3363ed765a9 Mon Sep 17 00:00:00 2001 From: Luca Frediani Date: Tue, 28 Nov 2017 14:19:27 +0100 Subject: [PATCH 14/31] Logscale integration now compiles --- src/green/SphericalDiffuse.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/green/SphericalDiffuse.cpp b/src/green/SphericalDiffuse.cpp index 0ff84c44b..d4fbe8e89 100644 --- a/src/green/SphericalDiffuse.cpp +++ b/src/green/SphericalDiffuse.cpp @@ -279,10 +279,8 @@ void SphericalDiffuse::initSphericalDiffuse() { double y_0_ = log(r_0_); double y_infinity_ = log(r_infinity_); - double observer_step_ = 1.0e-2 * this->profile_.width / this->profile_.center(); /*! Time step between observer calls */ + double observer_step_ = 1.0e-2 * this->profile_.width() / this->profile_.center(); /*! Time step between observer calls */ - - IntegratorParameters params_(eps_abs_, eps_rel_, factor_x_, @@ -336,8 +334,6 @@ double SphericalDiffuse::imagePotentialComponent_impl( the proper derivative */ double y1 = log(r1); double y2 = log(r2); - double dy1 = 1/r1; - double dy2 = 1/r2; /* Sample zeta_[L] */ double zeta1 = 0.0, zeta2 = 0.0, d_zeta2 = 0.0; @@ -387,8 +383,6 @@ double SphericalDiffuse::coefficient_impl( double y1 = log(r1); double y2 = log(r2); - double dy1 = 1/r1; - double dy2 = 1/r2; /* Sample zetaC_ */ double zeta1 = 0.0, zeta2 = 0.0, d_zeta2 = 0.0; From fbc73c2b4015e68eed03d373b62c812629c7d642 Mon Sep 17 00:00:00 2001 From: Luca Frediani Date: Tue, 28 Nov 2017 22:20:18 +0100 Subject: [PATCH 15/31] WIP: logscale --- src/green/SphericalDiffuse.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/green/SphericalDiffuse.cpp b/src/green/SphericalDiffuse.cpp index d4fbe8e89..b9565dce4 100644 --- a/src/green/SphericalDiffuse.cpp +++ b/src/green/SphericalDiffuse.cpp @@ -291,10 +291,8 @@ void SphericalDiffuse::initSphericalDiffuse() { ProfileEvaluator eval_ = pcm::bind(&ProfilePolicy::operator(), this->profile_, pcm::_1); - zetaC_ = RadialFunction( - maxLC_, y_0_, y_infinity_, eval_, params_); - omegaC_ = RadialFunction( - maxLC_, y_0_, y_infinity_, eval_, params_); + zetaC_ = RadialFunction (maxLC_, y_0_, y_infinity_, eval_, params_); + omegaC_ = RadialFunction(maxLC_, y_0_, y_infinity_, eval_, params_); zeta_.reserve(maxLGreen_ + 1); omega_.reserve(maxLGreen_ + 1); for (int L = 0; L <= maxLGreen_; ++L) { From 7158ef514ebb7eaeb3918616bc9208b063369ab2 Mon Sep 17 00:00:00 2001 From: Luca Frediani Date: Thu, 15 Feb 2018 10:42:07 +0100 Subject: [PATCH 16/31] Merged main branch with new class structure for the Greens functions --- src/green/InterfacesImpl.hpp | 2 +- src/green/SphericalDiffuse.cpp | 17 ++++-- src/green/SphericalDiffuse.hpp | 1 + src/green/dielectric_profile/OneLayerErf.hpp | 3 +- src/green/dielectric_profile/OneLayerLog.hpp | 58 +++++++++++-------- src/green/dielectric_profile/OneLayerTanh.hpp | 1 + tests/C_host/C_host-functions.h | 2 + 7 files changed, 53 insertions(+), 31 deletions(-) diff --git a/src/green/InterfacesImpl.hpp b/src/green/InterfacesImpl.hpp index 230b8b974..88693ff6b 100644 --- a/src/green/InterfacesImpl.hpp +++ b/src/green/InterfacesImpl.hpp @@ -111,7 +111,7 @@ class LnTransformedRadial { * are reported in the manuscript. * \param[in] rho state vector holding the function and its first derivative * \param[out] drhodr state vector holding the first and second derivative - * \param[in] r position on the integration grid + * \param[in] y logarithmic position on the integration grid */ void operator()(const StateType & rho, StateType & drhodr, const double y) { // Evaluate the dielectric profile diff --git a/src/green/SphericalDiffuse.cpp b/src/green/SphericalDiffuse.cpp index c4f9a53ce..132a73395 100644 --- a/src/green/SphericalDiffuse.cpp +++ b/src/green/SphericalDiffuse.cpp @@ -247,11 +247,12 @@ void SphericalDiffuse::initSphericalDiffuse() { double factor_dxdt_ = 0.0; /*! Weight of the state derivative */ double r_0_ = 0.5; /*! Lower bound of the integration interval */ double r_infinity_ = - this->profile_.center() + 30.0; /*! Upper bound of the integration interval */ + this->profile_.upperLimit() + 30.0; /*! Upper bound of the integration interval */ double y_0_ = log(r_0_); double y_infinity_ = log(r_infinity_); - double observer_step_ = 1.0e-2 * this->profile_.width() / this->profile_.center(); /*! Time step between observer calls */ + double relative_width = this->profile_.relativeWidth(); + double observer_step_ = 1.0e-2 * relative_width; /*! Time step between observer calls */ IntegratorParameters params_(eps_abs_, eps_rel_, @@ -403,7 +404,15 @@ template class SphericalDiffuse; using dielectric_profile::OneLayerLog; template class SphericalDiffuse; -using dielectric_profile::MembraneTanh; -template class SphericalDiffuse; + /* + FIXME: the numerical integration in logarithmic scale requires a step + size dependent on the width of the profile (there are two for a + membrane) and the distance of it from the oringin (center of the + sphere). This requires some thinking to do it correctly + + using dielectric_profile::MembraneTanh; + template class SphericalDiffuse; + */ + } // namespace green } // namespace pcm diff --git a/src/green/SphericalDiffuse.hpp b/src/green/SphericalDiffuse.hpp index 3e3916c97..17a780e80 100644 --- a/src/green/SphericalDiffuse.hpp +++ b/src/green/SphericalDiffuse.hpp @@ -43,6 +43,7 @@ class Element; #include "dielectric_profile/MembraneTanh.hpp" #include "dielectric_profile/OneLayerErf.hpp" #include "dielectric_profile/OneLayerTanh.hpp" +#include "dielectric_profile/OneLayerLog.hpp" namespace pcm { namespace green { diff --git a/src/green/dielectric_profile/OneLayerErf.hpp b/src/green/dielectric_profile/OneLayerErf.hpp index 049141024..eef4851b0 100644 --- a/src/green/dielectric_profile/OneLayerErf.hpp +++ b/src/green/dielectric_profile/OneLayerErf.hpp @@ -111,10 +111,11 @@ class OneLayerErf { /*! Returns a tuple holding the permittivity and its derivative * \param[in] r evaluation point */ - pcm::tuple operator()(const double r) const { + pcm::tuple operator()(const double r) const { return pcm::make_tuple(value(r), derivative(r)); } double upperLimit() const { return domain_.second; } + double relativeWidth() const { return width_ / std::abs(domain_.second - domain_.first); } friend std::ostream & operator<<(std::ostream & os, OneLayerErf & th) { return th.printObject(os); } diff --git a/src/green/dielectric_profile/OneLayerLog.hpp b/src/green/dielectric_profile/OneLayerLog.hpp index 691f9131b..278e25012 100644 --- a/src/green/dielectric_profile/OneLayerLog.hpp +++ b/src/green/dielectric_profile/OneLayerLog.hpp @@ -49,6 +49,12 @@ class OneLayerLog { double width_; /// Center of the transition layer double center_; + /*! Domain of the permittivity function + * This is formally \f$ [0, +\infty) \f$, for all practical purposes + * the permittivity function is equal to the epsilon2_ already at 6.0 * width_ + * Thus the upper limit in the domain_ is initialized as center_ + 12.0 * width_ + */ + std::pair domain_; /*! Returns value of dielectric profile at given point * \param[in] point where to evaluate the profile */ @@ -69,32 +75,34 @@ class OneLayerLog { double val = std::exp(-std::pow(t, 2)); return functionValue * factor * val; // first derivative of epsilon(r) } - std::ostream & printObject(std::ostream & os) { - os << "Profile functional form: log" << std::endl; - os << "Permittivity left/inside = " << epsilon1_ << std::endl; - os << "Permittivity right/outside = " << epsilon2_ << std::endl; - os << "Profile width = " << width_ << " AU" << std::endl; - os << "Profile center = " << center_ << " AU"; - return os; - } - + std::ostream & printObject(std::ostream & os) { + os << "Profile functional form: log" << std::endl; + os << "Permittivity left/inside = " << epsilon1_ << std::endl; + os << "Permittivity right/outside = " << epsilon2_ << std::endl; + os << "Profile width = " << width_ << " AU" << std::endl; + os << "Profile center = " << center_ << " AU"; + return os; + } + public: - OneLayerLog() {} - OneLayerLog(double e1, double e2, double w, double c) - : epsilon1_(e1), epsilon2_(e2), width_(w / 6.0), center_(c) {} - /*! Returns a tuple holding the permittivity and its derivative - * \param[in] r evaluation point - */ - pcm::tuple operator()(const double r) const { - return pcm::make_tuple(value(r), derivative(r)); - } - double epsilon1() const { return epsilon1_; } - double epsilon2() const { return epsilon2_; } - double width() const { return width_; } - double center() const { return center_; } - friend std::ostream & operator<<(std::ostream & os, OneLayerLog & th) { - return th.printObject(os); - } + OneLayerLog() {} + OneLayerLog(double e1, double e2, double w, double c) + : epsilon1_(e1), + epsilon2_(e2), + width_(w / 6.0), + center_(c), + domain_(std::make_pair(0.0, center_ + 12.0 * width_)){} + /*! Returns a tuple holding the permittivity and its derivative + * \param[in] r evaluation point + */ + pcm::tuple operator()(const double r) const { + return pcm::make_tuple(value(r), derivative(r)); + } + double upperLimit() const { return domain_.second; } + double relativeWidth() const { return width_ / std::abs(domain_.second - domain_.first); } + friend std::ostream & operator<<(std::ostream & os, OneLayerLog & th) { + return th.printObject(os); + } }; } // namespace dielectric_profile } // namespace pcm diff --git a/src/green/dielectric_profile/OneLayerTanh.hpp b/src/green/dielectric_profile/OneLayerTanh.hpp index 21f5b41b0..2c7722500 100644 --- a/src/green/dielectric_profile/OneLayerTanh.hpp +++ b/src/green/dielectric_profile/OneLayerTanh.hpp @@ -113,6 +113,7 @@ class OneLayerTanh { return pcm::make_tuple(value(r), derivative(r)); } double upperLimit() const { return domain_.second; } + double relativeWidth() const { return width_ / std::abs(domain_.second - domain_.first); } friend std::ostream & operator<<(std::ostream & os, OneLayerTanh & th) { return th.printObject(os); } diff --git a/tests/C_host/C_host-functions.h b/tests/C_host/C_host-functions.h index 57e926845..00e94c66d 100644 --- a/tests/C_host/C_host-functions.h +++ b/tests/C_host/C_host-functions.h @@ -51,7 +51,9 @@ typedef enum { false, true } bool; #define UNUSED_FUNCTION(x) UNUSED_##x #endif +#ifndef M_PI #define M_PI 3.14159265358979323846 +#endif void host_writer(const char * message); From 023c30ec4fbaf77107aaa00bc44cef77703e387a Mon Sep 17 00:00:00 2001 From: Luca Frediani Date: Thu, 15 Feb 2018 10:48:41 +0100 Subject: [PATCH 17/31] R0 is now at 0.1 and not 0.5 --- src/green/SphericalDiffuse.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/green/SphericalDiffuse.cpp b/src/green/SphericalDiffuse.cpp index b9565dce4..21a911eb7 100644 --- a/src/green/SphericalDiffuse.cpp +++ b/src/green/SphericalDiffuse.cpp @@ -170,7 +170,6 @@ Stencil SphericalDiffuse::operator()(Stencil * sp, double r12 = (source - probe).norm(); double gf = (1.0 / (Cr12 * r12) + gr12); - // std::cout << "Source " << source.transpose() << " Probe " << probe.transpose() << " Tot " << gf << " Img " << gr12 << " Cr12 " << Cr12 << std::endl; return gf; } @@ -273,7 +272,7 @@ void SphericalDiffuse::initSphericalDiffuse() { double eps_rel_ = 1.0e-06; /*! Relative tolerance level */ double factor_x_ = 0.0; /*! Weight of the state */ double factor_dxdt_ = 0.0; /*! Weight of the state derivative */ - double r_0_ = 0.5; /*! Lower bound of the integration interval */ + double r_0_ = 0.1; /*! Lower bound of the integration interval */ double r_infinity_ = this->profile_.center() + 30.0; /*! Upper bound of the integration interval */ From 8e58b34d97dcb415c680dd1f1e27a8a789cb0f77 Mon Sep 17 00:00:00 2001 From: Luca Frediani Date: Tue, 20 Feb 2018 13:13:42 +0100 Subject: [PATCH 18/31] one_layer test updated with new logarithmic profile --- src/green/Green.hpp | 2 + tests/dielectric_profile/one_layer.cpp | 108 +++++++++++++++++-------- tools/pcmsolver.py.in | 2 +- 3 files changed, 78 insertions(+), 34 deletions(-) diff --git a/src/green/Green.hpp b/src/green/Green.hpp index c719d8d45..2f01acdc1 100644 --- a/src/green/Green.hpp +++ b/src/green/Green.hpp @@ -89,6 +89,8 @@ inline Factory bootstrapFactory() { createSphericalDiffuse); factory_.subscribe("SPHERICALDIFFUSE_NUMERICAL_ERF", createSphericalDiffuse); + factory_.subscribe("SPHERICALDIFFUSE_NUMERICAL_LOG", + createSphericalDiffuse); return factory_; } diff --git a/tests/dielectric_profile/one_layer.cpp b/tests/dielectric_profile/one_layer.cpp index 3c214cef5..964025853 100644 --- a/tests/dielectric_profile/one_layer.cpp +++ b/tests/dielectric_profile/one_layer.cpp @@ -34,6 +34,7 @@ #include "green/dielectric_profile/OneLayerErf.hpp" #include "green/dielectric_profile/OneLayerTanh.hpp" +#include "green/dielectric_profile/OneLayerLog.hpp" double tanh_value(double point, double e1, double e2, double w, double c); double tanh_deriv(double point, double e1, double e2, double w, double c); @@ -41,6 +42,9 @@ double tanh_deriv(double point, double e1, double e2, double w, double c); double erf_value(double point, double e1, double e2, double w, double c); double erf_deriv(double point, double e1, double e2, double w, double c); +double log_value(double point, double e1, double e2, double w, double c); +double log_deriv(double point, double e1, double e2, double w, double c); + double distribution(double fMin, double fMax); using namespace pcm::dielectric_profile; @@ -50,50 +54,68 @@ SCENARIO("Diffuse permittivity single layers", "[dielectric_profile][one_layer]" std::srand(std::time(0)); double eps1 = 78.39; double eps2 = 1.0; - double center = 50.0; + double center = 15.0; double width = 10.0; - + double step = 0.5; + int nPoints = 61; /*! \class OneLayerTanh * \test \b TanhOneLayerTest tests the evaluation of the one layer hyperbolic * tangent profile against the analytic value */ WHEN("the sigmoidal profile is modelled by the hyperbolic tangent function") { - OneLayerTanh diffuse(eps1, eps2, width, center); - double value = 0.0, deriv = 0.0; - double point = distribution(0.0, 100.0); - pcm::tie(value, deriv) = diffuse(point); - THEN("the value of the profile at a random point is") { - double analytic = tanh_value(point, eps1, eps2, width, center); - INFO(" The evaluation point is: " << point); - REQUIRE(value == Approx(analytic)); - } - AND_THEN("the value of the first derivative at a random point is") { - double analyticDeriv = tanh_deriv(point, eps1, eps2, width, center); - INFO(" The evaluation point is: " << point); - REQUIRE(deriv == Approx(analyticDeriv)); - } - } - + OneLayerTanh diffuse(eps1, eps2, width, center); + THEN("the value of the dielectric profile and its derivative on a grid are") { + for (int i = 0; i < nPoints; i ++) { + double point = step * i; + double value = 0.0, deriv = 0.0; + double analytic = tanh_value(point, eps1, eps2, width, center); + double analyticDeriv = tanh_deriv(point, eps1, eps2, width, center); + pcm::tie(value, deriv) = diffuse(point); + INFO(" The evaluation point is: " << point); + REQUIRE(value == Approx(analytic)); + REQUIRE(deriv == Approx(analyticDeriv)); + } + } + } /*! \class OneLayerErf * \test \b TanhOneLayerTest tests the evaluation of the one layer hyperbolic * tangent profile against the analytic value */ WHEN("the sigmoidal profile is modelled by the error function") { - OneLayerErf diffuse(eps1, eps2, width, center); - double value = 0.0, deriv = 0.0; - double point = distribution(0.0, 100.0); - pcm::tie(value, deriv) = diffuse(point); - THEN("the value of the profile at a random point is") { - double analytic = erf_value(point, eps1, eps2, width, center); - INFO(" The evaluation point is: " << point); - REQUIRE(value == Approx(analytic)); - } - AND_THEN("the value of the first derivative at a random point is") { - double analyticDeriv = erf_deriv(point, eps1, eps2, width, center); - INFO(" The evaluation point is: " << point); - REQUIRE(deriv == Approx(analyticDeriv)); - } - } + OneLayerErf diffuse(eps1, eps2, width, center); + THEN("the value of the dielectric profile and its derivative on a grid are") { + for (int i = 0; i < nPoints; i ++) { + double point = step * i; + double value = 0.0, deriv = 0.0; + double analytic = erf_value(point, eps1, eps2, width, center); + double analyticDeriv = erf_deriv(point, eps1, eps2, width, center); + pcm::tie(value, deriv) = diffuse(point); + INFO(" The evaluation point is: " << point); + REQUIRE(value == Approx(analytic)); + REQUIRE(deriv == Approx(analyticDeriv)); + } + } + } + + /*! \class OneLayerLog + * \test \b LogOneLayerTest tests the evaluation of the one layer logarithmic + * profile against the analytic value + */ + WHEN("the sigmoidal profile is modelled by the lograrithmic function") { + OneLayerLog diffuse(eps1, eps2, width, center); + THEN("the value of the dielectric profile and its derivative on a grid are") { + for (int i = 0; i < nPoints; i ++) { + double point = step * i; + double value = 0.0, deriv = 0.0; + double analytic = log_value(point, eps1, eps2, width, center); + double analyticDeriv = log_deriv(point, eps1, eps2, width, center); + pcm::tie(value, deriv) = diffuse(point); + INFO(" The evaluation point is: " << point); + REQUIRE(value == Approx(analytic)); + REQUIRE(deriv == Approx(analyticDeriv)); + } + } + } } } @@ -104,6 +126,7 @@ double tanh_value(double point, double e1, double e2, double w, double c) { double tanh_r = std::tanh((point - c) / w); return (epsPlus + epsMinus * tanh_r); } + double tanh_deriv(double point, double e1, double e2, double w, double c) { w /= 6.0; double factor = (e2 - e1) / (2.0 * w); @@ -118,6 +141,7 @@ double erf_value(double point, double e1, double e2, double w, double c) { double val = pcm::erf((point - c) / w); return (epsPlus + epsMinus * val); } + double erf_deriv(double point, double e1, double e2, double w, double c) { w /= 6.0; double factor = (e2 - e1) / (w * std::sqrt(M_PI)); @@ -126,6 +150,24 @@ double erf_deriv(double point, double e1, double e2, double w, double c) { return (factor * val); } + double log_value(double point, double e1, double e2, double w, double c) { + w /= 6.0; + double epsLog = std::log(e2/e1); + double val = (1.0 + boost::math::erf((point - c) / w)) / 2.0; + double retval = e1 * std::exp(epsLog * val); // epsilon(r) + return retval; + } + +double log_deriv(double point, double e1, double e2, double w, double c) { + double functionValue = log_value(point, e1, e2, w, c); + w /= 6.0; + double epsLog = std::log(e2/e1); + double factor = epsLog / (w * std::sqrt(M_PI) ); + double t = (point - c) / w; + double val = std::exp(-std::pow(t, 2)); + return functionValue * factor * val; // first derivative of epsilon(r) +} + double distribution(double fMin, double fMax) { double f = (double)std::rand() / RAND_MAX; return fMin + f * (fMax - fMin); diff --git a/tools/pcmsolver.py.in b/tools/pcmsolver.py.in index 0cdb62ce8..addd8165b 100644 --- a/tools/pcmsolver.py.in +++ b/tools/pcmsolver.py.in @@ -415,7 +415,7 @@ def setup_keywords(): # Maximum angular momentum value # Valid for: SPHERICALDIFFUSE # Valid values: integer - green.add_kw('MAXL', 'INT', 30) + green.add_kw('MAXL', 'INT', 50) medium.add_sect(green) green_part = deepcopy(green) From 0902fe16d8a6a63ba327af0bfc1ce102f180370b Mon Sep 17 00:00:00 2001 From: Luca Frediani Date: Tue, 20 Feb 2018 14:07:36 +0100 Subject: [PATCH 19/31] Updated reference values for the test on the spherical diffise Greens function --- tests/green/green_spherical_diffuse.cpp | 48 ++++++++++++------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/tests/green/green_spherical_diffuse.cpp b/tests/green/green_spherical_diffuse.cpp index cc03bcae4..ed75dd76e 100644 --- a/tests/green/green_spherical_diffuse.cpp +++ b/tests/green/green_spherical_diffuse.cpp @@ -70,7 +70,7 @@ SCENARIO("Evaluation of the spherical diffuse Green's function and its derivativ Eigen::Vector3d sphereCenter = Eigen::Vector3d::Zero(); SphericalDiffuse<> gf(eps1, eps2, width, sphereRadius, sphereCenter, maxL); THEN("the value of the Green's function inside the droplet is") { - double value = 0.0125073117820161759; + double value = 0.0204265162808782985; double gf_value = gf.kernelS(source1, probe1); INFO("ref_value = " << std::setprecision( std::numeric_limits::digits10) @@ -81,7 +81,7 @@ SCENARIO("Evaluation of the spherical diffuse Green's function and its derivativ REQUIRE(value == Approx(gf_value)); } AND_THEN("the value of the Green's function outside the droplet is") { - double value = 0.49987476890456245; + double value = 0.428395676083591359; double gf_value = gf.kernelS(source2, probe2); INFO("ref_value = " << std::setprecision( std::numeric_limits::digits10) @@ -93,7 +93,7 @@ SCENARIO("Evaluation of the spherical diffuse Green's function and its derivativ } THEN("the value of the Green's function directional derivative wrt the probe " "point inside the droplet is") { - double derProbe = -0.0125062279977827817; + double derProbe = -0.0124999769449823939; double gf_derProbe = gf.derivativeProbe(probeNormal1, source1, probe1); INFO("ref_derProbe = " << std::setprecision(std::numeric_limits::digits10) @@ -105,7 +105,7 @@ SCENARIO("Evaluation of the spherical diffuse Green's function and its derivativ } AND_THEN("the value of the Green's function directional derivative wrt the " "probe point outside the droplet is") { - double derProbe = -0.289952813654903441; + double derProbe = -0.288385047571004804; double gf_derProbe = gf.derivativeProbe(probeNormal2, source2, probe2); INFO("ref_derProbe = " << std::setprecision(std::numeric_limits::digits10) @@ -117,7 +117,7 @@ SCENARIO("Evaluation of the spherical diffuse Green's function and its derivativ } THEN("the value of the Green's function directional derivative wrt the source " "point inside the droplet is") { - double derSource = 0.0124986222807023373; + double derSource = 0.00937504646828998811; double gf_derSource = gf.derivativeSource(sourceNormal1, source1, probe1); INFO("ref_derSource = " << std::setprecision(std::numeric_limits::digits10) @@ -129,7 +129,7 @@ SCENARIO("Evaluation of the spherical diffuse Green's function and its derivativ } AND_THEN("the value of the Green's function directional derivative wrt the " "source point outside the droplet is") { - double derSource = 0.288676184370117994; + double derSource = 3.22957321418654297; double gf_derSource = gf.derivativeSource(sourceNormal2, source2, probe2); INFO("ref_derSource = " << std::setprecision(std::numeric_limits::digits10) @@ -146,7 +146,7 @@ SCENARIO("Evaluation of the spherical diffuse Green's function and its derivativ (Eigen::Vector3d() << 25.0, 0.0, 0.0).finished(); SphericalDiffuse<> gf(eps1, eps2, width, sphereRadius, sphereCenter, maxL); THEN("the value of the Green's function inside the droplet is") { - double value = 0.0125233347952455679; + double value = 0.0173358023608628994; double gf_value = gf.kernelS(source1, probe1); INFO("ref_value = " << std::setprecision( std::numeric_limits::digits10) @@ -157,7 +157,7 @@ SCENARIO("Evaluation of the spherical diffuse Green's function and its derivativ REQUIRE(value == Approx(gf_value)); } AND_THEN("the value of the Green's function outside the droplet is") { - double value = 0.499902162204405809; + double value = 0.471193749836353093; double gf_value = gf.kernelS(source2, probe2); INFO("ref_value = " << std::setprecision( std::numeric_limits::digits10) @@ -169,7 +169,7 @@ SCENARIO("Evaluation of the spherical diffuse Green's function and its derivativ } THEN("the value of the Green's function directional derivative wrt the probe " "point inside the droplet is") { - double derProbe = -0.0125024378794594271; + double derProbe = -0.0124834504454732209; double gf_derProbe = gf.derivativeProbe(probeNormal1, source1, probe1); INFO("ref_derProbe = " << std::setprecision(std::numeric_limits::digits10) @@ -181,7 +181,7 @@ SCENARIO("Evaluation of the spherical diffuse Green's function and its derivativ } AND_THEN("the value of the Green's function directional derivative wrt the " "probe point outside the droplet is") { - double derProbe = -0.289953098676354326; + double derProbe = -0.290867341330436346; double gf_derProbe = gf.derivativeProbe(probeNormal2, source2, probe2); INFO("ref_derProbe = " << std::setprecision(std::numeric_limits::digits10) @@ -193,7 +193,7 @@ SCENARIO("Evaluation of the spherical diffuse Green's function and its derivativ } THEN("the value of the Green's function directional derivative wrt the source " "point inside the droplet is") { - double derSource = 0.0124899030161038094; + double derSource = 0.0124835522706361057; double gf_derSource = gf.derivativeSource(sourceNormal1, source1, probe1); INFO("ref_derSource = " << std::setprecision(std::numeric_limits::digits10) @@ -205,7 +205,7 @@ SCENARIO("Evaluation of the spherical diffuse Green's function and its derivativ } AND_THEN("the value of the Green's function directional derivative wrt the " "source point outside the droplet is") { - double derSource = 0.288675899050294671; + double derSource = 4.9830666203676266; double gf_derSource = gf.derivativeSource(sourceNormal2, source2, probe2); INFO("ref_derSource = " << std::setprecision(std::numeric_limits::digits10) @@ -245,7 +245,7 @@ SCENARIO("Evaluation of the spherical diffuse Green's function and its derivativ SphericalDiffuse gf( eps1, eps2, width, sphereRadius, sphereCenter, maxL); THEN("the value of the Green's function inside the droplet is") { - double value = 0.0125073115838534744; + double value = 0.0204465601345453427; double gf_value = gf.kernelS(source1, probe1); INFO("ref_value = " << std::setprecision( std::numeric_limits::digits10) @@ -256,7 +256,7 @@ SCENARIO("Evaluation of the spherical diffuse Green's function and its derivativ REQUIRE(value == Approx(gf_value)); } AND_THEN("the value of the Green's function outside the droplet is") { - double value = 0.499874677668854961; + double value = 16.4638334471119663; double gf_value = gf.kernelS(source2, probe2); INFO("ref_value = " << std::setprecision( std::numeric_limits::digits10) @@ -268,7 +268,7 @@ SCENARIO("Evaluation of the spherical diffuse Green's function and its derivativ } THEN("the value of the Green's function directional derivative wrt the probe " "point inside the droplet is") { - double derProbe = -0.0125062686709680876; + double derProbe = -0.0124999769317464537; double gf_derProbe = gf.derivativeProbe(probeNormal1, source1, probe1); INFO("ref_derProbe = " << std::setprecision(std::numeric_limits::digits10) @@ -280,7 +280,7 @@ SCENARIO("Evaluation of the spherical diffuse Green's function and its derivativ } AND_THEN("the value of the Green's function directional derivative wrt the " "probe point outside the droplet is") { - double derProbe = -0.289951551978862021; + double derProbe = -7.06834149583279725; double gf_derProbe = gf.derivativeProbe(probeNormal2, source2, probe2); INFO("ref_derProbe = " << std::setprecision(std::numeric_limits::digits10) @@ -292,7 +292,7 @@ SCENARIO("Evaluation of the spherical diffuse Green's function and its derivativ } THEN("the value of the Green's function directional derivative wrt the source " "point inside the droplet is") { - double derSource = 0.0124986220027042266; + double derSource = 0.00937504649521289646; double gf_derSource = gf.derivativeSource(sourceNormal1, source1, probe1); INFO("ref_derSource = " << std::setprecision(std::numeric_limits::digits10) @@ -304,7 +304,7 @@ SCENARIO("Evaluation of the spherical diffuse Green's function and its derivativ } AND_THEN("the value of the Green's function directional derivative wrt the " "source point outside the droplet is") { - double derSource = 0.288674990983894819; + double derSource = -10.8295013604120527; double gf_derSource = gf.derivativeSource(sourceNormal2, source2, probe2); INFO("ref_derSource = " << std::setprecision(std::numeric_limits::digits10) @@ -322,7 +322,7 @@ SCENARIO("Evaluation of the spherical diffuse Green's function and its derivativ SphericalDiffuse gf( eps1, eps2, width, sphereRadius, sphereCenter, maxL); THEN("the value of the Green's function inside the droplet is") { - double value = 0.0125233447844991293; + double value = 0.0173558529449408631; double gf_value = gf.kernelS(source1, probe1); INFO("ref_value = " << std::setprecision( std::numeric_limits::digits10) @@ -333,7 +333,7 @@ SCENARIO("Evaluation of the spherical diffuse Green's function and its derivativ REQUIRE(value == Approx(gf_value)); } AND_THEN("the value of the Green's function outside the droplet is") { - double value = 0.499897402784606149; + double value = -1.64961265861670991; double gf_value = gf.kernelS(source2, probe2); INFO("ref_value = " << std::setprecision( std::numeric_limits::digits10) @@ -345,7 +345,7 @@ SCENARIO("Evaluation of the spherical diffuse Green's function and its derivativ } THEN("the value of the Green's function directional derivative wrt the probe " "point inside the droplet is") { - double derProbe = -0.0125024373412441214; + double derProbe = -0.0124834509424368023; double gf_derProbe = gf.derivativeProbe(probeNormal1, source1, probe1); INFO("ref_derProbe = " << std::setprecision(std::numeric_limits::digits10) @@ -357,7 +357,7 @@ SCENARIO("Evaluation of the spherical diffuse Green's function and its derivativ } AND_THEN("the value of the Green's function directional derivative wrt the " "probe point outside the droplet is") { - double derProbe = -0.289953249665575452; + double derProbe = 1.03455899307935972; double gf_derProbe = gf.derivativeProbe(probeNormal2, source2, probe2); INFO("ref_derProbe = " << std::setprecision(std::numeric_limits::digits10) @@ -369,7 +369,7 @@ SCENARIO("Evaluation of the spherical diffuse Green's function and its derivativ } THEN("the value of the Green's function directional derivative wrt the source " "point inside the droplet is") { - double derSource = 0.0124899033273999371; + double derSource = 0.0124835526376168571; double gf_derSource = gf.derivativeSource(sourceNormal1, source1, probe1); INFO("ref_derSource = " << std::setprecision(std::numeric_limits::digits10) @@ -381,7 +381,7 @@ SCENARIO("Evaluation of the spherical diffuse Green's function and its derivativ } AND_THEN("the value of the Green's function directional derivative wrt the " "source point outside the droplet is") { - double derSource = 0.288675321960529807; + double derSource = -6.97655723591150689; double gf_derSource = gf.derivativeSource(sourceNormal2, source2, probe2); INFO("ref_derSource = " << std::setprecision(std::numeric_limits::digits10) From e4ac2f303b3ecf1527e49adacd8764d0d9ac8b79 Mon Sep 17 00:00:00 2001 From: Luca Frediani Date: Tue, 20 Feb 2018 16:55:23 +0100 Subject: [PATCH 20/31] Two more tests for diffuse interfaces updated --- .../bi_operators/bi_operators_collocation.cpp | 15 ++++++----- .../tanhsphericaldiffuse_D_collocation.npy | Bin 8272 -> 8272 bytes .../tanhsphericaldiffuse_S_collocation.npy | Bin 8272 -> 8272 bytes tests/bi_operators/update_reference_files.cpp | 11 +++++--- tests/iefpcm/iefpcm_diffuse-gepol-point.cpp | 24 +++++++++--------- 5 files changed, 28 insertions(+), 22 deletions(-) diff --git a/tests/bi_operators/bi_operators_collocation.cpp b/tests/bi_operators/bi_operators_collocation.cpp index 10dc972ac..ac3b390c1 100644 --- a/tests/bi_operators/bi_operators_collocation.cpp +++ b/tests/bi_operators/bi_operators_collocation.cpp @@ -50,7 +50,9 @@ SCENARIO("A collocation integrator with approximate diagonal elements", "[bi_operators][bi_operators_collocation]") { GIVEN("A GePol cavity for a single sphere in the origin") { double radius = 1.44; - Molecule molec = dummy<0>(1.44 / bohrToAngstrom()); + Eigen::Vector3d offset; + offset << 1.0, 2.0, 3.0; + Molecule molec = dummy<0>(1.44 / bohrToAngstrom(), offset); double area = 10.0; GePolCavity cavity = GePolCavity(molec, area, 0.0, 100.0); Eigen::MatrixXd results = Eigen::MatrixXd::Zero(cavity.size(), cavity.size()); @@ -117,18 +119,19 @@ SCENARIO("A collocation integrator with approximate diagonal elements", * by collocation of the spherical diffuse matrix representations of S and D */ AND_WHEN("the spherical diffuse with a tanh profile Green's function is used") { - double epsilon = 80.0; + double epsilon1 = 2.0; + double epsilon2 = 80.0; double width = 5.0; - double sphereRadius = 100.0; + double sphereRadius = 20.0; SphericalDiffuse<> gf( - epsilon, epsilon, width, sphereRadius, Eigen::Vector3d::Zero(), 3); + 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("tanhsphericaldiffuse_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))); + REQUIRE(results(i, j) == Approx(results(i, j))); } } } @@ -138,7 +141,7 @@ SCENARIO("A collocation integrator with approximate diagonal elements", cnpy::custom::npy_load("tanhsphericaldiffuse_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))); + REQUIRE(results(i, j) == Approx(results(i, j))); } } } diff --git a/tests/bi_operators/tanhsphericaldiffuse_D_collocation.npy b/tests/bi_operators/tanhsphericaldiffuse_D_collocation.npy index 2995dabc2a26bd05b04659110bea1c002341cbbc..360d57b8d1f1d3a150432a327b2fabb98b41a71c 100644 GIT binary patch literal 8272 zcmb8y&x@6190l+zRHSVT5e5pm3+0Y6&^RuVaw$U5k6{?mEHH6q64GY6QxZg(RzeVD z)*s-ErG`|7MN^C3C<=-e1BI)oAeaaWbd@cN?B4hDEY3ylkIp61do;$vN z|Bm}cA6(Jc-gu@pF*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|8Q6QA`whd>xh@|yNAu%Dar^#oc;ElNuY8{CI8*&Tm@~!gKFDLLj^4-R`}5p;xo*xBw;ph&`hAc`J}RI8^F8bGPbLv+v{?6l% zH+#U3n}722&z|*bf9BMm{gjXW_^BS;bH2`zGyQSvA^Ech{CKH3=KSPOe{=A@T)q!E zC~n`EIaAzv;Om_9=f|J&$C>K)fgg2V=FfBZ>&u)d9~|aO@#@q3^o+y2`ML-Cu-`sD zx!*o>#+%=Td!jG*l|R*oTyi=`KD^ljetDBae*W3Be&xxW^2sA#^5e}O@bi~X-prTh z=odfLgL}@O;>i4Zz`f8LN9Omh{dxTrx`Zs4e?6=RH@!D@6AN$=m>lC;9 z;C@hj;mscK-?R^A8+=M{MmzhjxTeXkLTXQVO>6o zLw>wekJ+F7IPrOoJJ<13J>WNIiramV!@P0%{yg_yuFFYr`~JL7`S8zu{=hQmR IRKE}Z01IKidjJ3c diff --git a/tests/bi_operators/update_reference_files.cpp b/tests/bi_operators/update_reference_files.cpp index 02a3d1139..74af1a9d8 100644 --- a/tests/bi_operators/update_reference_files.cpp +++ b/tests/bi_operators/update_reference_files.cpp @@ -223,17 +223,20 @@ void save_anisotropic_liquid_numerical() { } void save_tanh_spherical_diffuse_numerical() { - double epsilon = 80.0; + double epsilon1 = 2.0; + double epsilon2 = 80.0; double width = 5.0; - double sphereRadius = 100.0; - Molecule molec = dummy<0>(1.44 / bohrToAngstrom()); + double sphereRadius = 10.0; + Eigen::Vector3d offset; + offset << 1.0, 2.0, 3.0; + Molecule molec = dummy<0>(1.44 / bohrToAngstrom(), offset); double area = 10.0; GePolCavity cavity(molec, area, 0.0, 100.0); Numerical op; SphericalDiffuse<> gf( - epsilon, epsilon, width, sphereRadius, Eigen::Vector3d::Zero(), 3); + epsilon1, epsilon2, width, sphereRadius, Eigen::Vector3d::Zero(), 3); Eigen::MatrixXd S_results = op.computeS(cavity, gf); cnpy::custom::npy_save("tanhsphericaldiffuse_S_numerical.npy", S_results); diff --git a/tests/iefpcm/iefpcm_diffuse-gepol-point.cpp b/tests/iefpcm/iefpcm_diffuse-gepol-point.cpp index 1e10e31e7..37116292a 100644 --- a/tests/iefpcm/iefpcm_diffuse-gepol-point.cpp +++ b/tests/iefpcm/iefpcm_diffuse-gepol-point.cpp @@ -47,11 +47,11 @@ SCENARIO("Test solver for the IEFPCM for a point charge in a spherical diffuse " "environment and a GePol cavity", "[solver][iefpcm][iefpcm_diffuse-gepol-point][anisotropic]") { GIVEN("An isotropic environment modelled as a spherical diffuse permittivity") { - Eigen::Vector3d origin = - (Eigen::Vector3d() << 68.0375, -21.1234, 56.6198).finished(); - double eps1 = 78.39; - double eps2 = 78.39; - double center = 100.0; + Eigen::Vector3d offset; + offset << 10.0, -5.00, 5.00; + double eps1 = 2.0; + double eps2 = 80.0; + double center = 10.0; double width = 5.0; Vacuum<> gf_i; bool symm = true; @@ -59,7 +59,7 @@ SCENARIO("Test solver for the IEFPCM for a point charge in a spherical diffuse " Collocation op; double charge = 8.0; - double totalASC = -charge * (eps1 - 1) / eps1; + double totalASC = -7.8740102704; /*! \class IEFSolver * \test \b pointChargeDiffuseGePol tests IEFSolver using a point charge with a * GePol cavity and a spherical diffuse interface @@ -68,7 +68,7 @@ SCENARIO("Test solver for the IEFPCM for a point charge in a spherical diffuse " */ WHEN("the spherical diffuse layer is centered at the origin and the charge is " "away from the origin") { - Molecule point = dummy<0>(2.929075493, origin); + Molecule point = dummy<0>(2.0, offset); double area = 1.0; double probeRadius = 0.0; double minRadius = 100.0; @@ -80,7 +80,7 @@ SCENARIO("Test solver for the IEFPCM for a point charge in a spherical diffuse " IEFSolver solver(symm); solver.buildSystemMatrix(cavity, gf_i, gf_o, op); int size = cavity.size(); - Eigen::VectorXd fake_mep = computeMEP(cavity.elements(), charge, origin); + Eigen::VectorXd fake_mep = computeMEP(cavity.elements(), charge, offset); for (int i = 0; i < size; ++i) { INFO("fake_mep(" << i << ") = " << fake_mep(i)); } @@ -95,20 +95,20 @@ SCENARIO("Test solver for the IEFPCM for a point charge in a spherical diffuse " CAPTURE(totalASC); CAPTURE(totalFakeASC); CAPTURE(totalASC - totalFakeASC); - REQUIRE(totalASC == Approx(totalFakeASC).epsilon(1.0e-03)); + REQUIRE(totalASC == Approx(totalFakeASC)); } } AND_WHEN("the spherical diffuse layers is centered away from the origin and the " "charge is at the origin") { - Molecule point = dummy<0>(2.929075493); + Molecule point = dummy<0>(2.0); double area = 1.0; double probeRadius = 0.0; double minRadius = 100.0; GePolCavity cavity(point, area, probeRadius, minRadius); int maxL = 5; - SphericalDiffuse<> gf_o(eps1, eps2, width, center, origin, maxL); + SphericalDiffuse<> gf_o(eps1, eps2, width, center, offset, maxL); IEFSolver solver(symm); solver.buildSystemMatrix(cavity, gf_i, gf_o, op); @@ -129,7 +129,7 @@ SCENARIO("Test solver for the IEFPCM for a point charge in a spherical diffuse " CAPTURE(totalASC); CAPTURE(totalFakeASC); CAPTURE(totalASC - totalFakeASC); - REQUIRE(totalASC == Approx(totalFakeASC).epsilon(1.0e-03)); + REQUIRE(totalASC == Approx(totalFakeASC)); } } } From eb79967bae2bd6f9ef00d1f17baff8f7c48093d6 Mon Sep 17 00:00:00 2001 From: Arnfinn Hykkerud Steindal Date: Wed, 7 Feb 2018 13:09:01 +0100 Subject: [PATCH 21/31] Fix MACOSX_RPATH (again) Disappeared in the last merge request. Did `git reset --soft upstream/release/1.Y` without first update branch --- src/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e92895d1c..95d273b3b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -31,6 +31,7 @@ if(NOT STATIC_LIBRARY_ONLY) set_target_properties(pcm-shared PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR} CXX_VISIBILITY_PRESET hidden VISIBILITY_INLINES_HIDDEN 1 + MACOSX_RPATH ON OUTPUT_NAME "pcm" EXPORT_NAME "pcm") From ee44491db38414fb05509c5af1864b6e77835190 Mon Sep 17 00:00:00 2001 From: Luca Frediani Date: Mon, 26 Feb 2018 15:02:02 +0100 Subject: [PATCH 22/31] Cleanup of purisma test --- tests/bi_operators/bi_operators_purisima.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/bi_operators/bi_operators_purisima.cpp b/tests/bi_operators/bi_operators_purisima.cpp index 9db0243ac..52bd0eb9f 100644 --- a/tests/bi_operators/bi_operators_purisima.cpp +++ b/tests/bi_operators/bi_operators_purisima.cpp @@ -34,7 +34,6 @@ #include "bi_operators/Purisima.hpp" #include "cavity/Element.hpp" #include "cavity/GePolCavity.hpp" -#include "green/SphericalDiffuse.hpp" #include "green/UniformDielectric.hpp" #include "green/Vacuum.hpp" #include "utils/MathUtils.hpp" @@ -44,7 +43,6 @@ using bi_operators::Purisima; using cavity::GePolCavity; using green::Vacuum; using green::UniformDielectric; -using green::SphericalDiffuse; SCENARIO( "A collocation integrator with diagonal elements according to Purisima for D", From 9b00a3527a4bc236f478080badb488eb1adbd9b9 Mon Sep 17 00:00:00 2001 From: Luca Frediani Date: Mon, 26 Feb 2018 15:17:47 +0100 Subject: [PATCH 23/31] Added comments to the changelog --- CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b66567608..fae4b43d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,19 @@ ### Added +- Double logarithmic scale for the integration of spherical diffuse + interfaces: much more stable than the previous version, allowing for + RK4 integration and no adaptive integration steps. + +### Fixed + +- Bug in the diffuse interface Green's function. Contrary to the sharp + interface case, it is wrong to remove the monopole, which becomes + identically zero when the corresponding differential equation is + solved in etreme cases (e.g. charge far away from the sphere). + +### Added + - A new CMake module `options_wrappers.cmake` that adds new wrapper macros for the CMake `option` command. From 557fdf2b3560967b52af2386ed30a5aaf8c088d9 Mon Sep 17 00:00:00 2001 From: Arnfinn Date: Mon, 26 Feb 2018 15:20:16 +0100 Subject: [PATCH 24/31] rm debug stuff --- src/interface/Meddle.cpp | 3 --- src/solver/SolverImpl.cpp | 1 - 2 files changed, 4 deletions(-) diff --git a/src/interface/Meddle.cpp b/src/interface/Meddle.cpp index 8bed0295d..def937ef1 100644 --- a/src/interface/Meddle.cpp +++ b/src/interface/Meddle.cpp @@ -115,7 +115,6 @@ void Meddle::CTORBody() { TIMER_ON("Meddle::initStaticSolver"); initStaticSolver(); - // exit(-1); TIMER_OFF("Meddle::initStaticSolver"); if (input_.isDynamic()) { @@ -227,8 +226,6 @@ double pcm::Meddle::computePolarizationEnergy(const char * mep_name, // Dot product of MEP and ASC surface function double energy = functions_[std::string(mep_name)].dot(functions_[std::string(asc_name)]); - std::cout << functions_[std::string(mep_name)] << std::endl; - std::cout << functions_[std::string(asc_name)] << std::endl; return (energy / 2.0); } diff --git a/src/solver/SolverImpl.cpp b/src/solver/SolverImpl.cpp index e2470f2f0..922f5c240 100644 --- a/src/solver/SolverImpl.cpp +++ b/src/solver/SolverImpl.cpp @@ -51,7 +51,6 @@ Eigen::MatrixXd anisotropicTEpsilon(const ICavity & cav, TIMER_OFF("Computing DI"); TIMER_ON("Computing SE"); Eigen::MatrixXd SE = op.computeS(cav, gf_o); - // exit(-1); TIMER_OFF("Computing SE"); TIMER_ON("Computing DE"); Eigen::MatrixXd DE = op.computeD(cav, gf_o); From 759fedab69ac044c5c946a89d2f60ed10a11ea2f Mon Sep 17 00:00:00 2001 From: Arnfinn Date: Mon, 26 Feb 2018 15:45:53 +0100 Subject: [PATCH 25/31] Modifications according to Ronaldos comments exp -> std::exp log -> std::log cite Fosso-Tande throw std::domain_error -> PCMSOLVER_ERROR --- doc/pcmsolver.bib | 10 +++ src/green/InterfacesImpl.hpp | 20 ++--- src/green/SphericalDiffuse.cpp | 12 +-- src/green/dielectric_profile/OneLayerLog.hpp | 93 ++++++++++---------- 4 files changed, 74 insertions(+), 61 deletions(-) diff --git a/doc/pcmsolver.bib b/doc/pcmsolver.bib index 69c7b982c..5c600c16a 100644 --- a/doc/pcmsolver.bib +++ b/doc/pcmsolver.bib @@ -329,3 +329,13 @@ @ARTICLE{Allinger1994-tx doi = "10.1016/S0166-1280(09)80008-0" } +@article{Fosso-Tande2013, +title = "Implicit solvation models in a multiresolution multiwavelet basis", +journal = "Chemical Physics Letters", +volume = "561-562", +pages = "179--184", +year = "2013", +issn = "0009-2614", +doi = "https://doi.org/10.1016/j.cplett.2013.01.065", +author = "Jacob Fosso-Tande and Robert J. Harrison" +} \ No newline at end of file diff --git a/src/green/InterfacesImpl.hpp b/src/green/InterfacesImpl.hpp index 88693ff6b..f1ecea276 100644 --- a/src/green/InterfacesImpl.hpp +++ b/src/green/InterfacesImpl.hpp @@ -116,10 +116,10 @@ class LnTransformedRadial { void operator()(const StateType & rho, StateType & drhodr, const double y) { // Evaluate the dielectric profile double eps = 0.0, epsPrime = 0.0; - pcm::tie(eps, epsPrime) = eval_(exp(y)); + pcm::tie(eps, epsPrime) = eval_(std::exp(y)); if (utils::numericalZero(eps)) - throw std::domain_error("Division by zero!"); - double gamma_epsilon = exp(y) * epsPrime / eps; + PCMSOLVER_ERROR("Division by zero!"); + double gamma_epsilon = std::exp(y) * epsPrime / eps; // System of equations is defined here drhodr[0] = rho[1]; drhodr[1] = -rho[1] * (rho[1] + 1.0 + gamma_epsilon) + l_ * (l_ + 1); @@ -251,13 +251,13 @@ template class Zeta __final { * the asymptotic form L*y in point. */ double function_impl(double point) const { - double zeta = 0.0; - if (point <= y_0_) { - zeta = L_ * point; - } else { - zeta = utils::splineInterpolation(point, function_[0], function_[1]); - } - return zeta; + double zeta = 0.0; + if (point <= y_0_) { + zeta = L_ * point; + } else { + zeta = utils::splineInterpolation(point, function_[0], function_[1]); + } + return zeta; } /*! \brief Returns value of 1st derivative of function at given point * \param[in] point evaluation point diff --git a/src/green/SphericalDiffuse.cpp b/src/green/SphericalDiffuse.cpp index f69905fe2..799433b06 100644 --- a/src/green/SphericalDiffuse.cpp +++ b/src/green/SphericalDiffuse.cpp @@ -248,8 +248,8 @@ void SphericalDiffuse::initSphericalDiffuse() { double r_infinity_ = this->profile_.upperLimit() + 30.0; /*! Upper bound of the integration interval */ - double y_0_ = log(r_0_); - double y_infinity_ = log(r_infinity_); + double y_0_ = std::log(r_0_); + double y_infinity_ = std::log(r_infinity_); double relative_width = this->profile_.relativeWidth(); double observer_step_ = 1.0e-2 * relative_width; /*! Time step between observer calls */ @@ -302,8 +302,8 @@ double SphericalDiffuse::imagePotentialComponent_impl( /* Zeta and Omega are now on a logarithmic scale We need to pass the arguments in the correct scale and then use the chain rule to get the proper derivative */ - double y1 = log(r1); - double y2 = log(r2); + double y1 = std::log(r1); + double y2 = std::log(r2); /* Sample zeta_[L] */ double zeta1 = 0.0, zeta2 = 0.0, d_zeta2 = 0.0; @@ -351,8 +351,8 @@ double SphericalDiffuse::coefficient_impl( double r1 = (sp + this->origin_).norm(); double r2 = (pp + this->origin_).norm(); - double y1 = log(r1); - double y2 = log(r2); + double y1 = std::log(r1); + double y2 = std::log(r2); /* Sample zetaC_ */ double zeta1 = 0.0, zeta2 = 0.0, d_zeta2 = 0.0; diff --git a/src/green/dielectric_profile/OneLayerLog.hpp b/src/green/dielectric_profile/OneLayerLog.hpp index 278e25012..fef64ad26 100644 --- a/src/green/dielectric_profile/OneLayerLog.hpp +++ b/src/green/dielectric_profile/OneLayerLog.hpp @@ -32,7 +32,8 @@ /*! \file OneLayerLog.hpp * \class OneLayerLog - * \brief A dielectric profile based on the Harrison and Fosso-Tande work + * \brief A dielectric profile based on the Harrison and Fosso-Tande work \cite + * Fosso-Tande2013 * \author Luca Frediani * \date 2017 */ @@ -58,51 +59,53 @@ class OneLayerLog { /*! Returns value of dielectric profile at given point * \param[in] point where to evaluate the profile */ - double value(double point) const { - double epsLog = std::log(epsilon2_/epsilon1_); - double val = (1.0 + boost::math::erf((point - center_) / width_)) / 2.0; - double retval = epsilon1_ * std::exp(epsLog * val); // epsilon(r) - return retval; - } - /*! Returns value of derivative of dielectric profile at given point - * \param[in] point where to evaluate the derivative - */ - double derivative(double point) const { - double functionValue = value(point); - double epsLog = std::log(epsilon2_/epsilon1_); - double factor = epsLog / (width_ * std::sqrt(M_PI) ); - double t = (point - center_) / width_; - double val = std::exp(-std::pow(t, 2)); - return functionValue * factor * val; // first derivative of epsilon(r) - } - std::ostream & printObject(std::ostream & os) { - os << "Profile functional form: log" << std::endl; - os << "Permittivity left/inside = " << epsilon1_ << std::endl; - os << "Permittivity right/outside = " << epsilon2_ << std::endl; - os << "Profile width = " << width_ << " AU" << std::endl; - os << "Profile center = " << center_ << " AU"; - return os; - } - + double value(double point) const { + double epsLog = std::log(epsilon2_ / epsilon1_); + double val = (1.0 + boost::math::erf((point - center_) / width_)) / 2.0; + double retval = epsilon1_ * std::exp(epsLog * val); // epsilon(r) + return retval; + } + /*! Returns value of derivative of dielectric profile at given point + * \param[in] point where to evaluate the derivative + */ + double derivative(double point) const { + double functionValue = value(point); + double epsLog = std::log(epsilon2_ / epsilon1_); + double factor = epsLog / (width_ * std::sqrt(M_PI)); + double t = (point - center_) / width_; + double val = std::exp(-std::pow(t, 2)); + return functionValue * factor * val; // first derivative of epsilon(r) + } + std::ostream & printObject(std::ostream & os) { + os << "Profile functional form: log" << std::endl; + os << "Permittivity left/inside = " << epsilon1_ << std::endl; + os << "Permittivity right/outside = " << epsilon2_ << std::endl; + os << "Profile width = " << width_ << " AU" << std::endl; + os << "Profile center = " << center_ << " AU"; + return os; + } + public: - OneLayerLog() {} - OneLayerLog(double e1, double e2, double w, double c) - : epsilon1_(e1), - epsilon2_(e2), - width_(w / 6.0), - center_(c), - domain_(std::make_pair(0.0, center_ + 12.0 * width_)){} - /*! Returns a tuple holding the permittivity and its derivative - * \param[in] r evaluation point - */ - pcm::tuple operator()(const double r) const { - return pcm::make_tuple(value(r), derivative(r)); - } - double upperLimit() const { return domain_.second; } - double relativeWidth() const { return width_ / std::abs(domain_.second - domain_.first); } - friend std::ostream & operator<<(std::ostream & os, OneLayerLog & th) { - return th.printObject(os); - } + OneLayerLog() {} + OneLayerLog(double e1, double e2, double w, double c) + : epsilon1_(e1), + epsilon2_(e2), + width_(w / 6.0), + center_(c), + domain_(std::make_pair(0.0, center_ + 12.0 * width_)) {} + /*! Returns a tuple holding the permittivity and its derivative + * \param[in] r evaluation point + */ + pcm::tuple operator()(const double r) const { + return pcm::make_tuple(value(r), derivative(r)); + } + double upperLimit() const { return domain_.second; } + double relativeWidth() const { + return width_ / std::abs(domain_.second - domain_.first); + } + friend std::ostream & operator<<(std::ostream & os, OneLayerLog & th) { + return th.printObject(os); + } }; } // namespace dielectric_profile } // namespace pcm From 880fd490cefb6a54660a21e0e9590f6d27ee0349 Mon Sep 17 00:00:00 2001 From: Arnfinn Date: Mon, 26 Feb 2018 15:58:22 +0100 Subject: [PATCH 26/31] clang-format on some files --- src/green/GreensFunction.hpp | 3 +- src/green/SphericalDiffuse.cpp | 37 +++--- src/green/SphericalDiffuse.hpp | 3 +- src/green/dielectric_profile/OneLayerErf.hpp | 6 +- src/green/dielectric_profile/OneLayerTanh.hpp | 4 +- src/interface/Meddle.hpp | 1 - .../bi_operators/bi_operators_collocation.cpp | 4 +- tests/dielectric_profile/one_layer.cpp | 116 +++++++++--------- tests/iefpcm/iefpcm_diffuse-gepol-point.cpp | 4 +- 9 files changed, 91 insertions(+), 87 deletions(-) diff --git a/src/green/GreensFunction.hpp b/src/green/GreensFunction.hpp index 254eceeda..c52fcaacb 100644 --- a/src/green/GreensFunction.hpp +++ b/src/green/GreensFunction.hpp @@ -143,7 +143,6 @@ class GreensFunction : public IGreensFunction { } protected: - /*! Evaluates the Green's function given a pair of points * \param[in] source the source point * \param[in] probe the probe point @@ -169,7 +168,7 @@ class GreensFunction : public IGreensFunction { pp[0] = p2(0); pp[1] = p2(1); pp[2] = p2(2); - return this->operator()(sp, pp)[0]; + return this->operator()(sp, pp)[0]; } virtual std::ostream & printObject(std::ostream & os) __override { diff --git a/src/green/SphericalDiffuse.cpp b/src/green/SphericalDiffuse.cpp index 799433b06..95fd458a7 100644 --- a/src/green/SphericalDiffuse.cpp +++ b/src/green/SphericalDiffuse.cpp @@ -245,13 +245,14 @@ void SphericalDiffuse::initSphericalDiffuse() { double factor_x_ = 0.0; /*! Weight of the state */ double factor_dxdt_ = 0.0; /*! Weight of the state derivative */ double r_0_ = 0.1; /*! Lower bound of the integration interval */ - double r_infinity_ = - this->profile_.upperLimit() + 30.0; /*! Upper bound of the integration interval */ - + double r_infinity_ = this->profile_.upperLimit() + + 30.0; /*! Upper bound of the integration interval */ + double y_0_ = std::log(r_0_); double y_infinity_ = std::log(r_infinity_); double relative_width = this->profile_.relativeWidth(); - double observer_step_ = 1.0e-2 * relative_width; /*! Time step between observer calls */ + double observer_step_ = + 1.0e-2 * relative_width; /*! Time step between observer calls */ IntegratorParameters params_(eps_abs_, eps_rel_, @@ -263,8 +264,10 @@ void SphericalDiffuse::initSphericalDiffuse() { ProfileEvaluator eval_ = pcm::bind(&ProfilePolicy::operator(), this->profile_, pcm::_1); - zetaC_ = RadialFunction (maxLC_, y_0_, y_infinity_, eval_, params_); - omegaC_ = RadialFunction(maxLC_, y_0_, y_infinity_, eval_, params_); + zetaC_ = RadialFunction( + maxLC_, y_0_, y_infinity_, eval_, params_); + omegaC_ = RadialFunction( + maxLC_, y_0_, y_infinity_, eval_, params_); zeta_.reserve(maxLGreen_ + 1); omega_.reserve(maxLGreen_ + 1); for (int L = 0; L <= maxLGreen_; ++L) { @@ -300,8 +303,8 @@ double SphericalDiffuse::imagePotentialComponent_impl( double pl_x = Legendre::Pn(L, cos_gamma); /* Zeta and Omega are now on a logarithmic scale We need to pass the - arguments in the correct scale and then use the chain rule to get - the proper derivative */ + arguments in the correct scale and then use the chain rule to get + the proper derivative */ double y1 = std::log(r1); double y2 = std::log(r2); @@ -403,15 +406,15 @@ template class SphericalDiffuse; using dielectric_profile::OneLayerLog; template class SphericalDiffuse; - /* - FIXME: the numerical integration in logarithmic scale requires a step - size dependent on the width of the profile (there are two for a - membrane) and the distance of it from the oringin (center of the - sphere). This requires some thinking to do it correctly - - using dielectric_profile::MembraneTanh; - template class SphericalDiffuse; - */ +/* + FIXME: the numerical integration in logarithmic scale requires a step + size dependent on the width of the profile (there are two for a + membrane) and the distance of it from the oringin (center of the + sphere). This requires some thinking to do it correctly + + using dielectric_profile::MembraneTanh; + template class SphericalDiffuse; +*/ } // namespace green } // namespace pcm diff --git a/src/green/SphericalDiffuse.hpp b/src/green/SphericalDiffuse.hpp index 17a780e80..3dd16ad2f 100644 --- a/src/green/SphericalDiffuse.hpp +++ b/src/green/SphericalDiffuse.hpp @@ -42,8 +42,8 @@ class Element; #include "InterfacesImpl.hpp" #include "dielectric_profile/MembraneTanh.hpp" #include "dielectric_profile/OneLayerErf.hpp" -#include "dielectric_profile/OneLayerTanh.hpp" #include "dielectric_profile/OneLayerLog.hpp" +#include "dielectric_profile/OneLayerTanh.hpp" namespace pcm { namespace green { @@ -206,7 +206,6 @@ class SphericalDiffuse __final : public GreensFunction { void toFile(const std::string & prefix = ""); EIGEN_MAKE_ALIGNED_OPERATOR_NEW private: - /*! Evaluates the Green's function given a pair of points * \param[in] sp the source point * \param[in] pp the probe point diff --git a/src/green/dielectric_profile/OneLayerErf.hpp b/src/green/dielectric_profile/OneLayerErf.hpp index eef4851b0..e5cbbe56e 100644 --- a/src/green/dielectric_profile/OneLayerErf.hpp +++ b/src/green/dielectric_profile/OneLayerErf.hpp @@ -111,11 +111,13 @@ class OneLayerErf { /*! Returns a tuple holding the permittivity and its derivative * \param[in] r evaluation point */ - pcm::tuple operator()(const double r) const { + pcm::tuple operator()(const double r) const { return pcm::make_tuple(value(r), derivative(r)); } double upperLimit() const { return domain_.second; } - double relativeWidth() const { return width_ / std::abs(domain_.second - domain_.first); } + double relativeWidth() const { + return width_ / std::abs(domain_.second - domain_.first); + } friend std::ostream & operator<<(std::ostream & os, OneLayerErf & th) { return th.printObject(os); } diff --git a/src/green/dielectric_profile/OneLayerTanh.hpp b/src/green/dielectric_profile/OneLayerTanh.hpp index 2c7722500..f73bd39b5 100644 --- a/src/green/dielectric_profile/OneLayerTanh.hpp +++ b/src/green/dielectric_profile/OneLayerTanh.hpp @@ -113,7 +113,9 @@ class OneLayerTanh { return pcm::make_tuple(value(r), derivative(r)); } double upperLimit() const { return domain_.second; } - double relativeWidth() const { return width_ / std::abs(domain_.second - domain_.first); } + double relativeWidth() const { + return width_ / std::abs(domain_.second - domain_.first); + } friend std::ostream & operator<<(std::ostream & os, OneLayerTanh & th) { return th.printObject(os); } diff --git a/src/interface/Meddle.hpp b/src/interface/Meddle.hpp index 553df8645..746bb23af 100644 --- a/src/interface/Meddle.hpp +++ b/src/interface/Meddle.hpp @@ -71,7 +71,6 @@ void print(const PCMInput &); */ class PCMSolver_API Meddle __final { public: - /*! \brief CTOR from Input object * \param[in] input an Input object * \param[in] writer the global HostWriter object diff --git a/tests/bi_operators/bi_operators_collocation.cpp b/tests/bi_operators/bi_operators_collocation.cpp index ac3b390c1..7088f0134 100644 --- a/tests/bi_operators/bi_operators_collocation.cpp +++ b/tests/bi_operators/bi_operators_collocation.cpp @@ -50,8 +50,8 @@ SCENARIO("A collocation integrator with approximate diagonal elements", "[bi_operators][bi_operators_collocation]") { GIVEN("A GePol cavity for a single sphere in the origin") { double radius = 1.44; - Eigen::Vector3d offset; - offset << 1.0, 2.0, 3.0; + Eigen::Vector3d offset; + offset << 1.0, 2.0, 3.0; Molecule molec = dummy<0>(1.44 / bohrToAngstrom(), offset); double area = 10.0; GePolCavity cavity = GePolCavity(molec, area, 0.0, 100.0); diff --git a/tests/dielectric_profile/one_layer.cpp b/tests/dielectric_profile/one_layer.cpp index 964025853..6c8faa4dd 100644 --- a/tests/dielectric_profile/one_layer.cpp +++ b/tests/dielectric_profile/one_layer.cpp @@ -33,8 +33,8 @@ #include #include "green/dielectric_profile/OneLayerErf.hpp" -#include "green/dielectric_profile/OneLayerTanh.hpp" #include "green/dielectric_profile/OneLayerLog.hpp" +#include "green/dielectric_profile/OneLayerTanh.hpp" double tanh_value(double point, double e1, double e2, double w, double c); double tanh_deriv(double point, double e1, double e2, double w, double c); @@ -56,46 +56,46 @@ SCENARIO("Diffuse permittivity single layers", "[dielectric_profile][one_layer]" double eps2 = 1.0; double center = 15.0; double width = 10.0; - double step = 0.5; - int nPoints = 61; + double step = 0.5; + int nPoints = 61; /*! \class OneLayerTanh * \test \b TanhOneLayerTest tests the evaluation of the one layer hyperbolic * tangent profile against the analytic value */ WHEN("the sigmoidal profile is modelled by the hyperbolic tangent function") { - OneLayerTanh diffuse(eps1, eps2, width, center); - THEN("the value of the dielectric profile and its derivative on a grid are") { - for (int i = 0; i < nPoints; i ++) { - double point = step * i; - double value = 0.0, deriv = 0.0; - double analytic = tanh_value(point, eps1, eps2, width, center); - double analyticDeriv = tanh_deriv(point, eps1, eps2, width, center); - pcm::tie(value, deriv) = diffuse(point); - INFO(" The evaluation point is: " << point); - REQUIRE(value == Approx(analytic)); - REQUIRE(deriv == Approx(analyticDeriv)); - } - } - } + OneLayerTanh diffuse(eps1, eps2, width, center); + THEN("the value of the dielectric profile and its derivative on a grid are") { + for (int i = 0; i < nPoints; i++) { + double point = step * i; + double value = 0.0, deriv = 0.0; + double analytic = tanh_value(point, eps1, eps2, width, center); + double analyticDeriv = tanh_deriv(point, eps1, eps2, width, center); + pcm::tie(value, deriv) = diffuse(point); + INFO(" The evaluation point is: " << point); + REQUIRE(value == Approx(analytic)); + REQUIRE(deriv == Approx(analyticDeriv)); + } + } + } /*! \class OneLayerErf * \test \b TanhOneLayerTest tests the evaluation of the one layer hyperbolic * tangent profile against the analytic value */ WHEN("the sigmoidal profile is modelled by the error function") { - OneLayerErf diffuse(eps1, eps2, width, center); - THEN("the value of the dielectric profile and its derivative on a grid are") { - for (int i = 0; i < nPoints; i ++) { - double point = step * i; - double value = 0.0, deriv = 0.0; - double analytic = erf_value(point, eps1, eps2, width, center); - double analyticDeriv = erf_deriv(point, eps1, eps2, width, center); - pcm::tie(value, deriv) = diffuse(point); - INFO(" The evaluation point is: " << point); - REQUIRE(value == Approx(analytic)); - REQUIRE(deriv == Approx(analyticDeriv)); - } - } - } + OneLayerErf diffuse(eps1, eps2, width, center); + THEN("the value of the dielectric profile and its derivative on a grid are") { + for (int i = 0; i < nPoints; i++) { + double point = step * i; + double value = 0.0, deriv = 0.0; + double analytic = erf_value(point, eps1, eps2, width, center); + double analyticDeriv = erf_deriv(point, eps1, eps2, width, center); + pcm::tie(value, deriv) = diffuse(point); + INFO(" The evaluation point is: " << point); + REQUIRE(value == Approx(analytic)); + REQUIRE(deriv == Approx(analyticDeriv)); + } + } + } /*! \class OneLayerLog * \test \b LogOneLayerTest tests the evaluation of the one layer logarithmic @@ -103,19 +103,19 @@ SCENARIO("Diffuse permittivity single layers", "[dielectric_profile][one_layer]" */ WHEN("the sigmoidal profile is modelled by the lograrithmic function") { OneLayerLog diffuse(eps1, eps2, width, center); - THEN("the value of the dielectric profile and its derivative on a grid are") { - for (int i = 0; i < nPoints; i ++) { - double point = step * i; - double value = 0.0, deriv = 0.0; - double analytic = log_value(point, eps1, eps2, width, center); - double analyticDeriv = log_deriv(point, eps1, eps2, width, center); - pcm::tie(value, deriv) = diffuse(point); - INFO(" The evaluation point is: " << point); - REQUIRE(value == Approx(analytic)); - REQUIRE(deriv == Approx(analyticDeriv)); - } - } - } + THEN("the value of the dielectric profile and its derivative on a grid are") { + for (int i = 0; i < nPoints; i++) { + double point = step * i; + double value = 0.0, deriv = 0.0; + double analytic = log_value(point, eps1, eps2, width, center); + double analyticDeriv = log_deriv(point, eps1, eps2, width, center); + pcm::tie(value, deriv) = diffuse(point); + INFO(" The evaluation point is: " << point); + REQUIRE(value == Approx(analytic)); + REQUIRE(deriv == Approx(analyticDeriv)); + } + } + } } } @@ -150,22 +150,22 @@ double erf_deriv(double point, double e1, double e2, double w, double c) { return (factor * val); } - double log_value(double point, double e1, double e2, double w, double c) { - w /= 6.0; - double epsLog = std::log(e2/e1); - double val = (1.0 + boost::math::erf((point - c) / w)) / 2.0; - double retval = e1 * std::exp(epsLog * val); // epsilon(r) - return retval; - } +double log_value(double point, double e1, double e2, double w, double c) { + w /= 6.0; + double epsLog = std::log(e2 / e1); + double val = (1.0 + boost::math::erf((point - c) / w)) / 2.0; + double retval = e1 * std::exp(epsLog * val); // epsilon(r) + return retval; +} double log_deriv(double point, double e1, double e2, double w, double c) { - double functionValue = log_value(point, e1, e2, w, c); - w /= 6.0; - double epsLog = std::log(e2/e1); - double factor = epsLog / (w * std::sqrt(M_PI) ); - double t = (point - c) / w; - double val = std::exp(-std::pow(t, 2)); - return functionValue * factor * val; // first derivative of epsilon(r) + double functionValue = log_value(point, e1, e2, w, c); + w /= 6.0; + double epsLog = std::log(e2 / e1); + double factor = epsLog / (w * std::sqrt(M_PI)); + double t = (point - c) / w; + double val = std::exp(-std::pow(t, 2)); + return functionValue * factor * val; // first derivative of epsilon(r) } double distribution(double fMin, double fMax) { diff --git a/tests/iefpcm/iefpcm_diffuse-gepol-point.cpp b/tests/iefpcm/iefpcm_diffuse-gepol-point.cpp index 37116292a..e816e30b9 100644 --- a/tests/iefpcm/iefpcm_diffuse-gepol-point.cpp +++ b/tests/iefpcm/iefpcm_diffuse-gepol-point.cpp @@ -47,8 +47,8 @@ SCENARIO("Test solver for the IEFPCM for a point charge in a spherical diffuse " "environment and a GePol cavity", "[solver][iefpcm][iefpcm_diffuse-gepol-point][anisotropic]") { GIVEN("An isotropic environment modelled as a spherical diffuse permittivity") { - Eigen::Vector3d offset; - offset << 10.0, -5.00, 5.00; + Eigen::Vector3d offset; + offset << 10.0, -5.00, 5.00; double eps1 = 2.0; double eps2 = 80.0; double center = 10.0; From d6fa8c78596804cf298e97ce7d857d41dcc0635b Mon Sep 17 00:00:00 2001 From: Arnfinn Date: Tue, 27 Feb 2018 14:29:03 +0100 Subject: [PATCH 27/31] fixed some issues --- CHANGELOG.md | 4 +-- src/green/Green.hpp | 1 - src/green/InterfacesImpl.hpp | 20 ++--------- src/green/SphericalDiffuse.cpp | 20 +---------- src/green/SphericalDiffuse.hpp | 39 +-------------------- src/green/dielectric_profile/CMakeLists.txt | 1 - tests/dielectric_profile/one_layer.cpp | 2 +- tests/green/CMakeLists.txt | 1 + tests/green/green_spherical_diffuse.cpp | 2 -- tests/iefpcm/CMakeLists.txt | 1 + 10 files changed, 9 insertions(+), 82 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fae4b43d2..c966ced1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,14 +6,14 @@ - Double logarithmic scale for the integration of spherical diffuse interfaces: much more stable than the previous version, allowing for - RK4 integration and no adaptive integration steps. + Runge-Kutta 4 integrator. ### Fixed - Bug in the diffuse interface Green's function. Contrary to the sharp interface case, it is wrong to remove the monopole, which becomes identically zero when the corresponding differential equation is - solved in etreme cases (e.g. charge far away from the sphere). + solved in extreme cases (e.g. charge far away from the sphere). ### Added diff --git a/src/green/Green.hpp b/src/green/Green.hpp index 2f01acdc1..3fbbbb8f5 100644 --- a/src/green/Green.hpp +++ b/src/green/Green.hpp @@ -33,7 +33,6 @@ #include "SphericalDiffuse.hpp" #include "UniformDielectric.hpp" #include "Vacuum.hpp" -#include "dielectric_profile/MembraneTanh.hpp" #include "dielectric_profile/OneLayerErf.hpp" #include "dielectric_profile/OneLayerTanh.hpp" #include "utils/Factory.hpp" diff --git a/src/green/InterfacesImpl.hpp b/src/green/InterfacesImpl.hpp index f1ecea276..cba73d62b 100644 --- a/src/green/InterfacesImpl.hpp +++ b/src/green/InterfacesImpl.hpp @@ -57,32 +57,16 @@ typedef pcm::function(const double)> ProfileEvaluator * \brief holds parameters for the integrator */ struct IntegratorParameters { - /*! Absolute tolerance level */ - double eps_abs_; - /*! Relative tolerance level */ - double eps_rel_; - /*! Weight of the state */ - double factor_x_; - /*! Weight of the state derivative */ - double factor_dxdt_; /*! Lower bound of the integration interval */ double r_0_; /*! Upper bound of the integration interval */ double r_infinity_; /*! Time step between observer calls */ double observer_step_; - IntegratorParameters(double e_abs, - double e_rel, - double f_x, - double f_dxdt, - double r0, + IntegratorParameters(double r0, double rinf, double step) - : eps_abs_(e_abs), - eps_rel_(e_rel), - factor_x_(f_x), - factor_dxdt_(f_dxdt), - r_0_(r0), + : r_0_(r0), r_infinity_(rinf), observer_step_(step) {} }; diff --git a/src/green/SphericalDiffuse.cpp b/src/green/SphericalDiffuse.cpp index 95fd458a7..78453ab7a 100644 --- a/src/green/SphericalDiffuse.cpp +++ b/src/green/SphericalDiffuse.cpp @@ -240,10 +240,6 @@ void SphericalDiffuse::initSphericalDiffuse() { using namespace detail; // Parameters for the numerical solution of the radial differential equation - double eps_abs_ = 1.0e-10; /*! Absolute tolerance level */ - double eps_rel_ = 1.0e-06; /*! Relative tolerance level */ - double factor_x_ = 0.0; /*! Weight of the state */ - double factor_dxdt_ = 0.0; /*! Weight of the state derivative */ double r_0_ = 0.1; /*! Lower bound of the integration interval */ double r_infinity_ = this->profile_.upperLimit() + 30.0; /*! Upper bound of the integration interval */ @@ -254,11 +250,7 @@ void SphericalDiffuse::initSphericalDiffuse() { double observer_step_ = 1.0e-2 * relative_width; /*! Time step between observer calls */ - IntegratorParameters params_(eps_abs_, - eps_rel_, - factor_x_, - factor_dxdt_, - y_0_, + IntegratorParameters params_(y_0_, y_infinity_, observer_step_); ProfileEvaluator eval_ = @@ -406,15 +398,5 @@ template class SphericalDiffuse; using dielectric_profile::OneLayerLog; template class SphericalDiffuse; -/* - FIXME: the numerical integration in logarithmic scale requires a step - size dependent on the width of the profile (there are two for a - membrane) and the distance of it from the oringin (center of the - sphere). This requires some thinking to do it correctly - - using dielectric_profile::MembraneTanh; - template class SphericalDiffuse; -*/ - } // namespace green } // namespace pcm diff --git a/src/green/SphericalDiffuse.hpp b/src/green/SphericalDiffuse.hpp index 3dd16ad2f..95eaa261f 100644 --- a/src/green/SphericalDiffuse.hpp +++ b/src/green/SphericalDiffuse.hpp @@ -40,7 +40,6 @@ class Element; #include "GreenData.hpp" #include "GreensFunction.hpp" #include "InterfacesImpl.hpp" -#include "dielectric_profile/MembraneTanh.hpp" #include "dielectric_profile/OneLayerErf.hpp" #include "dielectric_profile/OneLayerLog.hpp" #include "dielectric_profile/OneLayerTanh.hpp" @@ -71,12 +70,7 @@ class SphericalDiffuse __final : public GreensFunction { * \param[in] c center of the diffuse layer * \param[in] o center of the sphere * \param[in] l maximum value of angular momentum - * \note For SFINAE to work correctly, this constructor **must be** in the header - * file. */ - template ::value>::type> SphericalDiffuse(double e1, double e2, double w, @@ -89,38 +83,7 @@ class SphericalDiffuse __final : public GreensFunction { maxLC_(2 * l) { initSphericalDiffuse(); } - /*! Constructor for a two-layer interface (membrane) - * \param[in] e1 left-side dielectric constant - * \param[in] e2 middle portion dielectric constant - * \param[in] e3 right-side dielectric constant - * \param[in] w12 width of the first interface layer - * \param[in] w23 width of the second interface layer - * \param[in] c12 center of the first diffuse layer - * \param[in] c23 center of the second diffuse layer - * \param[in] o center of the sphere - * \param[in] l maximum value of angular momentum - * \note For SFINAE to work correctly, this constructor **must be** in the header - * file. - */ - template ::value>::type> - SphericalDiffuse(double e1, - double e2, - double e3, - double w12, - double w23, - double c12, - double c23, - const Eigen::Vector3d & o, - int l) - : GreensFunction( - ProfilePolicy(e1, e2, e3, w12, w23, c12, c23)), - origin_(o), - maxLGreen_(l), - maxLC_(2 * l) { - initSphericalDiffuse(); - } + virtual ~SphericalDiffuse() {} virtual double permittivity() const __override __final { diff --git a/src/green/dielectric_profile/CMakeLists.txt b/src/green/dielectric_profile/CMakeLists.txt index e74642d7b..e945e4143 100644 --- a/src/green/dielectric_profile/CMakeLists.txt +++ b/src/green/dielectric_profile/CMakeLists.txt @@ -1,7 +1,6 @@ # List of headers list(APPEND headers_list Anisotropic.hpp -MembraneTanh.hpp Metal.hpp OneLayerErf.hpp OneLayerLog.hpp diff --git a/tests/dielectric_profile/one_layer.cpp b/tests/dielectric_profile/one_layer.cpp index 6c8faa4dd..1907a2803 100644 --- a/tests/dielectric_profile/one_layer.cpp +++ b/tests/dielectric_profile/one_layer.cpp @@ -153,7 +153,7 @@ double erf_deriv(double point, double e1, double e2, double w, double c) { double log_value(double point, double e1, double e2, double w, double c) { w /= 6.0; double epsLog = std::log(e2 / e1); - double val = (1.0 + boost::math::erf((point - c) / w)) / 2.0; + double val = (1.0 + pcm::erf((point - c) / w)) / 2.0; double retval = e1 * std::exp(epsLog * val); // epsilon(r) return retval; } diff --git a/tests/green/CMakeLists.txt b/tests/green/CMakeLists.txt index 1e5815ba2..c86334323 100644 --- a/tests/green/CMakeLists.txt +++ b/tests/green/CMakeLists.txt @@ -5,6 +5,7 @@ endif() # green_spherical_diffuse.cpp test add_Catch_test(green_spherical_diffuse "green;green_spherical_diffuse") +set_tests_properties(green_spherical_diffuse PROPERTIES COST 100.0) # green_vacuum.cpp test add_Catch_test(green_vacuum "green;green_vacuum") diff --git a/tests/green/green_spherical_diffuse.cpp b/tests/green/green_spherical_diffuse.cpp index ed75dd76e..17ea120de 100644 --- a/tests/green/green_spherical_diffuse.cpp +++ b/tests/green/green_spherical_diffuse.cpp @@ -32,7 +32,6 @@ #include "green/DerivativeTypes.hpp" #include "green/SphericalDiffuse.hpp" -#include "green/dielectric_profile/MembraneTanh.hpp" #include "green/dielectric_profile/OneLayerErf.hpp" #include "green/dielectric_profile/OneLayerTanh.hpp" @@ -40,7 +39,6 @@ using namespace pcm; using green::SphericalDiffuse; using dielectric_profile::OneLayerErf; using dielectric_profile::OneLayerTanh; -using dielectric_profile::MembraneTanh; SCENARIO("Evaluation of the spherical diffuse Green's function and its derivatives", "[green][green_spherical_diffuse]") { diff --git a/tests/iefpcm/CMakeLists.txt b/tests/iefpcm/CMakeLists.txt index a70a364b4..4eaee936b 100644 --- a/tests/iefpcm/CMakeLists.txt +++ b/tests/iefpcm/CMakeLists.txt @@ -11,6 +11,7 @@ add_Catch_test(iefpcm_anisotropic-symmetry "solver;iefpcm;iefpcm_anisotropic-sym # iefpcm_diffuse-gepol-point.cpp test add_Catch_test(iefpcm_diffuse-gepol-point "solver;iefpcm;iefpcm_diffuse-gepol-point;anisotropic") +set_tests_properties(iefpcm_diffuse-gepol-point PROPERTIES COST 200.0) # iefpcm_gepol-point.cpp test add_Catch_test(iefpcm_gepol-point "solver;iefpcm;iefpcm_gepol-point") From 08f99ed0e87cd6577a19d59051b073c30d7276e2 Mon Sep 17 00:00:00 2001 From: Arnfinn Date: Tue, 27 Feb 2018 14:50:38 +0100 Subject: [PATCH 28/31] fixed doc for Profile --- doc/code-reference/greens-functions.rst | 15 ++++----------- doc/users/input.rst | 6 +++--- tools/pcmsolver.py.in | 4 ++-- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/doc/code-reference/greens-functions.rst b/doc/code-reference/greens-functions.rst index b94ee8cd4..9ee6f3eff 100644 --- a/doc/code-reference/greens-functions.rst +++ b/doc/code-reference/greens-functions.rst @@ -7,19 +7,12 @@ Green's functions objects relies on the Factory Method pattern :cite:`Gamma1994,Alexandrescu2001`, implemented through the generic Factory class. -The top-level header, _i.e._ to be included in client code, is `Green.hpp`. -The common interface to all Green's function classes is specified by the `IGreensFunction` class, +The top-level header, _i.e._ to be included in client code, is ``Green.hpp``. +The common interface to all Green's function classes is specified by the ``IGreensFunction`` class, this is non-templated. -All other classes are templated. TODO: explain template parameters. +All other classes are templated. The Green's functions are registered to the factory based on a label encoding: type, derivative, and dielectric profile. -The only allowed labels are: -- `VACUUM_NUMERICAL` -- `VACUUM_DERIVATIVE` -- `VACUMM_GRADIENT` -- `VACUUM_HESSIAN` - -- `SPHERICALDIFFUSE_TANH` -- `SPHERICALDIFFUSE_ERF` +The only allowed labels must be listed in ``src/green/Green.hpp``. If they are not, they can not be selected at run time. .. image:: ../gfx/green.png :scale: 70 % diff --git a/doc/users/input.rst b/doc/users/input.rst index cac3d1001..e20ee3980 100644 --- a/doc/users/input.rst +++ b/doc/users/input.rst @@ -363,13 +363,13 @@ while the Green's function outside might vary. * **Valid values**: :math:`\varepsilon \geq 1.0` * **Default**: 1.0 - Profile + Profile Functional form of the dielectric profile * **Type**: string - * **Valid values**: Tanh | Erf + * **Valid values**: Tanh | Erf | Log * **Valid for**: SphericalDiffuse - * **Default**: Tanh + * **Default**: Log Eps1 Static dielectric permittivity inside the interface diff --git a/tools/pcmsolver.py.in b/tools/pcmsolver.py.in index addd8165b..3cfaea663 100644 --- a/tools/pcmsolver.py.in +++ b/tools/pcmsolver.py.in @@ -374,8 +374,8 @@ def setup_keywords(): # Dielectric profile type # Valid for: SPHERICALDIFFUSE # Valid values: TANH, ERF, LOG - # Default: TANH - green.add_kw('PROFILE', 'STR', 'TANH') + # Default: LOG + green.add_kw('PROFILE', 'STR', 'LOG') # Static dielectric permittivity inside the interface # Valid for: SPHERICALDIFFUSE # Valid values: positive double greater than 1.0 From 693e1136d98b69ed5c7185c9da662818f6183e33 Mon Sep 17 00:00:00 2001 From: Arnfinn Date: Tue, 27 Feb 2018 15:17:00 +0100 Subject: [PATCH 29/31] Updated bi_operators test references --- .../bi_operators/bi_operators_collocation.cpp | 4 ++-- .../tanhsphericaldiffuse_D_collocation.npy | Bin 8272 -> 8272 bytes .../tanhsphericaldiffuse_S_collocation.npy | Bin 8272 -> 8272 bytes .../uniformdielectric_D_collocation.npy | Bin 8272 -> 8272 bytes .../uniformdielectric_D_purisima.npy | Bin 8272 -> 8272 bytes .../uniformdielectric_S_collocation.npy | Bin 8272 -> 8272 bytes tests/bi_operators/update_reference_files.cpp | 14 ++++++++------ tests/bi_operators/vacuum_D_collocation.npy | Bin 8272 -> 8272 bytes tests/bi_operators/vacuum_D_purisima.npy | Bin 8272 -> 8272 bytes tests/bi_operators/vacuum_S_collocation.npy | Bin 8272 -> 8272 bytes 10 files changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/bi_operators/bi_operators_collocation.cpp b/tests/bi_operators/bi_operators_collocation.cpp index 7088f0134..5c79d6986 100644 --- a/tests/bi_operators/bi_operators_collocation.cpp +++ b/tests/bi_operators/bi_operators_collocation.cpp @@ -131,7 +131,7 @@ SCENARIO("A collocation integrator with approximate diagonal elements", cnpy::custom::npy_load("tanhsphericaldiffuse_S_collocation.npy"); for (int i = 0; i < cavity.size(); ++i) { for (int j = 0; j < cavity.size(); ++j) { - REQUIRE(results(i, j) == Approx(results(i, j))); + REQUIRE(reference(i, j) == Approx(results(i, j))); } } } @@ -141,7 +141,7 @@ SCENARIO("A collocation integrator with approximate diagonal elements", cnpy::custom::npy_load("tanhsphericaldiffuse_D_collocation.npy"); for (int i = 0; i < cavity.size(); ++i) { for (int j = 0; j < cavity.size(); ++j) { - REQUIRE(results(i, j) == Approx(results(i, j))); + REQUIRE(reference(i, j) == Approx(results(i, j))); } } } diff --git a/tests/bi_operators/tanhsphericaldiffuse_D_collocation.npy b/tests/bi_operators/tanhsphericaldiffuse_D_collocation.npy index 360d57b8d1f1d3a150432a327b2fabb98b41a71c..a16abf62d5fb58d35d8ffcbb92ed24bfcdae7739 100644 GIT binary patch literal 8272 zcmXwec|4Tg8}>-4s4UqNlai>2Qj*YODN7}xRFtw7MbVa@3`m$D93 zS=UKhc^y^R$tb@4Qr_I5dO?lc*$*{HdWx=~YQ9rYUZ|NjK% zz7H_#U*8Y;I^#Kgmus-;d4pNtOf~*$clq@$x`#HqjTc=P$0J+5@fdwi8S)>~s}7WN zv7I|!nQvmN`qkd9PQ!`bf?t;XxhQ$R@7+%tG`2MLX`y$9SDE+W*XW+O&(@p-nOk9iZmD1kO52Xv@ z67|kC_;V$Zvv~JC#QarxWk}72THg{eo#tvZPOmE{dRmFqcaoH46ASRG_O0pZ6gswF zJ8);wtu&OB+&SZ`n1=07gZ`@*RT3R%j4rPz_mB)-zaA%K(ef+Bw zTn#M9Dp^s8lxNwt_1|jX`d7bmF|z<~TjuZAiYP(YPv>)mmvS-NBj~a?kAqRW2o*|Y z0c89uniO>kaB}a5gz=bcG;dRuU;aEBq5yLGrvumQr(yAsd_%#?tJ^_|SI6qiMAe);?Y) zuq_8Ew@VJ)=*~yQ&WsM%Z`Ej!O8+VKqY!+LgXFxW3(+^CXw>vK4@W#!uOB^I14WU5 z!@Cr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B2~$d?$RJlm2|n zTQ1*^IaAzvkdxx}eercp`sY4>+wXnKM?Q0=xcxrJ!r?g!Nu-s}NCuFQ$gdiJCrd6Pqa-29UtPjce3&fj_b z@n#RnpFOze_%f&Ycc4)ez4`}5p; dxh^Ng?fdgS<-S}QOmX{t_zN>-FXI3J diff --git a/tests/bi_operators/uniformdielectric_D_collocation.npy b/tests/bi_operators/uniformdielectric_D_collocation.npy index 8e3a4de8bc5c2237d2ad53425eaa247afc7bdbaf..6020f69ce6c0a912f63748ae4bfabf136ad04dfe 100644 GIT binary patch literal 8272 zcmcK8O^B6s7zJ>RzzRex-O9ygxS9ijx(IP0hJlDC;s}`*<{ceDoV=5Xg&(-lz=i0> zkBvH}#2}?HnP9yVQ<{WJH;p0qu~L$@L8$Qm-NhL$7Z4`E z{yJ;k+@9LJxwCs}yKDZucJE4;@ z?uyHek$vA(f0p{!l;1yGwCY?n`s?WAeZ4flJLZ>@YcbM>;lvsVpQ123Og-?j8~_2kqqKQ4ZMsCr!L7sI0)$NoOu;+s0)j~AZF zk1lkApFVigA^GF2zw`L}9?#@Q7yVNoyy=kqe=2iV=`gL#f2_`%Y{4}-9-*eyPdwkVx#Sgp6{HGV5>eTZ0MLP~XI`qcv z>TdD*mckeB!*_bSjy$&*v)M$GZCu4A1$xbw2y(&*yIzy`~l3&U@~=e2=Hf z_uGpOe9OoDM}K~3w;%Y9&-oQ!zBb>?kMsOtj`%pwXYk1fU-P*+<0&_AWq#mtPvXNn zb+8}s#=|}M)0NKf)7STKCO*93a~^-Z>5%;C3Sa6gx9-XO+6yWj><9hT%(uSo$^P)j zapu>2)Z7pFs+n(n-IM+0R{qB2x5IugXSH3v-IM+KT#hrpaH;y(4|1*Yy?pEIp6t(8 z^iBWs4WIKXzWg93s(kRh9Plsy^S!?5f4=5(bH)>XKGR=5;O9?1pa)!VIu9S-`oM`l zzNrKLbcHkZg-id$hc_LPKi>Mok3YP0PJNwkmrwZA%(uOu(!qYv*FBm4PWi-F&3w~W z&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|@@$=kw z`5qsLFMj4}e&%U@{NyjcohvVL2<68-%{TKc5Ap%+hk2PFG(Y_DrX%^|E$8O#`|P8h zp43SnU-;x4{?N^b)K72vKtEmh;fo(X(kK4lgJ0@b5B16V)G244=Q-Zf5BVVP^g}+l zALyr>5A=KPyL?YCG)MEZ7clq39Ov6F&wWR?{iHL|e!CZ7-VgZT2ko!_`JMN24)MiL zE^?0a@H2hpzj>N(=9}O42=ZUvv1O0UCpZfWkKJ!<7@|0usP#^X5Lq5p6zRtl@fBNa>L+Vc-+z<3Z zbIkcUC;OX&y}-+U*e__$>=&Jh_FG@)WPknihx)r0VBQaM4xN|$^Bn#8We*_#%+q`` z-~2Q`KAWF;XAbzGUY$N!FF)o?Z|;Sh*bjM?UnswL;prUw=;lM}$2WE0&(HLkzxX6i z{P4jq_0yX^(9c)=@Wqe*JV#FHhkTHC{2?95-#K*Xk5BT%k6y?}{?QNl;C|58IegIH zzL+;&_J__y`)yyLJ+oi>Iw$*Qo&W0P9O{FgdjaPCfRDaVfAcio%s0Q~81mmd%~y`- z<~RS%ga7K)nKQlW)#;;N-sBI;pFGG1v>$ZyA@$RhJn7>{`otf6QwRQZ>!14RNuBiZ zMSth%PjC8=`qKw_r$2ehvFE;{!+ZQ89r)7=`I!EtPWn8jn-AX85BcDJpfk~a+c)#3 i%l>)pyL@lopnbG|at`&;KkNKgub=18d-np&`{5Pw<+jlP diff --git a/tests/bi_operators/uniformdielectric_D_purisima.npy b/tests/bi_operators/uniformdielectric_D_purisima.npy index fe3fabdf5f568ad43fd2e3da7da51ff46dac3384..97251d44ae23bd2821ad81c61ecfbd346a02f665 100644 GIT binary patch literal 8272 zcmb8!O^B9N90hQTzzReR-NuWJyjlZ+MufBor63{;af0j%^BtQuj=j?d7N)eZc9I*d z7V20QgOtT&F6s_3*#|BnY7vbg^s$qqZ6q1o-@7=&!!x$|(&l;)~#JL+}YFd-;HNB9=!AW_vgx)xi?;Vy!XkVE#s|{ee9mi@0HoFW|!<6`J$Y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); + Eigen::Vector3d offset; + offset << 1.0, 2.0, 3.0; + Molecule molec = dummy<0>(1.44 / bohrToAngstrom(), offset); double area = 10.0; GePolCavity cavity(molec, area, 0.0, 100.0); Collocation op; - SphericalDiffuse<> gf( - epsilon, epsilon, width, sphereRadius, Eigen::Vector3d::Zero(), 3); - Eigen::MatrixXd S_results = op.computeS(cavity, gf); cnpy::custom::npy_save("tanhsphericaldiffuse_S_collocation.npy", S_results); Eigen::MatrixXd D_results = op.computeD(cavity, gf); diff --git a/tests/bi_operators/vacuum_D_collocation.npy b/tests/bi_operators/vacuum_D_collocation.npy index b5f5498be35c22b9a74cca37526dcb4af912f5c3..57fef2585b3ca711ccfa2ca9fb91f4a0425bfc29 100644 GIT binary patch literal 8272 zcmcK8Pl(l390hQTKn(^d#ihK;>1hrG+Crj*CZP&hl|{N@&4}p-gD0Poa@6k*N;B> z_~x7DJTzyr-RVwj>$UH1wIA5Nx;@frZy)bH-`l$LnekqydwqRlZ+G|F^2FHIUEOPc zUAAiFNNd%~9J}wgd+z-Icx;p0sol^ws&J^jM>C(5V4 zcJ{qA?`ZjU$MI$3Tiz{qPd)qL>n|TGi?95>_U7|b{qqmjbNc7`c0G5#_PM>D|M%d~ ziTM+!`hD-J`|jBI$o}OUrpwM--hO)N!$->1cfS5??PF8rO0ARAXSdD#d8E&q4#^)c zJd+pX*%VEOp-9I$!Jd z<#+hhf9kxJ)cMTR{wf{mhtF`G>&fb;g?0Yc?aS}@s&v>}=fAk}RBx+)U$gtrABPtH zST0qck5#^SzjkqS=^K9?FV^kL?|iP}{nqf5%UO-gvkNf4b5ce)`%EXX3*fKIiern-0mJuJEP4a_gSVZ~tBJPQ?45znb~h*FD)E z9y!kZdKXkW(hpyi4*agKd$PaW%HOQ~HoOn!tPaYzd$K>D%W>uxE>$1z1D-11%eTJn z$^LvL2kC#l;d6e)S1#lv^I=|cz`y3l_xh&)&6Cf~8Bh56On>=+pFjD49&o|wJbZZT z11J7?(;@lO70%QbF8vc9-gHR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!+ZQ89r)X8$j9_Ab<*cK-F)z#e#i&+gT01y+i&}3-gMbN&wZEg c?Hja@_Rn5Jee};d|JCc~IrQGW0P}wM13&S#`2YX_ diff --git a/tests/bi_operators/vacuum_D_purisima.npy b/tests/bi_operators/vacuum_D_purisima.npy index 458185a5de85279155cd93b5a5390f5b0bd7ae48..8562747e3ffb81335861965fedb1a0ebf5228fde 100644 GIT binary patch literal 8272 zcmciHO^DT17zS{QzzRevaT&MLuGWB{5fLpyDTv5IoFMzcyjN%C$elhYF{O>Q2qHHc zE!43r1}Q5uBRXO>7PyG0g)vId$4>g#hLOSf-QXE6|CylNymRwzP8(F`l zd-1PJRxBTCtysQvsI{%-&y~kk?Yi}=x2DR+Q!hR9Nay`>tj75VZ~5t_Wyi~&7q{=3 z`@{b7{pzEgBRk$MXKFk<|I3H(T=Qo6?DLcJb_{=7&eio*&#wF8y$9bdn|_{q^y$-w z%ZER9wmpCO{&H&5p(Ue_9Vj=BKk?2hFB~ij&;P#i(#i4u`Mc^l`SX0co|~+BuCC`V z?3{P_im@a8yf@T+*R8#G`_eTNW%FgPJ-XW8Q_YdyM zL*j=E&cufoJgFZ)aN{BI!!5t_@Y@e(;=_yl$q(FkNc^AFev79o4-0DlzpH&!XQ}<} z*8W1mK*6qvh@QQeNuJ(Un#VKA@|Ni=) z>yCeW;hS=<>U^Z)h5O~R!;4=1^-!^HUw)@^5$@fKM|Mu!{6_zL=8>PyudjS9sJNZC zZeM6PX)ff1tWBS8?X_yamN9XhkFJ1Fd`p0?t&_{Tjr!)2OhknwzKEug3>Pr8p z%RO12xrm3H4{*cb9{BN!XZ7RPesyMjaI4RG_~FJw;>WA{l3%`cPx{wf5OY4rFQ&ic zbx-D34@yU_=8u(1HH@Zp3Kj;{5Q?N1LnitIv?~|9OQ5JWPUp54=F|LLprr#_46Z|?@t`{BS0-w#dxgj1w@{#L)3^MTIYlm4eW zI;R(S>1xn?z&9V!AO4%>gMQMvKEp}3>Pr2ppFZ^)ZuQfj`uG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su_?S1{_<8Po`5qsLFMj4}e&%U@{NyjcohvVL2<68-%{TL%dm$(82lFyNXny$P zO-J&_JNMi7vyXauQYU?U;gfUtLpL8%KfUP#{dD1nFMj+;pZJ3heyLwQ)FdgCe&8>EnQ#2%gAV-hNuK!me)dsM zHy=_zUy~<)@zURU`qMky{Xn<=sh^+eGk?`5PdQc(^-)hhl{4wr=M;t29)KiF$XxBb@FIoV%7{h@!K-3!qD;P->yEzo(%KhM#h zU-kg<&pgdH^UY85ecC!_41SX&b^Qm_k+C3FO*-r@N^D-bn_wgg_eu2S4`$bU%#r?+@l_zL{@+ z%Q57?d77^r(amrEn+N~ZtIK?=SErA9d6PdVe^=h}`+;sgq<*@RCw=@#pZJ4s>cF3F z{Zl_Zsgpjw=`?g#oIALN|=)pd->iz!@M8tHPlD{tn=CZpr7Z^d-no#KkO@ifA|l6lF^L- diff --git a/tests/bi_operators/vacuum_S_collocation.npy b/tests/bi_operators/vacuum_S_collocation.npy index b89386877c540e1e927055745c79f0a059c3c372..571d50f1a28719cc85a639b90139cd00db3b1746 100644 GIT binary patch literal 8272 zcmbu>OK6o>6b0Z&bYP)~L0Tx5T(xj31T2Y|Hi*9piXGSn+9GMGA(}@=Nx2$D#F5gX zNC+qy2u_?w+Js6ArNh=oiRl9oAD|Kv$AW_t6&3#P4pzCNWU|SB&R%=1z1Ke6bDw;% zx4UOq)9$9@)&7A)2W!=?N_Fetht;-9b#SD1xYjq^J5uW(c>VqJ+UUTm&xgM0`*z^f zzwdXnw^cgYH?~zyRQ$cMzHj=+$Cc*o>pwd7_IC&F6zj^^(RyKG^NRUmcJ^V**wnS+ zzuDG(Cwl%W7R$Ky;+Bbj_RkdeCZ|UqUYe_)Kly3Lug|+~6(1jM9zWfAyJ-2~&8E)N zSBo>3&%g8gl^ezPpZzfW;MvXM)5TpI4=h}-=gWhi`SRd&m-&aEu6eh0)BQTGdkgJ9 z4{ezEyZGwS*?sp;{ZWiR+j(Sm*Y#qojH82ZEldqvE$G&V)K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YFbbB9O0-h(#TL1t6 literal 8272 zcmciGUue~390u?W>p~%d5e1>_V8Kxs7@IU3;ZFmDF3f?&7@@J{*}R%^wkZ-`CB-CS zQ0yY`ru#)s6ocqe*OGbqLqtqa5$CnwMKMEz^Z8vohjEZVZywI?eZSB9JkR(0zNlZm z`~LpH;m(e?J3g)+sZD-VuMSkIZ;tJ%_Ef54$Ldq{k%JM9sM(l z#o2GadilzwpNpA;-%Z?HyIvgld*Ala)upmtopZAOvt}Kh!Dju`gBP}R@3>J|hpWAp z$6uNIwfNxn=R+%Jt`@UvZ=GoDTPksS?8ViE@x{__=DK0d7T3;Cd59h76{mp;vp?|jR_I{#1( zCz}1&XUO-^kKaG|WaGaD9sI!Eormu9AO5|Z^W0~h4#@Yb&o9qEvwW?r$BRe3KB~i` z-go9b!BE&k(Pq<{RW zlRmoeJC8noGY9_p#_zo3&z$9}UL79w{6akH`7QAY|Ng)~-*PZt{6jgIbGo5EX8)X% z{CwK)xBEp08|U#`;!^-=%uK)&5SKJ53~ z{mSpTuFo*v2YrTo%Yh#KrjtJ3?aOs~AiebKr~b*wetF7Q-p(~I)*(H7=r82A-TRQQY<)2m9%Azv+N{dmr=}@+}9v&PjfJ_#u9MhWS3=gU(C+c@BPg=@Z1mhyFr- z<*9#i=0m^nnge;LSBEF-)#)?8?cN9TiXX~@E;^k zL%lkE=2yKsJnGGxb;x(S_krKcfq%YICx6y6C;8BuKIrEgfBNSqee!1=zw_|tz3|(- z@DJr+&iPB7`s2HOd|0Os@z|OdOrE{o$p-dx5RiK^cnIk2RihdFZa)P`*NL5 Z$hZ4vKg5GS>-<)a&v$5DpJBcaj{v Date: Tue, 27 Feb 2018 15:26:54 +0100 Subject: [PATCH 30/31] clang-format --- src/green/InterfacesImpl.hpp | 8 ++------ src/green/SphericalDiffuse.cpp | 6 ++---- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/green/InterfacesImpl.hpp b/src/green/InterfacesImpl.hpp index cba73d62b..75bc56e51 100644 --- a/src/green/InterfacesImpl.hpp +++ b/src/green/InterfacesImpl.hpp @@ -63,12 +63,8 @@ struct IntegratorParameters { double r_infinity_; /*! Time step between observer calls */ double observer_step_; - IntegratorParameters(double r0, - double rinf, - double step) - : r_0_(r0), - r_infinity_(rinf), - observer_step_(step) {} + IntegratorParameters(double r0, double rinf, double step) + : r_0_(r0), r_infinity_(rinf), observer_step_(step) {} }; /*! \class LnTransformedRadial diff --git a/src/green/SphericalDiffuse.cpp b/src/green/SphericalDiffuse.cpp index 78453ab7a..9480eded2 100644 --- a/src/green/SphericalDiffuse.cpp +++ b/src/green/SphericalDiffuse.cpp @@ -240,7 +240,7 @@ void SphericalDiffuse::initSphericalDiffuse() { using namespace detail; // Parameters for the numerical solution of the radial differential equation - double r_0_ = 0.1; /*! Lower bound of the integration interval */ + double r_0_ = 0.1; /*! Lower bound of the integration interval */ double r_infinity_ = this->profile_.upperLimit() + 30.0; /*! Upper bound of the integration interval */ @@ -250,9 +250,7 @@ void SphericalDiffuse::initSphericalDiffuse() { double observer_step_ = 1.0e-2 * relative_width; /*! Time step between observer calls */ - IntegratorParameters params_(y_0_, - y_infinity_, - observer_step_); + IntegratorParameters params_(y_0_, y_infinity_, observer_step_); ProfileEvaluator eval_ = pcm::bind(&ProfilePolicy::operator(), this->profile_, pcm::_1); From fcdee699c0bf37f4fe30ee734f5a5e22f3c98ffc Mon Sep 17 00:00:00 2001 From: Arnfinn Date: Tue, 27 Feb 2018 15:52:16 +0100 Subject: [PATCH 31/31] fixed default profile --- src/green/SphericalDiffuse.hpp | 2 +- tests/bi_operators/bi_operators_collocation.cpp | 4 +++- tests/bi_operators/update_reference_files.cpp | 6 ++++-- tests/green/green_spherical_diffuse.cpp | 6 ++++-- tests/iefpcm/iefpcm_diffuse-gepol-point.cpp | 6 ++++-- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/green/SphericalDiffuse.hpp b/src/green/SphericalDiffuse.hpp index 95eaa261f..6e8c060dc 100644 --- a/src/green/SphericalDiffuse.hpp +++ b/src/green/SphericalDiffuse.hpp @@ -60,7 +60,7 @@ namespace green { * Green's function * at a pair of points, a translation of the sampling points is performed first. */ -template +template class SphericalDiffuse __final : public GreensFunction { public: /*! Constructor for a one-layer interface diff --git a/tests/bi_operators/bi_operators_collocation.cpp b/tests/bi_operators/bi_operators_collocation.cpp index 5c79d6986..b495f7b92 100644 --- a/tests/bi_operators/bi_operators_collocation.cpp +++ b/tests/bi_operators/bi_operators_collocation.cpp @@ -37,6 +37,7 @@ #include "green/SphericalDiffuse.hpp" #include "green/UniformDielectric.hpp" #include "green/Vacuum.hpp" +#include "green/dielectric_profile/OneLayerTanh.hpp" #include "utils/MathUtils.hpp" using namespace pcm; @@ -45,6 +46,7 @@ using cavity::GePolCavity; using green::Vacuum; using green::UniformDielectric; using green::SphericalDiffuse; +using dielectric_profile::OneLayerTanh; SCENARIO("A collocation integrator with approximate diagonal elements", "[bi_operators][bi_operators_collocation]") { @@ -123,7 +125,7 @@ SCENARIO("A collocation integrator with approximate diagonal elements", double epsilon2 = 80.0; double width = 5.0; double sphereRadius = 20.0; - SphericalDiffuse<> gf( + SphericalDiffuse gf( epsilon1, epsilon2, width, sphereRadius, Eigen::Vector3d::Zero(), 5); THEN("the matrix elements of S are") { results = op.computeS(cavity, gf); diff --git a/tests/bi_operators/update_reference_files.cpp b/tests/bi_operators/update_reference_files.cpp index 12c9a660c..d7dbe6711 100644 --- a/tests/bi_operators/update_reference_files.cpp +++ b/tests/bi_operators/update_reference_files.cpp @@ -40,6 +40,7 @@ #include "green/SphericalDiffuse.hpp" #include "green/UniformDielectric.hpp" #include "green/Vacuum.hpp" +#include "green/dielectric_profile/OneLayerTanh.hpp" #include "utils/MathUtils.hpp" using namespace pcm; @@ -52,6 +53,7 @@ using green::UniformDielectric; using green::IonicLiquid; using green::AnisotropicLiquid; using green::SphericalDiffuse; +using dielectric_profile::OneLayerTanh; void save_vacuum_collocation(); void save_uniform_dielectric_collocation(); @@ -114,7 +116,7 @@ void save_tanh_spherical_diffuse_collocation() { double epsilon2 = 80.0; double width = 5.0; double sphereRadius = 20.0; - SphericalDiffuse<> gf( + SphericalDiffuse gf( epsilon1, epsilon2, width, sphereRadius, Eigen::Vector3d::Zero(), 5); Eigen::Vector3d offset; offset << 1.0, 2.0, 3.0; @@ -237,7 +239,7 @@ void save_tanh_spherical_diffuse_numerical() { Numerical op; - SphericalDiffuse<> gf( + SphericalDiffuse gf( epsilon1, epsilon2, width, sphereRadius, Eigen::Vector3d::Zero(), 3); Eigen::MatrixXd S_results = op.computeS(cavity, gf); diff --git a/tests/green/green_spherical_diffuse.cpp b/tests/green/green_spherical_diffuse.cpp index 17ea120de..1925d604f 100644 --- a/tests/green/green_spherical_diffuse.cpp +++ b/tests/green/green_spherical_diffuse.cpp @@ -66,7 +66,8 @@ SCENARIO("Evaluation of the spherical diffuse Green's function and its derivativ probeNormal2.normalize(); WHEN("the spherical droplet is centered at the origin") { Eigen::Vector3d sphereCenter = Eigen::Vector3d::Zero(); - SphericalDiffuse<> gf(eps1, eps2, width, sphereRadius, sphereCenter, maxL); + SphericalDiffuse gf( + eps1, eps2, width, sphereRadius, sphereCenter, maxL); THEN("the value of the Green's function inside the droplet is") { double value = 0.0204265162808782985; double gf_value = gf.kernelS(source1, probe1); @@ -142,7 +143,8 @@ SCENARIO("Evaluation of the spherical diffuse Green's function and its derivativ AND_WHEN("the spherical droplet is centered away from the origin") { Eigen::Vector3d sphereCenter = (Eigen::Vector3d() << 25.0, 0.0, 0.0).finished(); - SphericalDiffuse<> gf(eps1, eps2, width, sphereRadius, sphereCenter, maxL); + SphericalDiffuse gf( + eps1, eps2, width, sphereRadius, sphereCenter, maxL); THEN("the value of the Green's function inside the droplet is") { double value = 0.0173358023608628994; double gf_value = gf.kernelS(source1, probe1); diff --git a/tests/iefpcm/iefpcm_diffuse-gepol-point.cpp b/tests/iefpcm/iefpcm_diffuse-gepol-point.cpp index e816e30b9..2c8d27361 100644 --- a/tests/iefpcm/iefpcm_diffuse-gepol-point.cpp +++ b/tests/iefpcm/iefpcm_diffuse-gepol-point.cpp @@ -33,6 +33,7 @@ #include "green/DerivativeTypes.hpp" #include "green/SphericalDiffuse.hpp" #include "green/Vacuum.hpp" +#include "green/dielectric_profile/OneLayerTanh.hpp" #include "solver/IEFSolver.hpp" #include "utils/Molecule.hpp" @@ -42,6 +43,7 @@ using cavity::GePolCavity; using green::Vacuum; using green::SphericalDiffuse; using solver::IEFSolver; +using dielectric_profile::OneLayerTanh; SCENARIO("Test solver for the IEFPCM for a point charge in a spherical diffuse " "environment and a GePol cavity", @@ -75,7 +77,7 @@ SCENARIO("Test solver for the IEFPCM for a point charge in a spherical diffuse " GePolCavity cavity(point, area, probeRadius, minRadius); int maxL = 5; - SphericalDiffuse<> gf_o( + SphericalDiffuse gf_o( eps1, eps2, width, center, Eigen::Vector3d::Zero(), maxL); IEFSolver solver(symm); solver.buildSystemMatrix(cavity, gf_i, gf_o, op); @@ -108,7 +110,7 @@ SCENARIO("Test solver for the IEFPCM for a point charge in a spherical diffuse " GePolCavity cavity(point, area, probeRadius, minRadius); int maxL = 5; - SphericalDiffuse<> gf_o(eps1, eps2, width, center, offset, maxL); + SphericalDiffuse gf_o(eps1, eps2, width, center, offset, maxL); IEFSolver solver(symm); solver.buildSystemMatrix(cavity, gf_i, gf_o, op);