diff --git a/src/core/CellStructure.hpp b/src/core/CellStructure.hpp
index bd46322aa53..e81ae9abda1 100644
--- a/src/core/CellStructure.hpp
+++ b/src/core/CellStructure.hpp
@@ -669,11 +669,12 @@ struct CellStructure {
* @brief Run kernel on all particles inside cell and neighbors.
*
* @param p Particle to identify cell and neighbors
- * @param kernel Function with (Particle, Particle, Vector)
- * @return false if cell is not found via particle_to_cell, otherwise true
+ * @param kernel Function with signature double(Particle, Particle, Vector)
+ * @return false if cell is not found via @ref particle_to_cell, otherwise true
*/
template
- bool run_on_particle_short_range_neighbors(Particle const &p, Kernel kernel) {
+ bool run_on_particle_short_range_neighbors(Particle const &p,
+ Kernel &kernel) {
auto const cell = find_current_cell(p);
if (cell == nullptr) {
@@ -694,8 +695,8 @@ struct CellStructure {
private:
template
- void short_range_neighbor_loop(Particle const &p, Cell *cell, Kernel kernel,
- DistanceFunc df) {
+ void short_range_neighbor_loop(Particle const &p, Cell *const cell,
+ Kernel &kernel, DistanceFunc const &df) {
/* Iterate over particles inside cell */
for (auto const &part : cell->particles()) {
if (&part == &p) {
diff --git a/src/core/cells.cpp b/src/core/cells.cpp
index 602291a0e9f..75329d2ab2a 100644
--- a/src/core/cells.cpp
+++ b/src/core/cells.cpp
@@ -129,8 +129,8 @@ mpi_get_short_range_neighbors_local(int const pid, double const distance) {
auto kernel = [&ret, cutoff2](Particle const &p, Particle const &p1,
Utils::Vector3d const &vec) {
if (vec.norm2() < cutoff2) {
- ret.emplace_back(p1.p.identity);
- };
+ ret.emplace_back(p1.id());
+ }
};
cell_structure.run_on_particle_short_range_neighbors(*p, kernel);
return ret;
diff --git a/src/core/energy.cpp b/src/core/energy.cpp
index a67b126c6ac..fd17110452c 100644
--- a/src/core/energy.cpp
+++ b/src/core/energy.cpp
@@ -141,10 +141,13 @@ double particle_short_range_energy_contribution_local(int pid) {
if (p) {
auto kernel = [&ret](Particle const &p, Particle const &p1,
Utils::Vector3d const &vec) {
- auto const dist = sqrt(vec.norm2());
- auto const &ia_params = *get_ia_param(p.p.type, p1.p.type);
+#ifdef EXCLUSIONS
+ if (not do_nonbonded(p, p1))
+ return;
+#endif
+ auto const &ia_params = *get_ia_param(p.type(), p1.type());
// Add energy for current particle pair to result
- ret += calc_non_bonded_pair_energy(p, p1, ia_params, vec, dist);
+ ret += calc_non_bonded_pair_energy(p, p1, ia_params, vec, vec.norm());
};
cell_structure.run_on_particle_short_range_neighbors(*p, kernel);
}
diff --git a/src/python/espressomd/analyze.pyx b/src/python/espressomd/analyze.pyx
index d6e8024bf8c..cdb457823ce 100644
--- a/src/python/espressomd/analyze.pyx
+++ b/src/python/espressomd/analyze.pyx
@@ -345,17 +345,18 @@ class Analysis:
utils.handle_errors("calculate_energy() failed")
return obs
- def particle_energy(self, ParticleHandle particle):
+ def particle_energy(self, particle):
"""
Calculate the non-bonded energy of a single given particle.
Parameters
----------
- particle : :attr:`~espressomd.particle_data.ParticleHandle.type`
+ particle : :class:`~espressomd.particle_data.ParticleHandle`
Returns
-------
- :obj: `float` non-bonded energy of that particle
+ :obj: `float`
+ non-bonded energy of that particle
"""
energy_contribution = particle_short_range_energy_contribution(
diff --git a/src/python/espressomd/cellsystem.pxd b/src/python/espressomd/cellsystem.pxd
index db1a4928319..08ac8c43c47 100644
--- a/src/python/espressomd/cellsystem.pxd
+++ b/src/python/espressomd/cellsystem.pxd
@@ -39,11 +39,6 @@ cdef extern from "CellStructureType.hpp":
CELL_STRUCTURE_REGULAR "CellStructureType::CELL_STRUCTURE_REGULAR"
CELL_STRUCTURE_NSQUARE "CellStructureType::CELL_STRUCTURE_NSQUARE"
-cdef extern from "particle_data.hpp":
- ctypedef struct particle "Particle"
- const particle & get_particle_data(int pid) except +
-
-
cdef extern from "cells.hpp":
ctypedef struct CellStructure:
CellStructureType decomposition_type()
diff --git a/src/python/espressomd/cellsystem.pyx b/src/python/espressomd/cellsystem.pyx
index 979a97a465a..07dc3ca9a1e 100644
--- a/src/python/espressomd/cellsystem.pyx
+++ b/src/python/espressomd/cellsystem.pyx
@@ -130,13 +130,13 @@ cdef class CellSystem:
handle_errors("Error in get_pairs()")
return pairs
- def get_neighbors(self, ParticleHandle particle, distance):
+ def get_neighbors(self, particle, distance):
"""
Get neighbors of a given particle up to distance
Parameters
----------
- particle : :attr:`~espressomd.particle_data.ParticleHandle.type`
+ particle : :class:`~espressomd.particle_data.ParticleHandle`
distance : :obj:`float`
Pairs of particles closer than ``distance`` are found.