From 75257e1e31f4a1a862349f375a7fa555b2c099f0 Mon Sep 17 00:00:00 2001 From: Jonas Landsgesell Date: Mon, 16 Sep 2019 15:17:54 +0200 Subject: [PATCH 1/2] remove undocumented side effect --- src/core/reaction_ensemble.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/core/reaction_ensemble.cpp b/src/core/reaction_ensemble.cpp index 6bc139a881e..86f6a9a0dc0 100644 --- a/src/core/reaction_ensemble.cpp +++ b/src/core/reaction_ensemble.cpp @@ -632,17 +632,8 @@ Utils::Vector3d ReactionAlgorithm::get_random_position_in_box() { std::sqrt(m_uniform_real_distribution( m_generator)); // for uniform disk point picking in cylinder double phi = 2.0 * Utils::pi() * m_uniform_real_distribution(m_generator); - out_pos[0] = random_radius * cos(phi); - out_pos[1] = random_radius * sin(phi); - while (std::pow(out_pos[0], 2) + std::pow(out_pos[1], 2) <= - std::pow(exclusion_radius, 2)) { - random_radius = - cyl_radius * std::sqrt(m_uniform_real_distribution(m_generator)); - out_pos[0] = random_radius * cos(phi); - out_pos[1] = random_radius * sin(phi); - } - out_pos[0] += cyl_x; - out_pos[1] += cyl_y; + out_pos[0] = cyl_x+random_radius * cos(phi); + out_pos[1] = cyl_y+random_radius * sin(phi); out_pos[2] = box_geo.length()[2] * m_uniform_real_distribution(m_generator); } else if (box_has_wall_constraints) { out_pos[0] = box_geo.length()[0] * m_uniform_real_distribution(m_generator); From cbbbfdc56fd808ea9778cb2718561564cb4dba28 Mon Sep 17 00:00:00 2001 From: Jonas Landsgesell Date: Mon, 16 Sep 2019 15:22:08 +0200 Subject: [PATCH 2/2] fmt --- src/core/reaction_ensemble.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/reaction_ensemble.cpp b/src/core/reaction_ensemble.cpp index 86f6a9a0dc0..0afacc0cc58 100644 --- a/src/core/reaction_ensemble.cpp +++ b/src/core/reaction_ensemble.cpp @@ -632,8 +632,8 @@ Utils::Vector3d ReactionAlgorithm::get_random_position_in_box() { std::sqrt(m_uniform_real_distribution( m_generator)); // for uniform disk point picking in cylinder double phi = 2.0 * Utils::pi() * m_uniform_real_distribution(m_generator); - out_pos[0] = cyl_x+random_radius * cos(phi); - out_pos[1] = cyl_y+random_radius * sin(phi); + out_pos[0] = cyl_x + random_radius * cos(phi); + out_pos[1] = cyl_y + random_radius * sin(phi); out_pos[2] = box_geo.length()[2] * m_uniform_real_distribution(m_generator); } else if (box_has_wall_constraints) { out_pos[0] = box_geo.length()[0] * m_uniform_real_distribution(m_generator);