From 2ce94eb2ac72531ea8ff23308e51592a07f31811 Mon Sep 17 00:00:00 2001 From: Pietro Incardona <incardon@mpi-cbg.de> Date: Fri, 14 Oct 2016 13:39:44 +0200 Subject: [PATCH] Stabilized LJ --- src/Vector/vector_dist.hpp | 42 ++++++++++++++++++++-- src/Vector/vector_dist_cell_list_tests.hpp | 3 ++ src/Vector/vector_dist_unit_test.hpp | 2 -- 3 files changed, 43 insertions(+), 4 deletions(-) diff --git a/src/Vector/vector_dist.hpp b/src/Vector/vector_dist.hpp index e8e0832b1..e9d457fda 100644 --- a/src/Vector/vector_dist.hpp +++ b/src/Vector/vector_dist.hpp @@ -440,8 +440,7 @@ public: // Clear the cell list from the previous particles cell_list.clear(); - // for each particle add the particle to the cell list - + // for each particle real and ghost, add the particle to the cell list auto it = getIterator(); while (it.isNext()) @@ -456,6 +455,45 @@ public: cell_list.set_gm(g_m); } + /*! \brief Update a cell list using the stored particles + * + * \tparam CellL CellList type to construct + * + * \param cell_list Cell list to update + * + */ + template<typename CellL = CellList<dim, St, FAST, shift<dim, St> > > void updateCellListSym(CellL & cell_list) + { + // Clear the cell list from the previous particles + cell_list.clear(); + + // for each particle real and ghost, add the particle to the cell list + auto it = getDomainIterator(); + + while (it.isNext()) + { + auto key = it.get(); + + cell_list.addDom(this->getPos(key), key.getKey()); + + ++it; + } + + // for each particle real and ghost, add the particle to the cell list + it = getGhostIterator(); + + while (it.isNext()) + { + auto key = it.get(); + + cell_list.addGhost(this->getPos(key), key.getKey()); + + ++it; + } + + cell_list.set_gm(g_m); + } + /*! \brief Construct a cell list starting from the stored particles * * It differ from the get getCellList for an additional parameter, in case the diff --git a/src/Vector/vector_dist_cell_list_tests.hpp b/src/Vector/vector_dist_cell_list_tests.hpp index b6c4265a4..bb878a10d 100644 --- a/src/Vector/vector_dist_cell_list_tests.hpp +++ b/src/Vector/vector_dist_cell_list_tests.hpp @@ -524,6 +524,9 @@ BOOST_AUTO_TEST_CASE( vector_dist_symmetric_cell_list ) for (size_t i = 0 ; i < vd.getProp<3>(p).size() ; i++) ret &= vd.getProp<3>(p).get(i).id == vd.getProp<4>(p).get(i).id; + if (ret == false) + break; + ++p_it3; } diff --git a/src/Vector/vector_dist_unit_test.hpp b/src/Vector/vector_dist_unit_test.hpp index 90bd56628..ac68bea2e 100644 --- a/src/Vector/vector_dist_unit_test.hpp +++ b/src/Vector/vector_dist_unit_test.hpp @@ -1239,8 +1239,6 @@ BOOST_AUTO_TEST_CASE( vector_dist_cell_verlet_test ) vd.ghost_get<0>(); - vd.write("Debug_output"); - // calculate the distance of the first, second and third neighborhood particle // Consider that they are on a regular grid -- GitLab