Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Particle counter per type broken #3498

Open
fweik opened this issue Feb 17, 2020 · 5 comments
Open

Particle counter per type broken #3498

fweik opened this issue Feb 17, 2020 · 5 comments

Comments

@fweik
Copy link
Contributor

fweik commented Feb 17, 2020

There is a mechanism for tracking the number of particles per type in the head node particle data interface. This does so by tracking type changes thru the front end, but does not register type/particles changes from other places e.g. by collisions. This count is used in the reaction ensemble (and exposed to the user), and wrong counts can lead to wrong results. There are concrete plans to use RE and reactions/collision together, so this has to be fixed.

The preferred way to fix this by calculating the particles counts on demand in the reaction ensemble on the front end, where also all the global information is available. I think the state tracking to brittle, and generally not a good idea.

@fweik
Copy link
Contributor Author

fweik commented Feb 17, 2020

Was #3495.

@jonaslandsgesell
Copy link
Member

The preferred way to fix this by calculating the particles counts on demand in the reaction ensemble on the front end

What mechanism do you have in mind? The current state tracking is of O(1) and avoids looping over all particles to determine the number of particles of a given type. This state tracking, therefore, is fast compared to looping over all particles and reading their type which is O(N).

@fweik
Copy link
Contributor Author

fweik commented Feb 18, 2020

It has to be calculated once when the control transfers to the RE, then the changes done by the RE itself can be tracked without recounting. A linear term is no problem, considering that the RE e.g. also does linear searches for neighbor distances when inserting as well as energy calculations which are more expensive. Also I'm sure there are even faster methods to obtain an incorrect result :-)

@jngrad
Copy link
Member

jngrad commented Oct 7, 2022

In addition, particles of type 0 created with system.part.add(pos=[1, 2, 3]) cannot react, because they are not tracked by the particle map (#4588). All ESPResSo versions since 4.0.0 are affected by this bug.

@jngrad
Copy link
Member

jngrad commented Jan 9, 2023

The particle map is not cleared when the list of particles is cleared (#4645).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants