diff --git a/README.html b/README.html index e4506cd..f5bd035 100644 --- a/README.html +++ b/README.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- +The latest version fo QMCkl can be downloaded @@ -296,8 +296,8 @@ The latest version fo QMCkl can be downloaded
QMCkl is built with GNU Autotools, so the usual
@@ -312,8 +312,8 @@ options are defined using CFLAGS
and FCFLAGS
.
To compile from the source repository, additional dependencies are @@ -334,8 +334,8 @@ to be executed first.
The qmckl.h
header file installed in the ${prefix}/include
directory
@@ -364,12 +364,12 @@ Both files are located in the include/
directory.
In a traditional source code, most of the lines of source files of a program @@ -419,8 +419,8 @@ tarball contains the generated source code.
For a tutorial on literate programming with org-mode, follow this link. @@ -451,8 +451,8 @@ org-mode.
Most of the codes of the TREX CoE are written in Fortran with some
@@ -496,7 +496,7 @@ call directly the Fortran routines, but call instead the C binding
function and an iso_c_binding
is still required:
+ISO_C_BINDING ISO_C_BINDING Fortran ---------------> C ---------------> Fortran@@ -516,8 +516,8 @@ For more guidelines on using Fortran to generate a C interface, see
The authors should follow the recommendations of the C99 @@ -537,8 +537,8 @@ make cppcheck ; cat cppcheck.out
The proposed API should allow the library to: deal with memory transfers @@ -549,8 +549,8 @@ functions (see below).
To avoid namespace collisions, we use qmckl_
as a prefix for all exported
@@ -571,8 +571,8 @@ form is allowed.
In the C language, the number of bits used by the integer types can change @@ -604,15 +604,15 @@ bindings in other languages in other repositories.
Global variables should be avoided in the library, because it is
possible that one single program needs to use multiple instances
of the library. To solve this problem we propose to use a pointer
to a context
variable, built by the library with the
-qmckl_context_create
function. The context
contains the global
+qmckl_context_create
function. The context
contains the global
state of the library, and is used as the first argument of many
QMCkl functions.
A single qmckl.h
header to be distributed by the library
@@ -715,8 +715,8 @@ and the types definitions should be written in the *fh_type.f90
fil
Low-level functions are very simple functions which are leaves of @@ -725,14 +725,14 @@ the function call tree (they don't call any other QMCkl function).
These functions are pure, and unaware of the QMCkl
-context
. They are not allowed to allocate/deallocate memory, and
+context
. They are not allowed to allocate/deallocate memory, and
if they need temporary memory it should be provided in input.
High-level functions are at the top of the function call tree. @@ -744,8 +744,8 @@ temporary storage, to simplify the use of accelerators.
The minimal number of bits of precision required for a function
@@ -753,7 +753,7 @@ should be given as an input of low-level computational
functions. This input will be used to define the values of the
different thresholds that might be used to avoid computing
unnecessary noise. High-level functions will use the precision
-specified in the context
variable.
+specified in the context
variable.
@@ -821,8 +821,8 @@ following points :
Reducing the scaling of an algorithm usually implies also reducing @@ -838,7 +838,7 @@ implemented adapted to different problem sizes.
The atomic basis set is defined as a list of shells. Each shell \(s\) is @@ -376,19 +389,19 @@ gradients and Laplacian of the atomic basis functions.
The following arrays are stored in the context, and need to be set when initializing the library:
-When the basis set is completely entered, extra data structures may be @@ -1423,8 +1436,8 @@ the context.
For faster access, we provide extra arrays for the shell information as: @@ -1454,8 +1467,8 @@ which is a matrix-vector product.
qmckl_exit_code @@ -1468,7 +1481,7 @@ which is a matrix-vector product.Returns the array of values, gradients an Laplacian of primitive basis functions evaluated at the current coordinates. -See section 3.2. +See section 3.2.
@@ -1481,7 +1494,7 @@ See section 3.2.-Returns the array of values, gradients an Laplacian of contracted shells -evaluated at the current coordinates. See section 3.3. +evaluated at the current coordinates. See section 3.3.
@@ -1495,7 +1508,7 @@ evaluated at the current coordinates. See section 3.3.Returns the array of values, gradients an Laplacian of the atomic orbitals evaluated at the current coordinates. -See section 5. +See section 5.
@@ -1520,7 +1533,7 @@ Uses the given array to compute the VGL.
Returns the array of values of the atomic orbitals evaluated at -the current coordinates. See section 5. +the current coordinates. See section 5.
@@ -1539,12 +1552,12 @@ Uses the given array to compute the value.
-3. Radial part
++3. Radial part
--3.1. General functions for Gaussian basis functions
++-3.1. General functions for Gaussian basis functions
qmckl_ao_gaussian_vgl
computes the values, gradients and @@ -1717,10 +1730,10 @@ Requirements:-3.2. Computation of primitives
++3.2. Computation of primitives
-+
@@ -1881,10 +1894,10 @@ Requirements: - -3.3. Computation of shells
++3.3. Computation of shells
-+
@@ -2138,10 +2151,276 @@ Requirements: + + ++ +3.4. Hessian
++-+Computes the Hessian of the shells. The
+\begin{eqnarray} +\nabla_n \nabla_m v_i &=& 4 a_i^2 (X_n-R_n)(X_m - R_m)v_i -\delta_{n,m}2a_i v_i\\ +\nabla_m \nabla^2 v_i &=& 8 a_i^2 (X_m-R_m)v_i -2a_i^2 (4|X-R|^2 a_i -6)(X_m-R_m)v_i = 20 a_i^2 (X_m-R_m)v_i - 8a_i^3 |X-R|^2 (X_m-R_m) v_i +\end{eqnarray}shell_hessian[:][:][3][:]
component is reserved for the derivative of the Laplacian of the shells. +-+4. Polynomial part
+++ +3.4.1. Get
+++++qmckl_exit_code +qmckl_get_ao_basis_shell_hessian (qmckl_context context, + double* const shell_hessian, + const int64_t size_max); ++++3.4.2. Compute
++++ + +
+ ++ + ++ + + + + + + + + + +Variable +Type +In/Out +Description ++ + ++ context
+ qmckl_context
in +Global state ++ + ++ prim_num
+ int64_t
in +Number of primitives ++ + ++ shell_num
+ int64_t
in +Number of shells ++ + ++ point_num
+ int64_t
in +Number of points ++ + ++ nucl_num
+ int64_t
in +Number of nuclei ++ + ++ nucleus_shell_num
+ int64_t[nucl_num]
in +Number of shells for each nucleus ++ + ++ nucleus_index
+ int64_t[nucl_num]
in +Index of the 1st shell of each nucleus ++ + ++ nucleus_range
+ double[nucl_num]
in +Range of the nucleus ++ + ++ shell_prim_index
+ int64_t[shell_num]
in +Index of the 1st primitive of each shell ++ + ++ shell_prim_num
+ int64_t[shell_num]
in +Number of primitives per shell ++ + ++ coord
+ double[3][point_num]
in +Coordinates ++ + ++ nucl_coord
+ double[3][nucl_num]
in +Nuclear coordinates ++ + ++ expo
+ double[prim_num]
in +Exponents of the primitives ++ + ++ coef_normalized
+ double[prim_num]
in +Coefficients of the primitives ++ + ++ shell_hessian
+ double[point_num][3][4][shell_num]
out +Hessian of the shells +++function qmckl_compute_ao_basis_shell_gaussian_hessian( & + context, prim_num, shell_num, point_num, nucl_num, & + nucleus_shell_num, nucleus_index, nucleus_range, & + shell_prim_index, shell_prim_num, coord, nucl_coord, & + expo, coef_normalized, shell_hessian) & + bind(C) result(info) + + use qmckl_constants + use qmckl, only: qmckl_get_numprec_precision + + implicit none + integer (qmckl_context), intent(in) , value :: context + integer (c_int64_t) , intent(in) , value :: prim_num + integer (c_int64_t) , intent(in) , value :: shell_num + integer (c_int64_t) , intent(in) , value :: point_num + integer (c_int64_t) , intent(in) , value :: nucl_num + integer (c_int64_t) , intent(in) :: nucleus_shell_num(nucl_num) + integer (c_int64_t) , intent(in) :: nucleus_index(nucl_num) + real (c_double ) , intent(in) :: nucleus_range(nucl_num) + integer (c_int64_t) , intent(in) :: shell_prim_index(shell_num) + integer (c_int64_t) , intent(in) :: shell_prim_num(shell_num) + real (c_double ) , intent(in) :: coord(point_num,3) + real (c_double ) , intent(in) :: nucl_coord(nucl_num,3) + real (c_double ) , intent(in) :: expo(prim_num) + real (c_double ) , intent(in) :: coef_normalized(prim_num) + real (c_double ) , intent(out) :: shell_hessian(shell_num,4,3,point_num) + integer(qmckl_exit_code) :: info + + double precision :: xyz(3) + + integer*8 :: inucl, iprim, ipoint, ishell + integer*8 :: ishell_start, ishell_end + integer*8 :: iprim_start , iprim_end, i, j + double precision :: x, y, z, two_a, ar2, r2, v, cutoff + + info = QMCKL_SUCCESS + + ! Don't compute exponentials when the result will be almost zero. + cutoff = qmckl_get_numprec_precision(context) + cutoff = dlog(2.d0**(cutoff-2)) + + do ipoint = 1, point_num + + do inucl=1,nucl_num + + xyz(1) = coord(ipoint,1) - nucl_coord(inucl,1) + xyz(2) = coord(ipoint,2) - nucl_coord(inucl,2) + xyz(3) = coord(ipoint,3) - nucl_coord(inucl,3) + + r2 = xyz(1)*xyz(1) + xyz(2)*xyz(2) + xyz(3)*xyz(3) + + if (r2 > cutoff*nucleus_range(inucl)) then + cycle + end if + + ! C is zero-based, so shift bounds by one + ishell_start = nucleus_index(inucl) + 1 + ishell_end = nucleus_index(inucl) + nucleus_shell_num(inucl) + + do ishell=ishell_start, ishell_end + + do i = 1, 4 + do j = 1, 3 + shell_hessian(ishell, i, j, ipoint) = 0.d0 + end do + end do + + iprim_start = shell_prim_index(ishell) + 1 + iprim_end = shell_prim_index(ishell) + shell_prim_num(ishell) + + do iprim = iprim_start, iprim_end + + ar2 = expo(iprim)*r2 + if (ar2 > cutoff) then + cycle + end if + + v = coef_normalized(iprim) * dexp(-ar2) + two_a = 2.d0 * expo(iprim) + + do i = 1, 3 + do j = 1, 3 + if (i == j) then + shell_hessian(ishell, i, j, ipoint) = & + shell_hessian(ishell, i, j, ipoint) - two_a * v + end if + shell_hessian(ishell, i, j, ipoint) = & + shell_hessian(ishell, i, j, ipoint) + two_a * two_a * xyz(i) * xyz(j) * v + + end do + shell_hessian(ishell,4,i,ipoint) = shell_hessian(ishell,4,i,ipoint) & + + (5.d0 * two_a * two_a * xyz(i) & + - two_a * two_a * two_a * r2 * xyz(i)) * v + end do + + end do + + end do + end do + + end do + +end function qmckl_compute_ao_basis_shell_gaussian_hessian +++4. Polynomial part
-Going from the atomic basis set to AOs implies a systematic @@ -2161,8 +2440,8 @@ f & : & f_{xxx}, f_{xxy}, f_{xxz}, f_{xyy}, f_{xyz}, f_{xzz}, f_{yyy}, f_{yyz}, \end{eqnarray}
-4.1. General functions for Powers of \(x-X_i\)
++4.1. General functions for Powers of \(x-X_i\)
The
-qmckl_ao_power
function computes all the powers of then
@@ -2174,7 +2453,7 @@ the \(n\) points: \[ P_{ik} = X_i^k \]+
@@ -2315,8 +2594,8 @@ Requirements: - -4.2. General functions for Value, Gradient and Laplacian of a polynomial
++4.2. General functions for Value, Gradient and Laplacian of a polynomial
A polynomial is centered on a nucleus \(\mathbf{R}_i\) @@ -2361,7 +2640,7 @@ Laplacians at a given point in space, of all polynomials with an angular momentum up to
-lmax
.+
@@ -2474,6 +2753,7 @@ For example, with a=0, b=2 and c=1 the string is "yyz" -qmckl_exit_code qmckl_ao_polynomial_vgl ( + Type Variable, const qmckl_context context, const double* X, const double* R, @@ -2488,6 +2768,7 @@ For example, with a=0, b=2 and c=1 the string is "yyz"+ +qmckl_exit_code qmckl_ao_polynomial_vgl_doc ( + Type Variable, const qmckl_context context, const double* X, const double* R, @@ -2661,6 +2942,7 @@ For example, with a=0, b=2 and c=1 the string is "yyz"qmckl_exit_code qmckl_ao_polynomial_transp_vgl ( + Type Variable, const qmckl_context context, const double* X, const double* R, @@ -2675,6 +2957,7 @@ For example, with a=0, b=2 and c=1 the string is "yyz"qmckl_exit_code qmckl_ao_polynomial_transp_vgl_doc ( + Type Variable, const qmckl_context context, const double* X, const double* R, @@ -3155,14 +3438,218 @@ For example, with a=0, b=2 and c=1 the string is "yyz"+4.3. Hessian
++++Compute the Hessian of the polynomial part of the atomic orbitals. Similarly to the shells, the
+ + + +hessian[:][3][:]
component is reserved for the derivative of the Laplacian. ++ + +
+ ++ + ++ + + + + + + + + + +Variable +Type +In/Out +Description ++ + ++ context
+ qmckl_context
in +Global state ++ + ++ X
+ double[3]
in +Array containing the coordinates of the points ++ + ++ R
+ double[3]
in +Array containing the x,y,z coordinates of the center ++ + ++ lmax
+ int32_t
in +Maximum angular momentum ++ + ++ n
+ int64_t
inout +Number of computed polynomials ++ + ++ hessian
+ double[ldv][4][3]
out +Hessian of the polynomials +++function qmckl_compute_ao_polynomial_hessian_doc (context, & + X, R, lmax, n, hessian) & + bind(C) result(info) + use qmckl_constants + implicit none + + integer (qmckl_context), intent(in) , value :: context + real (c_double ) , intent(in) :: X(3) + real (c_double ) , intent(in) :: R(3) + integer (c_int32_t) , intent(in) , value :: lmax + integer (c_int64_t) , intent(inout) :: n + real (c_double ) , intent(out) :: hessian(3,4,(lmax+1)*(lmax+2)*(lmax+3)/6) + + integer(qmckl_exit_code) :: info + + integer :: i,j,m,k + integer :: a,b,c,d + double precision :: Y(3) + double precision :: pows(-2:lmax,3) + double precision :: xy, yz, xz + double precision :: da, db, dc, dd + + info = 0 + + if (context == QMCKL_NULL_CONTEXT) then + info = QMCKL_INVALID_CONTEXT + return + endif + + if (lmax < 0) then + info = QMCKL_INVALID_ARG_4 + return + endif + + + ! The shift below is such that polynomials will not make the AO equal to zero at the nodes of the orbitals + do i=1,3 + Y(i) = (X(i) - R(i)) + 1.d-20 + end do + + if (lmax == 0) then + do k = 1, 3 + do m = 1, 3 + hessian(k,m,1) = 0.d0 + end do + end do + n=1 + else if (lmax > 0) then + pows(-2:0,1:3) = 1.d0 + do i=1,lmax + pows(i,1) = pows(i-1,1) * Y(1) + pows(i,2) = pows(i-1,2) * Y(2) + pows(i,3) = pows(i-1,3) * Y(3) + end do + + hessian(1:3,1:4,1:4) = 0.d0 + + n=4 + endif + + ! l>=2 + dd = 2.d0 + do d=2,lmax + da = dd + do a=d,0,-1 + db = dd-da + do b=d-a,0,-1 + c = d - a - b + dc = dd - da - db + n = n+1 + + xy = pows(a,1) * pows(b,2) + yz = pows(b,2) * pows(c,3) + xz = pows(a,1) * pows(c,3) + + xy = dc * xy + xz = db * xz + yz = da * yz + + hessian(1,1,n) = da * (da-1.d0) * pows(a-2,1) * pows(b,2) * pows(c,3) + hessian(2,2,n) = db * (db-1.d0) * pows(a,1) * pows(b-2,2) * pows(c,3) + hessian(3,3,n) = dc * (dc-1.d0) * pows(a,1) * pows(b,2) * pows(c-2,3) + + hessian(1,2,n) = da * db * pows(a-1,1) * pows(b-1,2) * pows(c,3) + hessian(2,1,n) = da * db * pows(a-1,1) * pows(b-1,2) * pows(c,3) + + hessian(1,3,n) = da * dc * pows(a-1,1) * pows(b,2) * pows(c-1,3) + hessian(3,1,n) = da * dc * pows(a-1,1) * pows(b,2) * pows(c-1,3) + + hessian(2,3,n) = db * dc * pows(a,1) * pows(b-1,2) * pows(c-1,3) + hessian(3,2,n) = db * dc * pows(a,1) * pows(b-1,2) * pows(c-1,3) + + hessian(1,4,n) = (da * db * (db-1.d0) * pows(a-1,1) * pows(b-2,2) * pows(c,3)) + & + (da * dc * (dc-1.d0) * pows(a-1,1) * pows(b,2) * pows(c-2,3)) + + hessian(2,4,n) = (db * da * (da-1.d0) * pows(a-2,1) * pows(b-1,2) * pows(c,3)) + & + (db * dc * (dc-1.d0) * pows(a,1) * pows(b-1,2) * pows(c-2,3)) + + hessian(3,4,n) = (dc * da * (da-1.d0) * pows(a-2,1) * pows(b,2) * pows(c-1,3)) + & + (dc * db * (db-1.d0) * pows(a,1) * pows(b-2,2) * pows(c-1,3)) + + if (da > 2) then + hessian(1,4,n) = hessian(1,4,n) + (da * (da-1.d0) * (da-2.d0) * & + pows(a-3,1) * pows(b,2) * pows(c,3)) + end if + if (db > 2) then + hessian(2,4,n) = hessian(2,4,n) + (db * (db-1.d0) * (db-2.d0) * & + pows(a,1) * pows(b-3,2) * pows(c,3)) + end if + if (dc > 2) then + hessian(3,4,n) = hessian(3,4,n) + (dc * (dc-1.d0) * (dc-2.d0) * & + pows(a,1) * pows(b,2) * pows(c-3,3)) + end if + + db = db - 1.d0 + end do + da = da - 1.d0 + end do + dd = dd + 1.d0 + end do + + info = QMCKL_SUCCESS + +end function qmckl_compute_ao_polynomial_hessian_doc ++-5. Combining radial and polynomial parts
++5. Combining radial and polynomial parts
--5.1. Determination of nucleus ranges
++-5.1. Determination of nucleus ranges
The range of a nucleus is defined as the distance beyond which all @@ -3328,14 +3815,14 @@ of bits of precision (1-53), a range is given.
-5.2. Values only
++5.2. Values only
--5.2.1. Unoptimized version
++5.2.1. Unoptimized version
-+
@@ -3575,10 +4062,10 @@ of bits of precision (1-53), a range is given. - -5.2.2. HPC version
++5.2.2. HPC version
-+
@@ -3736,8 +4223,8 @@ of bits of precision (1-53), a range is given. - -5.2.3. Interfaces
++5.2.3. Interfaces
-qmckl_exit_code qmckl_compute_ao_value_doc ( @@ -3786,14 +4273,14 @@ of bits of precision (1-53), a range is given.-5.3. Value, gradients, Laplacian
++5.3. Value, gradients, Laplacian
--5.3.1. Reference version
++5.3.1. Reference version
-+
@@ -4061,10 +4548,10 @@ of bits of precision (1-53), a range is given. - -5.3.2. HPC version
++5.3.2. HPC version
-+
@@ -4223,8 +4710,8 @@ of bits of precision (1-53), a range is given. - -diff --git a/qmckl_blas.html b/qmckl_blas.html index ff39d29..1d9e44e 100644 --- a/qmckl_blas.html +++ b/qmckl_blas.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + -5.3.3. Interfaces
+++ +5.3.3. Interfaces
qmckl_exit_code qmckl_compute_ao_vgl_doc ( @@ -4272,11 +4759,313 @@ of bits of precision (1-53), a range is given.+5.4. AO Hessian
+++ ++Computes the Hessian of the AOs. For this, it needs the Hessian of the shells, as well as the Hessian of the polynomials. +The
+ao_hessian[:][:][4][:]
component is reserved for the derivative of the Laplacian of the AOs. +++ +5.4.1. Get
+++++qmckl_exit_code +qmckl_get_ao_basis_ao_hessian(qmckl_context context, + double* const ao_hessian, + const int64_t size_max); ++++5.4.2. Compute
++++ + +
+ ++ + ++ + + + + + + + + + +Variable +Type +In/Out +Description ++ + ++ context
+ qmckl_context
in +Global state ++ + ++ ao_num
+ int64_t
in +Number of AOs ++ + ++ shell_num
+ int64_t
in +Number of shells ++ + ++ point_num
+ int64_t
in +Number of points ++ + ++ nucl_num
+ int64_t
in +Number of nuclei ++ + ++ coord
+ double[3][point_num]
in +Coordinates ++ + ++ nucl_coord
+ double[3][nucl_num]
in +Nuclear coordinates ++ + ++ nucleus_index
+ int64_t[nucl_num]
in +Index of the 1st shell of each nucleus ++ + ++ nucleus_shell_num
+ int64_t[nucl_num]
in +Number of shells per nucleus ++ + ++ nucleus_range
+ double[nucl_num]
in +Range beyond which all is zero ++ + ++ nucleus_max_ang_mom
+ int32_t[nucl_num]
in +Maximum angular momentum per nucleus ++ + ++ shell_ang_mom
+ int32_t[shell_num]
in +Angular momentum of each shell ++ + ++ ao_factor
+ double[ao_num]
in +Normalization factor of the AOs ++ + ++ shell_vgl
+ double[point_num][5][shell_num]
in +Value, gradients and Laplacian of the shells ++ + ++ shell_hessian
+ double[point_num][3][4][shell_num]
in +Hessian of the shells ++ + ++ ao_hessian
+ double[3][point_num][4][ao_num]
out +Hessian of the AOs +++function qmckl_compute_ao_hessian_doc(context, & + ao_num, shell_num, point_num, nucl_num, & + coord, nucl_coord, nucleus_index, nucleus_shell_num, & + nucleus_range, nucleus_max_ang_mom, shell_ang_mom, & + ao_factor, shell_vgl, shell_hessian, ao_hessian) & + bind(C) result(info) + use qmckl_constants + use qmckl, only : qmckl_ao_polynomial_hessian, qmckl_ao_polynomial_vgl, qmckl_get_numprec_precision + implicit none + integer (qmckl_context), intent(in) , value :: context + integer (c_int64_t) , intent(in) , value :: ao_num + integer (c_int64_t) , intent(in) , value :: shell_num + integer (c_int64_t) , intent(in) , value :: point_num + integer (c_int64_t) , intent(in) , value :: nucl_num + real (c_double ) , intent(in) :: coord(point_num,3) + real (c_double ) , intent(in) :: nucl_coord(nucl_num,3) + integer (c_int64_t) , intent(in) :: nucleus_index(nucl_num) + integer (c_int64_t) , intent(in) :: nucleus_shell_num(nucl_num) + real (c_double ) , intent(in) :: nucleus_range(nucl_num) + integer (c_int32_t) , intent(in) :: nucleus_max_ang_mom(nucl_num) + integer (c_int32_t) , intent(in) :: shell_ang_mom(shell_num) + real (c_double ) , intent(in) :: ao_factor(ao_num) + real (c_double ) , intent(in) :: shell_vgl(shell_num,5,point_num) + real (c_double ) , intent(in) :: shell_hessian(shell_num,4,3,point_num) + real (c_double ) , intent(out) :: ao_hessian(ao_num,4,point_num,3) + integer(qmckl_exit_code) :: info + + double precision :: e_coord(3), n_coord(3) + integer*8 :: n_poly + integer :: l, il, k, i, j + integer*8 :: ipoint, inucl, ishell + integer*8 :: ishell_start, ishell_end + integer :: lstart(0:20) + double precision :: x, y, z, r2 + double precision :: cutoff + + double precision, allocatable :: poly_hessian(:,:,:), poly_vgl(:,:) + integer , allocatable :: powers(:,:), ao_index(:) + + allocate(poly_vgl(5,ao_num), poly_hessian(3,4,ao_num), powers(3,ao_num), ao_index(ao_num)) + + ! Pre-computed data + do l=0,20 + lstart(l) = l*(l+1)*(l+2)/6 +1 + end do + + k=1 + do inucl=1,nucl_num + ishell_start = nucleus_index(inucl) + 1 + ishell_end = nucleus_index(inucl) + nucleus_shell_num(inucl) + do ishell = ishell_start, ishell_end + l = shell_ang_mom(ishell) + ao_index(ishell) = k + k = k + lstart(l+1) - lstart(l) + end do + end do + info = QMCKL_SUCCESS + + ! Don't compute polynomials when the radial part is zero. + cutoff = qmckl_get_numprec_precision(context) + cutoff = dlog(2.d0**(cutoff-2)) + + !ao_hessian = 0.d0 + + do ipoint = 1, point_num + e_coord(1) = coord(ipoint,1) + e_coord(2) = coord(ipoint,2) + e_coord(3) = coord(ipoint,3) + ao_hessian(:,:,ipoint,:) = 0.d0 + do inucl=1,nucl_num + n_coord(1) = nucl_coord(inucl,1) + n_coord(2) = nucl_coord(inucl,2) + n_coord(3) = nucl_coord(inucl,3) + + ! Test if the point is in the range of the nucleus + x = e_coord(1) - n_coord(1) + y = e_coord(2) - n_coord(2) + z = e_coord(3) - n_coord(3) + + r2 = x*x + y*y + z*z + if (r2 > cutoff*nucleus_range(inucl)) then + !ao_hessian(:,:,ipoint,:) = 0.d0 + cycle + end if + + ! Compute polynomials + info = qmckl_ao_polynomial_hessian(context, e_coord, n_coord, & + nucleus_max_ang_mom(inucl), n_poly, poly_hessian) + + info = qmckl_ao_polynomial_vgl(context, e_coord, n_coord, & + nucleus_max_ang_mom(inucl), n_poly, powers, 3_8, & + poly_vgl, 5_8) + + ! Loop over shells + ishell_start = nucleus_index(inucl) + 1 + ishell_end = nucleus_index(inucl) + nucleus_shell_num(inucl) + do ishell = ishell_start, ishell_end + k = ao_index(ishell) + l = shell_ang_mom(ishell) + do il = lstart(l), lstart(l+1)-1 + + do i = 1, 3 + do j = 1, 3 + ao_hessian(k,j,ipoint,i) = (& + poly_hessian(j,i,il) * shell_vgl(ishell,1,ipoint) + & + poly_vgl(1,il) * shell_hessian(ishell,j,i,ipoint) + & + poly_vgl(j+1,il) * shell_vgl(ishell,i+1,ipoint) + & + poly_vgl(i+1,il) * shell_vgl(ishell,j+1,ipoint) & + ) * ao_factor(k) + end do + + ao_hessian(k,4,ipoint,i) = (& + poly_hessian(i,4,il) * shell_vgl(ishell,1,ipoint) + & + poly_vgl(1,il) * shell_hessian(ishell,4,i,ipoint) + & + poly_vgl(5,il) * shell_vgl(ishell,i+1,ipoint) + & + poly_vgl(i+1,il) * shell_vgl(ishell,5,ipoint) + & + 2.d0 * (& + poly_hessian(1,i,il) * shell_vgl(ishell,2,ipoint) + & + poly_vgl(2,il) * shell_hessian(ishell,1,i,ipoint) + & + poly_hessian(2,i,il) * shell_vgl(ishell,3,ipoint) + & + poly_vgl(3,il) * shell_hessian(ishell,2,i,ipoint) + & + poly_hessian(3,i,il) * shell_vgl(ishell,4,ipoint) + & + poly_vgl(4,il) * shell_hessian(ishell,3,i,ipoint) & + )) * ao_factor(k) + + end do + + k = k+1 + end do + end do + end do + end do + + deallocate(poly_vgl, powers, poly_hessian, ao_index) +end function qmckl_compute_ao_hessian_doc ++BLAS functions @@ -258,56 +258,56 @@ org_html_manager.setup(); // activate after the parameters are setTable of Contents
--
- -
-- 1. Data types +
- -
+- 1. Data types
--
- 1.1. Vector
-- 1.2. Matrix
-- 1.3. Tensor
-- 1.4. Reshaping +
- 1.1. Vector
+- 1.2. Matrix
+- 1.3. Tensor
+- 1.4. Reshaping
-- 1.5. Access macros
-- 1.6. Set all elements +
- 1.5. Access macros
+- 1.6. Set all elements
-- 1.7. Copy to/from to
-double*
- 1.8. Allocate and copy to
+double*
- 1.7. Copy to/from to
+double*
- 1.8. Allocate and copy to
double*
- 2. Matrix operations +
- 2. Matrix operations
-- 3. Utilities
+- 3. Utilities
--
-++--
+Basic linear algebra data types and operations are described in this file. The data types are private, so that HPC implementations can use @@ -321,12 +321,12 @@ are not intended to be passed to external codes.
-1. Data types
++1. Data types
--1.1. Vector
++1.1. Vector
@@ -380,8 +380,8 @@ Allocates a new vector. If the allocation failed the size is zero. -
-1.2. Matrix
++1.2. Matrix
@@ -441,8 +441,8 @@ Allocates a new matrix. If the allocation failed the sizes are zero. -
-1.3. Tensor
++1.3. Tensor
@@ -509,16 +509,16 @@ is zero. -
-1.4. Reshaping
++1.4. Reshaping
-Reshaping occurs in-place and the pointer to the data is copied.
-1.4.1. Vector -> Matrix
++1.4.1. Vector -> Matrix
-qmckl_matrix @@ -534,8 +534,8 @@ Reshapes a vector into a matrix.
-1.4.2. Vector -> Tensor
++1.4.2. Vector -> Tensor
-qmckl_tensor @@ -551,8 +551,8 @@ Reshapes a vector into a tensor.
-1.4.3. Matrix -> Vector
++1.4.3. Matrix -> Vector
-qmckl_vector @@ -566,8 +566,8 @@ Reshapes a matrix into a vector.
-1.4.4. Matrix -> Tensor
++1.4.4. Matrix -> Tensor
-qmckl_tensor @@ -583,8 +583,8 @@ Reshapes a matrix into a tensor.
-1.4.5. Tensor -> Vector
++1.4.5. Tensor -> Vector
-qmckl_vector @@ -598,8 +598,8 @@ Reshapes a tensor into a vector.
-1.4.6. Tensor -> Matrix
++1.4.6. Tensor -> Matrix
-qmckl_matrix @@ -616,8 +616,8 @@ Reshapes a tensor into a vector.
-1.5. Access macros
++-1.5. Access macros
Macros are provided to ease the access to vectors, matrices and @@ -642,12 +642,12 @@ For example:
-1.6. Set all elements
++1.6. Set all elements
--1.6.1. Vector
++1.6.1. Vector
-qmckl_vector @@ -657,8 +657,8 @@ For example:
-1.6.2. Matrix
++1.6.2. Matrix
-qmckl_matrix @@ -668,8 +668,8 @@ For example:
-1.6.3. Tensor
++1.6.3. Tensor
-qmckl_tensor @@ -680,8 +680,8 @@ For example:
-1.7. Copy to/from to
+double*
+1.7. Copy to/from to
double*
-qmckl_exit_code @@ -763,8 +763,8 @@ Converts adouble*
to a tensor.-1.8. Allocate and copy to
+double*
+1.8. Allocate and copy to
double*
-double* qmckl_alloc_double_of_vector(const qmckl_context context, @@ -788,12 +788,12 @@ Converts adouble*
to a tensor.-2. Matrix operations
++2. Matrix operations
--2.1.
+qmckl_dgemm
+2.1.
qmckl_dgemm
Matrix multiplication with a BLAS interface: @@ -805,7 +805,7 @@ Matrix multiplication with a BLAS interface: \]
-+
@@ -964,8 +964,8 @@ Requirements: - -2.2.
+qmckl_dgemm_safe
+2.2.
qmckl_dgemm_safe
"Size-safe" proxy function with the same functionality as
-qmckl_dgemm
@@ -974,7 +974,7 @@ are required primarily for the Python API, where compatibility with NumPy arrays implies that sizes of the input and output arrays are provided.+
@@ -1160,8 +1160,8 @@ Requirements: - -2.3.
+qmckl_matmul
+2.3.
qmckl_matmul
Matrix multiplication using the
-qmckl_matrix
data type: @@ -1173,7 +1173,7 @@ Matrix multiplication using theqmckl_matrix
data type: \]+
@@ -1267,8 +1267,8 @@ Matrix multiplication using the qmckl_matrix
data type: --2.4.
+qmckl_adjugate
+2.4.
qmckl_adjugate
Given a matrix \(\mathbf{A}\), the adjugate matrix @@ -1286,7 +1286,7 @@ of \(\mathbf{A}\). See also: https://en.wikipedia.org/wiki/Adjugate_matrix
-+
@@ -1482,8 +1482,8 @@ determinant with the inverse: - -2.5.
+qmckl_adjugate_safe
+2.5.
qmckl_adjugate_safe
"Size-safe" proxy function with the same functionality as
-qmckl_adjugate
@@ -1493,7 +1493,7 @@ NumPy arrays implies that sizes of the input and output arrays are provided.+
-
@@ -1615,13 +1615,13 @@ LAPACK library. - --2.5.1. C interface
++2.5.1. C interface
-2.6.
+qmckl_transpose
+-2.6.
qmckl_transpose
Transposes a matrix: \(A^\dagger_{ji} = A_{ij}\). @@ -1682,8 +1682,8 @@ Transposes a matrix: \(A^\dagger_{ji} = A_{ij}\).
-3. Utilities
++-3. Utilities
diff --git a/qmckl_context.html b/qmckl_context.html index 979827e..c81b457 100644 --- a/qmckl_context.html +++ b/qmckl_context.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + -Trick to make MKL efficient on AMD @@ -1701,7 +1701,7 @@ Trick to make MKL efficient on AMD
Context @@ -226,21 +226,25 @@ org_html_manager.setup(); // activate after the parameters are setTable of Contents
-1. Context handling
++1. Context handling
-The context variable is a handle for the state of the library, @@ -253,7 +257,7 @@ A value of
QMCKL_NULL_CONTEXT
for the context is equivalent to a-@@ -271,8 +275,8 @@ andtypedef int64_t qmckl_context ; +typedef int64_t qmckl_context ; #define QMCKL_NULL_CONTEXT (qmckl_context) 0ctx
is aqmckl_context_struct*
pointer.-1.1. Data structure
++-1.1. Data structure
+ +The qmcklextra pointer lets the other implementation of the library @@ -308,7 +312,7 @@ to be recomputed. The date is incremented when the context is touched.
When a new element is added to the context, the functions -
@@ -327,10 +331,15 @@ using the following function. This has the effect to increment the date of the context.qmckl_context_create
qmckl_context_destroy
andqmckl_context_copy
+qmckl_context_create
qmckl_context_destroy
andqmckl_context_copy
should be updated in order to make deep copies.+1.1.1. Fortran binding
+--1.2. Creation
+ ++1.2. Creation
To create a new context,
qmckl_context_create()
should be used. @@ -347,8 +356,8 @@ To create a new context,qmckl_context_create()
should be used.--1.3. Locking
++1.3. Locking
For thread safety, the context may be locked/unlocked. The lock is @@ -364,8 +373,8 @@ number of times the thread has locked it is saved in the
-1.4. TODO Copy
++-1.4. TODO Copy
qmckl_context_copy
makes a deep copy of a context. It returns @@ -373,8 +382,8 @@ number of times the thread has locked it is saved in the-1.5. Destroy
++-1.5. Destroy
diff --git a/qmckl_determinant.html b/qmckl_determinant.html index 63309d9..af0b9ee 100644 --- a/qmckl_determinant.html +++ b/qmckl_determinant.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + -The context is destroyed with
qmckl_context_destroy
, leaving the ancestors untouched. @@ -392,7 +401,7 @@ It frees the context, and returns the previous context.Slater Determinant @@ -226,32 +226,32 @@ org_html_manager.setup(); // activate after the parameters are setTable of Contents
-
- 1. Context +
- 1. Context
-- 2. Computation +
- 2. Computation @@ -260,8 +260,8 @@ org_html_manager.setup(); // activate after the parameters are set
-1. Context
++1. Context
The following arrays are stored in the context: @@ -437,8 +437,8 @@ Computed data:
-1.1. Data structure
++1.1. Data structure
-typedef struct qmckl_determinant_struct { @@ -506,8 +506,8 @@ this mechanism.-1.2. Access functions
++-1.2. Access functions
When all the data for the slater determinants have been provided, the following @@ -521,8 +521,8 @@ function returns
true
.-1.3. Initialization functions
++-1.3. Initialization functions
To set the basis set, all the following functions need to be @@ -545,24 +545,24 @@ computed to accelerate the calculations.
-1.4. Fortran Interfaces
++-1.4. Fortran Interfaces
--1.5. Test
++1.5. Test
-2. Computation
++2. Computation
--2.1. Determinant matrix
++2.1. Determinant matrix
--2.1.1. Get
++2.1.1. Get
-qmckl_exit_code qmckl_get_det_vgl_alpha(qmckl_context context, double* const det_vgl_alpha); @@ -572,14 +572,14 @@ computed to accelerate the calculations.-2.1.2. Provide
++-2.1.2. Provide
-2.1.3. Compute alpha
++2.1.3. Compute alpha
-+
@@ -753,10 +753,10 @@ computed to accelerate the calculations. - -2.1.4. Compute beta
++2.1.4. Compute beta
-+
@@ -930,18 +930,18 @@ computed to accelerate the calculations. - --2.1.5. Test
++2.1.5. Test
-2.2. Inverse of Determinant matrix
++2.2. Inverse of Determinant matrix
--2.2.1. Get
++2.2.1. Get
-qmckl_exit_code qmckl_get_det_inv_matrix_alpha(qmckl_context context, double* const det_inv_matrix_alpha); @@ -955,14 +955,14 @@ computed to accelerate the calculations.-2.2.2. Provide
++-2.2.2. Provide
-2.2.3. Compute alpha
++2.2.3. Compute alpha
-+
@@ -1124,10 +1124,10 @@ computed to accelerate the calculations. - -2.2.4. Compute beta
++2.2.4. Compute beta
-+
@@ -1294,7 +1294,7 @@ computed to accelerate the calculations. diff --git a/qmckl_distance.html b/qmckl_distance.html index 2a7a6ea..f208118 100644 --- a/qmckl_distance.html +++ b/qmckl_distance.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + - Inter-particle distances @@ -258,54 +258,54 @@ org_html_manager.setup(); // activate after the parameters are setTable of Contents
--1. Squared distance
++1. Squared distance
--1.1.
+qmckl_distance_sq
+1.1.
qmckl_distance_sq
-
qmckl_distance_sq
computes the matrix of the squared distances @@ -318,7 +318,7 @@ between all pairs of points in two sets, one point within each set: \]+
@@ -590,8 +590,8 @@ Requirements: - --1.1.1. Performance
++1.1.1. Performance
This function is more efficient when
A
andB
are @@ -601,12 +601,12 @@ transposed.-2. Distance
++2. Distance
--2.1.
+qmckl_distance
+2.1.
qmckl_distance
-
qmckl_distance
computes the matrix of the distances between all @@ -624,7 +624,7 @@ If the input array is normal ('N'
), the xyz coordinates are in the leading dimension:[n][3]
in C and(3,n)
in Fortran.+
-
@@ -725,8 +725,8 @@ the leading dimension: [n][3]
in C and(3,n)
in Fortra-2.1.1. Requirements
++-2.1.1. Requirements
- @@ -744,8 +744,8 @@ the leading dimension:
context
is notQMCKL_NULL_CONTEXT
[n][3]
in C and(3,n)
in Fortra-2.1.2. C header
++2.1.2. C header
-qmckl_exit_code qmckl_distance ( @@ -765,8 +765,8 @@ the leading dimension:[n][3]
in C and(3,n)
in Fortra-2.1.3. Source
++2.1.3. Source
-function qmckl_distance(context, transa, transb, m, n, & @@ -916,8 +916,8 @@ the leading dimension:[n][3]
in C and(3,n)
in Fortra-2.1.4. Performance
++-2.1.4. Performance
This function is more efficient when
A
andB
are transposed. @@ -927,12 +927,12 @@ This function is more efficient whenA
andB
are trans-3. Rescaled Distance
++3. Rescaled Distance
--3.1.
+qmckl_distance_rescaled
+3.1.
qmckl_distance_rescaled
-
qmckl_distance_rescaled
computes the matrix of the rescaled distances between all @@ -950,7 +950,7 @@ If the input array is normal ('N'
), the xyz coordinates are in the leading dimension:[n][3]
in C and(3,n)
in Fortran.+
-
@@ -1058,8 +1058,8 @@ the leading dimension: [n][3]
in C and(3,n)
in Fortra-3.1.1. Requirements
++-3.1.1. Requirements
- @@ -1077,8 +1077,8 @@ the leading dimension:
context
is notQMCKL_NULL_CONTEXT
[n][3]
in C and(3,n)
in Fortra-3.1.2. C header
++3.1.2. C header
-qmckl_exit_code qmckl_distance_rescaled ( @@ -1099,8 +1099,8 @@ the leading dimension:[n][3]
in C and(3,n)
in Fortra-3.1.3. Source
++3.1.3. Source
-function qmckl_distance_rescaled(context, transa, transb, m, n, & @@ -1253,8 +1253,8 @@ the leading dimension:[n][3]
in C and(3,n)
in Fortra--3.1.4. Performance
++3.1.4. Performance
This function is more efficient when
A
andB
are transposed. @@ -1263,12 +1263,12 @@ This function is more efficient whenA
andB
are trans-4. Rescaled Distance Derivatives
++4. Rescaled Distance Derivatives
--4.1.
+qmckl_distance_rescaled_gl
+4.1.
qmckl_distance_rescaled_gl
-
qmckl_distance_rescaled_gl
computes the matrix of the gradient and Laplacian of the @@ -1323,7 +1323,7 @@ If the input array is normal ('N'
), the xyz coordinates are in the leading dimension:[n][3]
in C and(3,n)
in Fortran.+
@@ -1643,7 +1643,7 @@ This function is more efficient when A
andB
are trans diff --git a/qmckl_electron.html b/qmckl_electron.html index 023f9d6..b917412 100644 --- a/qmckl_electron.html +++ b/qmckl_electron.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + -Electrons @@ -258,59 +258,59 @@ org_html_manager.setup(); // activate after the parameters are setTable of Contents