|
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: https://github.com/espressomd/espresso/blob/bd1cce48aef5634fca29db584664760703bdceff/src/core/forces_inline.hpp#L697-L699).
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: https://github.com/jngrad/espresso/blob/bb5b3d9bf650b4d556361c2bd4f6a50cf9c64ae0/src/core/bonded_interactions/angle_cosine.hpp
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. Best, JN 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. Best, Edvin
[Prev in Thread] | Current Thread | [Next in Thread] |