Multiwfn forum

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

You are not logged in.

#1 2022-02-07 08:14:48

i.s.ger
Member
Registered: 2020-12-01
Posts: 55

Feature request: local Hartree-Fock energy

Dear Tian Lu,

Some DFT functionals use local Hartree-Fock energy as one of its features as density, gradient, or Laplacian. The not full list is presented at https://gitlab.com/libxc/libxc/-/issues/40.

An example of a computation procedure can be found at https://github.com/deepmind/deepmind-re … py#L29-L49:

The Hartree-Fock (HF) exchange energy can be written as:
-2 HF_x = \sum_{a,b,c,d} D_{ab} D_{cd} \int dr \int dr' [ \chi_a(r) \chi_c(r) v(r, r') \chi_b(r') \chi_d(r') ]

where D is the density matrix, \chi_a the atomic basis functions and r, r' are
coordinates. For clarity we have dropped the spin-channel label of the density
matrix.

Defining the following intermediates:
\nu_{bd}(r) = \int dr' (\chi_b(r') v(r, r') \chi_d(r'))
E_b(r) = \sum_a D_{ab} \chi_a(r)
E_d(r) = \sum_c D_{cd} \chi_c(r)

we get the following expression for HF:
-2 HF_x = \int dr \sum_{bd} E_b(r) E_d(r) \nu_{bd}(r)

Therefore the quantity
exx(r) = -0.5 sum_{bd} E_b(r) E_d(r) \nu_{bd}(r)

As I can see, \nu_{bd}(r) is a one-electron Coulomb integral that should be computed fastly using libreta.

Is it possible to implement?

Best regards,
Igor

Offline

#2 2022-02-07 16:31:40

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

Re: Feature request: local Hartree-Fock energy

Dear Igor,

This local function seems pretty meaningful. The Libreta library currently embedded in Multiwfn is not full version but specific for evaluating electrostatic potential. I will ask Libreta developer if nu(r) can be realized, if yes, the exx(r) will be available in Multiwfn very soon, and at that time I will let you know here.

Best regards,

Tian

Offline

#3 2022-02-12 01:00:12

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

Re: Feature request: local Hartree-Fock energy

Dear Igor,

I am glad to inform you that this function has been supported as the 999th user-defined function in the Multiwfn updated today, see corresponding part of Section 2.7 of Multiwfn manual for detail.

Note that the -0.5 in the expression should be -1/4 for closed-shell case, this can be easily demonstrated. Also, the code segment you mentioned only works for closed-shell system, while the local HF exchange energy in Multiwfn also support open-shell system.

PS: To validate my implementation, I have performed integration for this real space function over the whole space using subfunction 4 of main function 100, the result is exactly identical to the HF exchange energy given by Gaussian.

Best regards,

Tian

Offline

#4 2022-02-13 10:01:53

i.s.ger
Member
Registered: 2020-12-01
Posts: 55

Re: Feature request: local Hartree-Fock energy

Dear Tian Lu,

Thank you so much!

Unfortunately, I got SIGSEGV: Segmentation fault - invalid memory reference.

I will look what is the problem with my input file or with the implementation or with the compiler.

Best regards,
Igor

Offline

#5 2022-02-13 23:13:46

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

Re: Feature request: local Hartree-Fock energy

Dear Igor,

At least for my tested system (examples\dopamine.wfn), both official Windows and Linux version (in RHEL6 U1) of Multiwfn work normally.
In order to implement this function, the interface of libreta library has been largely reorganized, make pay attention to proper compliation, the Makefile and "COMPLIATION_METHOD.txt" in source code package have been modified.

Best regards,

Tian

Offline

#6 2022-02-14 01:51:28

i.s.ger
Member
Registered: 2020-12-01
Posts: 55

Re: Feature request: local Hartree-Fock energy

Dear Tian Lu,

I found the problem. I do not use settings.ini.

I run Multiwfn as:

./Multiwfn H2O.wfn
1000
2
999
100
4
100

In that case, libreta is not initialized and genPprim routine is not called, so, Pprim_tot is not initialized.

I can write a code in 1000 section, but I'm not sure that it is a good idea since at the next time someone will need to fix several places.
What will be a better place for the correct initialization of needed libraries and matrixes?

Best regards,
Igor

Offline

#7 2022-02-14 04:38:18

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

Re: Feature request: local Hartree-Fock energy

Dear Igor,

I just fixed this issue and updated Multiwfn. Now you can also use 1000 to choose local HF exchange energy.

Best regards,

Tian

Offline

#8 2022-02-14 05:16:24

i.s.ger
Member
Registered: 2020-12-01
Posts: 55

Re: Feature request: local Hartree-Fock energy

Dear Tian Lu,

Thank you so much!

Now, that is working!

Best regards,
Igor

Offline

#9 2022-02-14 22:26:54

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

Re: Feature request: local Hartree-Fock energy

Dear Igor,

I forgot to mention, if this function is utilized in research, please not only cite Multiwfn but also cite original paper of Libreta liraray: J. Chem. Theory Comput., 14, 572−587 (2018). The developer of this library provided help about modifying Libreta interface during my implementation of this function.

Best regards,

Tian

Offline

#10 2022-02-19 03:14:51

i.s.ger
Member
Registered: 2020-12-01
Posts: 55

Re: Feature request: local Hartree-Fock energy

Dear Tian Lu,

While we tested a new code, we found that some basis sets lead to unreliable results while local Hartree-Fock energy is integrated over the whole space.

Here, the example .wfn where the problem is:
Al_large.wfn

At the same time, that .wfn have reliable energy:
Al_small.wfn

With binaries, provided in sobereva.com, we got the following energies:

$ echo "1000 2 999 100 4 100" | tr " " "\n" | ./Multiwfn Al_large.wfn 2>/dev/null | grep "Final result"
 Final result:                 NaN
$ echo "1000 2 999 100 4 100" | tr " " "\n" | ./Multiwfn Al_small.wfn 2>/dev/null | grep "Final result"
 Final result:      -18.0695836639

Best regards,
Igor

Offline

#11 2022-02-19 07:23:36

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

Re: Feature request: local Hartree-Fock energy

Dear Igor,

I have fixed this problem, please download latest version.

Best regards,

Tian

Offline

#12 2022-02-19 11:04:04

i.s.ger
Member
Registered: 2020-12-01
Posts: 55

Re: Feature request: local Hartree-Fock energy

Dear Tian Lu,

I downloaded most recent http://sobereva.com/multiwfn/misc/Multi … _noGUI.zip. Unfortunately, it continues to produce NaN local Hartree-Fock energy with

$ echo "1000 2 999 100 4 100" | tr " " "\n" | ./Multiwfn Al_large.wfn 2>/dev/null | grep "Final result"
 Final result:                 NaN

Additionally, running that version of MultiWFN with attached to archive settings.ini leads to error:

forrtl: severe (59): list-directed I/O syntax error, unit -5, file Internal List-Directed Read
Image              PC                Routine            Line        Source             
Multiwfn           0000000001F13C4B  Unknown               Unknown  Unknown
Multiwfn           0000000001F4037E  Unknown               Unknown  Unknown
Multiwfn           0000000001F3F0A5  Unknown               Unknown  Unknown
Multiwfn           000000000079DFBF  Unknown               Unknown  Unknown
Multiwfn           0000000000802012  Unknown               Unknown  Unknown
Multiwfn           000000000042B022  Unknown               Unknown  Unknown
libc-2.31.so       00007FC51DAFD0B3  __libc_start_main     Unknown  Unknown
Multiwfn           000000000042AF29  Unknown               Unknown  Unknown

Best regards,
Igor

Offline

#13 2022-02-19 13:30:37

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

Re: Feature request: local Hartree-Fock energy

Dear Igor,

I just updated again, this time it should work.

Best regards,

Tian

Offline

#14 2022-02-19 14:27:50

i.s.ger
Member
Registered: 2020-12-01
Posts: 55

Re: Feature request: local Hartree-Fock energy

Dear Tian Lu,

Thank you so much! Now, it is working!

Best regards,
Igor

Offline

#15 2022-02-19 19:59:54

lsvvt
Member
Registered: 2022-02-19
Posts: 2

Re: Feature request: local Hartree-Fock energy

Dear Tian Lu,

Thanks for the implementation of Local Hartree-Fock exchange energy. I have performed integration over the whole space for the open-shell He atom. Unfortunately, the result is 2 times more than the HF exchange energy given by Gaussian. At the same time, for the open-shell Be atom, the energy in Mulfiwfn is the same as in Gaussian.

Here, the example UHF-He.wfn where the problem is:
UHF-He.wfn

That is RHF-He.wfn results:
RHF-He.wfn

$ echo "1000 2 999 100 4 100" | tr " " "\n" | Multiwfn UHF-He.wfn 2>/dev/null | grep "Final result"
Final result:       -2.0409120547
$ echo "1000 2 999 100 4 100" | tr " " "\n" | Multiwfn RHF-He.wfn 2>/dev/null | grep "Final result"
Final result:       -1.0204560273

And two more examples for Be atom:
UHF-Be.wfn
RHF-Be.wfn

$ echo "1000 2 999 100 4 100" | tr " " "\n" | Multiwfn UHF-Be.wfn 2>/dev/null | grep "Final result"
Final result:       -2.6674331900
$ echo "1000 2 999 100 4 100" | tr " " "\n" | Multiwfn RHF-Be.wfn 2>/dev/null | grep "Final result"
Final result:       -2.6674331900

Best regards,
Timofey

Offline

#16 2022-02-20 05:49:21

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

Re: Feature request: local Hartree-Fock energy

Dear Timofey,

This problem has been fixed, please download the latest version of Multiwfn.

Best  regards,

Tian

Offline

#17 2022-02-20 11:15:58

lsvvt
Member
Registered: 2022-02-19
Posts: 2

Re: Feature request: local Hartree-Fock energy

Dear Tian Lu,

Thank you very much! Everything is working now!

Best regards,
Timofey

Offline

Board footer

Powered by FluxBB