diff --git a/org/qmckl_ao.org b/org/qmckl_ao.org index 0c820b9..4e7f97c 100644 --- a/org/qmckl_ao.org +++ b/org/qmckl_ao.org @@ -1033,7 +1033,130 @@ qmckl_exit_code qmckl_finalize_basis(qmckl_context context) { } #+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: diff --git a/org/qmckl_nucleus.org b/org/qmckl_nucleus.org index cc7dce6..bdd8cb8 100644 --- a/org/qmckl_nucleus.org +++ b/org/qmckl_nucleus.org @@ -102,10 +102,10 @@ typedef struct qmckl_nucleus_struct { Some values are initialized by default, and are not concerned by 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); #+end_src - + #+begin_src c :comments org :tangle (eval c) 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; } #+end_src - - + + ** Access functions - + #+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_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_get_nucleus_coord (const qmckl_context context, const char transp, double* const coord) { - + if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { return QMCKL_INVALID_CONTEXT; } - + if (transp != 'N' && transp != 'T') { return qmckl_failwith( context, 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); #+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 #+begin_src c :exports none if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { @@ -415,7 +449,7 @@ qmckl_set_nucleus_charge(qmckl_context context, const double* charge) { <> } #+end_src - + The following function sets the rescale parameter for the nuclear distances. #+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 double* nucl_charge = chbrclf_charge; 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