plumed / plumed2

Development version of plumed 2
https://www.plumed.org
GNU Lesser General Public License v3.0
357 stars 284 forks source link

Possible bug in EMMI #1032

Open GiovanniBussi opened 7 months ago

GiovanniBussi commented 7 months ago

Today I noticed this warning with INTEL compiler:

EMMI.cpp:1392:22: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
  ene += std::log( abs ( s * ovmd_ave_[i] - ovdd_[i] ) );
           ^
EMMI.cpp:1392:22: note: use function 'std::abs' instead
  ene += std::log( abs ( s * ovmd_ave_[i] - ovdd_[i] ) );

I guess it might be a bug, because using an integer there does not make sense. And the fix would require to replace abs with std::abs.

@maxbonomi can you double check?

In case, the line is there also in plumed v2.8, so I would backport the fix. Notice that the function is not covered in tests, so this would not affect regtests.

maxbonomi commented 7 months ago

Thanks Giovanni,

I will look into it! I am happy also to discontinue this Action, as we have a much better and simpler method now (EMMIVox.cpp). I will think a bit about it

Max

On 28 Feb 2024, at 11:32, Giovanni @.***> wrote:

Today I noticed this warning with INTEL compiler: EMMI.cpp:1392:22: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value] ene += std::log( abs ( s ovmdave[i] - ovdd_[i] ) ); ^ EMMI.cpp:1392:22: note: use function 'std::abs' instead ene += std::log( abs ( s ovmdave[i] - ovdd_[i] ) );

I guess it might be a bug, because using an integer there does not make sense. And the fix would require to replace abs with std::abs. @maxbonomi can you double check? In case, the line is there also in plumed v2.8, so I would backport the fix. Notice that the function is not covered in tests, so this would not affect regtests. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>