espressomd-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ESPResSo-users] Restricting interactions to nearest neighbors


From: Florian Weik
Subject: Re: [ESPResSo-users] Restricting interactions to nearest neighbors
Date: Wed, 19 Sep 2018 19:40:02 +0200

Hi,
what you want to do is not possible out of the box in Espresso, but it is not that hard to implement.
I'm sure you have good reasons for wanting that, but keep in mind that this results in a non-differentiable
potential and therefor in jumps in the force. This usually is neither physically sensible nor numerically stable. What would you use this for?

That being said, one way to implement this could be to a a property to ParticleLocal like `int nearest_neighbor_id`
and `double nearest_neighbor_distance`, initialize the distance with infinity and then during the short range calculation,
which is called once for every particle pair (closer than the cutoff) compare the pair distance to the one stored on the particle.
If it is shorter update the id and distance stored on the particle id. After the short range calculation on every particle
there either the nearest neighbor is stored, or none if there is no particle within the cutoff. The you can do a second (linear) pass over all particles and calculate the one interaction for every particle. Overall this is very similar to how the collision detection is implemented in newer versions of Espresso, you could look at that if you need some inspiration. Without a cutoff there is no efficient way to do this in Espresso. You would need a more suitable data structure like a k-d tree to do that efficiently.

Hope that helps,
Florian

On Wed, Sep 19, 2018 at 7:22 PM Memet, Edvin <address@hidden> wrote:

Dear Henry,

I understand LJ has a cutoff, but that will not do what I want. If I just fix some r_cut I won't have the guarantee that exactly one particle will fall within that cutoff, as things move around. I should have clarified that for each particle, I want it to only interact with exactly one other particle (the nearest one) at all times.

Slightly more concretely, I have an interaction LJ defined between particles of types 0 and 1, say. Each particle of type zero should only interact with the single nearest particle of type 1 (and viceversa). 

Best,
Edvin

On 09/19/2018 12:00 PM, address@hidden wrote:

Today's Topics:

   1. Restricting interactions to nearest neighbors (Memet, Edvin)
   2. Re: Restricting interactions to nearest neighbors (Henri Menke)


_______________________________________________
Espressomd-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/espressomd-users


reply via email to

[Prev in Thread] Current Thread [Next in Thread]