From 2d3807226744bd2bc8345caff5330547bebadfd4 Mon Sep 17 00:00:00 2001 From: Alexander Reinauer Date: Thu, 5 Sep 2019 09:56:32 +0200 Subject: [PATCH 01/11] condensed ELC tune error calculation --- .../electrostatics_magnetostatics/elc.cpp | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/core/electrostatics_magnetostatics/elc.cpp b/src/core/electrostatics_magnetostatics/elc.cpp index b5086eadf8f..058e2f9bbba 100644 --- a/src/core/electrostatics_magnetostatics/elc.cpp +++ b/src/core/electrostatics_magnetostatics/elc.cpp @@ -1152,16 +1152,19 @@ int ELC_tune(double error) { return ES_ERROR; elc_params.far_cut = min_inv_boxl; + do { - err = - 0.5 * (exp(2 * M_PI * elc_params.far_cut * h) / (lz - h) * - (C_2PI * elc_params.far_cut + 2 * (ux + uy) + 1 / (lz - h)) / - (expm1(2 * M_PI * elc_params.far_cut * lz)) + - exp(-2 * M_PI * elc_params.far_cut * h) / (lz + h) * - (C_2PI * elc_params.far_cut + 2 * (ux + uy) + 1 / (lz + h)) / - (expm1(2 * M_PI * elc_params.far_cut * lz))); - - elc_params.far_cut += min_inv_boxl; + const auto prefactor = 2 * Utils::pi() * elc_params.far_cut; + + const auto sum = prefactor + 2 * (ux + uy); + const auto den = expm1(-prefactor * lz); + const auto num1 = exp(prefactor * (h - lz)); + const auto num2 = exp(-prefactor * (h + lz)); + + err = 0.5 * (num1 / (-den) / (lz - h) * (sum + 1 / (lz - h)) + + num2 / den / (lz + h) * (sum + 1 / (lz + h))); + + elc_params.far_cut += min_inv_boxl; } while (err > error && elc_params.far_cut < MAXIMAL_FAR_CUT); if (elc_params.far_cut >= MAXIMAL_FAR_CUT) return ES_ERROR; From 38522c9c2ff0375bee674d8d60cf605df4be3fa4 Mon Sep 17 00:00:00 2001 From: Alexander Reinauer Date: Thu, 5 Sep 2019 10:15:30 +0200 Subject: [PATCH 02/11] changed elc_vs_mmm2d test parameters --- testsuite/python/elc_vs_mmm2d_neutral.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/testsuite/python/elc_vs_mmm2d_neutral.py b/testsuite/python/elc_vs_mmm2d_neutral.py index 9afd832c2e4..6a1bf5f5f9d 100644 --- a/testsuite/python/elc_vs_mmm2d_neutral.py +++ b/testsuite/python/elc_vs_mmm2d_neutral.py @@ -26,8 +26,8 @@ class ELC_vs_MMM2D_neutral(ut.TestCase): # Handle to espresso system system = espressomd.System(box_l=[1.0, 1.0, 1.0]) - acc = 1e-6 - elc_gap = 5.0 + acc = 1e-7 + elc_gap = 10.0 box_l = 10.0 bl2 = box_l * 0.5 system.time_step = 0.01 @@ -127,7 +127,7 @@ def test_elc_vs_mmm2d(self): self.system.cell_system.node_grid = buf_node_grid self.system.periodicity = [1, 1, 1] p3m = espressomd.electrostatics.P3M(prefactor=1.0, accuracy=self.acc, - mesh=[16, 16, 24], cao=6) + mesh=[24, 24, 32], cao=6) self.system.actors.add(p3m) elc = electrostatic_extensions.ELC(**elc_param_sets["inert"]) From 29d7dc7e7e6dfe906c59d2781c3208b95847d6d2 Mon Sep 17 00:00:00 2001 From: Alexander Reinauer Date: Thu, 5 Sep 2019 10:41:11 +0200 Subject: [PATCH 03/11] fixed interface-core difference of MMM2D const_pot --- src/core/electrostatics_magnetostatics/elc.hpp | 2 +- src/core/electrostatics_magnetostatics/mmm2d.cpp | 14 +++++++------- src/core/electrostatics_magnetostatics/mmm2d.hpp | 6 +++--- src/python/espressomd/electrostatics.pxd | 4 ++-- testsuite/python/elc_vs_mmm2d_neutral.py | 8 ++++++++ 5 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/core/electrostatics_magnetostatics/elc.hpp b/src/core/electrostatics_magnetostatics/elc.hpp index d75d1a0e8d8..be016a8295f 100644 --- a/src/core/electrostatics_magnetostatics/elc.hpp +++ b/src/core/electrostatics_magnetostatics/elc.hpp @@ -64,7 +64,7 @@ typedef struct { /// @copybrief MMM2D_struct::delta_mid_bot double delta_mid_bot; - /// @copybrief MMM2D_struct::const_pot_on + /// @copybrief MMM2D_struct::const_pot bool const_pot; /// @copybrief MMM2D_struct::pot_diff double pot_diff; diff --git a/src/core/electrostatics_magnetostatics/mmm2d.cpp b/src/core/electrostatics_magnetostatics/mmm2d.cpp index 9074ea48050..a79a4cc79cf 100644 --- a/src/core/electrostatics_magnetostatics/mmm2d.cpp +++ b/src/core/electrostatics_magnetostatics/mmm2d.cpp @@ -589,7 +589,7 @@ static void add_z_force(const ParticleRange &particles) { double field_tot = 0; /* Const. potential: subtract global dipole moment */ - if (mmm2d_params.const_pot_on) { + if (mmm2d_params.const_pot) { double gbl_dm_z = 0; double lcl_dm_z = 0; for (auto const &p : particles) { @@ -667,7 +667,7 @@ static double z_energy(const ParticleRange &particles) { } /* total dipole moment term, for capacitor feature */ - if (mmm2d_params.const_pot_on) { + if (mmm2d_params.const_pot) { double gbl_dm_z = 0; double lcl_dm_z = 0; @@ -1721,7 +1721,7 @@ void MMM2D_self_energy(const ParticleRange &particles) { ****************************************/ int MMM2D_set_params(double maxPWerror, double far_cut, double delta_top, - double delta_bot, bool const_pot_on, double pot_diff) { + double delta_bot, bool const_pot, double pot_diff) { int err; if (cell_structure.type != CELL_STRUCTURE_NSQUARE && @@ -1731,25 +1731,25 @@ int MMM2D_set_params(double maxPWerror, double far_cut, double delta_top, mmm2d_params.maxPWerror = maxPWerror; - if (const_pot_on) { + if (const_pot) { mmm2d_params.dielectric_contrast_on = true; mmm2d_params.delta_mid_top = -1; mmm2d_params.delta_mid_bot = -1; mmm2d_params.delta_mult = 1; - mmm2d_params.const_pot_on = true; + mmm2d_params.const_pot = true; mmm2d_params.pot_diff = pot_diff; } else if (delta_top != 0.0 || delta_bot != 0.0) { mmm2d_params.dielectric_contrast_on = true; mmm2d_params.delta_mid_top = delta_top; mmm2d_params.delta_mid_bot = delta_bot; mmm2d_params.delta_mult = delta_top * delta_bot; - mmm2d_params.const_pot_on = false; + mmm2d_params.const_pot = false; } else { mmm2d_params.dielectric_contrast_on = false; mmm2d_params.delta_mid_top = 0; mmm2d_params.delta_mid_bot = 0; mmm2d_params.delta_mult = 0; - mmm2d_params.const_pot_on = false; + mmm2d_params.const_pot = false; } MMM2D_setup_constants(); diff --git a/src/core/electrostatics_magnetostatics/mmm2d.hpp b/src/core/electrostatics_magnetostatics/mmm2d.hpp index 015f57ef8d5..34233708a3a 100644 --- a/src/core/electrostatics_magnetostatics/mmm2d.hpp +++ b/src/core/electrostatics_magnetostatics/mmm2d.hpp @@ -60,7 +60,7 @@ typedef struct { /// flag whether there is any dielectric contrast in the system. bool dielectric_contrast_on; /// @brief Flag whether a const. potential is applied. - bool const_pot_on; + bool const_pot; /// @brief Const. potential. double pot_diff; /// dielectric contrast in the upper part of the simulation cell. @@ -82,11 +82,11 @@ extern MMM2D_struct mmm2d_params; * Manual setting is probably only good for testing. * @param delta_top @copybrief MMM2D_struct::delta_mid_top * @param delta_bot @copybrief MMM2D_struct::delta_mid_bot - * @param const_pot_on @copybrief MMM2D_struct::const_pot_on + * @param const_pot @copybrief MMM2D_struct::const_pot * @param pot_diff @copybrief MMM2D_struct::pot_diff */ int MMM2D_set_params(double maxPWerror, double far_cut, double delta_top, - double delta_bot, bool const_pot_on, double pot_diff); + double delta_bot, bool const_pot, double pot_diff); /** the general long range force/energy calculation */ double MMM2D_add_far(int f, int e, const ParticleRange &particles); diff --git a/src/python/espressomd/electrostatics.pxd b/src/python/espressomd/electrostatics.pxd index f653506ed74..f8657eba92e 100644 --- a/src/python/espressomd/electrostatics.pxd +++ b/src/python/espressomd/electrostatics.pxd @@ -236,7 +236,7 @@ IF ELECTROSTATICS: double far_cut2; int far_calculated; bool dielectric_contrast_on; - bool const_pot_on; + bool const_pot; double pot_diff; double delta_mid_top; double delta_mid_bot; @@ -244,7 +244,7 @@ IF ELECTROSTATICS: cdef extern MMM2D_struct mmm2d_params; - int MMM2D_set_params(double maxPWerror, double far_cut, double delta_top, double delta_bot, bool const_pot_on, double pot_diff); + int MMM2D_set_params(double maxPWerror, double far_cut, double delta_top, double delta_bot, bool const_pot, double pot_diff); void MMM2D_init(); diff --git a/testsuite/python/elc_vs_mmm2d_neutral.py b/testsuite/python/elc_vs_mmm2d_neutral.py index 6a1bf5f5f9d..2ae9adad250 100644 --- a/testsuite/python/elc_vs_mmm2d_neutral.py +++ b/testsuite/python/elc_vs_mmm2d_neutral.py @@ -105,6 +105,8 @@ def test_elc_vs_mmm2d(self): self.system.actors.add(mmm2d) mmm2d_res = {} mmm2d_res["inert"] = self.scan() + + print(mmm2d) mmm2d.set_params(**mmm2d_param_sets["dielectric"]) mmm2d_res["dielectric"] = self.scan() @@ -134,12 +136,18 @@ def test_elc_vs_mmm2d(self): self.system.actors.add(elc) elc_res = {} elc_res["inert"] = self.scan() + + print(elc) elc.set_params(**elc_param_sets["dielectric"]) elc_res["dielectric"] = self.scan() + + print(elc) elc.set_params(**elc_param_sets["const_pot_0"]) elc_res["const_pot_0"] = self.scan() + + print(elc) elc.set_params(**elc_param_sets["const_pot_1"]) elc_res["const_pot_1"] = self.scan() From d23e2e3901ff8fc4ffa1aa0ec47146ed6763565c Mon Sep 17 00:00:00 2001 From: Alexander Reinauer Date: Thu, 5 Sep 2019 11:10:02 +0200 Subject: [PATCH 04/11] fixed missing sign in errorformula --- src/core/electrostatics_magnetostatics/elc.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/electrostatics_magnetostatics/elc.cpp b/src/core/electrostatics_magnetostatics/elc.cpp index 0953f9ac99b..6ea1667e210 100644 --- a/src/core/electrostatics_magnetostatics/elc.cpp +++ b/src/core/electrostatics_magnetostatics/elc.cpp @@ -1157,12 +1157,12 @@ int ELC_tune(double error) { const auto prefactor = 2 * Utils::pi() * elc_params.far_cut; const auto sum = prefactor + 2 * (ux + uy); - const auto den = expm1(-prefactor * lz); + const auto den = -expm1(-prefactor * lz); const auto num1 = exp(prefactor * (h - lz)); const auto num2 = exp(-prefactor * (h + lz)); - err = 0.5 * (num1 / (-den) / (lz - h) * (sum + 1 / (lz - h)) + - num2 / den / (lz + h) * (sum + 1 / (lz + h))); + err = 0.5 / den * (num1 * (sum + 1 / (lz - h)) / (lz - h) + + num2 * (sum + 1 / (lz + h)) / (lz + h)); elc_params.far_cut += min_inv_boxl; } while (err > error && elc_params.far_cut < MAXIMAL_FAR_CUT); @@ -1266,7 +1266,7 @@ void ELC_on_resort_particles() { } int ELC_set_params(double maxPWerror, double gap_size, double far_cut, - int neutralize, double delta_top, double delta_bot, + bool neutralize, double delta_top, double delta_bot, bool const_pot, double pot_diff) { elc_params.maxPWerror = maxPWerror; elc_params.gap_size = gap_size; @@ -1279,7 +1279,7 @@ int ELC_set_params(double maxPWerror, double gap_size, double far_cut, elc_params.delta_mid_bot = delta_bot; // neutralize is automatic with dielectric contrast - elc_params.neutralize = 0; + elc_params.neutralize = false; // initial setup of parameters, may change later when P3M is finally tuned // set the space_layer to be 1/3 of the gap size, so that box = layer elc_params.space_layer = (1. / 3.) * gap_size; From 2d21567018a470d17985c34f5e651b7923b04ab6 Mon Sep 17 00:00:00 2001 From: Alexander Reinauer Date: Thu, 5 Sep 2019 11:11:24 +0200 Subject: [PATCH 05/11] removed debug output --- testsuite/python/elc_vs_mmm2d_neutral.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/testsuite/python/elc_vs_mmm2d_neutral.py b/testsuite/python/elc_vs_mmm2d_neutral.py index 2ae9adad250..6a1bf5f5f9d 100644 --- a/testsuite/python/elc_vs_mmm2d_neutral.py +++ b/testsuite/python/elc_vs_mmm2d_neutral.py @@ -105,8 +105,6 @@ def test_elc_vs_mmm2d(self): self.system.actors.add(mmm2d) mmm2d_res = {} mmm2d_res["inert"] = self.scan() - - print(mmm2d) mmm2d.set_params(**mmm2d_param_sets["dielectric"]) mmm2d_res["dielectric"] = self.scan() @@ -136,18 +134,12 @@ def test_elc_vs_mmm2d(self): self.system.actors.add(elc) elc_res = {} elc_res["inert"] = self.scan() - - print(elc) elc.set_params(**elc_param_sets["dielectric"]) elc_res["dielectric"] = self.scan() - - print(elc) elc.set_params(**elc_param_sets["const_pot_0"]) elc_res["const_pot_0"] = self.scan() - - print(elc) elc.set_params(**elc_param_sets["const_pot_1"]) elc_res["const_pot_1"] = self.scan() From 4304d9187d4fc15a5200c2b9a366c3a73a31b489 Mon Sep 17 00:00:00 2001 From: Alexander Reinauer Date: Thu, 5 Sep 2019 11:12:36 +0200 Subject: [PATCH 06/11] converted MMM2D const_pot to bool --- src/core/electrostatics_magnetostatics/elc.hpp | 4 ++-- src/python/espressomd/electrostatic_extensions.pxd | 2 +- src/python/espressomd/electrostatic_extensions.pyx | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/electrostatics_magnetostatics/elc.hpp b/src/core/electrostatics_magnetostatics/elc.hpp index be016a8295f..bb15a7322aa 100644 --- a/src/core/electrostatics_magnetostatics/elc.hpp +++ b/src/core/electrostatics_magnetostatics/elc.hpp @@ -54,7 +54,7 @@ typedef struct { * systems. Unlike the 3D case, this background adds an additional * force pointing towards the system center, so be careful with this. */ - int neutralize; + bool neutralize; /// @copybrief MMM2D_struct::dielectric_contrast_on bool dielectric_contrast_on; @@ -103,7 +103,7 @@ extern ELC_struct elc_params; * @retval ES_OK */ int ELC_set_params(double maxPWerror, double min_dist, double far_cut, - int neutralize, double delta_mid_top, double delta_mid_bot, + bool neutralize, double delta_mid_top, double delta_mid_bot, bool const_pot, double pot_diff); /// the force calculation diff --git a/src/python/espressomd/electrostatic_extensions.pxd b/src/python/espressomd/electrostatic_extensions.pxd index 773f28e7813..470dd912d97 100644 --- a/src/python/espressomd/electrostatic_extensions.pxd +++ b/src/python/espressomd/electrostatic_extensions.pxd @@ -32,7 +32,7 @@ IF ELECTROSTATICS and P3M: double maxPWerror double gap_size double far_cut - int neutralize + bool neutralize double delta_mid_top, double delta_mid_bot, bool const_pot, diff --git a/src/python/espressomd/electrostatic_extensions.pyx b/src/python/espressomd/electrostatic_extensions.pyx index afb1558317f..10b43697fd9 100644 --- a/src/python/espressomd/electrostatic_extensions.pyx +++ b/src/python/espressomd/electrostatic_extensions.pyx @@ -131,7 +131,7 @@ IF ELECTROSTATICS and P3M: self._params["maxPWerror"], self._params["gap_size"], self._params["far_cut"], - int(self._params["neutralize"]), + self._params["neutralize"], self._params["delta_mid_top"], self._params["delta_mid_bot"], int(self._params["const_pot"]), From be2205d849c475d1ce13dcc23369fc1667a200f2 Mon Sep 17 00:00:00 2001 From: Alexander Reinauer Date: Thu, 5 Sep 2019 11:27:46 +0200 Subject: [PATCH 07/11] ... --- src/python/espressomd/electrostatic_extensions.pxd | 2 +- src/python/espressomd/electrostatic_extensions.pyx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/python/espressomd/electrostatic_extensions.pxd b/src/python/espressomd/electrostatic_extensions.pxd index 470dd912d97..a97717edb9e 100644 --- a/src/python/espressomd/electrostatic_extensions.pxd +++ b/src/python/espressomd/electrostatic_extensions.pxd @@ -39,7 +39,7 @@ IF ELECTROSTATICS and P3M: double pot_diff int ELC_set_params(double maxPWerror, double min_dist, double far_cut, - int neutralize, double delta_mid_top, double delta_mid_bot, bool const_pot, double pot_diff) + bool neutralize, double delta_mid_top, double delta_mid_bot, bool const_pot, double pot_diff) # links intern C-struct with python object ELC_struct elc_params diff --git a/src/python/espressomd/electrostatic_extensions.pyx b/src/python/espressomd/electrostatic_extensions.pyx index 10b43697fd9..7b0e6adf667 100644 --- a/src/python/espressomd/electrostatic_extensions.pyx +++ b/src/python/espressomd/electrostatic_extensions.pyx @@ -134,7 +134,7 @@ IF ELECTROSTATICS and P3M: self._params["neutralize"], self._params["delta_mid_top"], self._params["delta_mid_bot"], - int(self._params["const_pot"]), + self._params["const_pot"], self._params["pot_diff"]): handle_errors( "ELC tuning failed, ELC is not set up to work with the GPU P3M") From e25316cd8b53d2f1036cb124765bf6ab14245979 Mon Sep 17 00:00:00 2001 From: Alexander Reinauer Date: Thu, 5 Sep 2019 11:45:52 +0200 Subject: [PATCH 08/11] formatting --- src/core/electrostatics_magnetostatics/elc.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/core/electrostatics_magnetostatics/elc.cpp b/src/core/electrostatics_magnetostatics/elc.cpp index 6ea1667e210..f76a15ffef5 100644 --- a/src/core/electrostatics_magnetostatics/elc.cpp +++ b/src/core/electrostatics_magnetostatics/elc.cpp @@ -1154,17 +1154,18 @@ int ELC_tune(double error) { elc_params.far_cut = min_inv_boxl; do { - const auto prefactor = 2 * Utils::pi() * elc_params.far_cut; + const auto prefactor = 2 * Utils::pi() * elc_params.far_cut; - const auto sum = prefactor + 2 * (ux + uy); - const auto den = -expm1(-prefactor * lz); - const auto num1 = exp(prefactor * (h - lz)); - const auto num2 = exp(-prefactor * (h + lz)); + const auto sum = prefactor + 2 * (ux + uy); + const auto den = -expm1(-prefactor * lz); + const auto num1 = exp(prefactor * (h - lz)); + const auto num2 = exp(-prefactor * (h + lz)); - err = 0.5 / den * (num1 * (sum + 1 / (lz - h)) / (lz - h) + - num2 * (sum + 1 / (lz + h)) / (lz + h)); + err = 0.5 / den * + (num1 * (sum + 1 / (lz - h)) / (lz - h) + + num2 * (sum + 1 / (lz + h)) / (lz + h)); - elc_params.far_cut += min_inv_boxl; + elc_params.far_cut += min_inv_boxl; } while (err > error && elc_params.far_cut < MAXIMAL_FAR_CUT); if (elc_params.far_cut >= MAXIMAL_FAR_CUT) return ES_ERROR; From 02ef10381d7b451e4cbd5d76edbdf880b7b65296 Mon Sep 17 00:00:00 2001 From: Alexander Reinauer Date: Thu, 5 Sep 2019 12:06:41 +0200 Subject: [PATCH 09/11] clang --- src/core/electrostatics_magnetostatics/elc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/electrostatics_magnetostatics/elc.cpp b/src/core/electrostatics_magnetostatics/elc.cpp index f76a15ffef5..58d9e68f48f 100644 --- a/src/core/electrostatics_magnetostatics/elc.cpp +++ b/src/core/electrostatics_magnetostatics/elc.cpp @@ -58,7 +58,7 @@ static double ux, ux2, uy, uy2, uz, height_inverse; /*@}*/ -ELC_struct elc_params = {1e100, 10, 1, 0, 1, 1, false, 1, +ELC_struct elc_params = {1e100, 10, 1, 0, 1, true, false, 1, 1, false, 0, 0, 0, 0, 0.0}; /**************************************** From 08f818b4a8c9934386a2e6487cfb0823a0f388ee Mon Sep 17 00:00:00 2001 From: Alexander Reinauer Date: Thu, 5 Sep 2019 12:14:42 +0200 Subject: [PATCH 10/11] converted far_calculated flag to bool --- src/core/electrostatics_magnetostatics/elc.cpp | 8 ++++---- src/core/electrostatics_magnetostatics/elc.hpp | 2 +- src/core/electrostatics_magnetostatics/mmm2d.cpp | 6 +++--- src/core/electrostatics_magnetostatics/mmm2d.hpp | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/core/electrostatics_magnetostatics/elc.cpp b/src/core/electrostatics_magnetostatics/elc.cpp index 58d9e68f48f..1759119cae6 100644 --- a/src/core/electrostatics_magnetostatics/elc.cpp +++ b/src/core/electrostatics_magnetostatics/elc.cpp @@ -58,8 +58,8 @@ static double ux, ux2, uy, uy2, uz, height_inverse; /*@}*/ -ELC_struct elc_params = {1e100, 10, 1, 0, 1, true, false, 1, - 1, false, 0, 0, 0, 0, 0.0}; +ELC_struct elc_params = {1e100, 10, 1, 0, true, true, false, 1, + 1, false, 0, 0, 0, 0, 0.0}; /**************************************** * LOCAL ARRAYS @@ -1313,9 +1313,9 @@ int ELC_set_params(double maxPWerror, double gap_size, double far_cut, elc_params.far_cut = far_cut; if (far_cut != -1) { elc_params.far_cut2 = Utils::sqr(far_cut); - elc_params.far_calculated = 0; + elc_params.far_calculated = false; } else { - elc_params.far_calculated = 1; + elc_params.far_calculated = true; if (ELC_tune(elc_params.maxPWerror) == ES_ERROR) { runtimeErrorMsg() << "ELC tuning failed, gap size too small"; } diff --git a/src/core/electrostatics_magnetostatics/elc.hpp b/src/core/electrostatics_magnetostatics/elc.hpp index bb15a7322aa..bdb316764e8 100644 --- a/src/core/electrostatics_magnetostatics/elc.hpp +++ b/src/core/electrostatics_magnetostatics/elc.hpp @@ -48,7 +48,7 @@ typedef struct { */ double gap_size; /** @copybrief MMM2D_struct::far_calculated */ - int far_calculated; + bool far_calculated; /** Flag whether the box is neutralized by a homogeneous background. * If true, use a homogeneous neutralizing background for nonneutral * systems. Unlike the 3D case, this background adds an additional diff --git a/src/core/electrostatics_magnetostatics/mmm2d.cpp b/src/core/electrostatics_magnetostatics/mmm2d.cpp index a79a4cc79cf..227e3ce4a4f 100644 --- a/src/core/electrostatics_magnetostatics/mmm2d.cpp +++ b/src/core/electrostatics_magnetostatics/mmm2d.cpp @@ -135,7 +135,7 @@ static double max_near, min_far; /// static double self_energy; -MMM2D_struct mmm2d_params = {1e100, 10, 1, 0, false, false, 0, 1, 1, 1}; +MMM2D_struct mmm2d_params = {1e100, 10, 1, false, false, false, 0, 1, 1, 1}; /** return codes for \ref MMM2D_tune_near and \ref MMM2D_tune_far */ /*@{*/ @@ -1769,11 +1769,11 @@ int MMM2D_set_params(double maxPWerror, double far_cut, double delta_top, mmm2d_params.far_cut = far_cut; mmm2d_params.far_cut2 = Utils::sqr(far_cut); if (mmm2d_params.far_cut > 0) - mmm2d_params.far_calculated = 0; + mmm2d_params.far_calculated = false; else { if ((err = MMM2D_tune_far(maxPWerror))) return err; - mmm2d_params.far_calculated = 1; + mmm2d_params.far_calculated = true; } } diff --git a/src/core/electrostatics_magnetostatics/mmm2d.hpp b/src/core/electrostatics_magnetostatics/mmm2d.hpp index 34233708a3a..723bd0e42c2 100644 --- a/src/core/electrostatics_magnetostatics/mmm2d.hpp +++ b/src/core/electrostatics_magnetostatics/mmm2d.hpp @@ -56,7 +56,7 @@ typedef struct { * In the latter case, the cutoff will be adapted if important parameters, * such as the box dimensions, change. */ - int far_calculated; + bool far_calculated; /// flag whether there is any dielectric contrast in the system. bool dielectric_contrast_on; /// @brief Flag whether a const. potential is applied. From 26fe01124a21ed6d89450e57030c1fc243a804a4 Mon Sep 17 00:00:00 2001 From: Alexander Reinauer Date: Thu, 5 Sep 2019 12:19:12 +0200 Subject: [PATCH 11/11] formatting --- src/core/electrostatics_magnetostatics/elc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/electrostatics_magnetostatics/elc.cpp b/src/core/electrostatics_magnetostatics/elc.cpp index 1759119cae6..ea0498ad998 100644 --- a/src/core/electrostatics_magnetostatics/elc.cpp +++ b/src/core/electrostatics_magnetostatics/elc.cpp @@ -59,7 +59,7 @@ static double ux, ux2, uy, uy2, uz, height_inverse; /*@}*/ ELC_struct elc_params = {1e100, 10, 1, 0, true, true, false, 1, - 1, false, 0, 0, 0, 0, 0.0}; + 1, false, 0, 0, 0, 0, 0.0}; /**************************************** * LOCAL ARRAYS