Multiwfn forum

Multiwfn official website: //www.umsyar.com/multiwfn. Multiwfn forum in Chinese: http://bbs.keinsci.com/wfn

You are not logged in.

#12025-02-10 08:33:39

lsimon
Member
Registered: 2023-03-04
Posts: 10

possible bug in LEA QAMS surface properties of each atom

analysing the LEA of each atom surface using QAMS (sequence of options: 12 2 4 0 11) I obtained results like this:

Note: Average and variance below are in eV and eV^2 respectively
Atom# All/Positive/Negative average All/Positive/Negative variance
3 -36.41248 NaN -36.41248 NaN NaN 24.17663
4 -36.25866 NaN -36.25866 NaN NaN 21.78491
5 -35.78661 NaN -35.78661 NaN NaN 23.29892
6 -35.81292 NaN -35.81292 NaN NaN 23.65038
12 -22.13457 NaN -22.13457 NaN NaN 8.27424
13 -21.98016 NaN -21.98016 NaN NaN 14.85794


While I find reasonable the results in the first 3 columns (basically, the "positive" values are all NaN and not used in calculating the average, so the average of all values and of negative values are identical), I wonder if the other 3 columns are correct. I would expect a similar result than with the others: NAN for "positive", and therefore identical variance considering all points or only negative points. Could this be a problem and the "All variance" column should also match the "Negative variance" column?

Thanks

Luis

Offline

#22025-02-10 12:35:38

lsimon
Member
Registered: 2023-03-04
Posts: 10

Re: possible bug in LEA QAMS surface properties of each atom

Hi again... I opened the code and found these two lines in surfana.f90 file:

fragsurvar=fragsurvar/fragsurarea
fragsurvar(:,1)=fragsurvar(:,2)+fragsurvar(:,3)

¿Could this be that "fragsurarea" is 0 for positive values (the surface area corresponding to positive values of the LEA is zero, since LEA is negative everywhere, so fragsurvar is NaN for positive values, and accordingly the first element of the vector is also NaN since it is calculated by the sume in the second instruction? Maybe for LEA the second instruction should be changed to:

fragsurvar(:,1)=fragsurvar(:,3)

or even an if..else could be used to determine wether to use one or the other alternative depending on NaN values in fragsurvar(:,2)...

Offline

#32025-02-11 02:42:19

sobereva
Tian Lu (Multiwfn developer)
From: Beijing
Registered: 2017-09-11
Posts: 2,019
Website

Re: possible bug in LEA QAMS surface properties of each atom

Thank you for your report. This piece of code should be changed to

fragsurvar(:,2:3)=fragsurvar(:,2:3)/fragsurarea(:,2:3) do ifrag=1,nsurfrag if (fragsurarea(ifrag,2)>0) fragsurvar(ifrag,1)=fragsurvar(ifrag,1)+fragsurvar(ifrag,2) if (fragsurarea(ifrag,3)>0) fragsurvar(ifrag,1)=fragsurvar(ifrag,1)+fragsurvar(ifrag,3) end do

This issue will be fixed in the next update of Multiwfn.

Offline

#42025-02-11 09:24:36

lsimon
Member
Registered: 2023-03-04
Posts: 10

Re: possible bug in LEA QAMS surface properties of each atom

Thanks! I was about to suggest the common trick of adding some small quantity to the denominator:

fragsurvar=fragsurvar/(fragsurarea+0.000000000000001)

But your solution will definitely be more stable and less sensitive to numeric errors!

Offline

Board footer

Baidu
map