Skip to content

Commit 8195983

Browse files
ilfreddyrobertodr
authored andcommitted
Fix bug and improve ODE integration of the spherical diffuse Green's function (#109)
The integration of the differential equation for the angular momentum component is now performed after a second change of variables. The asymptotic solution is no longer logarithmic but linear. The component at L=0 has now been reintroduced. Without it, we don't get the correct solvation energy.
1 parent 4dfac30 commit 8195983

34 files changed

+463
-295
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,7 @@
3737

3838
# Autocmake stuff
3939
cmake/lib/*.pyc
40+
41+
# Emacs backup files
42+
*~
43+

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@
44

55
### Added
66

7+
- Double logarithmic scale for the integration of spherical diffuse
8+
interfaces: much more stable than the previous version, allowing for
9+
Runge-Kutta 4 integrator.
10+
11+
### Fixed
12+
13+
- Bug in the diffuse interface Green's function. Contrary to the sharp
14+
interface case, it is wrong to remove the monopole, which becomes
15+
identically zero when the corresponding differential equation is
16+
solved in extreme cases (e.g. charge far away from the sphere).
17+
18+
### Added
19+
720
- A new CMake module `options_wrappers.cmake` that adds new wrapper macros for
821
the CMake `option` command.
922

@@ -125,6 +138,8 @@
125138
- The uppercased contents of the `.pcm` input file are written to a temporary
126139
file, instead of overwriting the user provided file. The temporary file is
127140
removed after it has been parsed. Fixes #91 as noted by @ilfreddy.
141+
- Use Runge-Kutta-Fehlberg 7(8) ODE solver to integrate the radial equation
142+
in the spherical diffuse Green's function class.
128143

129144
### Fixed
130145

doc/code-reference/greens-functions.rst

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,12 @@ Green's functions objects relies on the Factory Method pattern
77
:cite:`Gamma1994,Alexandrescu2001`, implemented through the
88
generic Factory class.
99

10-
The top-level header, _i.e._ to be included in client code, is `Green.hpp`.
11-
The common interface to all Green's function classes is specified by the `IGreensFunction` class,
10+
The top-level header, _i.e._ to be included in client code, is ``Green.hpp``.
11+
The common interface to all Green's function classes is specified by the ``IGreensFunction`` class,
1212
this is non-templated.
13-
All other classes are templated. TODO: explain template parameters.
13+
All other classes are templated.
1414
The Green's functions are registered to the factory based on a label encoding: type, derivative, and dielectric profile.
15-
The only allowed labels are:
16-
- `VACUUM_NUMERICAL`
17-
- `VACUUM_DERIVATIVE`
18-
- `VACUMM_GRADIENT`
19-
- `VACUUM_HESSIAN`
20-
21-
- `SPHERICALDIFFUSE_TANH`
22-
- `SPHERICALDIFFUSE_ERF`
15+
The only allowed labels must be listed in ``src/green/Green.hpp``. If they are not, they can not be selected at run time.
2316

2417
.. image:: ../gfx/green.png
2518
:scale: 70 %

doc/pcmsolver.bib

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,3 +329,13 @@ @ARTICLE{Allinger1994-tx
329329
doi = "10.1016/S0166-1280(09)80008-0"
330330
}
331331

332+
@article{Fosso-Tande2013,
333+
title = "Implicit solvation models in a multiresolution multiwavelet basis",
334+
journal = "Chemical Physics Letters",
335+
volume = "561-562",
336+
pages = "179--184",
337+
year = "2013",
338+
issn = "0009-2614",
339+
doi = "https://doi.org/10.1016/j.cplett.2013.01.065",
340+
author = "Jacob Fosso-Tande and Robert J. Harrison"
341+
}

doc/users/input.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,13 +363,13 @@ while the Green's function outside might vary.
363363
* **Valid values**: :math:`\varepsilon \geq 1.0`
364364
* **Default**: 1.0
365365

366-
Profile
366+
Profile
367367
Functional form of the dielectric profile
368368

369369
* **Type**: string
370-
* **Valid values**: Tanh | Erf
370+
* **Valid values**: Tanh | Erf | Log
371371
* **Valid for**: SphericalDiffuse
372-
* **Default**: Tanh
372+
* **Default**: Log
373373

374374
Eps1
375375
Static dielectric permittivity inside the interface

src/green/Green.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#include "SphericalDiffuse.hpp"
3434
#include "UniformDielectric.hpp"
3535
#include "Vacuum.hpp"
36-
#include "dielectric_profile/MembraneTanh.hpp"
3736
#include "dielectric_profile/OneLayerErf.hpp"
3837
#include "dielectric_profile/OneLayerTanh.hpp"
3938
#include "utils/Factory.hpp"
@@ -89,6 +88,8 @@ inline Factory<detail::CreateGreensFunction> bootstrapFactory() {
8988
createSphericalDiffuse<dielectric_profile::OneLayerTanh>);
9089
factory_.subscribe("SPHERICALDIFFUSE_NUMERICAL_ERF",
9190
createSphericalDiffuse<dielectric_profile::OneLayerErf>);
91+
factory_.subscribe("SPHERICALDIFFUSE_NUMERICAL_LOG",
92+
createSphericalDiffuse<dielectric_profile::OneLayerLog>);
9293

9394
return factory_;
9495
}

src/green/GreensFunction.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ class GreensFunction : public IGreensFunction {
149149
*/
150150
virtual DerivativeTraits operator()(DerivativeTraits * source,
151151
DerivativeTraits * probe) const = 0;
152+
152153
/*! Returns value of the kernel of the \f$\mathcal{S}\f$ integral operator, i.e.
153154
* the value of the Greens's function for the pair of points p1, p2:
154155
* \f$ G(\mathbf{p}_1, \mathbf{p}_2)\f$
@@ -169,6 +170,7 @@ class GreensFunction : public IGreensFunction {
169170
pp[2] = p2(2);
170171
return this->operator()(sp, pp)[0];
171172
}
173+
172174
virtual std::ostream & printObject(std::ostream & os) __override {
173175
os << "Green's Function" << std::endl;
174176
return os;

0 commit comments

Comments
 (0)