1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2024-12-22 20:36:01 +01:00

Fortran interface

This commit is contained in:
Anthony Scemama 2022-02-27 11:18:26 +01:00
parent ad86cb7d67
commit 5e35df226a
2 changed files with 64 additions and 8 deletions

View File

@ -1,3 +1,4 @@
B
#+TITLE: Atomic Orbitals #+TITLE: Atomic Orbitals
#+SETUPFILE: ../tools/theme.setup #+SETUPFILE: ../tools/theme.setup
#+INCLUDE: ../tools/lib.org #+INCLUDE: ../tools/lib.org
@ -2639,14 +2640,15 @@ qmckl_exit_code qmckl_finalize_basis(qmckl_context context) {
*** HPC-specific data structures *** HPC-specific data structures
For faster access, we provide 3D tensors for the shell information For faster access, we provide extra arrays for the shell information as:
as:
- $C_{psa}$ = =coef_per_nucleus (iprim, ishell, inucl)= - $C_{psa}$ = =coef_per_nucleus (iprim, ishell, inucl)=
- $\gamma_{pa}$ =expo_per_nucleus (iprim, inucl)= - $\gamma_{pa}$ =expo_per_nucleus (iprim, inucl)=
such that the computation of the radial parts can be vectorized. such that the computation of the radial parts can be vectorized.
Exponents are sorted in increasing order to exit loops quickly, Exponents are sorted in increasing order to exit loops quickly,
and only unique exponents are kept. and only unique exponents are kept. This also allows to pack the
exponents to enable vectorization of exponentials.
The computation of the radial part is made as The computation of the radial part is made as
\[ \[
@ -2655,7 +2657,7 @@ qmckl_exit_code qmckl_finalize_basis(qmckl_context context) {
which is a matrix-vector product. which is a matrix-vector product.
#+NAME:HPC_struct #+NAME:HPC_struct
#+begin_src c :comments org :tangle (eval h_private_type) :exports none #+begin_src c :comments org :exports none
/* HPC specific data structures */ /* HPC specific data structures */
qmckl_tensor coef_per_nucleus; qmckl_tensor coef_per_nucleus;
qmckl_matrix expo_per_nucleus; qmckl_matrix expo_per_nucleus;

View File

@ -187,6 +187,19 @@ qmckl_get_nucleus_num (const qmckl_context context, int64_t* const num) {
} }
#+end_src #+end_src
#+begin_src f90 :tangle (eval fh_func) :comments org :exports none
interface
integer(c_int32_t) function qmckl_get_nucleus_num(context, num) &
bind(C)
use, intrinsic :: iso_c_binding
import
implicit none
integer (c_int64_t) , intent(in) , value :: context
integer (c_int64_t) , intent(out) :: num
end function qmckl_get_nucleus_num
end interface
#+end_src
#+begin_src c :comments org :tangle (eval h_func) :exports none #+begin_src c :comments org :tangle (eval h_func) :exports none
qmckl_exit_code qmckl_exit_code
@ -242,6 +255,20 @@ qmckl_get_nucleus_charge (const qmckl_context context,
#+end_src #+end_src
#+begin_src f90 :tangle (eval fh_func) :comments org :exports none
interface
integer(c_int32_t) function qmckl_get_nucleus_charge(context, charge, size_max) &
bind(C)
use, intrinsic :: iso_c_binding
import
implicit none
integer (c_int64_t) , intent(in) , value :: context
real (c_double) , intent(out) :: charge(*)
integer (c_int64_t) , intent(in) , value :: size_max
end function qmckl_get_nucleus_charge
end interface
#+end_src
#+begin_src c :comments org :tangle (eval h_func) :exports none #+begin_src c :comments org :tangle (eval h_func) :exports none
qmckl_exit_code qmckl_exit_code
@ -277,6 +304,18 @@ qmckl_get_nucleus_rescale_factor (const qmckl_context context,
} }
#+end_src #+end_src
#+begin_src f90 :tangle (eval fh_func) :comments org :exports none
interface
integer(c_int32_t) function qmckl_get_nucleus_rescale_factor(context, kappa) &
bind(C)
use, intrinsic :: iso_c_binding
import
implicit none
integer (c_int64_t) , intent(in) , value :: context
real (c_double) , intent(out) :: kappa
end function qmckl_get_nucleus_rescale_factor
end interface
#+end_src
#+begin_src c :comments org :tangle (eval h_func) :exports none #+begin_src c :comments org :tangle (eval h_func) :exports none
qmckl_exit_code qmckl_exit_code
@ -342,6 +381,21 @@ qmckl_get_nucleus_coord (const qmckl_context context,
} }
#+end_src #+end_src
#+begin_src f90 :tangle (eval fh_func) :comments org :exports none
interface
integer(c_int32_t) function qmckl_get_nucleus_coord(context, transp, coord, size_max) &
bind(C)
use, intrinsic :: iso_c_binding
import
implicit none
integer (c_int64_t) , intent(in) , value :: context
character(c_char) , intent(in) , value :: transp
real (c_double) , intent(out) :: coord(*)
integer (c_int64_t) , intent(in) , value :: size_max
end function qmckl_get_nucleus_coord
end interface
#+end_src
When all the data relative to nuclei have been set, the following When all the data relative to nuclei have been set, the following
function returns ~true~. function returns ~true~.
@ -424,7 +478,7 @@ interface
implicit none implicit none
integer (c_int64_t) , intent(in) , value :: context integer (c_int64_t) , intent(in) , value :: context
integer (c_int64_t) , intent(in) , value :: num integer (c_int64_t) , intent(in) , value :: num
end function end function qmckl_set_nucleus_num
end interface end interface
#+end_src #+end_src
@ -570,7 +624,7 @@ interface
character(c_char) , intent(in) , value :: transp character(c_char) , intent(in) , value :: transp
real (c_double) , intent(in) :: coord(*) real (c_double) , intent(in) :: coord(*)
integer (c_int64_t) , intent(in) , value :: size_max integer (c_int64_t) , intent(in) , value :: size_max
end function end function qmckl_set_nucleus_coord
end interface end interface
#+end_src #+end_src
@ -604,14 +658,14 @@ qmckl_set_nucleus_rescale_factor(qmckl_context context,
#+begin_src f90 :tangle (eval fh_func) :comments org :exports none #+begin_src f90 :tangle (eval fh_func) :comments org :exports none
interface interface
integer(c_int32_t) function qmckl_set_rescale_factor(context, kappa) & integer(c_int32_t) function qmckl_set_nucleus_rescale_factor(context, kappa) &
bind(C) bind(C)
use, intrinsic :: iso_c_binding use, intrinsic :: iso_c_binding
import import
implicit none implicit none
integer (c_int64_t) , intent(in) , value :: context integer (c_int64_t) , intent(in) , value :: context
real (c_double) , intent(in) , value :: kappa real (c_double) , intent(in) , value :: kappa
end function end function qmckl_set_nucleus_rescale_factor
end interface end interface
#+end_src #+end_src