Skip to content

Commit f3fd8f9

Browse files
committed
Merge remote-tracking branch 'upstream/release/1.Y' into release/1.Y
2 parents cc7abb5 + af4df2a commit f3fd8f9

39 files changed

+851
-87
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ tests/green/*.cpp licensefile=.githooks/LICENSE-C++
6767
tests/iefpcm/*.cpp licensefile=.githooks/LICENSE-C++
6868
tests/input/*.cpp licensefile=.githooks/LICENSE-C++
6969
tests/numerical_quadrature/*.cpp licensefile=.githooks/LICENSE-C++
70+
tests/utils/*.cpp licensefile=.githooks/LICENSE-C++
7071

7172
# tools
7273
doc/conf.py licensefile=.githooks/LICENSE-Python

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
- A Python script, using Matplotlib, to plot the cavity.
88
The script can also color-map the finite elements according to the values of
99
a surface function.
10+
- The input learnt to parse the additional `ChargeDistribution` section.
11+
It is possible to specify a classical charge distribution of point multipoles.
12+
This can be an additional source of electrostatic potential for the calculation
13+
of the ASC.
1014

1115
## [Version 1.1.10] - 2017-03-27
1216

api/pcmsolver.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ end subroutine pcmsolver_set_surface_function
187187
subroutine pcmsolver_print_surface_function(context, name) bind(C)
188188
import
189189
type(c_ptr), value :: context
190-
character(c_char), intent(in) :: name
190+
character(c_char), intent(in) :: name(*)
191191
end subroutine pcmsolver_print_surface_function
192192

193193
subroutine pcmsolver_save_surface_functions(context) bind(C)
@@ -198,13 +198,13 @@ end subroutine pcmsolver_save_surface_functions
198198
subroutine pcmsolver_save_surface_function(context, name) bind(C)
199199
import
200200
type(c_ptr), value :: context
201-
character(kind=c_char, len=1), intent(in) :: name
201+
character(kind=c_char, len=1), intent(in) :: name(*)
202202
end subroutine pcmsolver_save_surface_function
203203

204204
subroutine pcmsolver_load_surface_function(context, name) bind(C)
205205
import
206206
type(c_ptr), value :: context
207-
character(kind=c_char, len=1), intent(in) :: name
207+
character(kind=c_char, len=1), intent(in) :: name(*)
208208
end subroutine pcmsolver_load_surface_function
209209

210210
subroutine pcmsolver_write_timings(context) bind(C)

api/pcmsolver.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,13 +246,19 @@ PCMSolver_API void pcmsolver_save_surface_functions(pcmsolver_context_t * contex
246246
/*! \brief Dumps a surface function to NumPy array in .npy file
247247
* \param[in, out] context the PCM context object
248248
* \param[in] name label of the surface function
249+
*
250+
* \note The name parameter is the name of the NumPy array file
251+
* **without** .npy extension
249252
*/
250253
PCMSolver_API void pcmsolver_save_surface_function(pcmsolver_context_t * context,
251254
const char * name);
252255

253256
/*! \brief Loads a surface function from a .npy file
254257
* \param[in, out] context the PCM context object
255258
* \param[in] name label of the surface function
259+
*
260+
* \note The name parameter is the name of the NumPy array file
261+
* **without** .npy extension
256262
*/
257263
PCMSolver_API void pcmsolver_load_surface_function(pcmsolver_context_t * context,
258264
const char * name);

doc/code-reference/helper-classes.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ Atom
2929
:protected-members:
3030
:private-members:
3131

32+
ChargeDistribution
33+
------------------
34+
.. doxygenstruct:: ChargeDistribution
35+
:project: PCMSolver
36+
:members:
37+
:protected-members:
38+
:private-members:
39+
3240
Molecule
3341
--------
3442
.. doxygenclass:: Molecule

doc/snippets/example_input-all.inp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@ Cavity {
1313
Spheres = [Array of Doubles]
1414
}
1515
Medium {
16+
Nonequilibrium = [Bool]
1617
Solvent = [String]
1718
SolverType = [String]
1819
MatrixSymm = [Bool]
1920
Correction = [Double]
21+
DiagonalIntegrator = [String]
22+
DiagonalScaling = [Double]
2023
ProbeRadius = [Double]
2124
Green<GreenTag> {
2225
Type = [String]
@@ -33,3 +36,11 @@ Medium {
3336
MaxL = [Integer]
3437
}
3538
}
39+
Molecule {
40+
MEP = [Bool]
41+
Geometry = [Double]
42+
}
43+
ChargeDistribution {
44+
Monopoles = [Double]
45+
Dipoles = [Double]
46+
}

doc/users/input.rst

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,21 @@ core parameters.
1515
In this page, input style and input parameters available in Method 1 will be
1616
documented.
1717

18+
Note that it is also possible to run the module standalone and use a classical charge
19+
distribution.
20+
The classical charge distribution can be specified by giving a molecular geometry
21+
in the molecule section and an additional point multipoles distribution
22+
in the charge distribution section.
23+
The ``run_pcm.x`` executable has to be compiled for a standalone run with:
24+
25+
.. code-block:: bash
26+
27+
python pcmsolver.py -x molecule.inp
28+
29+
where the ``molecule.inp`` input file looks like:
30+
31+
.. literalinclude:: ../snippets/molecule.inp
32+
1833
Input style
1934
-----------
2035

@@ -46,6 +61,14 @@ Available sections:
4661
i.e. the Green's functions inside and outside the cavity;
4762
+ Green, subsection of medium. Sets up the Green's function inside and
4863
outside the cavity.
64+
+ Molecule: molecular geometry to be used in a standalone run.
65+
+ ChargeDistribution: sets up a classical multipolar (currently up to dipoles)
66+
charge distribution to use as additional source of electrostatic potential.
67+
68+
.. note::
69+
70+
The Molecule and ChargeDistribution sections only make sense in a standalone run,
71+
i.e. when using the ``run_pcm.x`` executable.
4972

5073
.. warning::
5174

@@ -436,6 +459,27 @@ where the ``molecule.inp`` input file looks like:
436459

437460
* **Type**: array of doubles
438461

462+
ChargeDistribution section keywords
463+
-----------------------------------
464+
465+
Set a classical charge distribution, inside or outside the cavity
466+
No additional spheres will be generated.
467+
468+
.. glossary::
469+
470+
Monopoles
471+
Array of point charges
472+
Format is :math:`[\ldots, x_i, y_i, z_i, Q_i, \ldots]`
473+
474+
* **Type**: array of doubles
475+
476+
Dipoles
477+
Array of point dipoles.
478+
Format is :math:`[\ldots, x_i, y_i, z_i, \mu_{x_i}, \mu_{y_i}, \mu_{z_i} \ldots]`
479+
The dipole moment components are always read in atomic units.
480+
481+
* **Type**: array of doubles
482+
439483
.. _available-radii:
440484

441485
Available radii

src/bin/run_pcm.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include "interface/Input.hpp"
4242
#include "interface/Meddle.hpp"
4343
#include "utils/Molecule.hpp"
44+
#include "utils/ChargeDistribution.hpp"
4445

4546
std::ofstream pcmsolver_out;
4647

@@ -66,16 +67,17 @@ int main(int argc, char * argv[]) {
6667
PCMSolverIndex size = context_.getCavitySize();
6768

6869
// Form vector with electrostatic potential
69-
// FIXME
70-
// 1. Try to understand why this is needed
71-
// 2. Try to re-write this such that the input object is not needed!!!
7270
// First compute the potential from the classical point multipoles distribution
7371
// then add the one from the molecule
7472
TIMER_ON("Computing MEP");
75-
// Eigen::VectorXd mep = Eigen::VectorXd::Zero(size);
76-
// if (input.MEPfromMolecule())
77-
// mep += computeMEP(context_.molecule(), context_.getCenters());
78-
Eigen::VectorXd mep = computeMEP(context_.molecule(), context_.getCenters());
73+
// FIXME currently hardcoded to the dipole-dipole interaction potential in vacuum
74+
Eigen::VectorXd mep =
75+
computeDipolarPotential(context_.getCenters(), input.multipoles());
76+
// FIXME
77+
// 1. Try to understand why this is needed
78+
// 2. Try to re-write this such that the input object is not needed!!!
79+
if (input.MEPfromMolecule())
80+
mep += computeMEP(context_.molecule(), context_.getCenters());
7981
TIMER_OFF("Computing MEP");
8082
context_.setSurfaceFunction(mep.size(), mep.data(), "MEP");
8183
// Compute apparent surface charge

src/green/AnisotropicLiquid.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,16 @@ KernelD AnisotropicLiquid<DerivativeTraits>::exportKernelD_impl() const {
9393
pcm::_3);
9494
}
9595

96+
template <typename DerivativeTraits>
97+
DerivativeProbe AnisotropicLiquid<DerivativeTraits>::exportDerivativeProbe_impl()
98+
const {
99+
return pcm::bind(&AnisotropicLiquid<DerivativeTraits>::derivativeProbe,
100+
*this,
101+
pcm::_1,
102+
pcm::_2,
103+
pcm::_3);
104+
}
105+
96106
template <typename DerivativeTraits>
97107
double AnisotropicLiquid<DerivativeTraits>::singleLayer_impl(
98108
const Element & /* e */,

src/green/AnisotropicLiquid.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ class AnisotropicLiquid __final
7878

7979
virtual KernelS exportKernelS_impl() const __override;
8080
virtual KernelD exportKernelD_impl() const __override;
81+
virtual DerivativeProbe exportDerivativeProbe_impl() const __override;
8182

8283
__noreturn virtual double singleLayer_impl(const Element & /* e */,
8384
double /* factor */) const __override;

0 commit comments

Comments
 (0)