[Top][All Lists]

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

Re: [ESPResSo-users] Angle potential 3-body vs 2-body (?) forces

From: Jean-Noël Grad
Subject: Re: [ESPResSo-users] Angle potential 3-body vs 2-body (?) forces
Date: Tue, 26 Mar 2019 17:01:10 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:60.0) Gecko/20100101 Thunderbird/60.5.1

Dear Edvin,

They are the same. One function returns three vectors, the other returns two vectors (the third vector is deduced by addition:

Function calc_angle_cosine_force() is called by forces_inline.hpp, while function calc_angle_cosine_3body_forces() is called by pressure_inline.hpp. Whenever you define a bond in Python with espressomd.interactions.AngleCosine, both functions get called during integration (the forces and pressure .hpp files are walked through).

Both functions carry out the same calculation, even though the coding style differs. We're currently refactoring bond angles to remove code duplication and improve readability. You can see the progress on GitHub with #2497, #2542 and #1224. The latest version of the file you attached can be found here:

If you need to edit these files, just keep in mind that intermediate variables related to angles follow the external angle convention (i.e. pi - theta, so the cosine changes sign, but the sine is unaffected). This will change in the future.

Hope this helps.


On 3/26/19 7:21 AM, Memet, Edvin wrote:
Dear all,

In a file like angle_cosine.hpp, for instance, what is the difference
between the following functions?

inline int calc_angle_cosine_force(...)
inline void calc_angle_cosine_3body_forces(...)

The first one seems like it computes the forces on only two of the
particles rather than on all three particles composing the angle bond.
If that is the case, then why/how would that work?

Also, I've tried to check which of the two functions is actually being
called when I define an angle potential. Surprisingly, it seemed like
only the first function was being called. Is that correct? Is the force
on the third particle zero, then, or is it being computed elsewhere?

If it's better to ask this in the developer's list, please let me know.


reply via email to

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