mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2025-01-03 18:16:28 +01:00
Added Fortran interfaces
This commit is contained in:
parent
efd32bcfe8
commit
2627368c54
125
org/qmckl_ao.org
125
org/qmckl_ao.org
@ -1033,7 +1033,130 @@ qmckl_exit_code qmckl_finalize_basis(qmckl_context context) {
|
|||||||
}
|
}
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
** TODO Fortran interfaces
|
** Fortran interfaces
|
||||||
|
|
||||||
|
#+begin_src f90 :tangle (eval fh_func) :comments org :exports none
|
||||||
|
interface
|
||||||
|
integer(c_int32_t) function qmckl_set_ao_basis_type (context, t) &
|
||||||
|
bind(C)
|
||||||
|
use, intrinsic :: iso_c_binding
|
||||||
|
import
|
||||||
|
implicit none
|
||||||
|
integer (c_int64_t) , intent(in) , value :: context
|
||||||
|
character(c_char) , intent(in) , value :: t
|
||||||
|
end function
|
||||||
|
end interface
|
||||||
|
interface
|
||||||
|
integer(c_int32_t) function qmckl_set_ao_basis_shell_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(in) , value :: num
|
||||||
|
end function
|
||||||
|
end interface
|
||||||
|
interface
|
||||||
|
integer(c_int32_t) function qmckl_set_ao_basis_prim_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(in) , value :: num
|
||||||
|
end function
|
||||||
|
end interface
|
||||||
|
interface
|
||||||
|
integer(c_int32_t) function qmckl_set_ao_basis_nucleus_index(context, idx) &
|
||||||
|
bind(C)
|
||||||
|
use, intrinsic :: iso_c_binding
|
||||||
|
import
|
||||||
|
implicit none
|
||||||
|
integer (c_int64_t) , intent(in) , value :: context
|
||||||
|
integer (c_int64_t) , intent(in) :: idx(*)
|
||||||
|
end function
|
||||||
|
end interface
|
||||||
|
interface
|
||||||
|
integer(c_int32_t) function qmckl_set_ao_basis_nucleus_shell_num(context,shell_num) &
|
||||||
|
bind(C)
|
||||||
|
use, intrinsic :: iso_c_binding
|
||||||
|
import
|
||||||
|
implicit none
|
||||||
|
integer (c_int64_t) , intent(in) , value :: context
|
||||||
|
integer (c_int64_t) , intent(in) :: shell_num(*)
|
||||||
|
end function
|
||||||
|
end interface
|
||||||
|
interface
|
||||||
|
integer(c_int32_t) function qmckl_set_ao_basis_nucleus_shell_ang_mom(context,shell_ang_mom) &
|
||||||
|
bind(C)
|
||||||
|
use, intrinsic :: iso_c_binding
|
||||||
|
import
|
||||||
|
implicit none
|
||||||
|
integer (c_int64_t) , intent(in) , value :: context
|
||||||
|
integer (c_int32_t) , intent(in) :: shell_ang_mom(*)
|
||||||
|
end function
|
||||||
|
end interface
|
||||||
|
interface
|
||||||
|
integer(c_int32_t) function qmckl_set_ao_basis_nucleus_shell_prim_num(context,shell_prim_num) &
|
||||||
|
bind(C)
|
||||||
|
use, intrinsic :: iso_c_binding
|
||||||
|
import
|
||||||
|
implicit none
|
||||||
|
integer (c_int64_t) , intent(in) , value :: context
|
||||||
|
integer (c_int64_t) , intent(in) :: shell_prim_num(*)
|
||||||
|
end function
|
||||||
|
end interface
|
||||||
|
interface
|
||||||
|
integer(c_int32_t) function qmckl_set_ao_basis_nucleus_shell_prim_index(context,shell_prim_index) &
|
||||||
|
bind(C)
|
||||||
|
use, intrinsic :: iso_c_binding
|
||||||
|
import
|
||||||
|
implicit none
|
||||||
|
integer (c_int64_t) , intent(in) , value :: context
|
||||||
|
integer (c_int64_t) , intent(in) :: shell_prim_index(*)
|
||||||
|
end function
|
||||||
|
end interface
|
||||||
|
interface
|
||||||
|
integer(c_int32_t) function qmckl_set_ao_basis_nucleus_shell_factor(context,shell_factor) &
|
||||||
|
bind(C)
|
||||||
|
use, intrinsic :: iso_c_binding
|
||||||
|
import
|
||||||
|
implicit none
|
||||||
|
integer (c_int64_t) , intent(in) , value :: context
|
||||||
|
real (c_double) , intent(in) :: shell_factor(*)
|
||||||
|
end function
|
||||||
|
end interface
|
||||||
|
interface
|
||||||
|
integer(c_int32_t) function qmckl_set_ao_basis_nucleus_exponent(context,exponent) &
|
||||||
|
bind(C)
|
||||||
|
use, intrinsic :: iso_c_binding
|
||||||
|
import
|
||||||
|
implicit none
|
||||||
|
integer (c_int64_t) , intent(in) , value :: context
|
||||||
|
real (c_double) , intent(in) :: exponent(*)
|
||||||
|
end function
|
||||||
|
end interface
|
||||||
|
interface
|
||||||
|
integer(c_int32_t) function qmckl_set_ao_basis_nucleus_coefficient(context,coefficient) &
|
||||||
|
bind(C)
|
||||||
|
use, intrinsic :: iso_c_binding
|
||||||
|
import
|
||||||
|
implicit none
|
||||||
|
integer (c_int64_t) , intent(in) , value :: context
|
||||||
|
real (c_double) , intent(in) :: coefficient(*)
|
||||||
|
end function
|
||||||
|
end interface
|
||||||
|
interface
|
||||||
|
integer(c_int32_t) function qmckl_set_ao_basis_nucleus_prim_factor(context,prim_factor) &
|
||||||
|
bind(C)
|
||||||
|
use, intrinsic :: iso_c_binding
|
||||||
|
import
|
||||||
|
implicit none
|
||||||
|
integer (c_int64_t) , intent(in) , value :: context
|
||||||
|
real (c_double) , intent(in) :: prim_factor(*)
|
||||||
|
end function
|
||||||
|
end interface
|
||||||
|
#+end_src
|
||||||
|
|
||||||
** Test :noexport:
|
** Test :noexport:
|
||||||
|
|
||||||
|
@ -102,10 +102,10 @@ typedef struct qmckl_nucleus_struct {
|
|||||||
Some values are initialized by default, and are not concerned by
|
Some values are initialized by default, and are not concerned by
|
||||||
this mechanism.
|
this mechanism.
|
||||||
|
|
||||||
#+begin_src c :comments org :tangle (eval h_private_func)
|
#+begin_src c :comments org :tangle (eval h_private_func)
|
||||||
qmckl_exit_code qmckl_init_nucleus(qmckl_context context);
|
qmckl_exit_code qmckl_init_nucleus(qmckl_context context);
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
#+begin_src c :comments org :tangle (eval c)
|
#+begin_src c :comments org :tangle (eval c)
|
||||||
qmckl_exit_code qmckl_init_nucleus(qmckl_context context) {
|
qmckl_exit_code qmckl_init_nucleus(qmckl_context context) {
|
||||||
|
|
||||||
@ -124,11 +124,11 @@ qmckl_exit_code qmckl_init_nucleus(qmckl_context context) {
|
|||||||
return QMCKL_SUCCESS;
|
return QMCKL_SUCCESS;
|
||||||
}
|
}
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
** Access functions
|
** Access functions
|
||||||
|
|
||||||
#+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_get_nucleus_num (const qmckl_context context, int64_t* const num);
|
qmckl_exit_code qmckl_get_nucleus_num (const qmckl_context context, int64_t* const num);
|
||||||
qmckl_exit_code qmckl_get_nucleus_charge (const qmckl_context context, double* const charge);
|
qmckl_exit_code qmckl_get_nucleus_charge (const qmckl_context context, double* const charge);
|
||||||
@ -244,11 +244,11 @@ qmckl_get_nucleus_rescale_factor (const qmckl_context context,
|
|||||||
|
|
||||||
qmckl_exit_code
|
qmckl_exit_code
|
||||||
qmckl_get_nucleus_coord (const qmckl_context context, const char transp, double* const coord) {
|
qmckl_get_nucleus_coord (const qmckl_context context, const char transp, double* const coord) {
|
||||||
|
|
||||||
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
|
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
|
||||||
return QMCKL_INVALID_CONTEXT;
|
return QMCKL_INVALID_CONTEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (transp != 'N' && transp != 'T') {
|
if (transp != 'N' && transp != 'T') {
|
||||||
return qmckl_failwith( context,
|
return qmckl_failwith( context,
|
||||||
QMCKL_INVALID_ARG_2,
|
QMCKL_INVALID_ARG_2,
|
||||||
@ -331,6 +331,40 @@ qmckl_exit_code qmckl_set_nucleus_coord (qmckl_context context, const char tra
|
|||||||
qmckl_exit_code qmckl_set_nucleus_rescale_factor (qmckl_context context, const double rescale_factor_kappa);
|
qmckl_exit_code qmckl_set_nucleus_rescale_factor (qmckl_context context, const double rescale_factor_kappa);
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
#+begin_src f90 :tangle (eval fh_func) :comments org :exports none
|
||||||
|
interface
|
||||||
|
integer(c_int32_t) function qmckl_set_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(in) , value :: num
|
||||||
|
end function
|
||||||
|
end interface
|
||||||
|
interface
|
||||||
|
integer(c_int32_t) function qmckl_set_nucleus_charge(context, charge) &
|
||||||
|
bind(C)
|
||||||
|
use, intrinsic :: iso_c_binding
|
||||||
|
import
|
||||||
|
implicit none
|
||||||
|
integer (c_int64_t) , intent(in) , value :: context
|
||||||
|
real (c_double) , intent(in) :: charge(*)
|
||||||
|
end function
|
||||||
|
end interface
|
||||||
|
interface
|
||||||
|
integer(c_int32_t) function qmckl_set_nucleus_coord(context, transp, coord) &
|
||||||
|
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(in) :: coord(*)
|
||||||
|
end function
|
||||||
|
end interface
|
||||||
|
#+end_src
|
||||||
|
|
||||||
#+NAME:pre2
|
#+NAME:pre2
|
||||||
#+begin_src c :exports none
|
#+begin_src c :exports none
|
||||||
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
|
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
|
||||||
@ -415,7 +449,7 @@ qmckl_set_nucleus_charge(qmckl_context context, const double* charge) {
|
|||||||
<<post2>>
|
<<post2>>
|
||||||
}
|
}
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
The following function sets the rescale parameter for the nuclear distances.
|
The following function sets the rescale parameter for the nuclear distances.
|
||||||
|
|
||||||
#+begin_src c :comments org :tangle (eval c) :noweb yes :exports none
|
#+begin_src c :comments org :tangle (eval c) :noweb yes :exports none
|
||||||
@ -488,7 +522,7 @@ qmckl_set_nucleus_coord(qmckl_context context, const char transp, const double*
|
|||||||
const int64_t nucl_num = chbrclf_nucl_num;
|
const int64_t nucl_num = chbrclf_nucl_num;
|
||||||
const double* nucl_charge = chbrclf_charge;
|
const double* nucl_charge = chbrclf_charge;
|
||||||
const double* nucl_coord = &(chbrclf_nucl_coord[0][0]);
|
const double* nucl_coord = &(chbrclf_nucl_coord[0][0]);
|
||||||
const double nucl_rescale_factor_kappa = 2.0;
|
const double nucl_rescale_factor_kappa = 2.0;
|
||||||
|
|
||||||
/* --- */
|
/* --- */
|
||||||
|
|
||||||
@ -561,7 +595,7 @@ for (size_t i=0 ; i<nucl_num ; ++i) {
|
|||||||
}
|
}
|
||||||
assert(qmckl_nucleus_provided(context));
|
assert(qmckl_nucleus_provided(context));
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
* Computation
|
* Computation
|
||||||
|
|
||||||
The computed data is stored in the context so that it can be reused
|
The computed data is stored in the context so that it can be reused
|
||||||
@ -573,7 +607,7 @@ assert(qmckl_nucleus_provided(context));
|
|||||||
current date is stored.
|
current date is stored.
|
||||||
|
|
||||||
** Nucleus-nucleus distances
|
** Nucleus-nucleus distances
|
||||||
|
|
||||||
*** Get
|
*** Get
|
||||||
|
|
||||||
#+begin_src c :comments org :tangle (eval h_func) :noweb yes
|
#+begin_src c :comments org :tangle (eval h_func) :noweb yes
|
||||||
@ -601,6 +635,19 @@ qmckl_exit_code qmckl_get_nucleus_nn_distance(qmckl_context context, double* dis
|
|||||||
}
|
}
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
#+begin_src f90 :tangle (eval fh_func) :comments org :exports none
|
||||||
|
interface
|
||||||
|
integer(c_int32_t) function qmckl_get_nucleus_nn_distance(context, distance) &
|
||||||
|
bind(C)
|
||||||
|
use, intrinsic :: iso_c_binding
|
||||||
|
import
|
||||||
|
implicit none
|
||||||
|
integer (c_int64_t) , intent(in) , value :: context
|
||||||
|
real (c_double ) , intent(out) :: distance(*)
|
||||||
|
end function
|
||||||
|
end interface
|
||||||
|
#+end_src
|
||||||
|
|
||||||
*** Provide :noexport:
|
*** Provide :noexport:
|
||||||
|
|
||||||
#+begin_src c :comments org :tangle (eval h_private_func) :noweb yes :exports none
|
#+begin_src c :comments org :tangle (eval h_private_func) :noweb yes :exports none
|
||||||
@ -917,7 +964,7 @@ qmckl_exit_code qmckl_compute_nn_distance_rescaled (
|
|||||||
\]
|
\]
|
||||||
|
|
||||||
*** Get
|
*** Get
|
||||||
|
|
||||||
#+begin_src c :comments org :tangle (eval h_func) :noweb yes
|
#+begin_src c :comments org :tangle (eval h_func) :noweb yes
|
||||||
qmckl_exit_code qmckl_get_nucleus_repulsion(qmckl_context context, double* energy);
|
qmckl_exit_code qmckl_get_nucleus_repulsion(qmckl_context context, double* energy);
|
||||||
#+end_src
|
#+end_src
|
||||||
@ -942,6 +989,19 @@ qmckl_exit_code qmckl_get_nucleus_repulsion(qmckl_context context, double* energ
|
|||||||
}
|
}
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
#+begin_src f90 :tangle (eval fh_func) :comments org :exports none
|
||||||
|
interface
|
||||||
|
integer(c_int32_t) function qmckl_get_nucleus_repulsion(context, energy) &
|
||||||
|
bind(C)
|
||||||
|
use, intrinsic :: iso_c_binding
|
||||||
|
import
|
||||||
|
implicit none
|
||||||
|
integer (c_int64_t) , intent(in) , value :: context
|
||||||
|
real (c_double ) , intent(out) :: energy
|
||||||
|
end function
|
||||||
|
end interface
|
||||||
|
#+end_src
|
||||||
|
|
||||||
*** Provide :noexport:
|
*** Provide :noexport:
|
||||||
|
|
||||||
#+begin_src c :comments org :tangle (eval h_private_func) :noweb yes :exports none
|
#+begin_src c :comments org :tangle (eval h_private_func) :noweb yes :exports none
|
||||||
|
Loading…
Reference in New Issue
Block a user