From 75ef9697b4d17c3416262f9716f35aad795488f2 Mon Sep 17 00:00:00 2001 From: scemama Date: Fri, 13 Dec 2024 02:01:49 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20TREX-CoE?= =?UTF-8?q?/qmckl@71de52c39fdcad574e3289fb8bb743e52f04feb7=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.html | 4 +- qmckl.html | 118 +- qmckl_ao.html | 218 +- qmckl_blas.html | 184 +- qmckl_context.html | 44 +- qmckl_determinant.html | 120 +- qmckl_distance.html | 114 +- qmckl_electron.html | 175 +- qmckl_error.html | 70 +- qmckl_examples.html | 48 +- qmckl_jastrow_champ.html | 3457 ++++++++++++++++---------- qmckl_local_energy.html | 156 +- qmckl_memory.html | 28 +- qmckl_mo.html | 192 +- qmckl_nucleus.html | 92 +- qmckl_numprec.html | 54 +- qmckl_point.html | 46 +- qmckl_sherman_morrison_woodbury.html | 398 +-- qmckl_tests.html | 70 +- qmckl_trexio.html | 196 +- qmckl_verificarlo.html | 46 +- 21 files changed, 3386 insertions(+), 2444 deletions(-) diff --git a/README.html b/README.html index 0d5ad52..8e76be7 100644 --- a/README.html +++ b/README.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + QMCkl source code documentation @@ -375,7 +375,7 @@ and bug reports should be submitted at

Author: TREX CoE

-

Created: 2024-12-09 Mon 14:46

+

Created: 2024-12-13 Fri 02:01

Validate

diff --git a/qmckl.html b/qmckl.html index 06875e9..61288d0 100644 --- a/qmckl.html +++ b/qmckl.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Introduction @@ -346,36 +346,36 @@ for the JavaScript code in this tag.

Table of Contents

-
-

1 Installing QMCkl

+
+

1 Installing QMCkl

The latest version fo QMCkl can be downloaded @@ -384,8 +384,8 @@ The latest version fo QMCkl can be downloaded

-
-

1.1 Installing from the released tarball (for end users)

+
+

1.1 Installing from the released tarball (for end users)

QMCkl is built with GNU Autotools, so the usual @@ -400,8 +400,8 @@ options are defined using CFLAGS and FCFLAGS.

-
-

1.2 Installing from the source repository (for developers)

+
+

1.2 Installing from the source repository (for developers)

To compile from the source repository, additional dependencies are @@ -422,8 +422,8 @@ to be executed first.

-
-

2 Using QMCkl

+
+

2 Using QMCkl

The qmckl.h header file installed in the ${prefix}/include directory @@ -452,12 +452,12 @@ Both files are located in the include/ directory.

-
-

3 Developing in QMCkl

+
+

3 Developing in QMCkl

-
-

3.1 Literate programming

+
+

3.1 Literate programming

In a traditional source code, most of the lines of source files of a program @@ -507,8 +507,8 @@ tarball contains the generated source code.

-
-

3.2 Source code editing

+
+

3.2 Source code editing

For a tutorial on literate programming with org-mode, follow this link. @@ -539,8 +539,8 @@ org-mode.

-
-

3.3 Choice of the programming language

+
+

3.3 Choice of the programming language

Most of the codes of the TREX CoE are written in Fortran with some @@ -604,8 +604,8 @@ For more guidelines on using Fortran to generate a C interface, see

-
-

3.4 Coding rules

+
+

3.4 Coding rules

The authors should follow the recommendations of the C99 @@ -625,8 +625,8 @@ make cppcheck ; cat cppcheck.out

-
-

3.5 Design of the library

+
+

3.5 Design of the library

The proposed API should allow the library to: deal with memory transfers @@ -637,8 +637,8 @@ functions (see below).

-
-

3.6 Naming conventions

+
+

3.6 Naming conventions

To avoid namespace collisions, we use qmckl_ as a prefix for all exported @@ -659,8 +659,8 @@ form is allowed.

-
-

3.7 Application programming interface

+
+

3.7 Application programming interface

In the C language, the number of bits used by the integer types can change @@ -692,15 +692,15 @@ bindings in other languages in other repositories.

-
-

3.8 Global state

+
+

3.8 Global state

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.

@@ -714,8 +714,8 @@ the state is done by setters and getters, prefixed by
-
-

3.9 Headers

+
+

3.9 Headers

A single qmckl.h header to be distributed by the library @@ -803,8 +803,8 @@ and the types definitions should be written in the *fh_type.f90 fil

-
-

3.10 Low-level functions

+
+

3.10 Low-level functions

Low-level functions are very simple functions which are leaves of @@ -813,14 +813,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.

-
-

3.11 High-level functions

+
+

3.11 High-level functions

High-level functions are at the top of the function call tree. @@ -832,8 +832,8 @@ temporary storage, to simplify the use of accelerators.

-
-

3.12 Numerical precision

+
+

3.12 Numerical precision

The minimal number of bits of precision required for a function @@ -841,7 +841,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.

@@ -909,8 +909,8 @@ following points :

-
-

3.13 Algorithms

+
+

3.13 Algorithms

Reducing the scaling of an algorithm usually implies also reducing @@ -926,7 +926,7 @@ implemented adapted to different problem sizes.

Author: TREX CoE

-

Created: 2024-12-09 Mon 14:46

+

Created: 2024-12-13 Fri 02:01

Validate

diff --git a/qmckl_ao.html b/qmckl_ao.html index 43a513c..4704eef 100644 --- a/qmckl_ao.html +++ b/qmckl_ao.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Atomic Orbitals @@ -346,62 +346,62 @@ for the JavaScript code in this tag.

Table of Contents

-
-

1 Introduction

+
+

1 Introduction

The atomic basis set is defined as a list of shells. Each shell \(s\) is @@ -464,19 +464,19 @@ gradients and Laplacian of the atomic basis functions.

-
-

2 Context

+
+

2 Context

-
-

2.1 Constant data

+
+

2.1 Constant data

The following arrays are stored in the context, and need to be set when initializing the library:

- +
@@ -710,7 +710,7 @@ calling the functions:

-
qmckl_exit_code qmckl_set_ao_basis_$V$ ( qmckl_context context,
+
qmckl_exit_code qmckl_set_ao_basis_$V$ ( qmckl_context context,
                                          const $type_of_V$ $V$);
 
 qmckl_exit_code qmckl_get_ao_basis_$V$ ( const qmckl_context context,
@@ -747,7 +747,7 @@ For array variables, use the rule:
 

-
qmckl_exit_code qmckl_set_ao_basis_$V$ ( qmckl_context context,
+
qmckl_exit_code qmckl_set_ao_basis_$V$ ( qmckl_context context,
                                          const $type_of_V$ $V$,
                                          const int64_t size_max);
 
@@ -785,17 +785,17 @@ For array variables, use the rule:
 
-
-

2.1.1 Initialization functions

+
+

2.1.1 Initialization functions

size_max is the dimension of the input array, which should be -equal of larger than the value given in the table of section 2. +equal of larger than the value given in the table of section 2.

-
-
2.1.1.1 C interface
+
+
2.1.1.1 C interface

To set the basis set, all the following functions need to be @@ -919,8 +919,8 @@ called.

-
-
2.1.1.2 Fortran interface
+
+
2.1.1.2 Fortran interface
interface
@@ -1103,17 +1103,17 @@ called.
 
-
-

2.1.2 Access functions

+
+

2.1.2 Access functions

size_max is the dimension of the input array, which should be -equal of larger than the value given in the table of section 2. +equal of larger than the value given in the table of section 2.

-
-
2.1.2.1 C interface
+
+
2.1.2.1 C interface
qmckl_exit_code
@@ -1235,8 +1235,8 @@ function returns true.
 
-
-
2.1.2.2 Fortran interface
+
+
2.1.2.2 Fortran interface
interface
@@ -1420,8 +1420,8 @@ function returns true.
 
-
-

2.2 Computed data

+
+

2.2 Computed data

The following data is computed as described in the next sections: @@ -1496,8 +1496,8 @@ The following data is computed as described in the next sections:

-
-

2.2.1 After initialization

+
+

2.2.1 After initialization

When the basis set is completely entered, extra data structures may be @@ -1511,8 +1511,8 @@ the context.

-
-

2.2.2 TODO HPC-specific data structures

+
+

2.2.2 TODO HPC-specific data structures

For faster access, we provide extra arrays for the shell information as: @@ -1542,8 +1542,8 @@ which is a matrix-vector product.

-
-

2.2.3 Access functions

+
+

2.2.3 Access functions

qmckl_exit_code
@@ -1556,7 +1556,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.

@@ -1569,7 +1569,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.

@@ -1583,7 +1583,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.

@@ -1608,7 +1608,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.

@@ -1627,12 +1627,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 @@ -1805,10 +1805,10 @@ Requirements:

-
-

3.2 Computation of primitives

+
+

3.2 Computation of primitives

- +
@@ -1969,10 +1969,10 @@ Requirements: -
-

3.3 Computation of shells

+
+

3.3 Computation of shells

-
+
@@ -2228,8 +2228,8 @@ Requirements: -
-

4 Polynomial part

+
+

4 Polynomial part

Going from the atomic basis set to AOs implies a systematic @@ -2249,8 +2249,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 the n @@ -2262,7 +2262,7 @@ the \(n\) points: \[ P_{ik} = X_i^k \]

-
+
@@ -2403,8 +2403,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\) @@ -2449,7 +2449,7 @@ Laplacians at a given point in space, of all polynomials with an angular momentum up to lmax.

-
+
@@ -3245,12 +3245,12 @@ For example, with a=0, b=2 and c=1 the string is "yyz" -
-

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 @@ -3416,14 +3416,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

-
+
@@ -3663,10 +3663,10 @@ of bits of precision (1-53), a range is given. -
-

5.2.2 HPC version

+
+

5.2.2 HPC version

-
+
@@ -3824,8 +3824,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 (
@@ -3874,14 +3874,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

-
+
@@ -4149,10 +4149,10 @@ of bits of precision (1-53), a range is given. -
-

5.3.2 HPC version

+
+

5.3.2 HPC version

-
+
@@ -4311,8 +4311,8 @@ of bits of precision (1-53), a range is given. -
-

5.3.3 Interfaces

+
+

5.3.3 Interfaces

qmckl_exit_code qmckl_compute_ao_vgl_doc (
@@ -4364,7 +4364,7 @@ of bits of precision (1-53), a range is given.
 

Author: TREX CoE

-

Created: 2024-12-09 Mon 14:46

+

Created: 2024-12-13 Fri 02:01

Validate

diff --git a/qmckl_blas.html b/qmckl_blas.html index 73c94a3..c2e2a24 100644 --- a/qmckl_blas.html +++ b/qmckl_blas.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + BLAS functions @@ -346,56 +346,56 @@ for the JavaScript code in this tag.

Table of Contents

-
-

-

-
+
+

-

+

Basic linear algebra data types and operations are described in this file. The data types are private, so that HPC implementations can use @@ -409,12 +409,12 @@ are not intended to be passed to external codes.

-
-

1 Data types

+
+

1 Data types

-
-

1.1 Vector

+
+

1.1 Vector

@@ -468,8 +468,8 @@ Allocates a new vector. If the allocation failed the size is zero. -
-

1.2 Matrix

+
+

1.2 Matrix

@@ -529,8 +529,8 @@ Allocates a new matrix. If the allocation failed the sizes are zero. -
-

1.3 Tensor

+
+

1.3 Tensor

@@ -597,16 +597,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
@@ -622,8 +622,8 @@ Reshapes a vector into a matrix.
 
-
-

1.4.2 Vector -> Tensor

+
+

1.4.2 Vector -> Tensor

qmckl_tensor
@@ -639,8 +639,8 @@ Reshapes a vector into a tensor.
 
-
-

1.4.3 Matrix -> Vector

+
+

1.4.3 Matrix -> Vector

qmckl_vector
@@ -654,8 +654,8 @@ Reshapes a matrix into a vector.
 
-
-

1.4.4 Matrix -> Tensor

+
+

1.4.4 Matrix -> Tensor

qmckl_tensor
@@ -671,8 +671,8 @@ Reshapes a matrix into a tensor.
 
-
-

1.4.5 Tensor -> Vector

+
+

1.4.5 Tensor -> Vector

qmckl_vector
@@ -686,8 +686,8 @@ Reshapes a tensor into a vector.
 
-
-

1.4.6 Tensor -> Matrix

+
+

1.4.6 Tensor -> Matrix

qmckl_matrix
@@ -704,8 +704,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 @@ -730,12 +730,12 @@ For example:

-
-

1.6 Set all elements

+
+

1.6 Set all elements

-
-

1.6.1 Vector

+
+

1.6.1 Vector

qmckl_vector
@@ -745,8 +745,8 @@ For example:
 
-
-

1.6.2 Matrix

+
+

1.6.2 Matrix

qmckl_matrix
@@ -756,8 +756,8 @@ For example:
 
-
-

1.6.3 Tensor

+
+

1.6.3 Tensor

qmckl_tensor
@@ -768,8 +768,8 @@ For example:
 
-
-

1.7 Copy to/from to double*

+
+

1.7 Copy to/from to double*

qmckl_exit_code
@@ -851,8 +851,8 @@ Converts a double* 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,
@@ -876,12 +876,12 @@ Converts a double* to a tensor.
 
-
-

2 Matrix operations

+
+

2 Matrix operations

-
-

2.1 qmckl_dgemm

+
+

2.1 qmckl_dgemm

Matrix multiplication with a BLAS interface: @@ -893,7 +893,7 @@ Matrix multiplication with a BLAS interface: \]

-
+
@@ -1052,8 +1052,8 @@ Requirements: -
-

2.2 qmckl_dgemm_safe

+
+

2.2 qmckl_dgemm_safe

"Size-safe" proxy function with the same functionality as qmckl_dgemm @@ -1062,7 +1062,7 @@ are required primarily for the Python API, where compatibility with NumPy arrays implies that sizes of the input and output arrays are provided.

-
+
@@ -1248,8 +1248,8 @@ Requirements: -
-

2.3 qmckl_matmul

+
+

2.3 qmckl_matmul

Matrix multiplication using the qmckl_matrix data type: @@ -1261,7 +1261,7 @@ Matrix multiplication using the qmckl_matrix data type: \]

-
+
@@ -1355,8 +1355,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 @@ -1374,7 +1374,7 @@ of \(\mathbf{A}\). See also: https://en.wikipedia.org/wiki/Adjugate_matrix

-
+
@@ -1570,8 +1570,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 @@ -1581,7 +1581,7 @@ NumPy arrays implies that sizes of the input and output arrays are provided.

-
+
@@ -1703,13 +1703,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}\). @@ -1770,8 +1770,8 @@ Transposes a matrix: \(A^\dagger_{ji} = A_{ij}\).

-
-

3 Utilities

+
+

3 Utilities

Trick to make MKL efficient on AMD @@ -1789,7 +1789,7 @@ Trick to make MKL efficient on AMD

Author: TREX CoE

-

Created: 2024-12-09 Mon 14:46

+

Created: 2024-12-13 Fri 02:01

Validate

diff --git a/qmckl_context.html b/qmckl_context.html index 5d3bf49..e031510 100644 --- a/qmckl_context.html +++ b/qmckl_context.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Context @@ -324,21 +324,21 @@ for the JavaScript code in this tag.

Table of Contents

-
-

1 Context handling

+
+

1 Context handling

The context variable is a handle for the state of the library, @@ -351,7 +351,7 @@ A value of QMCKL_NULL_CONTEXT for the context is equivalent to a

-
typedef int64_t qmckl_context ;
+
typedef int64_t qmckl_context ;
 #define QMCKL_NULL_CONTEXT (qmckl_context) 0
 
@@ -369,8 +369,8 @@ and ctx is a qmckl_context_struct* pointer.

-
-

1.1 Data structure

+
+

1.1 Data structure

The qmcklextra pointer lets the other implementation of the library @@ -406,7 +406,7 @@ to be recomputed. The date is incremented when the context is touched.

When a new element is added to the context, the functions -qmckl_context_create qmckl_context_destroy and qmckl_context_copy +qmckl_context_create qmckl_context_destroy and qmckl_context_copy should be updated in order to make deep copies.

@@ -427,8 +427,8 @@ This has the effect to increment the date of the context.
-
-

1.2 Creation

+
+

1.2 Creation

To create a new context, qmckl_context_create() should be used. @@ -445,8 +445,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 @@ -462,8 +462,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 @@ -471,8 +471,8 @@ number of times the thread has locked it is saved in the

-
-

1.5 Destroy

+
+

1.5 Destroy

The context is destroyed with qmckl_context_destroy, leaving the ancestors untouched. @@ -490,7 +490,7 @@ It frees the context, and returns the previous context.

Author: TREX CoE

-

Created: 2024-12-09 Mon 14:46

+

Created: 2024-12-13 Fri 02:01

Validate

diff --git a/qmckl_determinant.html b/qmckl_determinant.html index 0f248ca..2bf9db9 100644 --- a/qmckl_determinant.html +++ b/qmckl_determinant.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Slater Determinant @@ -324,32 +324,32 @@ for the JavaScript code in this tag.

Table of Contents

-
-

1 Context

+
+

1 Context

The following arrays are stored in the context: @@ -535,8 +535,8 @@ Computed data:

-
-

1.1 Data structure

+
+

1.1 Data structure

typedef struct qmckl_determinant_struct {
@@ -604,8 +604,8 @@ this mechanism.
 
-
-

1.2 Access functions

+
+

1.2 Access functions

When all the data for the slater determinants have been provided, the following @@ -619,8 +619,8 @@ function returns true.

-
-

1.3 Initialization functions

+
+

1.3 Initialization functions

To set the basis set, all the following functions need to be @@ -643,24 +643,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);
@@ -670,14 +670,14 @@ computed to accelerate the calculations.
 
-
-

2.1.2 Provide

+
+

2.1.2 Provide

-
-

2.1.3 Compute alpha

+
+

2.1.3 Compute alpha

- +
@@ -851,10 +851,10 @@ computed to accelerate the calculations. -
-

2.1.4 Compute beta

+
+

2.1.4 Compute beta

-
+
@@ -1028,18 +1028,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);
@@ -1053,14 +1053,14 @@ computed to accelerate the calculations.
 
-
-

2.2.2 Provide

+
+

2.2.2 Provide

-
-

2.2.3 Compute alpha

+
+

2.2.3 Compute alpha

-
+
@@ -1222,10 +1222,10 @@ computed to accelerate the calculations. -
-

2.2.4 Compute beta

+
+

2.2.4 Compute beta

-
+
@@ -1392,7 +1392,7 @@ computed to accelerate the calculations.

Author: TREX CoE

-

Created: 2024-12-09 Mon 14:46

+

Created: 2024-12-13 Fri 02:01

Validate

diff --git a/qmckl_distance.html b/qmckl_distance.html index 7f4d5a5..d0e1a90 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 @@ -346,54 +346,54 @@ for the JavaScript code in this tag.

Table 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 @@ -406,7 +406,7 @@ between all pairs of points in two sets, one point within each set: \]

-
+
@@ -678,8 +678,8 @@ Requirements: -
-

1.1.1 Performance

+
+

1.1.1 Performance

This function is more efficient when A and B are @@ -689,12 +689,12 @@ transposed.

-
-

2 Distance

+
+

2 Distance

-
-

2.1 qmckl_distance

+
+

2.1 qmckl_distance

qmckl_distance computes the matrix of the distances between all @@ -712,7 +712,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.

-
+
@@ -813,8 +813,8 @@ the leading dimension: [n][3] in C and (3,n) in Fortra
-
-

2.1.1 Requirements

+
+

2.1.1 Requirements

  • context is not QMCKL_NULL_CONTEXT
  • @@ -832,8 +832,8 @@ the leading dimension: [n][3] in C and (3,n) in Fortra
-
-

2.1.2 C header

+
+

2.1.2 C header

qmckl_exit_code qmckl_distance (
@@ -853,8 +853,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, &
@@ -1004,8 +1004,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 and B are transposed. @@ -1015,12 +1015,12 @@ This function is more efficient when A and B 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 @@ -1038,7 +1038,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.

- +
@@ -1146,8 +1146,8 @@ the leading dimension: [n][3] in C and (3,n) in Fortra
-
-

3.1.1 Requirements

+
+

3.1.1 Requirements

  • context is not QMCKL_NULL_CONTEXT
  • @@ -1165,8 +1165,8 @@ the leading dimension: [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 (
@@ -1187,8 +1187,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, &
@@ -1341,8 +1341,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 and B are transposed. @@ -1351,12 +1351,12 @@ This function is more efficient when A and B 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 @@ -1411,7 +1411,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.

- +
@@ -1731,7 +1731,7 @@ This function is more efficient when A and B are trans

Author: TREX CoE

-

Created: 2024-12-09 Mon 14:46

+

Created: 2024-12-13 Fri 02:01

Validate

diff --git a/qmckl_electron.html b/qmckl_electron.html index 3b1d558..89d7d8c 100644 --- a/qmckl_electron.html +++ b/qmckl_electron.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - +Electrons @@ -346,59 +346,59 @@ for the JavaScript code in this tag.

Table of Contents

-
-

1 Context

+
+

1 Context

The following data stored in the context: @@ -539,8 +539,8 @@ Computed data:

-
-

1.1 Data structure

+
+

1.1 Data structure

@@ -609,8 +609,8 @@ this mechanism.
 
-
-

1.2 Initialization functions

+
+

1.2 Initialization functions

To set the data relative to the electrons in the context, the @@ -683,8 +683,8 @@ in the context.

-
-

1.3 Access functions

+
+

1.3 Access functions

Access functions return QMCKL_SUCCESS when the data has been @@ -696,12 +696,12 @@ contains the requested data. Otherwise, this variable is untouched.

-
-

1.3.1 Number of electrons

+
+

1.3.1 Number of electrons

-
-

1.3.2 Number of walkers

+
+

1.3.2 Number of walkers

A walker is a set of electron coordinates that are arguments of @@ -710,8 +710,8 @@ the wave function. walk_num is the number of walkers.

-
-

1.3.3 Electron coordinates

+
+

1.3.3 Electron coordinates

Returns the current electron coordinates. The pointer is assumed @@ -776,8 +776,8 @@ current points.

-
-

1.4 Test

+
+

1.4 Test

/* Reference input data */
@@ -856,8 +856,8 @@ rc = qmckl_get_electron_coord (context, 'N'
 
-
-

2 Computation

+
+

2 Computation

The computed data is stored in the context so that it can be reused @@ -870,24 +870,27 @@ current date is stored.

-
-

2.1 Electron-electron distances

+
+

2.1 Electron-electron distances

-
-

2.1.1 Get

+
+

2.1.1 Get

-
qmckl_exit_code qmckl_get_electron_ee_distance(qmckl_context context, double* const distance);
+
qmckl_exit_code
+qmckl_get_electron_ee_distance(qmckl_context context,
+                               double* const distance,
+                               const int64_t size_max);
 
-
-

2.1.2 Compute

+
+

2.1.2 Compute

- +
@@ -992,15 +995,15 @@ current date is stored. -
-

2.1.3 Test

+
+

2.1.3 Test

assert(qmckl_electron_provided(context));
 
 
 double ee_distance[walk_num * elec_num * elec_num];
-rc = qmckl_get_electron_ee_distance(context, ee_distance);
+rc = qmckl_get_electron_ee_distance(context, ee_distance, walk_num * elec_num * elec_num);
 
 // (e1,e2,w)
 // (0,0,0) == 0.
@@ -1027,8 +1030,8 @@ rc = qmckl_get_electron_ee_distance(context, ee_distance);
 
-
-

2.2 Electron-electron potential

+
+

2.2 Electron-electron potential

ee_potential is given by @@ -1046,8 +1049,8 @@ distance.

-
-

2.2.1 Get

+
+

2.2.1 Get

qmckl_exit_code qmckl_get_electron_ee_potential(qmckl_context context, double* const ee_potential);
@@ -1056,10 +1059,10 @@ distance.
 
-
-

2.2.2 Compute

+
+

2.2.2 Compute

-
+
@@ -1175,8 +1178,8 @@ distance. -
-

2.2.3 Test

+
+

2.2.3 Test

double ee_potential[walk_num];
@@ -1188,12 +1191,12 @@ rc = qmckl_get_electron_ee_potential(context, &(ee_potential[0]));
 
-
-

2.3 Electron-nucleus distances

+
+

2.3 Electron-nucleus distances

-
-

2.3.1 Get

+
+

2.3.1 Get

qmckl_exit_code qmckl_get_electron_en_distance(qmckl_context context, double* distance);
@@ -1202,10 +1205,10 @@ rc = qmckl_get_electron_ee_potential(context, &(ee_potential[0]));
 
-
-

2.3.2 Compute

+
+

2.3.2 Compute

-
+
@@ -1312,8 +1315,8 @@ rc = qmckl_get_electron_ee_potential(context, &(ee_potential[0])); -
-

2.3.3 Test

+
+

2.3.3 Test

@@ -1361,8 +1364,8 @@ rc = qmckl_get_electron_en_distance(context, &(en_distance[0][0][0]));
 
-
-

2.4 Electron-nucleus potential

+
+

2.4 Electron-nucleus potential

en_potential stores the en potential energy @@ -1380,8 +1383,8 @@ distance and \[Z_A\] is the nuclear charge.

-
-

2.4.1 Get

+
+

2.4.1 Get

qmckl_exit_code qmckl_get_electron_en_potential(qmckl_context context, double* const en_potential);
@@ -1390,10 +1393,10 @@ distance and \[Z_A\] is the nuclear charge.
 
-
-

2.4.2 Compute

+
+

2.4.2 Compute

-
+
@@ -1527,8 +1530,8 @@ distance and \[Z_A\] is the nuclear charge. -
-

2.4.3 Test

+
+

2.4.3 Test

double en_potential[walk_num];
@@ -1541,14 +1544,14 @@ rc = qmckl_get_electron_en_potential(context, &(en_potential[0]));
 
-
-

2.5 Generate initial coordinates

+
+

2.5 Generate initial coordinates

Author: TREX CoE

-

Created: 2024-12-09 Mon 14:46

+

Created: 2024-12-13 Fri 02:01

Validate

diff --git a/qmckl_error.html b/qmckl_error.html index 569dcb0..3f73fec 100644 --- a/qmckl_error.html +++ b/qmckl_error.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Error handling @@ -324,29 +324,29 @@ for the JavaScript code in this tag.

Table of Contents

-
-

-

-
+
+

-

+

The library should never make the calling programs abort, nor perform any input/output operations. This decision has to be taken @@ -357,7 +357,7 @@ by the developer of the code calling the library. All the functions return with an exit code, defined as

-
typedef int32_t qmckl_exit_code;
+
typedef int32_t qmckl_exit_code;
 
@@ -374,7 +374,7 @@ error code is returned to the program. Here is the complete list of exit codes.

-
+
@@ -582,8 +582,8 @@ string is assumed to be large enough to contain the error message -
-

1 Decoding errors

+
+

1 Decoding errors

To decode the error messages, qmckl_string_of_error converts an @@ -601,8 +601,8 @@ The text strings are extracted from the previous table.

-
-

2 Data structure in context

+
+

2 Data structure in context

The strings are declared internally with a maximum fixed size to avoid @@ -625,8 +625,8 @@ dynamic memory allocation.

-
-

3 Updating errors in the context

+
+

3 Updating errors in the context

The error is updated in the context using qmckl_set_error. @@ -645,8 +645,8 @@ explaining the error. The exit code can't be QMCKL_SUCCESS.

-
-

4 Get the error

+
+

4 Get the error

Upon error, the error type and message can be obtained from the @@ -665,8 +665,8 @@ function name and message is mandatory.

-
-

5 Failing

+
+

5 Failing

To make a function fail, the qmckl_failwith function should be @@ -703,8 +703,8 @@ For example, this function can be used as

-
-

6 Last error

+
+

6 Last error

Returns a string describing the last error, using qmckl_get_error. @@ -716,13 +716,13 @@ Returns a string describing the last error, using qmckl_get_error.

-
-

6.1 Fortran inteface

+
+

6.1 Fortran inteface

-
-

7 Helper functions for debugging

+
+

7 Helper functions for debugging

The following function prints to stderr an error message is the return code is @@ -748,14 +748,14 @@ It should be used as:

-
-

7.1 Fortran inteface

+
+

7.1 Fortran inteface

Author: TREX CoE

-

Created: 2024-12-09 Mon 14:46

+

Created: 2024-12-13 Fri 02:01

Validate

diff --git a/qmckl_examples.html b/qmckl_examples.html index 0c15242..7f7687c 100644 --- a/qmckl_examples.html +++ b/qmckl_examples.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Code examples @@ -346,25 +346,25 @@ for the JavaScript code in this tag.

Table of Contents

-
-

1 Overlap matrix in the MO basis

+
+

1 Overlap matrix in the MO basis

The focal point of this example is the numerical evaluation of the overlap @@ -417,8 +417,8 @@ code.

-
-

1.1 Python

+
+

1.1 Python

In this example, we will compute numerically the overlap @@ -593,8 +593,8 @@ and finally we compute the overlap between all the MOs as

-
-

1.2 C

+
+

1.2 C

In this example, electron-nucleus cusp fitting is added. @@ -922,8 +922,8 @@ and finally we compute the overlap between all the MOs as

-
-

1.3 Fortran

+
+

1.3 Fortran

Here is the same piece of code translated in Fortran @@ -1099,12 +1099,12 @@ Here is the same piece of code translated in Fortran

-
-

2 Fortran

+
+

2 Fortran

-
-

2.1 Checking errors

+
+

2.1 Checking errors

All QMCkl functions return an error code. A convenient way to handle @@ -1113,7 +1113,7 @@ error in text format and exits the program.

-
subroutine qmckl_check_error(rc, message)
+
subroutine qmckl_check_error(rc, message)
   use qmckl
   implicit none
   integer(qmckl_exit_code), intent(in) :: rc
@@ -1131,8 +1131,8 @@ error in text format and exits the program.
 
-
-

2.2 Computing an atomic orbital on a grid

+
+

2.2 Computing an atomic orbital on a grid

The following program, in Fortran, computes the values of an atomic @@ -1351,7 +1351,7 @@ We finally print the value and Laplacian of the AO:

Author: TREX CoE

-

Created: 2024-12-09 Mon 14:46

+

Created: 2024-12-13 Fri 02:01

Validate

diff --git a/qmckl_jastrow_champ.html b/qmckl_jastrow_champ.html index 889b6d4..0af49e1 100644 --- a/qmckl_jastrow_champ.html +++ b/qmckl_jastrow_champ.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + CHAMP Jastrow Factor @@ -346,184 +346,184 @@ for the JavaScript code in this tag.

Table of Contents

-
-

1 Introduction

+
+

1 Introduction

The Jastrow factor depends on the electronic (\(\mathbf{r}\)) and @@ -619,17 +619,22 @@ The terms \(J_{\text{ee}}^\infty\) and \(J_{\text{eN}}^\infty\) are shifts to en The eN and eeN parameters are the same of all identical nuclei. Warning: The types of nuclei use zero-based indexing.

+ +

+The derivatives are computed with respect to the electron \(i\) for +\[ r_{ij} = |r_i - r_j| \] +

-
-

2 Context

+
+

2 Context

The following data stored in the context:

-
+
@@ -1004,8 +1009,8 @@ Computed data:
-
-

2.1 Data structure

+
+

2.1 Data structure

typedef struct qmckl_jastrow_champ_struct{
@@ -1114,8 +1119,8 @@ this mechanism.
 
-
-

2.2 Initialization functions

+
+

2.2 Initialization functions

To prepare for the Jastrow and its derivative, all the following functions need to be @@ -1144,8 +1149,8 @@ are precontracted using BLAS LEVEL 3 operations.

-
-
2.2.0.1 Fortran interface
+
+
2.2.0.1 Fortran interface
interface
@@ -1260,8 +1265,8 @@ are precontracted using BLAS LEVEL 3 operations.
 
-
-

2.3 Access functions

+
+

2.3 Access functions

Along with these core functions, calculation of the jastrow factor @@ -1280,8 +1285,8 @@ function returns true.

-
-
2.3.0.1 Fortran interface
+
+
2.3.0.1 Fortran interface
interface
@@ -1396,8 +1401,8 @@ function returns true.
 
-
-

2.4 Test

+
+

2.4 Test

/* Reference input data */
@@ -1508,8 +1513,8 @@ rc = qmckl_check(context,
 
-
-

3 Computation

+
+

3 Computation

The computed data is stored in the context so that it can be reused @@ -1522,12 +1527,12 @@ current date is stored.

-
-

3.1 Electron-electron component

+
+

3.1 Electron-electron component

-
-

3.1.1 Asymptotic component

+
+

3.1.1 Asymptotic component

Calculate the asymptotic component asymp_jasb to be subtracted from the @@ -1546,8 +1551,8 @@ If the spin_independent variable is set to 1, then

-
-
3.1.1.1 Get
+
+
3.1.1.1 Get
qmckl_exit_code
@@ -1559,7 +1564,7 @@ If the spin_independent variable is set to 1, then
 
    -
  1. Fortran interface
    +
  2. Fortran interface
    interface
    @@ -1580,10 +1585,10 @@ If the spin_independent variable is set to 1, then
     
-
-
3.1.1.2 Compute
+
+
3.1.1.2 Compute
- +
@@ -1746,7 +1751,7 @@ If the spin_independent variable is set to 1, then #ifdef HAVE_HPC return qmckl_compute_jastrow_champ_asymp_jasb_hpc #else - return qmckl_compute_jastrow_champ_asymp_jasb_doc + return qmckl_compute_jastrow_champ_asymp_jasb_doc #endif (context, bord_num, b_vector, rescale_factor_ee, spin_independent, asymp_jasb); } @@ -1754,8 +1759,8 @@ If the spin_independent variable is set to 1, then -
-
3.1.1.3 Test
+
+
3.1.1.3 Test
assert(qmckl_electron_provided(context));
@@ -1841,25 +1846,561 @@ rc = qmckl_check(context,
 /* Check if Jastrow is properly initialized */
 assert(qmckl_jastrow_champ_provided(context));
 
+printf("asymp_jasb\n");
 double asymp_jasb[2];
 rc = qmckl_check(context,
-                 qmckl_get_jastrow_champ_asymp_jasb(context, asymp_jasb,2)
+                 qmckl_get_jastrow_champ_asymp_jasb(context, &(asymp_jasb[0]),2)
                  );
 
 // calculate asymp_jasb
 assert(fabs(asymp_jasb[0]-0.7115733522582638) < 1.e-12);
 assert(fabs(asymp_jasb[1]-1.043287918508297 ) < 1.e-12);
 
+printf("asymp_jasb_hpc\n");
+double asymp_jasb_doc[2];
+double asymp_jasb_hpc[2];
+// calculate asymp_jasb
+rc = qmckl_check(context,
+                 qmckl_compute_jastrow_champ_asymp_jasb_doc (context,
+                                            bord_num,
+                                            b_vector,
+                                            rescale_factor_ee,
+                                            0,
+                                            &(asymp_jasb_doc[0]) )
+                 );
+rc = qmckl_check(context,
+                 qmckl_compute_jastrow_champ_asymp_jasb_hpc (context,
+                                            bord_num,
+                                            b_vector,
+                                            rescale_factor_ee,
+                                            0,
+                                            &(asymp_jasb_hpc[0]) )
+                 );
+assert(fabs(asymp_jasb_doc[0]-asymp_jasb_hpc[0]) < 1.e-12);
+assert(fabs(asymp_jasb_doc[1]-asymp_jasb_hpc[1]) < 1.e-12);
+
 
-
-

3.1.2 Electron-electron component

+
+

3.1.2 Electron-electron rescaled distances

+ee_distance_rescaled stores the matrix of the rescaled distances between all +pairs of electrons: +

+ +

+\[ + C_{ij} = \frac{ 1 - e^{-\kappa r_{ij}}}{\kappa} + \] +

+ +

+where \(r_{ij}\) is the matrix of electron-electron distances. +

+
+ +
+
3.1.2.1 Get
+
+
+
qmckl_exit_code qmckl_get_jastrow_champ_ee_distance_rescaled(qmckl_context context,
+                                                             double* const distance_rescaled,
+                                                             int64_t const max_size);
+
+
+
+
+ +
+
3.1.2.2 Compute
+
+
+ + +++ ++ ++ ++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
VariableTypeIn/OutDescription
contextqmckl_contextinGlobal state
elec_numint64_tinNumber of electrons
rescale_factor_eedoubleinFactor to rescale ee distances
walk_numint64_tinNumber of walkers
coorddouble[3][walk_num][elec_num]inElectron coordinates
ee_distancedouble[walk_num][elec_num][elec_num]outElectron-electron rescaled distances
+ +
+
function qmckl_compute_ee_distance_rescaled_doc(context, &
+     elec_num, rescale_factor_ee, walk_num, &
+     coord, ee_distance_rescaled) &
+     bind(C) result(info)
+  use qmckl
+  implicit none
+
+  integer(qmckl_context), intent(in), value :: context
+  integer (c_int64_t) , intent(in)  , value :: elec_num
+  real    (c_double ) , intent(in)  , value :: rescale_factor_ee
+  integer (c_int64_t) , intent(in)  , value :: walk_num
+  real    (c_double ) , intent(in)          :: coord(elec_num,walk_num,3)
+  real    (c_double ) , intent(out)         :: ee_distance_rescaled(elec_num,elec_num,walk_num)
+  integer(qmckl_exit_code)                  :: info
+
+  integer*8 :: k
+
+  info = QMCKL_SUCCESS
+
+  if (context == QMCKL_NULL_CONTEXT) then
+     info = QMCKL_INVALID_CONTEXT
+     return
+  endif
+
+  if (elec_num <= 0) then
+     info = QMCKL_INVALID_ARG_2
+     return
+  endif
+
+  if (walk_num <= 0) then
+     info = QMCKL_INVALID_ARG_3
+     return
+  endif
+
+  do k=1,walk_num
+     info = qmckl_distance_rescaled(context, 'T', 'T', elec_num, elec_num, &
+          coord(1,k,1), elec_num * walk_num, &
+          coord(1,k,1), elec_num * walk_num, &
+          ee_distance_rescaled(1,1,k), elec_num, rescale_factor_ee)
+     if (info /= QMCKL_SUCCESS) then
+        exit
+     endif
+  end do
+
+end function qmckl_compute_ee_distance_rescaled_doc
+
+
+
+
+ +
+
3.1.2.3 Test
+
+
+
assert(qmckl_electron_provided(context));
+
+{
+  printf("ee_distance_rescaled\n");
+  double ee_distance_rescaled[walk_num * elec_num * elec_num];
+  rc = qmckl_get_jastrow_champ_ee_distance_rescaled(context,
+                                                    ee_distance_rescaled,
+                                                    walk_num*elec_num*elec_num);
+
+  // (e1,e2,w)
+  // (0,0,0) == 0.
+  assert(ee_distance_rescaled[0] == 0.);
+
+  // (1,0,0) == (0,1,0)
+  assert(ee_distance_rescaled[1] == ee_distance_rescaled[elec_num]);
+
+  // value of (1,0,0)
+  assert(fabs(ee_distance_rescaled[1]-0.6347507420688708) < 1.e-12);
+
+  // (0,0,1) == 0.
+  assert(ee_distance_rescaled[5*elec_num + 5] == 0.);
+
+  // (1,0,1) == (0,1,1)
+  assert(ee_distance_rescaled[5*elec_num+6] == ee_distance_rescaled[6*elec_num+5]);
+
+  // value of (1,0,1)
+  assert(fabs(ee_distance_rescaled[5*elec_num+6]-0.3941735387855409) < 1.e-12);
+
+  printf("ee_distance_rescaled_hpc\n");
+  double ee_distance[walk_num * elec_num * elec_num];
+  rc = qmckl_get_electron_ee_distance(context, &(ee_distance[0]), walk_num*elec_num*elec_num);
+  assert(rc == QMCKL_SUCCESS);
+
+  double ee_distance_rescaled_doc[walk_num * elec_num * elec_num * (cord_num+1)];
+  memset(ee_distance_rescaled_doc, 0, sizeof(ee_distance_rescaled_doc));
+
+  rc = qmckl_compute_een_rescaled_e_doc (context, walk_num,
+                                         elec_num, cord_num,
+                                         rescale_factor_ee,
+                                         &(ee_distance[0]),
+                                         &(ee_distance_rescaled_doc[0]));
+
+  assert(rc == QMCKL_SUCCESS);
+
+  double ee_distance_rescaled_hpc[walk_num * elec_num * elec_num * (cord_num+1)];
+  memset(ee_distance_rescaled_hpc, 0, sizeof(ee_distance_rescaled_hpc));
+
+  rc = qmckl_compute_een_rescaled_e_hpc (context, walk_num,
+                                         elec_num, cord_num,
+                                         rescale_factor_ee,
+                                         &(ee_distance[0]),
+                                         &(ee_distance_rescaled_hpc[0]));
+  assert(rc == QMCKL_SUCCESS);
+
+  for (int64_t i=0 ; i<walk_num*elec_num*elec_num*(cord_num+1) ; i++) {
+    assert(fabs(ee_distance_rescaled_hpc[i] - ee_distance_rescaled_doc[i]) < 1.e-12);
+  }
+}
+
+
+
+
+
+ +
+

3.1.3 Electron-electron rescaled distance gradients and Laplacian with respect to electron coordinates

+
+

+The rescaled distances, represented by \(C_{ij} = (1 - e^{-\kappa_\text{e} r_{ij}})/\kappa_\text{e}\) +are differentiated with respect to the electron coordinates. +This information is stored in the tensor +ee_distance_rescaled_gl. The initial three sequential +elements of this three-dimensional tensor provide the \(x\), \(y\), and \(z\) +direction derivatives, while the fourth index corresponds to the Laplacian. +

+
+ +
+
3.1.3.1 Get
+
+
+
qmckl_exit_code qmckl_get_jastrow_champ_ee_distance_rescaled_gl(qmckl_context context,
+                                                                double* const distance_rescaled_gl,
+                                                                const int64_t size_max);
+
+
+
+
+ +
+
3.1.3.2 Compute
+
+ + + +++ ++ ++ ++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
VariableTypeIn/OutDescription
contextqmckl_contextinGlobal state
elec_numint64_tinNumber of electrons
rescale_factor_eedoubleinFactor to rescale ee distances
walk_numint64_tinNumber of walkers
coorddouble[3][walk_num][elec_num]inElectron coordinates
ee_distance_rescaled_gldouble[walk_num][elec_num][elec_num][4]outElectron-electron rescaled distance derivatives
+ +
+
function qmckl_compute_ee_distance_rescaled_gl_doc(context,  &
+     elec_num, rescale_factor_ee, walk_num, coord, ee_distance_rescaled_gl) &
+     bind(C) result(info)
+  use qmckl
+  implicit none
+
+  integer(qmckl_context), intent(in), value :: context
+  integer (c_int64_t) , intent(in)  , value :: elec_num
+  real    (c_double ) , intent(in)  , value :: rescale_factor_ee
+  integer (c_int64_t) , intent(in)  , value :: walk_num
+  real    (c_double ) , intent(in)          :: coord(elec_num,walk_num,3)
+  real    (c_double ) , intent(out)         :: ee_distance_rescaled_gl(4,elec_num,elec_num,walk_num)
+  integer(qmckl_exit_code)                  :: info
+
+  integer*8 :: k
+
+  info = QMCKL_SUCCESS
+
+  if (context == QMCKL_NULL_CONTEXT) then
+     info = QMCKL_INVALID_CONTEXT
+     return
+  endif
+
+  if (elec_num <= 0) then
+     info = QMCKL_INVALID_ARG_2
+     return
+  endif
+
+  if (walk_num <= 0) then
+     info = QMCKL_INVALID_ARG_3
+     return
+  endif
+
+  do k=1,walk_num
+     info = qmckl_distance_rescaled_gl(context, 'T', 'T', elec_num, elec_num, &
+          coord(1,k,1), elec_num*walk_num, &
+          coord(1,k,1), elec_num*walk_num, &
+          ee_distance_rescaled_gl(1,1,1,k), elec_num, rescale_factor_ee)
+     if (info /= QMCKL_SUCCESS) then
+        exit
+     endif
+  end do
+
+end function qmckl_compute_ee_distance_rescaled_gl_doc
+
+
+
+
+ +
+
3.1.3.3 Test
+
+
+
assert(qmckl_electron_provided(context));
+
+{
+  printf("ee_distance_rescaled_gl\n");
+  double fd[walk_num][elec_num][elec_num][4];
+
+  double delta_x = 0.0001;
+
+  // Finite difference coefficients for gradients
+  double coef[9] = { 1.0/280.0, -4.0/105.0,  1.0/5.0, -4.0/5.0,         0.0, 4.0/5.0, -1.0/5.0, 4.0/105.0, -1.0/280.0 };
+
+  // Finite difference coefficients for Laplacian
+  double coef2[9]= {-1.0/560.0,  8.0/315.0, -1.0/5.0,  8.0/5.0, -205.0/72.0, 8.0/5.0, -1.0/5.0, 8.0/315.0, -1.0/560.0 };
+
+  qmckl_exit_code rc;
+
+  int64_t walk_num;
+  rc = qmckl_get_electron_walk_num(context, &walk_num);
+  if (rc != QMCKL_SUCCESS) {
+    return rc;
+  }
+
+  int64_t elec_num;
+  rc = qmckl_get_electron_num(context, &elec_num);
+  if (rc != QMCKL_SUCCESS) {
+    return rc;
+  }
+
+  double elec_coord[walk_num][elec_num][3];
+  rc = qmckl_get_electron_coord (context, 'N', &(elec_coord[0][0][0]), 3*walk_num*elec_num);
+
+  double temp_coord[walk_num][elec_num][3];
+  memcpy(&(temp_coord[0][0][0]), &(elec_coord[0][0][0]), sizeof(temp_coord));
+
+  double function_values[walk_num][elec_num][elec_num];
+
+  memset(&(fd[0][0][0][0]), 0, sizeof(fd));
+
+  for (int64_t i = 0; i < elec_num; i++) {
+    for (int64_t k = 0; k < 3; k++) {
+      for (int64_t m = -4; m <= 4; m++) {          // Apply finite difference displacement
+
+        for (int64_t nw=0 ; nw<walk_num ; nw++) {
+          temp_coord[nw][i][k] = elec_coord[nw][i][k] + (double) m * delta_x;
+        }
+
+        // Update coordinates in the context
+        rc = qmckl_set_electron_coord (context, 'N', walk_num, &(temp_coord[0][0][0]), walk_num*3*elec_num);
+        assert(rc == QMCKL_SUCCESS);
+
+        // Call the provided function
+        rc = qmckl_get_jastrow_champ_ee_distance_rescaled(context, &(function_values[0][0][0]), elec_num*elec_num*walk_num);
+        assert(rc == QMCKL_SUCCESS);
+
+        // Accumulate derivative using finite-difference coefficients
+        for (int64_t nw=0 ; nw<walk_num ; nw++) {
+          for (int64_t j = 0; j < elec_num; j++) {
+            fd[nw][j][i][k] += coef [m + 4] * function_values[nw][j][i];
+            fd[nw][j][i][3] += coef2[m + 4] * function_values[nw][j][i];
+          }
+        }
+      }
+      for (int64_t nw=0 ; nw<walk_num ; nw++) {
+        temp_coord[nw][i][k] = elec_coord[nw][i][k];
+      }
+    }
+  }
+
+  // Reset coordinates in the context
+  rc = qmckl_set_electron_coord (context, 'N', walk_num, &(elec_coord[0][0][0]), walk_num*3*elec_num);
+  assert(rc == QMCKL_SUCCESS);
+
+  // Normalize by the step size
+  for (int64_t nw=0 ; nw<walk_num ; nw++) {
+    for (int64_t i = 0; i < elec_num; i++) {
+      for (int64_t k = 0; k < 4; k++) {
+        for (int64_t j = 0; j < elec_num; j++) {
+          fd[nw][i][j][k] /= delta_x;
+        }
+      }
+      for (int64_t j = 0; j < elec_num; j++) {
+        fd[nw][i][j][3] /= delta_x;
+      }
+    }
+  }
+
+
+  double ee_distance_rescaled_gl[walk_num][elec_num][elec_num][4];
+  rc = qmckl_check(context,
+                   qmckl_get_jastrow_champ_ee_distance_rescaled_gl(context,
+                                                                   &(ee_distance_rescaled_gl[0][0][0][0]),
+                                                                   walk_num*elec_num*4*elec_num)
+                   );
+
+  assert(rc == QMCKL_SUCCESS);
+
+  for (int nw = 0; nw < walk_num; nw++){
+    for (int i = 0; i < elec_num; i++) {
+      for (int j = 0; j < elec_num; j++) {
+        for (int k = 0; k < 3; k++){
+//        printf("%.10f\t", fd[nw][i][j][k]);
+//        printf("%.10f\n", ee_distance_rescaled_gl[nw][i][j][k]);
+          assert(fabs(fd[nw][i][j][k] - ee_distance_rescaled_gl[nw][i][j][k]) < 1.e-8);
+        }
+        int k=3;
+        if (i != j) {
+//        printf("%.10f\t", fd[nw][i][j][k]);
+//        printf("%.10f\n", ee_distance_rescaled_gl[nw][i][j][k]);
+          assert(fabs(fd[nw][i][j][k] - ee_distance_rescaled_gl[nw][i][j][k]) < 1.e-6);
+        }
+      }
+    }
+  }
+  printf("OK\n");
+
+  printf("ee_distance_rescaled_gl_hpc\n");
+
+  double ee_distance_rescaled_gl_doc[walk_num*elec_num*elec_num*4];
+  rc = qmckl_compute_ee_distance_rescaled_gl_doc (context,
+                                                  elec_num,
+                                                  rescale_factor_ee,
+                                                  walk_num,
+                                                  &(elec_coord[0][0][0]),
+                                                  &(ee_distance_rescaled_gl_doc[0]));
+  assert(rc == QMCKL_SUCCESS);
+
+  double ee_distance_rescaled_gl_hpc[walk_num*elec_num*elec_num*4];
+  rc = qmckl_compute_ee_distance_rescaled_gl_hpc (context,
+                                                  elec_num,
+                                                  rescale_factor_ee,
+                                                  walk_num,
+                                                  &(elec_coord[0][0][0]),
+                                                  &(ee_distance_rescaled_gl_hpc[0]));
+  assert(rc == QMCKL_SUCCESS);
+
+  for (int i = 0; i < walk_num*nucl_num*elec_num*4; i++) {
+    assert(fabs(ee_distance_rescaled_gl_doc[i] - ee_distance_rescaled_gl_hpc[i]) < 1.e-12);
+  }
+}
+
+
+
+
+
+
+
+ +
+

3.1.4 Electron-electron component

+
+

Calculate the electron-electron jastrow component factor_ee using the asymp_jasb component and the electron-electron rescaled distances ee_distance_rescaled. If the spin_independent variable is set to 1, then @@ -1890,9 +2431,9 @@ If the spin_independent variable is set to 1, then

-
-
3.1.2.1 Get
-
+
+
3.1.4.1 Get
+
qmckl_exit_code
 qmckl_get_jastrow_champ_factor_ee(qmckl_context context,
@@ -1903,8 +2444,8 @@ If the spin_independent variable is set to 1, then
 
    -
  1. Fortran interface
    -
    +
  2. Fortran interface
    +
    interface
        integer(qmckl_exit_code) function qmckl_get_jastrow_champ_factor_ee (context, &
    @@ -1924,10 +2465,10 @@ If the spin_independent variable is set to 1, then
     
-
-
3.1.2.2 Compute
-
- +
+
3.1.4.2 Compute
+
+
@@ -2210,31 +2751,74 @@ If the spin_independent variable is set to 1, then -
-
3.1.2.3 Test
-
+
+
3.1.4.3 Test
+
/* Check if Jastrow is properly initialized */
 assert(qmckl_jastrow_champ_provided(context));
 
-double factor_ee[walk_num];
-rc = qmckl_check(context,
-                 qmckl_get_jastrow_champ_factor_ee(context, factor_ee, walk_num)
-                 );
+{
+  printf("factor_ee\n");
+  double factor_ee[walk_num];
+  rc = qmckl_check(context,
+                   qmckl_get_jastrow_champ_factor_ee(context, &(factor_ee[0]), walk_num)
+                   );
 
-// calculate factor_ee
-printf("%e\n%e\n\n",factor_ee[0],-16.83886184243964);
-assert(fabs(factor_ee[0]+16.83886184243964) < 1.e-12);
+  // calculate factor_ee
+  printf("%20.15f\n%20.15f\n",factor_ee[0],-16.83886184243964);
+  assert(fabs(factor_ee[0]+16.83886184243964) < 1.e-12);
 
+  printf("factor_ee_hpc\n");
+  double ee_distance_rescaled[walk_num*elec_num*elec_num];
+  rc = qmckl_get_jastrow_champ_ee_distance_rescaled(context,
+                                                    &(ee_distance_rescaled[0]),
+                                                    walk_num*elec_num*elec_num);
+  assert(rc == QMCKL_SUCCESS);
+
+  int64_t up_num;
+  rc = qmckl_get_electron_up_num(context, &up_num);
+  assert(rc == QMCKL_SUCCESS);
+
+  double factor_ee_doc[walk_num];
+  rc = qmckl_compute_jastrow_champ_factor_ee_doc(context,
+                                                 walk_num,
+                                                 elec_num,
+                                                 up_num,
+                                                 bord_num,
+                                                 b_vector,
+                                                 &(ee_distance_rescaled[0]),
+                                                 &(asymp_jasb[0]),
+                                                 0,
+                                                 &(factor_ee_doc[0]));
+  assert (rc == QMCKL_SUCCESS);
+
+  double factor_ee_hpc[walk_num];
+  rc = qmckl_compute_jastrow_champ_factor_ee_hpc(context,
+                                                 walk_num,
+                                                 elec_num,
+                                                 up_num,
+                                                 bord_num,
+                                                 b_vector,
+                                                 &(ee_distance_rescaled[0]),
+                                                 &(asymp_jasb[0]),
+                                                 0,
+                                                 &(factor_ee_hpc[0]));
+  assert (rc == QMCKL_SUCCESS);
+
+  for (int64_t i = 0; i < walk_num; i++) {
+    assert(fabs(factor_ee_doc[i] - factor_ee_hpc[i]) < 1.e-12);
+  }
+}
 
-
-

3.1.3 Derivative

-
+
+

3.1.5 Derivative

+

The derivative of factor_ee is computed using the ee_distance_rescaled and the electron-electron rescaled distances derivatives @@ -2259,9 +2843,9 @@ directions and the laplacian as the last component.

-
-
3.1.3.1 Get
-
+
+
3.1.5.1 Get
+
qmckl_exit_code
 qmckl_get_jastrow_champ_factor_ee_gl(qmckl_context context,
@@ -2272,8 +2856,8 @@ directions and the laplacian as the last component.
 
    -
  1. Fortran interface
    -
    +
  2. Fortran interface
    +
    interface
        integer(qmckl_exit_code) function qmckl_get_jastrow_champ_factor_ee_gl (context, &
    @@ -2293,10 +2877,10 @@ directions and the laplacian as the last component.
     
-
-
3.1.3.2 Compute
-
-
+
+
3.1.5.2 Compute
+
+
@@ -2368,7 +2952,7 @@ directions and the laplacian as the last component. - + @@ -2668,389 +3252,171 @@ directions and the laplacian as the last component. -
-
3.1.3.3 Test
-
+
+
3.1.5.3 Test
+
/* Check if Jastrow is properly initialized */
 assert(qmckl_jastrow_champ_provided(context));
 
-// calculate factor_ee_gl
-double factor_ee_gl[walk_num][4][elec_num];
-rc = qmckl_get_jastrow_champ_factor_ee_gl(context, &(factor_ee_gl[0][0][0]),walk_num*4*elec_num);
-
-// check factor_ee_gl
-printf("%f  %f\n", factor_ee_gl[0][0][0], -0.39319353942687446);
-assert(fabs(factor_ee_gl[0][0][0]+0.39319353942687446) < 1.e-12);
-
-printf("%f  %f\n", factor_ee_gl[0][1][0], 1.0535615450668214);
-assert(fabs(factor_ee_gl[0][1][0]-1.0535615450668214) < 1.e-12);
-
-printf("%f  %f\n", factor_ee_gl[0][2][0],-0.39098406960784515);
-assert(fabs(factor_ee_gl[0][2][0]+0.39098406960784515) < 1.e-12);
-
-printf("%f  %f\n", factor_ee_gl[0][3][0],2.8650469630854483);
-assert(fabs(factor_ee_gl[0][3][0]-2.8650469630854483) < 1.e-12);
-
-
-
-
-
- -
-

3.1.4 Electron-electron rescaled distances

-
-

-ee_distance_rescaled stores the matrix of the rescaled distances between all -pairs of electrons: -

- -

-\[ - C_{ij} = \frac{ 1 - e^{-\kappa r_{ij}}}{\kappa} - \] -

- -

-where \(r_{ij}\) is the matrix of electron-electron distances. -

-
- -
-
3.1.4.1 Get
-
-
-
qmckl_exit_code qmckl_get_jastrow_champ_ee_distance_rescaled(qmckl_context context, double* const distance_rescaled);
-
-
-
-
- -
-
3.1.4.2 Compute
-
-
ee_distance_rescaled_gldouble[walk_num][4][elec_num][elec_num]double[walk_num][elec_num][elec_num][4] in Electron-electron distances
- - --- -- -- -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
VariableTypeIn/OutDescription
contextqmckl_contextinGlobal state
elec_numint64_tinNumber of electrons
rescale_factor_eedoubleinFactor to rescale ee distances
walk_numint64_tinNumber of walkers
coorddouble[3][walk_num][elec_num]inElectron coordinates
ee_distancedouble[walk_num][elec_num][elec_num]outElectron-electron rescaled distances
- -
-
function qmckl_compute_ee_distance_rescaled_doc(context, &
-     elec_num, rescale_factor_ee, walk_num, &
-     coord, ee_distance_rescaled) &
-     bind(C) result(info)
-  use qmckl
-  implicit none
-
-  integer(qmckl_context), intent(in), value :: context
-  integer (c_int64_t) , intent(in)  , value :: elec_num
-  real    (c_double ) , intent(in)  , value :: rescale_factor_ee
-  integer (c_int64_t) , intent(in)  , value :: walk_num
-  real    (c_double ) , intent(in)          :: coord(elec_num,walk_num,3)
-  real    (c_double ) , intent(out)         :: ee_distance_rescaled(elec_num,elec_num,walk_num)
-  integer(qmckl_exit_code)                  :: info
-
-  integer*8 :: k
-
-  info = QMCKL_SUCCESS
-
-  if (context == QMCKL_NULL_CONTEXT) then
-     info = QMCKL_INVALID_CONTEXT
-     return
-  endif
-
-  if (elec_num <= 0) then
-     info = QMCKL_INVALID_ARG_2
-     return
-  endif
-
-  if (walk_num <= 0) then
-     info = QMCKL_INVALID_ARG_3
-     return
-  endif
-
-  do k=1,walk_num
-     info = qmckl_distance_rescaled(context, 'T', 'T', elec_num, elec_num, &
-          coord(1,k,1), elec_num * walk_num, &
-          coord(1,k,1), elec_num * walk_num, &
-          ee_distance_rescaled(1,1,k), elec_num, rescale_factor_ee)
-     if (info /= QMCKL_SUCCESS) then
-        exit
-     endif
-  end do
-
-end function qmckl_compute_ee_distance_rescaled_doc
-
-
-
-
- -
-
3.1.4.3 Test
-
-
-
assert(qmckl_electron_provided(context));
-
-
-double ee_distance_rescaled[walk_num * elec_num * elec_num];
-rc = qmckl_get_jastrow_champ_ee_distance_rescaled(context, ee_distance_rescaled);
-
-// (e1,e2,w)
-// (0,0,0) == 0.
-assert(ee_distance_rescaled[0] == 0.);
-
-// (1,0,0) == (0,1,0)
-assert(ee_distance_rescaled[1] == ee_distance_rescaled[elec_num]);
-
-// value of (1,0,0)
-assert(fabs(ee_distance_rescaled[1]-0.6347507420688708) < 1.e-12);
-
-// (0,0,1) == 0.
-assert(ee_distance_rescaled[5*elec_num + 5] == 0.);
-
-// (1,0,1) == (0,1,1)
-assert(ee_distance_rescaled[5*elec_num+6] == ee_distance_rescaled[6*elec_num+5]);
-
-// value of (1,0,1)
-assert(fabs(ee_distance_rescaled[5*elec_num+6]-0.3941735387855409) < 1.e-12);
-
-
-
-
-
-
- -
-

3.1.5 Electron-electron rescaled distance gradients and Laplacian with respect to electron coordinates

-
-

-The rescaled distances, represented by \(C_{ij} = (1 - e^{-\kappa_\text{e} r_{ij}})/\kappa_\text{e}\) -are differentiated with respect to the electron coordinates. -This information is stored in the tensor -ee_distance_rescaled_gl. The initial three sequential -elements of this three-dimensional tensor provide the \(x\), \(y\), and \(z\) -direction derivatives, while the fourth index corresponds to the Laplacian. -

-
- -
-
3.1.5.1 Get
-
-
-
qmckl_exit_code qmckl_get_jastrow_champ_ee_distance_rescaled_gl(qmckl_context context, double* const distance_rescaled_gl);
-
-
-
-
- -
-
3.1.5.2 Compute
-
- - - --- -- -- -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
VariableTypeIn/OutDescription
contextqmckl_contextinGlobal state
elec_numint64_tinNumber of electrons
rescale_factor_eedoubleinFactor to rescale ee distances
walk_numint64_tinNumber of walkers
coorddouble[3][walk_num][elec_num]inElectron coordinates
ee_distance_rescaled_gldouble[walk_num][elec_num][elec_num][4]outElectron-electron rescaled distance derivatives
- -
-
function qmckl_compute_ee_distance_rescaled_gl_doc(context,  &
-     elec_num, rescale_factor_ee, walk_num, coord, ee_distance_rescaled_gl) &
-     bind(C) result(info)
-  use qmckl
-  implicit none
-
-  integer(qmckl_context), intent(in), value :: context
-  integer (c_int64_t) , intent(in)  , value :: elec_num
-  real    (c_double ) , intent(in)  , value :: rescale_factor_ee
-  integer (c_int64_t) , intent(in)  , value :: walk_num
-  real    (c_double ) , intent(in)          :: coord(elec_num,walk_num,3)
-  real    (c_double ) , intent(out)         :: ee_distance_rescaled_gl(4,elec_num,elec_num,walk_num)
-  integer(qmckl_exit_code)                  :: info
-
-  integer*8 :: k
-
-  info = QMCKL_SUCCESS
-
-  if (context == QMCKL_NULL_CONTEXT) then
-     info = QMCKL_INVALID_CONTEXT
-     return
-  endif
-
-  if (elec_num <= 0) then
-     info = QMCKL_INVALID_ARG_2
-     return
-  endif
-
-  if (walk_num <= 0) then
-     info = QMCKL_INVALID_ARG_3
-     return
-  endif
-
-  do k=1,walk_num
-     info = qmckl_distance_rescaled_gl(context, 'T', 'T', elec_num, elec_num, &
-          coord(1,k,1), elec_num*walk_num, &
-          coord(1,k,1), elec_num*walk_num, &
-          ee_distance_rescaled_gl(1,1,1,k), elec_num, rescale_factor_ee)
-     if (info /= QMCKL_SUCCESS) then
-        exit
-     endif
-  end do
-
-end function qmckl_compute_ee_distance_rescaled_gl_doc
-
-
-
-
- -
-
3.1.5.3 Test
-
-
-
assert(qmckl_electron_provided(context));
-
-
-double ee_distance_rescaled_gl[4 * walk_num * elec_num * elec_num];
-rc = qmckl_get_jastrow_champ_ee_distance_rescaled_gl(context, ee_distance_rescaled_gl);
-
-// TODO: Get exact values
-//// (e1,e2,w)
-//// (0,0,0) == 0.
-//assert(ee_distance[0] == 0.);
-//
-//// (1,0,0) == (0,1,0)
-//assert(ee_distance[1] == ee_distance[elec_num]);
-//
-//// value of (1,0,0)
-//assert(fabs(ee_distance[1]-7.152322512964209) < 1.e-12);
-//
-//// (0,0,1) == 0.
-//assert(ee_distance[elec_num*elec_num] == 0.);
-//
-//// (1,0,1) == (0,1,1)
-//assert(ee_distance[elec_num*elec_num+1] == ee_distance[elec_num*elec_num+elec_num]);
-//
-//// value of (1,0,1)
-//assert(fabs(ee_distance[elec_num*elec_num+1]-6.5517646321055665) < 1.e-12);
-
+//----
+{
+  printf("factor_ee_gl\n");
+  double fd[walk_num][4][elec_num];
+  double delta_x = 0.0001;
+
+  // Finite difference coefficients for gradients
+  double coef[9] = { 1.0/280.0, -4.0/105.0,  1.0/5.0, -4.0/5.0,         0.0, 4.0/5.0, -1.0/5.0, 4.0/105.0, -1.0/280.0 };
+
+  // Finite difference coefficients for Laplacian
+  double coef2[9]= {-1.0/560.0,  8.0/315.0, -1.0/5.0,  8.0/5.0, -205.0/72.0, 8.0/5.0, -1.0/5.0, 8.0/315.0, -1.0/560.0 };
+
+  qmckl_exit_code rc;
+
+  int64_t walk_num;
+  rc = qmckl_get_electron_walk_num(context, &walk_num);
+  if (rc != QMCKL_SUCCESS) {
+    return rc;
+  }
+
+  int64_t elec_num;
+  rc = qmckl_get_electron_num(context, &elec_num);
+  if (rc != QMCKL_SUCCESS) {
+    return rc;
+  }
+
+  double elec_coord[walk_num][elec_num][3];
+  rc = qmckl_get_electron_coord (context, 'N', &(elec_coord[0][0][0]), 3*walk_num*elec_num);
+
+  double temp_coord[walk_num][elec_num][3];
+  memcpy(&(temp_coord[0][0][0]), &(elec_coord[0][0][0]), sizeof(temp_coord));
+
+  double function_values[walk_num];
+
+  memset(&(fd[0][0][0]), 0, sizeof(fd));
+
+  for (int64_t i = 0; i < elec_num; i++) {
+    for (int64_t k = 0; k < 3; k++) {
+      for (int64_t m = -4; m <= 4; m++) {          // Apply finite difference displacement
+
+        for (int64_t nw=0 ; nw<walk_num ; nw++) {
+          temp_coord[nw][i][k] = elec_coord[nw][i][k] + (double) m * delta_x;
+        }
+
+        // Update coordinates in the context
+        rc = qmckl_set_electron_coord (context, 'N', walk_num, &(temp_coord[0][0][0]), walk_num*3*elec_num);
+        assert(rc == QMCKL_SUCCESS);
+
+        // Call the provided function
+        rc = qmckl_get_jastrow_champ_factor_ee(context, &(function_values[0]), walk_num);
+        assert(rc == QMCKL_SUCCESS);
+
+        // Accumulate derivative using finite-difference coefficients
+        for (int64_t nw=0 ; nw<walk_num ; nw++) {
+          fd[nw][k][i] += coef [m + 4] * function_values[nw];
+          fd[nw][3][i] += coef2[m + 4] * function_values[nw];
+        }
+      }
+      for (int64_t nw=0 ; nw<walk_num ; nw++) {
+        temp_coord[nw][i][k] = elec_coord[nw][i][k];
+      }
+    }
+  }
+
+  // Reset coordinates in the context
+  rc = qmckl_set_electron_coord (context, 'N', walk_num, &(elec_coord[0][0][0]), walk_num*3*elec_num);
+  assert(rc == QMCKL_SUCCESS);
+
+  // Normalize by the step size
+  for (int64_t nw=0 ; nw<walk_num ; nw++) {
+    for (int64_t k = 0; k < 4; k++) {
+      for (int64_t i = 0; i < elec_num; i++) {
+          fd[nw][k][i] /= delta_x;
+      }
+    }
+    for (int64_t i = 0; i < elec_num; i++) {
+      fd[nw][3][i] /= delta_x;
+    }
+  }
+
+
+  double factor_ee_gl[walk_num][4][elec_num];
+  rc = qmckl_check(context,
+                   qmckl_get_jastrow_champ_factor_ee_gl(context,
+                                                        &(factor_ee_gl[0][0][0]),
+                                                        walk_num*4*elec_num)
+                   );
+
+  assert(rc == QMCKL_SUCCESS);
+
+  for (int nw = 0; nw < walk_num; nw++){
+    for (int i = 0; i < elec_num; i++) {
+      for (int k = 0; k < 3; k++){
+        printf("%.10f\t", fd[nw][k][i]);
+        printf("%.10f\n", factor_ee_gl[nw][k][i]);
+        assert(fabs(fd[nw][k][i] - factor_ee_gl[nw][k][i]) < 1.e-8);
+      }
+      int k=3;
+      printf("%.10f\t", fd[nw][k][i]);
+      printf("%.10f\n", factor_ee_gl[nw][k][i]);
+      assert(fabs(fd[nw][k][i] - factor_ee_gl[nw][k][i]) < 2.e-5);
+    }
+  }
+  printf("OK\n");
+}
+{
+  printf("factor_ee_gl_hpc\n");
+  int64_t up_num;
+  rc = qmckl_get_electron_up_num(context, &up_num);
+  assert(rc == QMCKL_SUCCESS);
+
+  double ee_distance_rescaled[walk_num*elec_num*elec_num];
+  rc = qmckl_get_jastrow_champ_ee_distance_rescaled(context,
+                                                    &(ee_distance_rescaled[0]),
+                                                    walk_num*elec_num*elec_num);
+  assert(rc == QMCKL_SUCCESS);
+
+  double ee_distance_rescaled_gl[4*walk_num*elec_num*elec_num];
+  rc = qmckl_get_jastrow_champ_ee_distance_rescaled_gl(context,
+                                                      &(ee_distance_rescaled_gl[0]),
+                                                      4*walk_num*elec_num*elec_num);
+  assert(rc == QMCKL_SUCCESS);
+
+  double factor_ee_gl_doc[walk_num*4*elec_num];
+  memset(&(factor_ee_gl_doc[0]), 0, sizeof(factor_ee_gl_doc));
+
+  rc = qmckl_compute_jastrow_champ_factor_ee_gl_doc(context,
+                                                    walk_num,
+                                                    elec_num,
+                                                    up_num,
+                                                    bord_num,
+                                                    b_vector,
+                                                    &(ee_distance_rescaled[0]),
+                                                    &(ee_distance_rescaled_gl[0]),
+                                                    0,
+                                                    &(factor_ee_gl_doc[0]));
+  assert(rc == QMCKL_SUCCESS);
+
+  double factor_ee_gl_hpc[walk_num*4*elec_num];
+  memset(&(factor_ee_gl_hpc[0]), 0, sizeof(factor_ee_gl_hpc));
+
+  rc = qmckl_compute_jastrow_champ_factor_ee_gl_hpc(context,
+                                                    walk_num,
+                                                    elec_num,
+                                                    up_num,
+                                                    bord_num,
+                                                    b_vector,
+                                                    &(ee_distance_rescaled[0]),
+                                                    &(ee_distance_rescaled_gl[0]),
+                                                    0,
+                                                    &(factor_ee_gl_hpc[0]));
+  assert(rc == QMCKL_SUCCESS);
+
+  for (int64_t i = 0 ; i < walk_num*4*elec_num ; i++) {
+    printf("%ld %f %f\n", i, factor_ee_gl_hpc[i], factor_ee_gl_doc[i]);
+    assert(fabs(factor_ee_gl_hpc[i] - factor_ee_gl_doc[i]) < 1.e-12);
+  }
+}
 
@@ -3058,12 +3424,12 @@ rc = qmckl_get_jastrow_champ_ee_distance_rescaled_gl(context, ee_distance_rescal
-
-

3.2 Electron-nucleus component

+
+

3.2 Electron-nucleus component

-
-

3.2.1 Asymptotic component for

+
+

3.2.1 Asymptotic component for

Calculate the asymptotic component asymp_jasa to be subtracted from the final @@ -3078,8 +3444,8 @@ via the a_vector and the electron-nucleus rescale factors res

-
-
3.2.1.1 Get
+
+
3.2.1.1 Get
qmckl_exit_code
@@ -3091,7 +3457,7 @@ via the a_vector and the electron-nucleus rescale factors res
 
    -
  1. Fortran interface
    +
  2. Fortran interface
    interface
    @@ -3112,10 +3478,10 @@ via the a_vector and the electron-nucleus rescale factors res
     
-
-
3.2.1.2 Compute
+
+
3.2.1.2 Compute
- +
@@ -3239,8 +3605,8 @@ via the a_vector and the electron-nucleus rescale factors res -
-
3.2.1.3 Test
+
+
3.2.1.3 Test

double asympjasa[2]; @@ -3260,10 +3626,592 @@ assert(fabs(-1.75529774 - asympjasa[0]) < 1.e-8);

-
-

3.2.2 Electron-nucleus component

+
+

3.2.2 Electron-nucleus rescaled distances

+en_distance_rescaled stores the matrix of the rescaled distances between +electrons and nuclei. +

+ +

+\[ + C_{i\alpha} = \frac{ 1 - e^{-\kappa_\alpha R_{i\alpha}}}{\kappa_\alpha} + \] +

+ +

+where \(R_{i\alpha}\) is the matrix of electron-nucleus distances. +

+
+ +
+
3.2.2.1 Get
+
+
+
qmckl_exit_code
+qmckl_get_jastrow_champ_en_distance_rescaled(qmckl_context context,
+                                             double* const distance_rescaled,
+                                             const int64_t size_max);
+
+
+
+
+ + +
+
3.2.2.2 Compute
+
+
+ + +++ ++ ++ ++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
VariableTypeIn/OutDescription
contextqmckl_contextinGlobal state
elec_numint64_tinNumber of electrons
nucl_numint64_tinNumber of nuclei
type_nucl_numint64_tinNumber of types of nuclei
type_nucl_vectorint64_t[nucl_num]inNumber of types of nuclei
rescale_factor_endouble[type_nucl_num]inThe factor for rescaled distances
walk_numint64_tinNumber of walkers
elec_coorddouble[3][walk_num][elec_num]inElectron coordinates
nucl_coorddouble[3][elec_num]inNuclear coordinates
en_distance_rescaleddouble[walk_num][nucl_num][elec_num]outElectron-nucleus distances
+ +
+
function qmckl_compute_en_distance_rescaled_doc(context, &
+     elec_num, nucl_num, type_nucl_num, &
+     type_nucl_vector, rescale_factor_en, walk_num, elec_coord, &
+     nucl_coord, en_distance_rescaled) &
+     bind(C) result(info)
+  use qmckl
+  implicit none
+  integer (qmckl_context), intent(in), value :: context
+  integer (c_int64_t) , intent(in)  , value :: elec_num
+  integer (c_int64_t) , intent(in)  , value :: nucl_num
+  integer (c_int64_t) , intent(in)  , value :: type_nucl_num
+  integer (c_int64_t) , intent(in)          :: type_nucl_vector(nucl_num)
+  real    (c_double ) , intent(in)          :: rescale_factor_en(type_nucl_num)
+  integer (c_int64_t) , intent(in)  , value :: walk_num
+  real    (c_double ) , intent(in)          :: elec_coord(elec_num,walk_num,3)
+  real    (c_double ) , intent(in)          :: nucl_coord(nucl_num,3)
+  real    (c_double ) , intent(out)         :: en_distance_rescaled(elec_num,nucl_num,walk_num)
+  integer(qmckl_exit_code)                   :: info
+
+  integer*8 :: i, k
+  double precision      :: coord(3)
+
+  info = QMCKL_SUCCESS
+
+  if (context == QMCKL_NULL_CONTEXT) then
+     info = QMCKL_INVALID_CONTEXT
+     return
+  endif
+
+  if (elec_num <= 0) then
+     info = QMCKL_INVALID_ARG_2
+     return
+  endif
+
+  if (nucl_num <= 0) then
+     info = QMCKL_INVALID_ARG_3
+     return
+  endif
+
+  if (walk_num <= 0) then
+     info = QMCKL_INVALID_ARG_5
+     return
+  endif
+
+  do i=1, nucl_num
+     coord(1:3) = nucl_coord(i,1:3)
+     do k=1,walk_num
+        info = qmckl_distance_rescaled(context, 'T', 'N', elec_num, 1_8, &
+             elec_coord(1,k,1), elec_num*walk_num, coord, 3_8, &
+             en_distance_rescaled(1,i,k), elec_num, rescale_factor_en(type_nucl_vector(i)+1))
+        if (info /= QMCKL_SUCCESS) then
+           return
+        endif
+     end do
+  end do
+
+end function qmckl_compute_en_distance_rescaled_doc
+
+
+
+
+ +
+
3.2.2.3 Test
+
+
+
{
+assert(qmckl_electron_provided(context));
+assert(qmckl_nucleus_provided(context));
+
+double en_distance_rescaled[walk_num][nucl_num][elec_num];
+
+rc = qmckl_check(context,
+                 qmckl_get_jastrow_champ_en_distance_rescaled(context,
+                                                              &(en_distance_rescaled[0][0][0]),
+                                                              walk_num*nucl_num*elec_num)
+                 );
+assert (rc == QMCKL_SUCCESS);
+
+// (e,n,w) in Fortran notation
+// (1,1,1)
+assert(fabs(en_distance_rescaled[0][0][0] - 0.4942158656729477) < 1.e-12);
+// (1,2,1)
+assert(fabs(en_distance_rescaled[0][1][0] - 1.2464137498005765) < 1.e-12);
+// (2,1,1)
+assert(fabs(en_distance_rescaled[0][0][1] - 0.5248654474756858) < 1.e-12);
+// (1,1,2)
+assert(fabs(en_distance_rescaled[0][0][5] - 0.19529459944794733) < 1.e-12);
+// (1,2,2)
+assert(fabs(en_distance_rescaled[0][1][5] - 1.2091967687767369) < 1.e-12);
+// (2,1,2)
+assert(fabs(en_distance_rescaled[0][0][6] - 0.4726452953409436) < 1.e-12);
+
+}
+
+{
+  printf("en_distance_rescaled_hpc\n");
+
+  double en_distance_rescaled_doc[walk_num*nucl_num*elec_num];
+  memset(&(en_distance_rescaled_doc[0]), 0, walk_num*nucl_num*elec_num*sizeof(double));
+  rc = qmckl_compute_en_distance_rescaled_doc(context, elec_num, nucl_num, type_nucl_num,
+                                              type_nucl_vector, rescale_factor_en, walk_num,
+                                              elec_coord, nucl_coord, en_distance_rescaled_doc);
+  assert(rc == QMCKL_SUCCESS);
+
+  double en_distance_rescaled_hpc[walk_num*nucl_num*elec_num];
+  memset(&(en_distance_rescaled_hpc[0]), 0, walk_num*nucl_num*elec_num*sizeof(double));
+  rc = qmckl_compute_en_distance_rescaled_hpc(context, elec_num, nucl_num, type_nucl_num,
+                                              type_nucl_vector, rescale_factor_en, walk_num,
+                                              elec_coord, nucl_coord, en_distance_rescaled_hpc);
+  assert(rc == QMCKL_SUCCESS);
+
+  for (int64_t i=0 ; i<walk_num*nucl_num*elec_num ; ++i) {
+    assert(fabs(en_distance_rescaled_doc[i] - en_distance_rescaled_hpc[i]) < 1.e-12);
+  }
+}
+
+
+
+
+
+ +
+

3.2.3 Electron-electron rescaled distance gradients and Laplacian with respect to electron coordinates

+
+

+The rescaled distances, represented by \(C_{i\alpha} = (1 - e^{-\kappa_\alpha R_{i\alpha}})/\kappa\) +are differentiated with respect to the electron coordinates. +This information is stored in the tensor +en_distance_rescaled_gl. The initial three sequential +elements of this three-index tensor provide the \(x\), \(y\), and \(z\) +direction derivatives, while the fourth index corresponds to the Laplacian. +

+
+ +
+
3.2.3.1 Get
+
+
+
qmckl_exit_code
+qmckl_get_jastrow_champ_en_distance_rescaled_gl(qmckl_context context,
+                                                double* const distance_rescaled_gl,
+                                                const int64_t size_max);
+
+
+
+
+ +
+
3.2.3.2 Compute
+
+ + + +++ ++ ++ ++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
VariableTypeIn/OutDescription
contextqmckl_contextinGlobal state
elec_numint64_tinNumber of electrons
nucl_numint64_tinNumber of nuclei
type_nucl_numint64_tinNumber of nucleus types
type_nucl_vectorint64_t[nucl_num]inArray of nucleus types
rescale_factor_endouble[nucl_num]inThe factors for rescaled distances
walk_numint64_tinNumber of walkers
elec_coorddouble[3][walk_num][elec_num]inElectron coordinates
nucl_coorddouble[3][elec_num]inNuclear coordinates
en_distance_rescaled_gldouble[walk_num][nucl_num][elec_num][4]outElectron-nucleus distance derivatives
+ +
+
integer function qmckl_compute_en_distance_rescaled_gl_doc_f(context, elec_num, nucl_num, &
+     type_nucl_num, type_nucl_vector, rescale_factor_en, walk_num, elec_coord, &
+     nucl_coord, en_distance_rescaled_gl) &
+     result(info)
+  use qmckl
+  implicit none
+  integer(qmckl_context), intent(in)  :: context
+  integer*8             , intent(in)  :: elec_num
+  integer*8             , intent(in)  :: nucl_num
+  integer*8             , intent(in)  :: type_nucl_num
+  integer*8             , intent(in)  :: type_nucl_vector(nucl_num)
+  double precision      , intent(in)  :: rescale_factor_en(nucl_num)
+  integer*8             , intent(in)  :: walk_num
+  double precision      , intent(in)  :: elec_coord(elec_num,walk_num,3)
+  double precision      , intent(in)  :: nucl_coord(nucl_num,3)
+  double precision      , intent(out) :: en_distance_rescaled_gl(4,elec_num,nucl_num,walk_num)
+
+  integer*8 :: i, k
+  double precision :: coord(3)
+
+  info = QMCKL_SUCCESS
+
+  if (context == QMCKL_NULL_CONTEXT) then
+     info = QMCKL_INVALID_CONTEXT
+     return
+  endif
+
+  if (elec_num <= 0) then
+     info = QMCKL_INVALID_ARG_2
+     return
+  endif
+
+  if (nucl_num <= 0) then
+     info = QMCKL_INVALID_ARG_3
+     return
+  endif
+
+  if (walk_num <= 0) then
+     info = QMCKL_INVALID_ARG_5
+     return
+  endif
+
+  do i=1, nucl_num
+     coord(1:3) = nucl_coord(i,1:3)
+     do k=1,walk_num
+        info = qmckl_distance_rescaled_gl(context, 'T', 'T', elec_num, 1_8, &
+             elec_coord(1,k,1), elec_num*walk_num, coord, 1_8, &
+             en_distance_rescaled_gl(1,1,i,k), elec_num, rescale_factor_en(type_nucl_vector(i)+1))
+        if (info /= QMCKL_SUCCESS) then
+           return
+        endif
+     end do
+  end do
+
+end function qmckl_compute_en_distance_rescaled_gl_doc_f
+
+
+
+
+ +
+
3.2.3.3 Test
+
+
+
assert(qmckl_electron_provided(context));
+
+{
+  printf("en_distance_rescaled_gl\n");
+  double fd[walk_num][nucl_num][elec_num][4];
+
+  double delta_x = 0.0001;
+
+  // Finite difference coefficients for gradients
+  double coef[9] = { 1.0/280.0, -4.0/105.0,  1.0/5.0, -4.0/5.0,         0.0, 4.0/5.0, -1.0/5.0, 4.0/105.0, -1.0/280.0 };
+
+  // Finite difference coefficients for Laplacian
+  double coef2[9]= {-1.0/560.0,  8.0/315.0, -1.0/5.0,  8.0/5.0, -205.0/72.0, 8.0/5.0, -1.0/5.0, 8.0/315.0, -1.0/560.0 };
+
+  qmckl_exit_code rc;
+
+  int64_t walk_num;
+  rc = qmckl_get_electron_walk_num(context, &walk_num);
+  if (rc != QMCKL_SUCCESS) {
+    return rc;
+  }
+
+  int64_t elec_num;
+  rc = qmckl_get_electron_num(context, &elec_num);
+  if (rc != QMCKL_SUCCESS) {
+    return rc;
+  }
+
+  double elec_coord[walk_num][elec_num][3];
+  rc = qmckl_get_electron_coord (context, 'N', &(elec_coord[0][0][0]), 3*walk_num*elec_num);
+
+  double temp_coord[walk_num][elec_num][3];
+  memcpy(&(temp_coord[0][0][0]), &(elec_coord[0][0][0]), sizeof(temp_coord));
+
+  double function_values[walk_num][nucl_num][elec_num];
+
+  memset(&(fd[0][0][0][0]), 0, sizeof(fd));
+
+  for (int64_t i = 0; i < elec_num; i++) {
+    for (int64_t k = 0; k < 3; k++) {
+      for (int64_t m = -4; m <= 4; m++) {          // Apply finite difference displacement
+
+        for (int64_t nw=0 ; nw<walk_num ; nw++) {
+          temp_coord[nw][i][k] = elec_coord[nw][i][k] + (double) m * delta_x;
+        }
+
+        // Update coordinates in the context
+        rc = qmckl_set_electron_coord (context, 'N', walk_num, &(temp_coord[0][0][0]), walk_num*3*elec_num);
+        assert(rc == QMCKL_SUCCESS);
+
+        // Call the provided function
+        rc = qmckl_get_jastrow_champ_en_distance_rescaled(context, &(function_values[0][0][0]), nucl_num*elec_num*walk_num);
+        assert(rc == QMCKL_SUCCESS);
+
+        // Accumulate derivative using finite-difference coefficients
+        for (int64_t nw=0 ; nw<walk_num ; nw++) {
+          for (int64_t j = 0; j < nucl_num; j++) {
+            fd[nw][j][i][k] += coef [m + 4] * function_values[nw][j][i];
+            fd[nw][j][i][3] += coef2[m + 4] * function_values[nw][j][i];
+          }
+        }
+      }
+      for (int64_t nw=0 ; nw<walk_num ; nw++) {
+        temp_coord[nw][i][k] = elec_coord[nw][i][k];
+      }
+    }
+  }
+
+  // Reset coordinates in the context
+  rc = qmckl_set_electron_coord (context, 'N', walk_num, &(elec_coord[0][0][0]), walk_num*3*elec_num);
+  assert(rc == QMCKL_SUCCESS);
+
+  // Normalize by the step size
+  for (int64_t nw=0 ; nw<walk_num ; nw++) {
+    for (int64_t i = 0; i < nucl_num; i++) {
+      for (int64_t k = 0; k < 4; k++) {
+        for (int64_t j = 0; j < elec_num; j++) {
+          fd[nw][i][j][k] /= delta_x;
+        }
+      }
+      for (int64_t j = 0; j < elec_num; j++) {
+        fd[nw][i][j][3] /= delta_x;
+      }
+    }
+  }
+
+
+  double en_distance_rescaled_gl[walk_num][nucl_num][elec_num][4];
+  rc = qmckl_check(context,
+                   qmckl_get_jastrow_champ_en_distance_rescaled_gl(context,
+                                                                   &(en_distance_rescaled_gl[0][0][0][0]),
+                                                                   walk_num*nucl_num*4*elec_num)
+                   );
+
+  assert(rc == QMCKL_SUCCESS);
+
+  for (int nw = 0; nw < walk_num; nw++){
+    for (int i = 0; i < nucl_num; i++) {
+      for (int j = 0; j < elec_num; j++) {
+        for (int k = 0; k < 3; k++){
+          printf("%.10f\t", fd[nw][i][j][k]);
+          printf("%.10f\n", en_distance_rescaled_gl[nw][i][j][k]);
+          assert(fabs(fd[nw][i][j][k] - en_distance_rescaled_gl[nw][i][j][k]) < 1.e-8);
+        }
+        int k=3;
+        if (i != j) {
+          printf("%.10f\t", fd[nw][i][j][k]);
+          printf("%.10f\n", en_distance_rescaled_gl[nw][i][j][k]);
+          assert(fabs(fd[nw][i][j][k] - en_distance_rescaled_gl[nw][i][j][k]) < 1.e-6);
+        }
+      }
+    }
+  }
+  printf("OK\n");
+}
+
+{
+  printf("en_distance_rescaled_gl_hpc\n");
+
+  double en_distance_rescaled_gl_doc[walk_num*nucl_num*elec_num*4];
+  rc = qmckl_compute_en_distance_rescaled_gl_doc (context,
+          elec_num, nucl_num, type_nucl_num, type_nucl_vector, rescale_factor_en,
+          walk_num, elec_coord, nucl_coord,
+          &(en_distance_rescaled_gl_doc[0]));
+  assert(rc == QMCKL_SUCCESS);
+
+  double en_distance_rescaled_gl_hpc[walk_num*nucl_num*elec_num*4];
+  rc = qmckl_compute_en_distance_rescaled_gl_hpc (context,
+          elec_num, nucl_num, type_nucl_num, type_nucl_vector, rescale_factor_en,
+          walk_num, elec_coord, nucl_coord,
+          &(en_distance_rescaled_gl_hpc[0]));
+  assert(rc == QMCKL_SUCCESS);
+
+  for (int i = 0; i < walk_num*nucl_num*elec_num*4; i++) {
+    assert(fabs(en_distance_rescaled_gl_doc[i] - en_distance_rescaled_gl_hpc[i]) < 1.e-12);
+  }
+}
+
+
+
+
+
+ +
+

3.2.4 Electron-nucleus component

+
+

Calculate the electron-electron jastrow component factor_en using the a_vector coeffecients and the electron-nucleus rescaled distances en_distance_rescaled.

@@ -3276,9 +4224,9 @@ coeffecients and the electron-nucleus rescaled distances en_distance_resca
-
-
3.2.2.1 Get
-
+
+
3.2.4.1 Get
+
qmckl_exit_code
 qmckl_get_jastrow_champ_factor_en(qmckl_context context,
@@ -3289,8 +4237,8 @@ coeffecients and the electron-nucleus rescaled distances en_distance_resca
 
    -
  1. Fortran interface
    -
    +
  2. Fortran interface
    +
    interface
        integer(qmckl_exit_code) function qmckl_get_jastrow_champ_factor_en (context, &
    @@ -3310,10 +4258,10 @@ coeffecients and the electron-nucleus rescaled distances en_distance_resca
     
-
-
3.2.2.2 Compute
-
- +
+
3.2.4.2 Compute
+
+
@@ -3537,9 +4485,9 @@ coeffecients and the electron-nucleus rescaled distances en_distance_resca -
-
3.2.2.3 Test
-
+
+
3.2.4.3 Test
+
/* Check if Jastrow is properly initialized */
 assert(qmckl_jastrow_champ_provided(context));
@@ -3551,15 +4499,46 @@ rc = qmckl_get_jastrow_champ_factor_en(context, factor_en,walk_num);
 printf("%f %f\n", factor_en[0], 22.781375792083587);
 assert(fabs(22.781375792083587 - factor_en[0]) < 1.e-12);
 
+{
+  printf("factor_en_hpc\n");
+  double asymp_jasa[type_nucl_num];
+  rc = qmckl_get_jastrow_champ_asymp_jasa(context, asymp_jasa, type_nucl_num);
+  assert(rc == QMCKL_SUCCESS);
+
+  double en_distance_rescaled[walk_num*nucl_num*elec_num];
+  rc = qmckl_get_jastrow_champ_en_distance_rescaled(context,
+                                                    en_distance_rescaled,
+                                                    walk_num*nucl_num*elec_num);
+  assert(rc == QMCKL_SUCCESS);
+
+  double factor_en_doc[walk_num];
+  memset(&(factor_en_doc[0]), 0, sizeof(factor_en_doc));
+  rc = qmckl_compute_jastrow_champ_factor_en_doc (context,
+          walk_num, elec_num, nucl_num, type_nucl_num, type_nucl_vector,
+          aord_num, a_vector,
+          en_distance_rescaled, asymp_jasa, factor_en_doc);
+  assert(rc == QMCKL_SUCCESS);
+
+  double factor_en_hpc[walk_num];
+  rc = qmckl_compute_jastrow_champ_factor_en_hpc (context,
+          walk_num, elec_num, nucl_num, type_nucl_num, type_nucl_vector,
+          aord_num, a_vector,
+          en_distance_rescaled, asymp_jasa, factor_en_hpc);
+  assert(rc == QMCKL_SUCCESS);
+
+  for (int64_t i = 0; i < walk_num; i++) {
+    assert(fabs(factor_en_doc[i] - factor_en_hpc[i]) < 1.e-12);
+  }
+}
 
-
-

3.2.3 Derivative

-
+
+

3.2.5 Derivative

+

Calculate the electron-electron jastrow component factor_en_gl derivative with respect to the electron coordinates using the en_distance_rescaled and @@ -3571,9 +4550,9 @@ TODO: write equations.

-
-
3.2.3.1 Get
-
+
+
3.2.5.1 Get
+
qmckl_exit_code
 qmckl_get_jastrow_champ_factor_en_gl(qmckl_context context,
@@ -3584,8 +4563,8 @@ TODO: write equations.
 
    -
  1. Fortran interface
    -
    +
  2. Fortran interface
    +
    interface
        integer(qmckl_exit_code) function qmckl_get_jastrow_champ_factor_en_gl (context, &
    @@ -3605,10 +4584,10 @@ TODO: write equations.
     
-
-
3.2.3.2 Compute
-
-
+
+
3.2.5.2 Compute
+
+
@@ -3814,470 +4793,151 @@ TODO: write equations. -
-
3.2.3.3 Test
-
+
+
3.2.5.3 Test
+
/* Check if Jastrow is properly initialized */
 assert(qmckl_jastrow_champ_provided(context));
 
-// calculate factor_en_gl
-double factor_en_gl[walk_num][4][elec_num];
-rc = qmckl_get_jastrow_champ_factor_en_gl(context, &(factor_en_gl[0][0][0]),walk_num*4*elec_num);
-
-// check factor_en_gl
-assert(fabs( 0.19656663796630847 - factor_en_gl[0][0][0]) < 1.e-12);
-assert(fabs( -0.3945140890522283 - factor_en_gl[0][1][0]) < 1.e-12);
-assert(fabs( 0.5082964671286118  - factor_en_gl[0][2][0]) < 1.e-12);
-assert(fabs( -1.8409460670666289 - factor_en_gl[0][3][0]) < 1.e-12);
-
-
-
-
-
-
- -
-

3.2.4 Electron-nucleus rescaled distances

-
-

-en_distance_rescaled stores the matrix of the rescaled distances between -electrons and nuclei. -

- -

-\[ - C_{i\alpha} = \frac{ 1 - e^{-\kappa_\alpha R_{i\alpha}}}{\kappa_\alpha} - \] -

- -

-where \(R_{i\alpha}\) is the matrix of electron-nucleus distances. -

-
- -
-
3.2.4.1 Get
-
-
-
qmckl_exit_code qmckl_get_electron_en_distance_rescaled(qmckl_context context, double* distance_rescaled);
-
-
-
-
- - -
-
3.2.4.2 Compute
-
-
- - --- -- -- -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
VariableTypeIn/OutDescription
contextqmckl_contextinGlobal state
elec_numint64_tinNumber of electrons
nucl_numint64_tinNumber of nuclei
type_nucl_numint64_tinNumber of types of nuclei
type_nucl_vectorint64_t[nucl_num]inNumber of types of nuclei
rescale_factor_endouble[type_nucl_num]inThe factor for rescaled distances
walk_numint64_tinNumber of walkers
elec_coorddouble[3][walk_num][elec_num]inElectron coordinates
nucl_coorddouble[3][elec_num]inNuclear coordinates
en_distance_rescaleddouble[walk_num][nucl_num][elec_num]outElectron-nucleus distances
- -
-
function qmckl_compute_en_distance_rescaled_doc(context, &
-     elec_num, nucl_num, type_nucl_num, &
-     type_nucl_vector, rescale_factor_en, walk_num, elec_coord, &
-     nucl_coord, en_distance_rescaled) &
-     bind(C) result(info)
-  use qmckl
-  implicit none
-  integer (qmckl_context), intent(in), value :: context
-  integer (c_int64_t) , intent(in)  , value :: elec_num
-  integer (c_int64_t) , intent(in)  , value :: nucl_num
-  integer (c_int64_t) , intent(in)  , value :: type_nucl_num
-  integer (c_int64_t) , intent(in)          :: type_nucl_vector(nucl_num)
-  real    (c_double ) , intent(in)          :: rescale_factor_en(type_nucl_num)
-  integer (c_int64_t) , intent(in)  , value :: walk_num
-  real    (c_double ) , intent(in)          :: elec_coord(elec_num,walk_num,3)
-  real    (c_double ) , intent(in)          :: nucl_coord(nucl_num,3)
-  real    (c_double ) , intent(out)         :: en_distance_rescaled(elec_num,nucl_num,walk_num)
-  integer(qmckl_exit_code)                   :: info
-
-  integer*8 :: i, k
-  double precision      :: coord(3)
-
-  info = QMCKL_SUCCESS
-
-  if (context == QMCKL_NULL_CONTEXT) then
-     info = QMCKL_INVALID_CONTEXT
-     return
-  endif
-
-  if (elec_num <= 0) then
-     info = QMCKL_INVALID_ARG_2
-     return
-  endif
-
-  if (nucl_num <= 0) then
-     info = QMCKL_INVALID_ARG_3
-     return
-  endif
-
-  if (walk_num <= 0) then
-     info = QMCKL_INVALID_ARG_5
-     return
-  endif
-
-  do i=1, nucl_num
-     coord(1:3) = nucl_coord(i,1:3)
-     do k=1,walk_num
-        info = qmckl_distance_rescaled(context, 'T', 'N', elec_num, 1_8, &
-             elec_coord(1,k,1), elec_num*walk_num, coord, 3_8, &
-             en_distance_rescaled(1,i,k), elec_num, rescale_factor_en(type_nucl_vector(i)+1))
-        if (info /= QMCKL_SUCCESS) then
-           return
-        endif
-     end do
-  end do
-
-end function qmckl_compute_en_distance_rescaled_doc
-
-
-
-
- -
-
3.2.4.3 Test
-
-
-
-assert(qmckl_electron_provided(context));
-assert(qmckl_nucleus_provided(context));
-
-double en_distance_rescaled[walk_num][nucl_num][elec_num];
-
-rc = qmckl_check(context,
-                 qmckl_get_electron_en_distance_rescaled(context, &(en_distance_rescaled[0][0][0]))
-                 );
-assert (rc == QMCKL_SUCCESS);
-
-// (e,n,w) in Fortran notation
-// (1,1,1)
-assert(fabs(en_distance_rescaled[0][0][0] - 0.4942158656729477) < 1.e-12);
-// (1,2,1)
-assert(fabs(en_distance_rescaled[0][1][0] - 1.2464137498005765) < 1.e-12);
-// (2,1,1)
-assert(fabs(en_distance_rescaled[0][0][1] - 0.5248654474756858) < 1.e-12);
-// (1,1,2)
-assert(fabs(en_distance_rescaled[0][0][5] - 0.19529459944794733) < 1.e-12);
-// (1,2,2)
-assert(fabs(en_distance_rescaled[0][1][5] - 1.2091967687767369) < 1.e-12);
-// (2,1,2)
-assert(fabs(en_distance_rescaled[0][0][6] - 0.4726452953409436) < 1.e-12);
-
-
-
-
-
-
-
- -
-

3.2.5 Electron-electron rescaled distance gradients and Laplacian with respect to electron coordinates

-
-

-The rescaled distances, represented by \(C_{i\alpha} = (1 - e^{-\kappa_\alpha R_{i\alpha}})/\kappa\) -are differentiated with respect to the electron coordinates. -This information is stored in the tensor -en_distance_rescaled_gl. The initial three sequential -elements of this three-index tensor provide the \(x\), \(y\), and \(z\) -direction derivatives, while the fourth index corresponds to the Laplacian. -

-
- -
-
3.2.5.1 Get
-
-
-
qmckl_exit_code qmckl_get_electron_en_distance_rescaled_gl(qmckl_context context, double* distance_rescaled_gl);
-
-
-
-
- -
-
3.2.5.2 Compute
-
- - - --- -- -- -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
VariableTypeIn/OutDescription
contextqmckl_contextinGlobal state
elec_numint64_tinNumber of electrons
nucl_numint64_tinNumber of nuclei
type_nucl_numint64_tinNumber of nucleus types
type_nucl_vectorint64_t[nucl_num]inArray of nucleus types
rescale_factor_endouble[nucl_num]inThe factors for rescaled distances
walk_numint64_tinNumber of walkers
elec_coorddouble[3][walk_num][elec_num]inElectron coordinates
nucl_coorddouble[3][elec_num]inNuclear coordinates
en_distance_rescaled_gldouble[walk_num][nucl_num][elec_num][4]outElectron-nucleus distance derivatives
- -
-
integer function qmckl_compute_en_distance_rescaled_gl_doc_f(context, elec_num, nucl_num, &
-     type_nucl_num, type_nucl_vector, rescale_factor_en, walk_num, elec_coord, &
-     nucl_coord, en_distance_rescaled_gl) &
-     result(info)
-  use qmckl
-  implicit none
-  integer(qmckl_context), intent(in)  :: context
-  integer*8             , intent(in)  :: elec_num
-  integer*8             , intent(in)  :: nucl_num
-  integer*8             , intent(in)  :: type_nucl_num
-  integer*8             , intent(in)  :: type_nucl_vector(nucl_num)
-  double precision      , intent(in)  :: rescale_factor_en(nucl_num)
-  integer*8             , intent(in)  :: walk_num
-  double precision      , intent(in)  :: elec_coord(elec_num,walk_num,3)
-  double precision      , intent(in)  :: nucl_coord(nucl_num,3)
-  double precision      , intent(out) :: en_distance_rescaled_gl(4,elec_num,nucl_num,walk_num)
-
-  integer*8 :: i, k
-  double precision :: coord(3)
-
-  info = QMCKL_SUCCESS
-
-  if (context == QMCKL_NULL_CONTEXT) then
-     info = QMCKL_INVALID_CONTEXT
-     return
-  endif
-
-  if (elec_num <= 0) then
-     info = QMCKL_INVALID_ARG_2
-     return
-  endif
-
-  if (nucl_num <= 0) then
-     info = QMCKL_INVALID_ARG_3
-     return
-  endif
-
-  if (walk_num <= 0) then
-     info = QMCKL_INVALID_ARG_5
-     return
-  endif
-
-  do i=1, nucl_num
-     coord(1:3) = nucl_coord(i,1:3)
-     do k=1,walk_num
-        info = qmckl_distance_rescaled_gl(context, 'T', 'T', elec_num, 1_8, &
-             elec_coord(1,k,1), elec_num*walk_num, coord, 1_8, &
-             en_distance_rescaled_gl(1,1,i,k), elec_num, rescale_factor_en(type_nucl_vector(i)+1))
-        if (info /= QMCKL_SUCCESS) then
-           return
-        endif
-     end do
-  end do
-
-end function qmckl_compute_en_distance_rescaled_gl_doc_f
-
-
-
-
- -
-
3.2.5.3 Test
-
-
-
-assert(qmckl_electron_provided(context));
-
-assert(qmckl_nucleus_provided(context));
-
-double en_distance_rescaled_gl[walk_num][4][nucl_num][elec_num];
-
-rc = qmckl_check(context,
-                 qmckl_get_electron_en_distance_rescaled_gl(context, &(en_distance_rescaled_gl[0][0][0][0]))
-                 );
-assert (rc == QMCKL_SUCCESS);
-
-// TODO: check exact values
-//// (e,n,w) in Fortran notation
-//// (1,1,1)
-//assert(fabs(en_distance_rescaled[0][0][0] - 7.546738741619978) < 1.e-12);
-//
-//// (1,2,1)
-//assert(fabs(en_distance_rescaled[0][1][0] - 8.77102435246984) < 1.e-12);
-//
-//// (2,1,1)
-//assert(fabs(en_distance_rescaled[0][0][1] - 3.698922010513608) < 1.e-12);
-//
-//// (1,1,2)
-//assert(fabs(en_distance_rescaled[1][0][0] - 5.824059436060509) < 1.e-12);
-//
-//// (1,2,2)
-//assert(fabs(en_distance_rescaled[1][1][0] - 7.080482110317645) < 1.e-12);
-//
-//// (2,1,2)
-//assert(fabs(en_distance_rescaled[1][0][1] - 3.1804527583077356) < 1.e-12);
-
+{
+  printf("factor_en_gl\n");
+  double fd[walk_num][4][elec_num];
+  double delta_x = 0.0001;
+
+  // Finite difference coefficients for gradients
+  double coef[9] = { 1.0/280.0, -4.0/105.0,  1.0/5.0, -4.0/5.0,         0.0, 4.0/5.0, -1.0/5.0, 4.0/105.0, -1.0/280.0 };
+
+  // Finite difference coefficients for Laplacian
+  double coef2[9]= {-1.0/560.0,  8.0/315.0, -1.0/5.0,  8.0/5.0, -205.0/72.0, 8.0/5.0, -1.0/5.0, 8.0/315.0, -1.0/560.0 };
+
+  qmckl_exit_code rc;
+
+  int64_t walk_num;
+  rc = qmckl_get_electron_walk_num(context, &walk_num);
+  if (rc != QMCKL_SUCCESS) {
+    return rc;
+  }
+
+  int64_t elec_num;
+  rc = qmckl_get_electron_num(context, &elec_num);
+  if (rc != QMCKL_SUCCESS) {
+    return rc;
+  }
+
+  double elec_coord[walk_num][elec_num][3];
+  rc = qmckl_get_electron_coord (context, 'N', &(elec_coord[0][0][0]), 3*walk_num*elec_num);
+
+  double temp_coord[walk_num][elec_num][3];
+  memcpy(&(temp_coord[0][0][0]), &(elec_coord[0][0][0]), sizeof(temp_coord));
+
+  double function_values[walk_num];
+
+  memset(&(fd[0][0][0]), 0, sizeof(fd));
+
+  for (int64_t i = 0; i < elec_num; i++) {
+    for (int64_t k = 0; k < 3; k++) {
+      for (int64_t m = -4; m <= 4; m++) {          // Apply finite difference displacement
+
+        for (int64_t nw=0 ; nw<walk_num ; nw++) {
+          temp_coord[nw][i][k] = elec_coord[nw][i][k] + (double) m * delta_x;
+        }
+
+        // Update coordinates in the context
+        rc = qmckl_set_electron_coord (context, 'N', walk_num, &(temp_coord[0][0][0]), walk_num*3*elec_num);
+        assert(rc == QMCKL_SUCCESS);
+
+        // Call the provided function
+        rc = qmckl_get_jastrow_champ_factor_en(context, &(function_values[0]), walk_num);
+        assert(rc == QMCKL_SUCCESS);
+
+        // Accumulate derivative using finite-difference coefficients
+        for (int64_t nw=0 ; nw<walk_num ; nw++) {
+          fd[nw][k][i] += coef [m + 4] * function_values[nw];
+          fd[nw][3][i] += coef2[m + 4] * function_values[nw];
+        }
+      }
+      for (int64_t nw=0 ; nw<walk_num ; nw++) {
+        temp_coord[nw][i][k] = elec_coord[nw][i][k];
+      }
+    }
+  }
+
+  // Reset coordinates in the context
+  rc = qmckl_set_electron_coord (context, 'N', walk_num, &(elec_coord[0][0][0]), walk_num*3*elec_num);
+  assert(rc == QMCKL_SUCCESS);
+
+  // Normalize by the step size
+  for (int64_t nw=0 ; nw<walk_num ; nw++) {
+    for (int64_t k = 0; k < 4; k++) {
+      for (int64_t i = 0; i < elec_num; i++) {
+          fd[nw][k][i] /= delta_x;
+      }
+    }
+    for (int64_t i = 0; i < elec_num; i++) {
+      fd[nw][3][i] /= delta_x;
+    }
+  }
+
+
+  double factor_en_gl[walk_num][4][elec_num];
+  rc = qmckl_check(context,
+                   qmckl_get_jastrow_champ_factor_en_gl(context,
+                                                        &(factor_en_gl[0][0][0]),
+                                                        walk_num*4*elec_num)
+                   );
+
+  assert(rc == QMCKL_SUCCESS);
+
+  for (int nw = 0; nw < walk_num; nw++){
+    for (int i = 0; i < elec_num; i++) {
+      for (int k = 0; k < 3; k++){
+        printf("%.10f\t", fd[nw][k][i]);
+        printf("%.10f\n", factor_en_gl[nw][k][i]);
+        assert(fabs(fd[nw][k][i] - factor_en_gl[nw][k][i]) < 1.e-8);
+      }
+      int k=3;
+      printf("%.10f\t", fd[nw][k][i]);
+      printf("%.10f\n", factor_en_gl[nw][k][i]);
+      assert(fabs(fd[nw][k][i] - factor_en_gl[nw][k][i]) < 1.e-5);
+    }
+  }
+  printf("OK\n");
+}
+
+{
+  printf("factor_en_gl_hpc\n");
+
+  double en_distance_rescaled[walk_num][nucl_num][elec_num];
+  rc = qmckl_get_jastrow_champ_en_distance_rescaled(context,
+                                                    &(en_distance_rescaled[0][0][0]),
+                                                    walk_num*nucl_num*elec_num);
+  assert(rc == QMCKL_SUCCESS);
+
+  double en_distance_rescaled_gl[walk_num][4][elec_num][nucl_num];
+  rc = qmckl_get_jastrow_champ_en_distance_rescaled_gl(context,
+                                                       &(en_distance_rescaled_gl[0][0][0][0]),
+                                                       walk_num*4*elec_num*nucl_num);
+  assert(rc == QMCKL_SUCCESS);
+
+  double factor_en_gl_doc[walk_num*4*elec_num];
+  memset(&(factor_en_gl_doc[0]), 0, sizeof(factor_en_gl_doc));
+  rc = qmckl_compute_jastrow_champ_factor_en_gl_doc(context, walk_num, elec_num,
+       nucl_num, type_nucl_num, type_nucl_vector, aord_num, &(a_vector[0]),
+       &(en_distance_rescaled[0][0][0]), &(en_distance_rescaled_gl[0][0][0][0]), &(factor_en_gl_doc[0]));
+  assert(rc == QMCKL_SUCCESS);
+
+  double factor_en_gl_hpc[walk_num*4*elec_num];
+  memset(&(factor_en_gl_hpc[0]), 0, sizeof(factor_en_gl_hpc));
+  rc = qmckl_compute_jastrow_champ_factor_en_gl_hpc(context, walk_num, elec_num,
+       nucl_num, type_nucl_num, type_nucl_vector, aord_num, &(a_vector[0]),
+       &(en_distance_rescaled[0][0][0]), &(en_distance_rescaled_gl[0][0][0][0]), &(factor_en_gl_hpc[0]));
+  assert(rc == QMCKL_SUCCESS);
+
+  for (int64_t i = 0; i < walk_num*4*elec_num; i++) {
+    assert(fabs(factor_en_gl_doc[i] - factor_en_gl_hpc[i]) < 1.e-8);
+  }
+}
 
@@ -4285,12 +4945,12 @@ rc = qmckl_check(context,
-
-

3.3 Electron-electron-nucleus component

+
+

3.3 Electron-electron-nucleus component

-
-

3.3.1 Electron-electron rescaled distances in \(J_\text{eeN}\)

+
+

3.3.1 Electron-electron rescaled distances in \(J_\text{eeN}\)

een_rescaled_e stores the table of the rescaled distances between all @@ -4308,23 +4968,23 @@ where \(r_{ij}\) is the matrix of electron-electron distances.

-
-
3.3.1.1 Get
+
+
3.3.1.1 Get
qmckl_exit_code
-qmckl_get_jastrow_champ_een_rescaled_e(qmckl_context context,
-                                 double* const distance_rescaled,
-                                 const int64_t size_max);
+qmckl_get_jastrow_champ_een_distance_rescaled_e(qmckl_context context,
+                                                double* const een_rescaled_e,
+                                                const int64_t size_max);
 
-
-
3.3.1.2 Compute
+
+
3.3.1.2 Compute
- +
@@ -4486,8 +5146,7 @@ where \(r_{ij}\) is the matrix of electron-electron distances.
-
qmckl_exit_code qmckl_compute_een_rescaled_e_hpc (
-                                                  const qmckl_context context,
+
qmckl_exit_code qmckl_compute_een_rescaled_e_hpc (const qmckl_context context,
                                                   const int64_t walk_num,
                                                   const int64_t elec_num,
                                                   const int64_t cord_num,
@@ -4665,31 +5324,61 @@ where \(r_{ij}\) is the matrix of electron-electron distances.
 
-
-
3.3.1.3 Test
+
+
3.3.1.3 Test
assert(qmckl_electron_provided(context));
-
+{
 
 double een_rescaled_e[walk_num][(cord_num + 1)][elec_num][elec_num];
-rc = qmckl_get_jastrow_champ_een_rescaled_e(context, &(een_rescaled_e[0][0][0][0]),elec_num*elec_num*(cord_num+1)*walk_num);
+rc = qmckl_get_jastrow_champ_een_distance_rescaled_e(context, &(een_rescaled_e[0][0][0][0]),elec_num*elec_num*(cord_num+1)*walk_num);
 
 // value of (0,2,1)
-assert(fabs(een_rescaled_e[0][1][0][2]- 0.2211015082992776 ) < 1.e-12);
-assert(fabs(een_rescaled_e[0][1][0][3]- 0.2611178387068169 ) < 1.e-12);
-assert(fabs(een_rescaled_e[0][1][0][4]- 0.0884012350763747 ) < 1.e-12);
-assert(fabs(een_rescaled_e[0][2][1][3]- 0.1016685507354656 ) < 1.e-12);
-assert(fabs(een_rescaled_e[0][2][1][4]- 0.0113118073246869 ) < 1.e-12);
-assert(fabs(een_rescaled_e[0][2][1][5]- 0.5257156022077619 ) < 1.e-12);
+assert(fabs(een_rescaled_e[0][1][0][2]- 0.2211015082992776 ) < 1.e-12);
+assert(fabs(een_rescaled_e[0][1][0][3]- 0.2611178387068169 ) < 1.e-12);
+assert(fabs(een_rescaled_e[0][1][0][4]- 0.0884012350763747 ) < 1.e-12);
+assert(fabs(een_rescaled_e[0][2][1][3]- 0.1016685507354656 ) < 1.e-12);
+assert(fabs(een_rescaled_e[0][2][1][4]- 0.0113118073246869 ) < 1.e-12);
+assert(fabs(een_rescaled_e[0][2][1][5]- 0.5257156022077619 ) < 1.e-12);
+}
+
+{
+  printf("een_rescaled_e_hpc\n");
+  double ee_distance[walk_num * elec_num * elec_num];
+  rc = qmckl_get_electron_ee_distance(context, &(ee_distance[0]), walk_num*elec_num*elec_num);
+  assert(rc == QMCKL_SUCCESS);
+
+  double een_rescaled_e_doc[walk_num][cord_num+1][elec_num][elec_num];
+  memset(&(een_rescaled_e_doc[0][0][0][0]), 0, sizeof(een_rescaled_e_doc));
+  rc = qmckl_compute_een_rescaled_e(context, walk_num, elec_num, cord_num,
+                0.6, &(ee_distance[0]), &(een_rescaled_e_doc[0][0][0][0]));
+  assert(rc == QMCKL_SUCCESS);
+
+  double een_rescaled_e_hpc[walk_num][cord_num+1][elec_num][elec_num];
+  memset(&(een_rescaled_e_hpc[0][0][0][0]), 0, sizeof(een_rescaled_e_hpc));
+  rc = qmckl_compute_een_rescaled_e_hpc(context, walk_num, elec_num, cord_num,
+                0.6, &(ee_distance[0]), &(een_rescaled_e_hpc[0][0][0][0]));
+  assert(rc == QMCKL_SUCCESS);
+
+  for (int64_t i = 0; i < walk_num; i++) {
+    for (int64_t j = 0; j < cord_num+1; j++) {
+      for (int64_t k = 0; k < elec_num; k++) {
+        for (int64_t l = 0; l < elec_num; l++) {
+          assert(fabs(een_rescaled_e_doc[i][j][k][l] - een_rescaled_e_hpc[i][j][k][l]) < 1.e-8);
+        }
+      }
+    }
+  }
+}
 
-
-

3.3.2 Electron-electron rescaled distances derivatives in \(J_\text{eeN}\)

+
+

3.3.2 Electron-electron rescaled distances derivatives in \(J_\text{eeN}\)

een_rescaled_e_gl stores the table of the derivatives of the @@ -4705,23 +5394,23 @@ required for the een jastrowchamp.

-
-
3.3.2.1 Get
+
+
3.3.2.1 Get
qmckl_exit_code
-qmckl_get_jastrow_champ_een_rescaled_e_gl(qmckl_context context,
-                                         double* const distance_rescaled,
-                                         const int64_t size_max);
+qmckl_get_jastrow_champ_een_distance_rescaled_e_gl(qmckl_context context,
+                                                   double* const een_rescaled_e_gl,
+                                                   const int64_t size_max);
 
-
-
3.3.2.2 Compute
+
+
3.3.2.2 Compute
-
+
@@ -4823,10 +5512,13 @@ required for the een jastrowchamp. double precision , intent(in) :: ee_distance(elec_num,elec_num,walk_num)double precision , intent(in) :: een_rescaled_e(elec_num,elec_num,0:cord_num,walk_num)double precision , intent(out) :: een_rescaled_e_gl(elec_num,4,elec_num,0:cord_num,walk_num) - double precision,dimension(:,:,:),allocatable :: elec_dist_gl - double precision :: x, rij_inv, kappa_l + + double precision, allocatable :: elec_dist_gl(:,:,:) + double precision :: x, kappa_linteger*8 :: i, j, k, l, nw, ii + double precision :: rij_inv(elec_num) + allocate(elec_dist_gl(elec_num, 4, elec_num)) info = QMCKL_SUCCESS @@ -4854,27 +5546,20 @@ required for the een jastrowchamp. ! Prepare table of exponentiated distances raised to appropriate powerdo nw = 1, walk_num do j = 1, elec_num - do i = 1, j-1 - rij_inv = 1.0d0 / ee_distance(i, j, nw) + do i = 1, elec_num + rij_inv(i) = 1.0d0 / (ee_distance(i, j, nw) + 1.d-30) + enddo + rij_inv(j) = 0.0d0 + do i = 1, elec_num do ii = 1, 3 - elec_dist_gl(i, ii, j) = (coord_ee(i, ii, nw) - coord_ee(j, ii, nw)) * rij_inv + elec_dist_gl(i, ii, j) = (coord_ee(i, ii, nw) - coord_ee(j, ii, nw)) * rij_inv(i) end do - elec_dist_gl(i, 4, j) = 2.0d0 * rij_inv - end do - - elec_dist_gl(j, :, j) = 0.0d0 - - do i = j+1, elec_num - rij_inv = 1.0d0 / ee_distance(i, j, nw) - do ii = 1, 3 - elec_dist_gl(i, ii, j) = (coord_ee(i, ii, nw) - coord_ee(j, ii, nw)) * rij_inv - end do - elec_dist_gl(i, 4, j) = 2.0d0 * rij_inv + elec_dist_gl(i, 4, j) = 2.0d0 * rij_inv(i) end doend do ! Not necessary: should be set to zero by qmckl_malloc -! een_rescaled_e_gl(:,:,:,0,nw) = 0.d0 + een_rescaled_e_gl(:,:,:,0,nw) = 0.d0 do l = 1, cord_num kappa_l = - dble(l) * rescale_factor_ee @@ -4884,17 +5569,21 @@ required for the een jastrowchamp. een_rescaled_e_gl(i, 2, j, l, nw) = kappa_l * elec_dist_gl(i, 2, j) een_rescaled_e_gl(i, 3, j, l, nw) = kappa_l * elec_dist_gl(i, 3, j) een_rescaled_e_gl(i, 4, j, l, nw) = kappa_l * elec_dist_gl(i, 4, j) + end do - een_rescaled_e_gl(i, 4, j, l, nw) = een_rescaled_e_gl(i, 4, j, l, nw) & - + een_rescaled_e_gl(i, 1, j, l, nw) * een_rescaled_e_gl(i, 1, j, l, nw) & - + een_rescaled_e_gl(i, 2, j, l, nw) * een_rescaled_e_gl(i, 2, j, l, nw) & - + een_rescaled_e_gl(i, 3, j, l, nw) * een_rescaled_e_gl(i, 3, j, l, nw) - - een_rescaled_e_gl(i,1,j,l,nw) = een_rescaled_e_gl(i,1,j,l,nw) * een_rescaled_e(i,j,l,nw) - een_rescaled_e_gl(i,2,j,l,nw) = een_rescaled_e_gl(i,2,j,l,nw) * een_rescaled_e(i,j,l,nw) - een_rescaled_e_gl(i,3,j,l,nw) = een_rescaled_e_gl(i,3,j,l,nw) * een_rescaled_e(i,j,l,nw) - een_rescaled_e_gl(i,4,j,l,nw) = een_rescaled_e_gl(i,4,j,l,nw) * een_rescaled_e(i,j,l,nw) + do i = 1, elec_num + een_rescaled_e_gl(i, 4, j, l, nw) = een_rescaled_e_gl(i, 4, j, l, nw) & + + een_rescaled_e_gl(i, 1, j, l, nw) * een_rescaled_e_gl(i, 1, j, l, nw) & + + een_rescaled_e_gl(i, 2, j, l, nw) * een_rescaled_e_gl(i, 2, j, l, nw) & + + een_rescaled_e_gl(i, 3, j, l, nw) * een_rescaled_e_gl(i, 3, j, l, nw) end do + + do i = 1, elec_num + een_rescaled_e_gl(i,1,j,l,nw) = een_rescaled_e_gl(i,1,j,l,nw) * een_rescaled_e(i,j,l,nw) + een_rescaled_e_gl(i,2,j,l,nw) = een_rescaled_e_gl(i,2,j,l,nw) * een_rescaled_e(i,j,l,nw) + een_rescaled_e_gl(i,3,j,l,nw) = een_rescaled_e_gl(i,3,j,l,nw) * een_rescaled_e(i,j,l,nw) + een_rescaled_e_gl(i,4,j,l,nw) = een_rescaled_e_gl(i,4,j,l,nw) * een_rescaled_e(i,j,l,nw) + end doend doend doend do @@ -4977,7 +5666,6 @@ required for the een jastrowchamp. doublekappa_l = - (double)l * rescale_factor_ee; for (int64_tj = 0; j < elec_num; ++j) { double* restricteegl = &een_rescaled_e_gl[ elec_num * 4 * (j + elec_num * (l + (cord_num + 1) * nw))]; - constdouble* restrictee = &een_rescaled_e [ elec_num * (j + elec_num * (l + (cord_num + 1) * nw))]; #ifdef HAVE_OPENMP #pragma omp simd #endif @@ -4996,6 +5684,7 @@ required for the een jastrowchamp. eegl[i + elec_num*1] * eegl[i + elec_num*1] + eegl[i + elec_num*2] * eegl[i + elec_num*2]; } + constdouble* restrictee = &een_rescaled_e[ elec_num * (j + elec_num * (l + (cord_num + 1) * nw))]; #ifdef HAVE_OPENMP #pragma omp simd #endif @@ -5043,30 +5732,202 @@ required for the een jastrowchamp. -
-
3.3.2.3 Test
+ +
+
3.3.2.3 Test
-
double een_rescaled_e_gl[walk_num][(cord_num + 1)][elec_num][4][elec_num];
-size_max=walk_num*(cord_num + 1)*elec_num*4*elec_num;
-rc = qmckl_get_jastrow_champ_een_rescaled_e_gl(context,
-          &(een_rescaled_e_gl[0][0][0][0][0]),size_max);
+
{
+  double een_rescaled_e_gl[walk_num][(cord_num + 1)][elec_num][4][elec_num];
+  size_max=walk_num*(cord_num + 1)*elec_num*4*elec_num;
+  rc = qmckl_get_jastrow_champ_een_distance_rescaled_e_gl(context,
+            &(een_rescaled_e_gl[0][0][0][0][0]),size_max);
+
+  assert(fabs(een_rescaled_e_gl[0][1][0][0][2] +  0.09831391870751387   ) < 1.e-12);
+  assert(fabs(een_rescaled_e_gl[0][1][0][0][3] +  0.017204157459682526  ) < 1.e-12);
+  assert(fabs(een_rescaled_e_gl[0][1][0][0][4] +  0.013345768421098641  ) < 1.e-12);
+  assert(fabs(een_rescaled_e_gl[0][2][1][0][3] +  0.03733086358273962   ) < 1.e-12);
+  assert(fabs(een_rescaled_e_gl[0][2][1][0][4] +  0.004922634822943517  ) < 1.e-12);
+  assert(fabs(een_rescaled_e_gl[0][2][1][0][5] +  0.5416751547830984    ) < 1.e-12);
+
+
+ +
+
  assert(qmckl_electron_provided(context));
+
+  qmckl_context_struct* ctx = (qmckl_context_struct*) context;
+  double een_rescaled_e_gl_doc[walk_num*(cord_num + 1)*elec_num*4*elec_num];
+  memset(een_rescaled_e_gl_doc, 0, sizeof(een_rescaled_e_gl_doc));
+  rc = qmckl_compute_jastrow_champ_factor_een_rescaled_e_gl_doc(context,
+            ctx->electron.walker.num,
+            ctx->electron.num,
+            ctx->jastrow_champ.cord_num,
+            ctx->jastrow_champ.rescale_factor_ee,
+            ctx->electron.walker.point.coord.data,
+            ctx->electron.ee_distance,
+            ctx->jastrow_champ.een_rescaled_e,
+            een_rescaled_e_gl_doc);
+  assert(rc == QMCKL_SUCCESS);
+
+  double een_rescaled_e_gl_hpc[walk_num*(cord_num + 1)*elec_num*4*elec_num];
+  memset(een_rescaled_e_gl_hpc, 0, sizeof(een_rescaled_e_gl_hpc));
+  rc = qmckl_compute_jastrow_champ_factor_een_rescaled_e_gl_hpc(context,
+            ctx->electron.walker.num,
+            ctx->electron.num,
+            ctx->jastrow_champ.cord_num,
+            ctx->jastrow_champ.rescale_factor_ee,
+            ctx->electron.walker.point.coord.data,
+            ctx->electron.ee_distance,
+            ctx->jastrow_champ.een_rescaled_e,
+            een_rescaled_e_gl_hpc);
+  assert(rc == QMCKL_SUCCESS);
+
+  for (int64_t i = 0; i < walk_num*(cord_num + 1)*elec_num*4*elec_num; i++) {
+    printf("i = %ld, doc = %e, hpc = %e\n", i, een_rescaled_e_gl_doc[i], een_rescaled_e_gl_hpc[i]);
+    assert(fabs(een_rescaled_e_gl_doc[i] - een_rescaled_e_gl_hpc[i]) < 1.e-12);
+  }
+
+}
+
+{
+  printf("een_distance_rescaled_e_gl\n");
+  double fd[walk_num][cord_num+1][elec_num][4][elec_num];
+
+  double delta_x = 0.001;
+
+  // Finite difference coefficients for gradients
+  double coef[9] = { 1.0/280.0, -4.0/105.0,  1.0/5.0, -4.0/5.0,         0.0, 4.0/5.0, -1.0/5.0, 4.0/105.0, -1.0/280.0 };
+
+  // Finite difference coefficients for Laplacian
+  double coef2[9]= {-1.0/560.0,  8.0/315.0, -1.0/5.0,  8.0/5.0, -205.0/72.0, 8.0/5.0, -1.0/5.0, 8.0/315.0, -1.0/560.0 };
+
+  qmckl_exit_code rc;
+
+  int64_t walk_num;
+  rc = qmckl_get_electron_walk_num(context, &walk_num);
+  if (rc != QMCKL_SUCCESS) {
+    return rc;
+  }
+
+  int64_t elec_num;
+  rc = qmckl_get_electron_num(context, &elec_num);
+  if (rc != QMCKL_SUCCESS) {
+    return rc;
+  }
+
+  double elec_coord[walk_num][elec_num][3];
+  rc = qmckl_get_electron_coord (context, 'N', &(elec_coord[0][0][0]), 3*walk_num*elec_num);
+
+  double temp_coord[walk_num][elec_num][3];
+  memcpy(&(temp_coord[0][0][0]), &(elec_coord[0][0][0]), sizeof(temp_coord));
+
+  double function_values[walk_num][cord_num+1][elec_num][elec_num];
+
+  memset(&(fd[0][0][0][0]), 0, sizeof(fd));
+
+  for (int64_t k = 0; k < 3; k++) {
+    for (int64_t i = 0; i < elec_num; i++) {
+      for (int64_t m = -4; m <= 4; m++) {          // Apply finite difference displacement
+
+        for (int64_t nw=0 ; nw<walk_num ; nw++) {
+          temp_coord[nw][i][k] = elec_coord[nw][i][k] + (double) m * delta_x;
+        }
+
+        // Update coordinates in the context
+        rc = qmckl_set_electron_coord (context, 'N', walk_num,
+                                       &(temp_coord[0][0][0]),
+                                       walk_num*3*elec_num);
+        assert(rc == QMCKL_SUCCESS);
+        rc = qmckl_context_touch(context);
+        assert(rc == QMCKL_SUCCESS);
+
+        // Call the provided function
+        rc = qmckl_get_jastrow_champ_een_distance_rescaled_e(context,
+                                                             &(function_values[0][0][0][0]),
+                                                             sizeof(function_values)/sizeof(double));
+        assert(rc == QMCKL_SUCCESS);
+
+        // Accumulate derivative using finite-difference coefficients
+        for (int64_t c = 0; c < cord_num+1 ; c++) {
+          for (int64_t nw=0 ; nw<walk_num ; nw++) {
+            for (int64_t j = 0; j < elec_num; j++) {
+              fd[nw][c][j][k][i] += coef [m + 4] * function_values[nw][c][j][i];
+              fd[nw][c][j][3][i] += coef2[m + 4] * function_values[nw][c][j][i];
+            }
+          }
+        }
+
+      }
+      for (int64_t nw=0 ; nw<walk_num ; nw++) {
+        temp_coord[nw][i][k] = elec_coord[nw][i][k];
+      }
+    }
+  }
+
+  // Reset coordinates in the context
+  rc = qmckl_set_electron_coord (context, 'N', walk_num,
+                                 &(elec_coord[0][0][0]),
+                                 walk_num*3*elec_num);
+  assert(rc == QMCKL_SUCCESS);
+
+  // Normalize by the step size
+  for (int64_t nw=0 ; nw<walk_num ; nw++) {
+    for (int64_t c = 0; c < cord_num+1 ; c++) {
+      for (int64_t i = 0; i < elec_num; i++) {
+        for (int64_t k = 0; k < 4; k++) {
+          for (int64_t j = 0; j < elec_num; j++) {
+            fd[nw][c][i][k][j] /= delta_x;
+          }
+        }
+        for (int64_t j = 0; j < elec_num; j++) {
+          fd[nw][c][i][3][j] /= delta_x;
+        }
+      }
+    }
+  }
+
+
+  double een_distance_rescaled_e_gl[walk_num][cord_num+1][elec_num][4][elec_num];
+  rc = qmckl_check(context,
+                   qmckl_get_jastrow_champ_een_distance_rescaled_e_gl(context,
+                                                                      &(een_distance_rescaled_e_gl[0][0][0][0][0]),
+                                                                      sizeof(een_distance_rescaled_e_gl)/sizeof(double))
+                   );
+
+  assert(rc == QMCKL_SUCCESS);
+
+  for (int nw = 0; nw < walk_num; nw++){
+    for (int c = 0; c < cord_num+1 ; c++) {
+      for (int i = 0; i < elec_num; i++) {
+        for (int j = 0; j < elec_num; j++) {
+          for (int k = 0; k < 3; k++){
+            printf("%2d %2d %2d %2d %2d\t", nw, c, i, k, j);
+            printf("%.10e\t", fd[nw][c][i][k][j]);
+            printf("%.10e\n", een_distance_rescaled_e_gl[nw][c][i][k][j]);
+            assert(fabs(fd[nw][c][i][k][j] - een_distance_rescaled_e_gl[nw][c][i][k][j]) < 1.e-8);
+          }
+          int k=3;
+          if (i != j) {
+            printf("%2d %2d %2d %2d %2d\t", nw, c, i, k, j);
+            printf("%.10e\t", fd[nw][c][i][k][j]);
+            printf("%.10e\n", een_distance_rescaled_e_gl[nw][c][i][k][j]);
+            assert(fabs(fd[nw][c][i][k][j] - een_distance_rescaled_e_gl[nw][c][i][k][j]) < 1.e-6);
+          }
+        }
+      }
+    }
+  }
+  printf("OK\n");
+}
 
-// value of (0,0,0,2,1)
-assert(fabs(een_rescaled_e_gl[0][1][0][0][2] +  0.09831391870751387   ) < 1.e-12);
-assert(fabs(een_rescaled_e_gl[0][1][0][0][3] +  0.017204157459682526  ) < 1.e-12);
-assert(fabs(een_rescaled_e_gl[0][1][0][0][4] +  0.013345768421098641  ) < 1.e-12);
-assert(fabs(een_rescaled_e_gl[0][2][1][0][3] +  0.03733086358273962   ) < 1.e-12);
-assert(fabs(een_rescaled_e_gl[0][2][1][0][4] +  0.004922634822943517  ) < 1.e-12);
-assert(fabs(een_rescaled_e_gl[0][2][1][0][5] +  0.5416751547830984    ) < 1.e-12);
 
-
-

3.3.3 Electron-nucleus rescaled distances in \(J_\text{eeN}\)

+
+

3.3.3 Electron-nucleus rescaled distances in \(J_\text{eeN}\)

een_rescaled_n stores the table of the rescaled distances between @@ -5084,23 +5945,23 @@ where \(R_{i\alpha}\) is the matrix of electron-nucleus distances.

-
-
3.3.3.1 Get
+
+
3.3.3.1 Get
qmckl_exit_code
 qmckl_get_jastrow_champ_een_rescaled_n(qmckl_context context,
-                                 double* const distance_rescaled,
+                                 double* const een_rescaled_n,
                                  const int64_t size_max);
 
-
-
3.3.3.2 Compute
+
+
3.3.3.2 Compute
-
+
@@ -5335,8 +6196,8 @@ where \(R_{i\alpha}\) is the matrix of electron-nucleus distances. -
-
3.3.3.3 Test
+
+
3.3.3.3 Test
assert(qmckl_electron_provided(context));
@@ -5358,8 +6219,8 @@ rc = qmckl_get_jastrow_champ_een_rescaled_n(context, &(een_rescaled_n[0][0][
 
-
-

3.3.4 Electron-nucleus rescaled distances derivatives in \(J_\text{eeN}\)

+
+

3.3.4 Electron-nucleus rescaled distances derivatives in \(J_\text{eeN}\)

een_rescaled_n_gl stores the table of the derivatives of the @@ -5380,23 +6241,23 @@ required for the een jastrowchamp.

-
-
3.3.4.1 Get
+
+
3.3.4.1 Get
qmckl_exit_code
 qmckl_get_jastrow_champ_een_rescaled_n_gl(qmckl_context context,
-                                         double* const distance_rescaled,
+                                         double* const een_rescaled_n_gl,
                                          const int64_t size_max);
 
-
-
3.3.4.2 Compute
+
+
3.3.4.2 Compute
-
+
@@ -5612,8 +6473,8 @@ required for the een jastrowchamp. -
-
3.3.4.3 Test
+
+
3.3.4.3 Test
assert(qmckl_electron_provided(context));
@@ -5636,8 +6497,8 @@ rc = qmckl_get_jastrow_champ_een_rescaled_n_gl(context, &(een_rescaled_n_gl[
 
-
-

3.3.5 Temporary arrays for electron-electron-nucleus Jastrow \(f_{een}\)

+
+

3.3.5 Temporary arrays for electron-electron-nucleus Jastrow \(f_{een}\)

Prepare c_vector_full and lkpm_combined_index tables required for the @@ -5646,8 +6507,8 @@ calculation of the three-body jastrow factor_een and its derivative

-
-
3.3.5.1 Compute dimcvector
+
+
3.3.5.1 Compute dimcvector

Computes the dimension of the vector of parameters. @@ -5724,7 +6585,7 @@ Computes the dimension of the vector of parameters.

- +
@@ -5814,21 +6675,28 @@ Computes the dimension of the vector of parameters. -
-
3.3.5.2 Get
+
+
3.3.5.2 Get
-
qmckl_exit_code qmckl_get_jastrow_champ_tmp_c(qmckl_context context, double* const tmp_c);
-qmckl_exit_code qmckl_get_jastrow_champ_dtmp_c(qmckl_context context, double* const dtmp_c);
+
qmckl_exit_code
+qmckl_get_jastrow_champ_tmp_c(qmckl_context context,
+                              double* const tmp_c,
+                              const int64_t size_max);
+
+qmckl_exit_code
+qmckl_get_jastrow_champ_dtmp_c(qmckl_context context,
+                               double* const dtmp_c,
+                               const int64_t size_max);
 
-
-
3.3.5.3 Compute cvectorfull
+
+
3.3.5.3 Compute cvectorfull
-
+
@@ -6009,10 +6877,10 @@ Computes the dimension of the vector of parameters. -
-
3.3.5.4 Compute lkpmcombinedindex
+
+
3.3.5.4 Compute lkpmcombinedindex
-
+
@@ -6201,10 +7069,10 @@ Computes the dimension of the vector of parameters. -
-
3.3.5.5 Compute tmpc
+
+
3.3.5.5 Compute tmpc
-
+
@@ -6376,10 +7244,10 @@ Computes the dimension of the vector of parameters. -
-
3.3.5.6 Compute dtmpc
+
+
3.3.5.6 Compute dtmpc
-
+
@@ -6539,17 +7407,17 @@ Computes the dimension of the vector of parameters. -
-
3.3.5.7 Test
+
+
3.3.5.7 Test
assert(qmckl_electron_provided(context));
 
 double tmp_c[walk_num][cord_num][cord_num+1][nucl_num][elec_num];
-rc = qmckl_get_jastrow_champ_tmp_c(context, &(tmp_c[0][0][0][0][0]));
+rc = qmckl_get_jastrow_champ_tmp_c(context, &(tmp_c[0][0][0][0][0]), sizeof(tmp_c)/sizeof(double));
 
 double dtmp_c[walk_num][cord_num][cord_num+1][nucl_num][4][elec_num];
-rc = qmckl_get_jastrow_champ_dtmp_c(context, &(dtmp_c[0][0][0][0][0][0]));
+rc = qmckl_get_jastrow_champ_dtmp_c(context, &(dtmp_c[0][0][0][0][0][0]), sizeof(dtmp_c)/sizeof(double));
 
 printf("%e\n%e\n", tmp_c[0][0][1][0][0],  3.954384);
 assert(fabs(tmp_c[0][0][1][0][0] - 3.954384) < 1e-6);
@@ -6562,8 +7430,8 @@ printf("%e\n%e\n", dtmp_c[0][1][0][0][0][0]
 
-
-

3.3.6 Electron-electron-nucleus Jastrow \(f_{een}\)

+
+

3.3.6 Electron-electron-nucleus Jastrow \(f_{een}\)

Calculate the electron-electron-nuclear three-body jastrow component factor_een @@ -6575,8 +7443,8 @@ TODO: write equations.

-
-
3.3.6.1 Get
+
+
3.3.6.1 Get
qmckl_exit_code
@@ -6588,7 +7456,7 @@ TODO: write equations.
 
    -
  1. Fortran interface
    +
  2. Fortran interface
    interface
    @@ -6609,10 +7477,10 @@ TODO: write equations.
     
-
-
3.3.6.2 Compute naive
+
+
3.3.6.2 Compute naive
-
+
@@ -6799,10 +7667,10 @@ TODO: write equations. -
-
3.3.6.3 Compute
+
+
3.3.6.3 Compute
-
+
@@ -6960,8 +7828,8 @@ TODO: write equations. -
-
3.3.6.4 Test
+
+
3.3.6.4 Test
/* Check if Jastrow is properly initialized */
@@ -6977,8 +7845,8 @@ rc = qmckl_get_jastrow_champ_factor_een(context, &(factor_een[0]),walk_num);
 
-
-

3.3.7 Electron-electron-nucleus Jastrow \(f_{een}\) derivative

+
+

3.3.7 Electron-electron-nucleus Jastrow \(f_{een}\) derivative

Calculate the electron-electron-nuclear three-body jastrow component factor_een_gl @@ -6990,8 +7858,8 @@ TODO: write equations.

-
-
3.3.7.1 Get
+
+
3.3.7.1 Get
qmckl_exit_code
@@ -7003,7 +7871,7 @@ TODO: write equations.
 
    -
  1. Fortran interface
    +
  2. Fortran interface
    interface
    @@ -7023,10 +7891,10 @@ TODO: write equations.
     
-
-
3.3.7.2 Compute Naive
+
+
3.3.7.2 Compute Naive
-
+
@@ -7220,10 +8088,10 @@ TODO: write equations. -
-
3.3.7.3 Compute
+
+
3.3.7.3 Compute
-
+
@@ -7479,27 +8347,76 @@ TODO: write equations. -
-
3.3.7.4 Test
+
+
3.3.7.4 Test
/* Check if Jastrow is properly initialized */
 assert(qmckl_jastrow_champ_provided(context));
 
-double factor_een_gl[4][walk_num][elec_num];
-rc = qmckl_get_jastrow_champ_factor_een_gl(context, &(factor_een_gl[0][0][0]),4*walk_num*elec_num);
+double factor_een_gl[walk_num][4][elec_num];
+rc = qmckl_check(context,
+            rc = qmckl_get_jastrow_champ_factor_een_gl(context, &(factor_een_gl[0][0][0]),4*walk_num*elec_num)
+            );
+assert(rc == QMCKL_SUCCESS);
 
-printf("%20.15e\n", factor_een_gl[0][0][0]);
-assert(fabs(8.967809309100624e-02 - factor_een_gl[0][0][0]) < 1e-12);
+/*
+printf("%20.15e\n", factor_een_gl[0][0][0]);
+assert(fabs(8.967809309100624e-02 - factor_een_gl[0][0][0]) < 1e-12);
 
-printf("%20.15e\n", factor_een_gl[1][0][1]);
-assert(fabs(3.543090132452453e-02 - factor_een_gl[1][0][1]) < 1e-12);
+printf("%20.15e\n", factor_een_gl[0][1][1]);
+assert(fabs(3.543090132452453e-02 - factor_een_gl[0][1][1]) < 1e-12);
 
-printf("%20.15e\n", factor_een_gl[2][0][2]);
-assert(fabs(8.996044894431991e-04 - factor_een_gl[2][0][2]) < 1e-12);
+printf("%20.15e\n", factor_een_gl[0][2][2]);
+assert(fabs(8.996044894431991e-04 - factor_een_gl[0][2][2]) < 1e-12);
 
-printf("%20.15e\n", factor_een_gl[3][0][3]);
-assert(fabs(-1.175028308456619e+00 - factor_een_gl[3][0][3]) < 1e-12);
+printf("%20.15e\n", factor_een_gl[0][3][3]);
+assert(fabs(-1.175028308456619e+00 - factor_een_gl[0][3][3]) < 1e-12);
+TODO
+*/
+{
+  printf("factor_een_gl_hpc\n");
+
+  qmckl_context_struct* const ctx = (qmckl_context_struct*) context;
+  assert (ctx != NULL);
+
+  double factor_een_gl_doc[walk_num*4*elec_num];
+  memset(&(factor_een_gl_doc[0]), 0, walk_num*4*elec_num*sizeof(double));
+  rc = qmckl_compute_jastrow_champ_factor_een_gl_doc(context,
+                                                        ctx->electron.walker.num,
+                                                        ctx->electron.num,
+                                                        ctx->nucleus.num,
+                                                        ctx->jastrow_champ.cord_num,
+                                                        ctx->jastrow_champ.dim_c_vector,
+                                                        ctx->jastrow_champ.c_vector_full,
+                                                        ctx->jastrow_champ.lkpm_combined_index,
+                                                        ctx->jastrow_champ.tmp_c,
+                                                        ctx->jastrow_champ.dtmp_c,
+                                                        ctx->jastrow_champ.een_rescaled_n,
+                                                        ctx->jastrow_champ.een_rescaled_n_gl,
+                                                        factor_een_gl_doc);
+  assert(rc == QMCKL_SUCCESS);
+
+  double factor_een_gl_hpc[walk_num*4*elec_num];
+  memset(&(factor_een_gl_hpc[0]), 0, walk_num*4*elec_num*sizeof(double));
+  rc = qmckl_compute_jastrow_champ_factor_een_gl(context,
+                                                        ctx->electron.walker.num,
+                                                        ctx->electron.num,
+                                                        ctx->nucleus.num,
+                                                        ctx->jastrow_champ.cord_num,
+                                                        ctx->jastrow_champ.dim_c_vector,
+                                                        ctx->jastrow_champ.c_vector_full,
+                                                        ctx->jastrow_champ.lkpm_combined_index,
+                                                        ctx->jastrow_champ.tmp_c,
+                                                        ctx->jastrow_champ.dtmp_c,
+                                                        ctx->jastrow_champ.een_rescaled_n,
+                                                        ctx->jastrow_champ.een_rescaled_n_gl,
+                                                        factor_een_gl_hpc);
+
+  for (int64_t i = 0; i < walk_num*4*elec_num; ++i) {
+      assert(fabs(factor_een_gl_doc[i] - factor_een_gl_hpc[i]) < 1e-12);
+  }
+}
 
@@ -7507,20 +8424,20 @@ printf("%20.15e\n", factor_een_gl[3][0][3])
-
-

3.4 Total Jastrow

+
+

3.4 Total Jastrow

-
-

3.4.1 Value

+
+

3.4.1 Value

Value of the total Jastrow factor: \(\exp(J)\)

-
-
3.4.1.1 Get
+
+
3.4.1.1 Get
qmckl_exit_code
@@ -7532,7 +8449,7 @@ Value of the total Jastrow factor: \(\exp(J)\)
 
    -
  1. Fortran interface
    +
  2. Fortran interface
    interface
    @@ -7553,10 +8470,10 @@ Value of the total Jastrow factor: \(\exp(J)\)
     
-
-
3.4.1.2 Compute
+
+
3.4.1.2 Compute
-
+
@@ -7718,38 +8635,44 @@ Value of the total Jastrow factor: \(\exp(J)\) -
-
3.4.1.3 Test
+
+
3.4.1.3 Test
printf("Total Jastrow value\n");
 /* Check if Jastrow is properly initialized */
 assert(qmckl_jastrow_champ_provided(context));
 
-rc = qmckl_check(context,
-                 qmckl_get_jastrow_champ_factor_ee(context, &(factor_ee[0]), walk_num)
-                 );
-assert(rc == QMCKL_SUCCESS);
+{
 
-rc = qmckl_check(context,
-                 qmckl_get_jastrow_champ_factor_en(context, &(factor_en[0]), walk_num)
-                 );
-assert(rc == QMCKL_SUCCESS);
+  double factor_ee[walk_num];
+  rc = qmckl_check(context,
+                   qmckl_get_jastrow_champ_factor_ee(context, &(factor_ee[0]), walk_num)
+                   );
+  assert(rc == QMCKL_SUCCESS);
 
-rc = qmckl_check(context,
-                 qmckl_get_jastrow_champ_factor_een(context, &(factor_een[0]), walk_num)
-                 );
-assert(rc == QMCKL_SUCCESS);
+  double factor_en[walk_num];
+  rc = qmckl_check(context,
+                   qmckl_get_jastrow_champ_factor_en(context, &(factor_en[0]), walk_num)
+                   );
+  assert(rc == QMCKL_SUCCESS);
 
-double total_j[walk_num];
-rc = qmckl_check(context,
-                 qmckl_get_jastrow_champ_value(context, &(total_j[0]), walk_num)
-                 );
-assert(rc == QMCKL_SUCCESS);
+  double factor_een[walk_num];
+  rc = qmckl_check(context,
+                   qmckl_get_jastrow_champ_factor_een(context, &(factor_een[0]), walk_num)
+                   );
+  assert(rc == QMCKL_SUCCESS);
+
+  double total_j[walk_num];
+  rc = qmckl_check(context,
+                   qmckl_get_jastrow_champ_value(context, &(total_j[0]), walk_num)
+                   );
+  assert(rc == QMCKL_SUCCESS);
 
 
-for (int64_t i=0 ; i< walk_num ; ++i) {
-  assert (total_j[i] - exp(factor_ee[i] + factor_en[i] + factor_een[i]) < 1.e-12);
+  for (int64_t i=0 ; i< walk_num ; ++i) {
+    assert (total_j[i] - exp(factor_ee[i] + factor_en[i] + factor_een[i]) < 1.e-12);
+  }
 }
 
 
@@ -7759,8 +8682,8 @@ rc = qmckl_check(context,
 
-
-

3.4.2 Derivatives

+
+

3.4.2 Derivatives

Gradients and Laplacian of the total Jastrow factor: @@ -7774,8 +8697,8 @@ Gradients and Laplacian of the total Jastrow factor:

-
-
3.4.2.1 Get
+
+
3.4.2.1 Get
qmckl_exit_code
@@ -7787,7 +8710,7 @@ Gradients and Laplacian of the total Jastrow factor:
 
    -
  1. Fortran interface
    +
  2. Fortran interface
    interface
    @@ -7808,10 +8731,10 @@ Gradients and Laplacian of the total Jastrow factor:
     
-
-
3.4.2.2 Compute
+
+
3.4.2.2 Compute
-
+
@@ -8002,51 +8925,57 @@ Gradients and Laplacian of the total Jastrow factor: -
-
3.4.2.3 Test
+
+
3.4.2.3 Test
printf("Total Jastrow derivatives\n");
 /* Check if Jastrow is properly initialized */
 assert(qmckl_jastrow_champ_provided(context));
 
-rc = qmckl_check(context,
-                 qmckl_get_jastrow_champ_factor_ee_gl(context, &(factor_ee_gl[0][0][0]), walk_num*elec_num*4)
-                 );
-assert(rc == QMCKL_SUCCESS);
+{
+  double factor_ee_gl[walk_num][4][elec_num];
+  rc = qmckl_check(context,
+                   qmckl_get_jastrow_champ_factor_ee_gl(context, &(factor_ee_gl[0][0][0]), walk_num*elec_num*4)
+                   );
+  assert(rc == QMCKL_SUCCESS);
 
-rc = qmckl_check(context,
-                 qmckl_get_jastrow_champ_factor_en_gl(context, &(factor_en_gl[0][0][0]), walk_num*elec_num*4)
-                 );
-assert(rc == QMCKL_SUCCESS);
+  double factor_en_gl[walk_num][4][elec_num];
+  rc = qmckl_check(context,
+                   qmckl_get_jastrow_champ_factor_en_gl(context, &(factor_en_gl[0][0][0]), walk_num*elec_num*4)
+                   );
+  assert(rc == QMCKL_SUCCESS);
 
-rc = qmckl_check(context,
-                 qmckl_get_jastrow_champ_factor_een_gl(context, &(factor_een_gl[0][0][0]), walk_num*elec_num*4)
-                 );
-assert(rc == QMCKL_SUCCESS);
+  double factor_een_gl[walk_num][4][elec_num];
+  rc = qmckl_check(context,
+                   qmckl_get_jastrow_champ_factor_een_gl(context, &(factor_een_gl[0][0][0]), walk_num*elec_num*4)
+                   );
+  assert(rc == QMCKL_SUCCESS);
 
-double total_j_deriv[walk_num][4][elec_num];
-rc = qmckl_check(context,
-                 qmckl_get_jastrow_champ_gl(context, &(total_j_deriv[0][0][0]), walk_num*elec_num*4)
-                 );
-assert(rc == QMCKL_SUCCESS);
+  double total_j_deriv[walk_num][4][elec_num];
+  rc = qmckl_check(context,
+                   qmckl_get_jastrow_champ_gl(context, &(total_j_deriv[0][0][0]), walk_num*elec_num*4)
+                   );
+  assert(rc == QMCKL_SUCCESS);
 
-rc = qmckl_check(context,
-                 qmckl_get_jastrow_champ_value(context, &(total_j[0]), walk_num)
-                 );
-assert(rc == QMCKL_SUCCESS);
+  double total_j[walk_num];
+  rc = qmckl_check(context,
+                   qmckl_get_jastrow_champ_value(context, &(total_j[0]), walk_num)
+                   );
+  assert(rc == QMCKL_SUCCESS);
 
 
-for (int64_t k=0 ; k< walk_num ; ++k) {
-  for (int64_t m=0 ; m<4; ++m) {
-    for (int64_t e=0 ; e<elec_num; ++e) {
-      if (m < 3) { /* test only gradients */
-        assert (total_j_deriv[k][m][e]/total_j[k] - (factor_ee_gl[k][m][e] + factor_en_gl[k][m][e] + factor_een_gl[k][m][e]) < 1.e-12);
+  for (int64_t k=0 ; k< walk_num ; ++k) {
+    for (int64_t m=0 ; m<4; ++m) {
+      for (int64_t e=0 ; e<elec_num; ++e) {
+        if (m < 3) { /* test only gradients */
+          assert (total_j_deriv[k][m][e]/total_j[k] - (factor_ee_gl[k][m][e] + factor_en_gl[k][m][e] + factor_een_gl[k][m][e]) < 1.e-12);
+        }
       }
     }
   }
- }
 
+}
 
 
@@ -8058,7 +8987,7 @@ rc = qmckl_check(context,

Author: TREX CoE

-

Created: 2024-12-09 Mon 14:46

+

Created: 2024-12-13 Fri 02:01

Validate

diff --git a/qmckl_local_energy.html b/qmckl_local_energy.html index a0e4ccf..7eb9dda 100644 --- a/qmckl_local_energy.html +++ b/qmckl_local_energy.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Local Energy @@ -346,44 +346,44 @@ for the JavaScript code in this tag.

Table of Contents

-
-

1 Context

+
+

1 Context

The following arrays are stored in the context: @@ -466,8 +466,8 @@ Computed data:

-
-

1.1 Data structure

+
+

1.1 Data structure

typedef struct qmckl_local_energy_struct {
@@ -501,8 +501,8 @@ this mechanism.
 
-
-

1.2 Access functions

+
+

1.2 Access functions

When all the data for the local energy have been provided, the following @@ -517,12 +517,12 @@ function returns true.

-
-

2 Computation

+
+

2 Computation

-
-

2.1 Kinetic energy

+
+

2.1 Kinetic energy

Where the kinetic energy is given as: @@ -546,8 +546,8 @@ case is given as follows:

-
-

2.1.1 Get

+
+

2.1.1 Get

qmckl_exit_code qmckl_get_kinetic_energy(qmckl_context context, double* const kinetic_energy);
@@ -556,14 +556,14 @@ case is given as follows:
 
-
-

2.1.2 Provide

+
+

2.1.2 Provide

-
-

2.1.3 Compute kinetic enregy

+
+

2.1.3 Compute kinetic enregy

- +
@@ -792,12 +792,12 @@ case is given as follows: -
-

2.1.4 Test

+
+

2.1.4 Test

-
-

2.2 Potential energy

+
+

2.2 Potential energy

The potential energy is the sum of all the following terms @@ -833,8 +833,8 @@ contributions.

-
-

2.2.1 Get

+
+

2.2.1 Get

qmckl_exit_code qmckl_get_potential_energy(qmckl_context context, double* const potential_energy);
@@ -843,14 +843,14 @@ contributions.
 
-
-

2.2.2 Provide

+
+

2.2.2 Provide

-
-

2.2.3 Compute potential enregy

+
+

2.2.3 Compute potential enregy

-
+
@@ -977,12 +977,12 @@ contributions. -
-

2.2.4 Test

+
+

2.2.4 Test

-
-

2.3 Local energy

+
+

2.3 Local energy

The local energy is the sum of kinetic and potential energies. @@ -996,8 +996,8 @@ E_L = KE + PE

-
-

2.3.1 Get

+
+

2.3.1 Get

qmckl_exit_code qmckl_get_local_energy(qmckl_context context, double* const local_energy, const int64_t size_max);
@@ -1006,14 +1006,14 @@ E_L = KE + PE
 
-
-

2.3.2 Provide

+
+

2.3.2 Provide

-
-

2.3.3 Compute local enregy

+
+

2.3.3 Compute local enregy

-
+
@@ -1109,12 +1109,12 @@ E_L = KE + PE -
-

2.3.4 Test

+
+

2.3.4 Test

-
-

2.4 Drift vector

+
+

2.4 Drift vector

The drift vector is calculated as the ration of the gradient @@ -1128,8 +1128,8 @@ with the determinant of the wavefunction.

-
-

2.4.1 Get

+
+

2.4.1 Get

qmckl_exit_code qmckl_get_drift_vector(qmckl_context context, double* const drift_vector);
@@ -1138,14 +1138,14 @@ with the determinant of the wavefunction.
 
-
-

2.4.2 Provide

+
+

2.4.2 Provide

-
-

2.4.3 Compute drift vector

+
+

2.4.3 Compute drift vector

-
+
@@ -1366,15 +1366,15 @@ with the determinant of the wavefunction. -
-

2.4.4 Test

+
+

2.4.4 Test

Author: TREX CoE

-

Created: 2024-12-09 Mon 14:46

+

Created: 2024-12-13 Fri 02:01

Validate

diff --git a/qmckl_memory.html b/qmckl_memory.html index c2a8966..4a4504f 100644 --- a/qmckl_memory.html +++ b/qmckl_memory.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - +Memory management @@ -324,16 +324,16 @@ for the JavaScript code in this tag.

Table of Contents

-
-

1 Memory data structure for the context

+
+

1 Memory data structure for the context

Every time a new block of memory is allocated, the information @@ -375,8 +375,8 @@ array, and the number of allocated blocks.

-
-

2 Passing info to allocation routines

+
+

2 Passing info to allocation routines

Passing information to the allocation routine should be done by @@ -385,8 +385,8 @@ passing an instance of a qmckl_memory_info_struct.

-
-

3 Allocation/deallocation functions

+
+

3 Allocation/deallocation functions

Memory allocation inside the library should be done with @@ -645,8 +645,8 @@ successful deallocation of the memory block.

-
-

4 Get the size of a memory block

+
+

4 Get the size of a memory block

All the blocks allocated with qmckl_malloc keep track of how many @@ -741,7 +741,7 @@ rc = qmckl_context_destroy(context);

Author: TREX CoE

-

Created: 2024-12-09 Mon 14:46

+

Created: 2024-12-13 Fri 02:01

Validate

diff --git a/qmckl_mo.html b/qmckl_mo.html index 503a244..0cf61a1 100644 --- a/qmckl_mo.html +++ b/qmckl_mo.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Molecular Orbitals @@ -346,72 +346,72 @@ for the JavaScript code in this tag.

Table of Contents

-
-

1 Context

+
+

1 Context

The following arrays are stored in the context: @@ -490,8 +490,8 @@ Computed data:

-
-

1.1 Data structure

+
+

1.1 Data structure

typedef struct qmckl_mo_basis_struct {
@@ -548,8 +548,8 @@ this mechanism.
 
-
-

1.2 Initialization functions

+
+

1.2 Initialization functions

To set the basis set, all the following functions need to be @@ -570,8 +570,8 @@ computed to accelerate the calculations.

-
-

1.3 Cusp adjsutment functions

+
+

1.3 Cusp adjsutment functions

To activate the cusp adjustment, the user must enter the radius of @@ -586,8 +586,8 @@ of the non-\(s\) AOs at the center.

-
-

1.4 Access functions

+
+

1.4 Access functions

When all the data for the AOs have been provided, the following @@ -600,13 +600,13 @@ function returns true.

-
-

1.4.1 Fortran interfaces

+
+

1.4.1 Fortran interfaces

-
-

1.5 Update

+
+

1.5 Update

It may be desirable to remove certain molecular orbitals (MOs) that @@ -633,25 +633,25 @@ calculation. If the integer is non-zero, the MO will be kept.

-
-

1.5.1 Fortran interface

+
+

1.5.1 Fortran interface

-
-

2 Computation

+
+

2 Computation

-
-

2.1 Parameters of the cusp-correction functions

+
+

2.1 Parameters of the cusp-correction functions

-
-

2.2 Computation of MOs: values only

+
+

2.2 Computation of MOs: values only

-
-

2.2.1 Get

+
+

2.2.1 Get

qmckl_exit_code
@@ -675,8 +675,8 @@ Uses the given array to compute the values.
 
-
-

2.2.2 Provide

+
+

2.2.2 Provide

qmckl_exit_code qmckl_provide_mo_basis_mo_value(qmckl_context context);
@@ -761,10 +761,10 @@ Uses the given array to compute the values.
 
-
-

2.2.3 Compute

+
+

2.2.3 Compute

- +
@@ -919,8 +919,8 @@ matrix multiplication instead of a dgemm, as exposed in -
-

2.2.4 HPC version

+
+

2.2.4 HPC version

#ifdef HAVE_HPC
@@ -947,8 +947,8 @@ matrix multiplication instead of a dgemm, as exposed in
 
-
-
2.2.4.1 Single-precision
+
+
2.2.4.1 Single-precision
#ifdef HAVE_HPC
@@ -1069,8 +1069,8 @@ matrix multiplication instead of a dgemm, as exposed in
 
-
-
2.2.4.2 Double-precision
+
+
2.2.4.2 Double-precision
#ifdef HAVE_HPC
@@ -1187,12 +1187,12 @@ matrix multiplication instead of a dgemm, as exposed in
 
-
-

2.3 Computation of MOs: values, gradient, Laplacian

+
+

2.3 Computation of MOs: values, gradient, Laplacian

-
-

2.3.1 Get

+
+

2.3.1 Get

qmckl_exit_code
@@ -1216,8 +1216,8 @@ Uses the given array to compute the VGL.
 
-
-

2.3.2 Provide

+
+

2.3.2 Provide

qmckl_exit_code qmckl_provide_mo_basis_mo_vgl(qmckl_context context);
@@ -1301,10 +1301,10 @@ Uses the given array to compute the VGL.
 
-
-

2.3.3 Compute

+
+

2.3.3 Compute

-
+
@@ -1473,14 +1473,14 @@ matrix multiplication instead of a dgemm, as exposed in -
-

2.4 Computation of cusp-corrected MOs: values only

+
+

2.4 Computation of cusp-corrected MOs: values only

-
-

2.4.1 Compute

+
+

2.4.1 Compute

-
+
@@ -1719,8 +1719,8 @@ matrix multiplication instead of a dgemm, as exposed in -
-

2.4.2 HPC version

+
+

2.4.2 HPC version

#ifdef HAVE_HPC
@@ -1858,14 +1858,14 @@ IVDEP
 
-
-

2.5 Computation of cusp-corrected MOs: values, gradient, Laplacian

+
+

2.5 Computation of cusp-corrected MOs: values, gradient, Laplacian

-
-

2.5.1 Compute

+
+

2.5.1 Compute

-
+
@@ -2165,8 +2165,8 @@ IVDEP -
-

2.5.2 HPC version

+
+

2.5.2 HPC version

#ifdef HAVE_HPC
@@ -2365,8 +2365,8 @@ IVDEP
 
-
-

2.6 Rescaling of MO coefficients

+
+

2.6 Rescaling of MO coefficients

When evaluating Slater determinants, the value of the determinants @@ -2383,19 +2383,19 @@ correct range.

-
-

2.6.1 Fortran interface

+
+

2.6.1 Fortran interface

-
-

2.7 Test

+
+

2.7 Test

Author: TREX CoE

-

Created: 2024-12-09 Mon 14:46

+

Created: 2024-12-13 Fri 02:01

Validate

diff --git a/qmckl_nucleus.html b/qmckl_nucleus.html index 239c0c4..c21c845 100644 --- a/qmckl_nucleus.html +++ b/qmckl_nucleus.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Nucleus @@ -346,28 +346,28 @@ for the JavaScript code in this tag.

Table of Contents

-
-

1 Context

+
+

1 Context

The following data stored in the context: @@ -474,8 +474,8 @@ Computed data:

-
-

1.1 Data structure

+
+

1.1 Data structure

typedef struct qmckl_nucleus_struct {
@@ -529,8 +529,8 @@ this mechanism.
 
-
-

1.2 Access functions

+
+

1.2 Access functions

When all the data relative to nuclei have been set, the following @@ -544,8 +544,8 @@ function returns true.

-
-

1.3 Initialization functions

+
+

1.3 Initialization functions

To set the data relative to the nuclei in the context, the @@ -591,8 +591,8 @@ are be given in atomic units.

-
-

1.4 Test

+
+

1.4 Test

const double*   nucl_charge   = chbrclf_charge;
@@ -661,8 +661,8 @@ rc = qmckl_get_nucleus_charge(context, nucl_charge2, chbrclf_nucl_num);
 
-
-

2 Computation

+
+

2 Computation

The computed data is stored in the context so that it can be reused @@ -675,12 +675,12 @@ current date is stored.

-
-

2.1 Nucleus-nucleus distances

+
+

2.1 Nucleus-nucleus distances

-
-

2.1.1 Get

+
+

2.1.1 Get

qmckl_exit_code
@@ -692,10 +692,10 @@ current date is stored.
 
-
-

2.1.2 Compute

+
+

2.1.2 Compute

- +
@@ -773,8 +773,8 @@ current date is stored. -
-

2.1.3 Test

+
+

2.1.3 Test

/* Reference input data */
@@ -793,8 +793,8 @@ rc = qmckl_get_nucleus_nn_distance(context, distance, chbrclf_nucl_num*chbrclf_n
 
-
-

2.2 Nuclear repulsion energy

+
+

2.2 Nuclear repulsion energy

\[ @@ -803,8 +803,8 @@ rc = qmckl_get_nucleus_nn_distance(context, distance, chbrclf_nucl_num*chbrclf_n

-
-

2.2.1 Get

+
+

2.2.1 Get

qmckl_exit_code qmckl_get_nucleus_repulsion(qmckl_context context, double* const energy);
@@ -813,10 +813,10 @@ rc = qmckl_get_nucleus_nn_distance(context, distance, chbrclf_nucl_num*chbrclf_n
 
-
-

2.2.2 Compute

+
+

2.2.2 Compute

-
+
@@ -906,8 +906,8 @@ rc = qmckl_get_nucleus_nn_distance(context, distance, chbrclf_nucl_num*chbrclf_n -
-

2.2.3 Test

+
+

2.2.3 Test

/* Reference input data */
@@ -927,7 +927,7 @@ rc = qmckl_get_nucleus_repulsion(context, &rep);
 

Author: TREX CoE

-

Created: 2024-12-09 Mon 14:46

+

Created: 2024-12-13 Fri 02:01

Validate

diff --git a/qmckl_numprec.html b/qmckl_numprec.html index 4b8fc2a..9079741 100644 --- a/qmckl_numprec.html +++ b/qmckl_numprec.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + @@ -345,18 +345,18 @@ for the JavaScript code in this tag.

Table of Contents

@@ -366,8 +366,8 @@ for the JavaScript code in this tag. 3+TITLE: Numerical precision

-
-

1 Control of the numerical precision

+
+

1 Control of the numerical precision

Controlling numerical precision enables optimizations. Here, the @@ -378,7 +378,7 @@ Arithmetic (IEEE 754), sign bit) and range refers to the number of exponent bits.

-
+
@@ -422,8 +422,8 @@ integer. The update functions return QMCKL_SUCCESS or -
-

2 Precision

+
+

2 Precision

qmckl_context_set_numprec_precision modifies the parameter for the @@ -510,8 +510,8 @@ numerical precision in the context.

-
-

3 Range

+
+

3 Range

qmckl_set_numprec_range modifies the parameter for the numerical @@ -586,12 +586,12 @@ range in a given context.

-
-

4 Helper functions

+
+

4 Helper functions

-
-

4.1 Epsilon

+
+

4.1 Epsilon

qmckl_get_numprec_epsilon returns \(\epsilon = 2^{1-n}\) where n is the precision. @@ -610,8 +610,8 @@ We need to remove the sign bit from the precision.

-
-

4.2 Testing the number of unchanged bits

+
+

4.2 Testing the number of unchanged bits

To test that a given approximation keeps a given number of bits @@ -681,12 +681,12 @@ numbers differ.

-
-

5 Approximate functions

+
+

5 Approximate functions

-
-

5.1 Exponential

+
+

5.1 Exponential

Fast exponential function, adapted from Johan Rade's implementation @@ -741,7 +741,7 @@ N. Schraudolph, "A Fast, Compact Approximation of the Exponential Function",

Author: TREX CoE

-

Created: 2024-12-09 Mon 14:46

+

Created: 2024-12-13 Fri 02:01

Validate

diff --git a/qmckl_point.html b/qmckl_point.html index 83e2c04..94b579b 100644 --- a/qmckl_point.html +++ b/qmckl_point.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Point @@ -346,25 +346,25 @@ for the JavaScript code in this tag.

Table of Contents

-
-

1 Context

+
+

1 Context

The following data stored in the context: @@ -414,8 +414,8 @@ corresponds to the 3 × num matrix.

-
-

1.1 Data structure

+
+

1.1 Data structure

typedef struct qmckl_point_struct {
@@ -451,8 +451,8 @@ corresponds to the 3 × num matrix.
 
-
-

1.2 Access functions

+
+

1.2 Access functions

Access functions return QMCKL_SUCCESS when the data has been @@ -463,8 +463,8 @@ contains the requested data. Otherwise, this variable is untouched.

-
-

1.2.1 Number of points

+
+

1.2.1 Number of points

Returns the number of points stored in the context. @@ -486,8 +486,8 @@ Returns the number of points stored in the context.

-
-

1.2.2 Point coordinates

+
+

1.2.2 Point coordinates

Returns the point coordinates as sequences of (x,y,z). @@ -515,8 +515,8 @@ The pointer is assumed to point on a memory block of size

-
-

1.3 Initialization functions

+
+

1.3 Initialization functions

When the data is set in the context, if the arrays are large @@ -655,8 +655,8 @@ Copy a sequence of num points \((x,y,z)\) into the context.

-
-

1.4 Test

+
+

1.4 Test

/* Reference input data */
@@ -715,7 +715,7 @@ rc = qmckl_get_point (context, 'N', coord3,
 

Author: TREX CoE

-

Created: 2024-12-09 Mon 14:46

+

Created: 2024-12-13 Fri 02:01

Validate

diff --git a/qmckl_sherman_morrison_woodbury.html b/qmckl_sherman_morrison_woodbury.html index dafc09e..db801bc 100644 --- a/qmckl_sherman_morrison_woodbury.html +++ b/qmckl_sherman_morrison_woodbury.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Sherman-Morrison-Woodbury @@ -346,118 +346,118 @@ for the JavaScript code in this tag.

Table of Contents

-
-

1 Headers

+
+

1 Headers

#include "qmckl.h"
@@ -479,17 +479,17 @@ This is the range that determines the how many high performance kernel instantce
 

-
-

2 Naïve Sherman-Morrison

+
+

2 Naïve Sherman-Morrison

-
-

2.1 qmckl_sm_naive

+
+

2.1 qmckl_sm_naive

-
-

2.1.1 Introduction

+
+

2.1.1 Introduction

This is the simplest of the available Sherman-Morrison-Woodbury kernels. It applies rank-1 updates one by one in @@ -539,10 +539,10 @@ from applying the updates to the original matrix.

-
-

2.1.2 API

+
+

2.1.2 API

-
+
@@ -630,8 +630,8 @@ from applying the updates to the original matrix. -
-

2.1.3 Requirements

+
+

2.1.3 Requirements

  • context is not QMCKL_NULL_CONTEXT
  • @@ -647,8 +647,8 @@ from applying the updates to the original matrix.
-
-

2.1.4 Pedagogical kernel source (in Fortran)

+
+

2.1.4 Pedagogical kernel source (in Fortran)

The following source code written in Fortran is inteded to illustrate how the kernel works. Even though the kernel is @@ -742,8 +742,8 @@ not be used in real workloads.

-
-
2.1.4.1 C interface (not directly exposed)
+
+
2.1.4.1 C interface (not directly exposed)

The following Fortran function qmckl_sm_naive_doc makes sure @@ -755,8 +755,8 @@ for C users and in the module file 'qmcklf.F90' for Fortran users.

-
-

2.1.5 C headers (exposed in qmckl.h)

+
+

2.1.5 C headers (exposed in qmckl.h)

qmckl_exit_code qmckl_sm_naive (
@@ -802,8 +802,8 @@ for C users and in the module file 'qmcklf.F90' for Fortran users.
 
-
-

2.1.6 C sources

+
+

2.1.6 C sources

Common includes and macros used by all the Sherman-Morrison-Woodbury kernels. @@ -905,7 +905,7 @@ multiple of SIMD_LENGTH. qmckl_exit_code qmckl_sm_naive_{Dim} is a C function-template that is used to genereate instances of C fucntions based on the range given above. The advantage of this method is that for each of these instances all the dimensions and loop-bounds are known at compile time, allowing the compiler to optimize more aggressively.

-
static inline qmckl_exit_code qmckl_sm_naive_{Dim}(
+
static inline qmckl_exit_code qmckl_sm_naive_{Dim}(
     const qmckl_context context,
     const uint64_t N_updates,
     const double* restrict Updates,
@@ -981,7 +981,7 @@ multiple of SIMD_LENGTH.
 This is the kernel generator written in Python. It uses the kernel generator range and templates defined above to generate the C kernel instances.
 

-
text="""
+
text="""
 static inline qmckl_exit_code qmckl_sm_naive_{Dim}(
     const qmckl_context context,
     const uint64_t N_updates,
@@ -1065,7 +1065,7 @@ This is the kernel generator written in Python. It uses the kernel generator ran
 Python script that generated C switch cases that call individual kernel instances.
 

-
text="""
+
text="""
 case {Dim}:  
   return qmckl_sm_naive_{Dim}(context,
     N_updates,
@@ -2706,14 +2706,14 @@ Python script that generated C switch cases that call individual kernel instance
 
-
-

2.1.7 Fortran interfaces (exposed in qmcklf.F90)

+
+

2.1.7 Fortran interfaces (exposed in qmcklf.F90)

-
-

2.1.8 Performance

+
+

2.1.8 Performance

This function performs best when there is only 1 rank-1 update in the update cycle. It is @@ -2722,8 +2722,8 @@ can never resolve a situation where applying the update causes singular behaviou

-
-

2.1.9 Tests

+
+

2.1.9 Tests

The tests for the kernels are executed on datasets that are extracted from a run of @@ -2791,17 +2791,17 @@ rc = QMCKL_SUCCESS;

-
-

3 Sherman-Morrison with Slagel Splitting (core)

+
+

3 Sherman-Morrison with Slagel Splitting (core)

-
-

3.1 qmckl_sm_splitting_core

+
+

3.1 qmckl_sm_splitting_core

-
-

3.1.1 Introduction

+
+

3.1.1 Introduction

qmckl_sm_splitting_core is the inner core part of 'Sherman-Morrison with update splitting' in the next section. @@ -2829,10 +2829,10 @@ If the determinant is passed it will only be partially updated if there were any

-
-

3.1.2 API

+
+

3.1.2 API

-
+
@@ -2941,8 +2941,8 @@ If the determinant is passed it will only be partially updated if there were any -
-

3.1.3 Requirements

+
+

3.1.3 Requirements

  • LDS >= 2
  • @@ -2959,8 +2959,8 @@ If the determinant is passed it will only be partially updated if there were any
-
-

3.1.4 Pedagogical kernel source (in Fortran)

+
+

3.1.4 Pedagogical kernel source (in Fortran)

The following source code written in Fortran is inteded to illustrate how the kernel works. Even though the kernel is @@ -3076,8 +3076,8 @@ not be used in real workloads.

-
-
3.1.4.1 C interface to the pedagogical kernel (not directly exposed)
+
+
3.1.4.1 C interface to the pedagogical kernel (not directly exposed)

The function qmckl_sm_splitting_core_doc makes sure that @@ -3090,8 +3090,8 @@ exposed in qmckl.h and qmckl_f.F90, but

-
-

3.1.5 C headers (exposed in qmckl.h)

+
+

3.1.5 C headers (exposed in qmckl.h)

qmckl_exit_code qmckl_sm_splitting_core (
@@ -3146,8 +3146,8 @@ exposed in qmckl.h and qmckl_f.F90, but
 
-
-

3.1.6 C sources

+
+

3.1.6 C sources

qmckl_exit_code qmckl_sm_splitting_core_hpc(
@@ -3236,7 +3236,7 @@ exposed in qmckl.h and qmckl_f.F90, but
 
-
static inline qmckl_exit_code qmckl_sm_splitting_core_{Dim}(
+
static inline qmckl_exit_code qmckl_sm_splitting_core_{Dim}(
     const qmckl_context context,
     uint64_t N_updates,
     const double* restrict Updates,
@@ -3320,7 +3320,7 @@ exposed in qmckl.h and qmckl_f.F90, but
 
-
text="""
+
text="""
 static inline qmckl_exit_code qmckl_sm_splitting_core_{Dim}(
     const qmckl_context context,
     uint64_t N_updates,
@@ -3412,7 +3412,7 @@ exposed in qmckl.h and qmckl_f.F90, but
 
-
text="""
+
text="""
 case {Dim}: {
   return qmckl_sm_splitting_core_{Dim}(
       context,
@@ -5380,14 +5380,14 @@ exposed in qmckl.h and qmckl_f.F90, but
 
-
-

3.1.7 Fortran interfaces (exposed in qmcklf.F90)

+
+

3.1.7 Fortran interfaces (exposed in qmcklf.F90)

-
-

3.1.8 Performance

+
+

3.1.8 Performance

This function cannot be used by itself and is used in Sherman-Morrison with update splitting and Woodbury 3x3 and 2x2 @@ -5399,17 +5399,17 @@ with Sherman-Morrison and update splitting. Please look at the performance recco

-
-

4 Woodbury 2x2

+
+

4 Woodbury 2x2

-
-

4.1 qmckl_woodbury_2x2

+
+

4.1 qmckl_woodbury_2x2

-
-

4.1.1 Introduction

+
+

4.1.1 Introduction

The Woodbury 2x2 kernel. It is used to apply two rank-1 updates at once. The formula used in @@ -5433,10 +5433,10 @@ from applying the updates to the original matrix.

-
-

4.1.2 API

+
+

4.1.2 API

-
+
@@ -5517,8 +5517,8 @@ from applying the updates to the original matrix. -
-

4.1.3 Requirements

+
+

4.1.3 Requirements

  • context is not qmckl_null_context
  • @@ -5532,8 +5532,8 @@ from applying the updates to the original matrix.
-
-

4.1.4 Pedagogical kernel source (in Fortran)

+
+

4.1.4 Pedagogical kernel source (in Fortran)

The following source code written in Fortran is inteded to illustrate how the kernel works. Even though the kernel is @@ -5669,8 +5669,8 @@ not be used in real workloads.

-
-
4.1.4.1 C interface (not directly exposed)
+
+
4.1.4.1 C interface (not directly exposed)

The function qmckl_sm_splitting_core_doc makes sure that @@ -5683,8 +5683,8 @@ exposed in qmckl.h and qmckl_f.F90, but

-
-

4.1.5 C headers (exposed in qmckl.h)

+
+

4.1.5 C headers (exposed in qmckl.h)

qmckl_exit_code qmckl_woodbury_2x2 (
@@ -5727,8 +5727,8 @@ exposed in qmckl.h and qmckl_f.F90, but
 
-
-

4.1.6 C sources

+
+

4.1.6 C sources

qmckl_exit_code qmckl_woodbury_2x2_hpc(const qmckl_context context,
@@ -5812,7 +5812,7 @@ exposed in qmckl.h and qmckl_f.F90, but
 
-
static inline qmckl_exit_code qmckl_woodbury_2x2_{Dim}(
+
static inline qmckl_exit_code qmckl_woodbury_2x2_{Dim}(
     const qmckl_context context,
     const double* restrict Updates,
     const uint64_t* restrict Updates_index,
@@ -7762,14 +7762,14 @@ exposed in qmckl.h and qmckl_f.F90, but
 
-
-

4.1.7 Fortran interfaces (exposed in qmcklf.F90)

+
+

4.1.7 Fortran interfaces (exposed in qmcklf.F90)

-
-

4.1.8 Performance

+
+

4.1.8 Performance

This function is most efficient when used in cases where there are only 2 rank-1 updates and @@ -7778,8 +7778,8 @@ it is sure they will not result in a singular matrix.

-
-

4.1.9 Tests

+
+

4.1.9 Tests

assert(Updates2 != NULL);
@@ -7816,17 +7816,17 @@ rc = QMCKL_SUCCESS;
 
-
-

5 Woodbury 3x3

+
+

5 Woodbury 3x3

-
-

5.1 qmckl_woodbury_3x3

+
+

5.1 qmckl_woodbury_3x3

-
-

5.1.1 Introduction

+
+

5.1.1 Introduction

The Woodbury 3x3 kernel. It is used to apply two rank-1 updates at once. The formula used in @@ -7850,10 +7850,10 @@ from applying the updates to the original matrix.

-
-

5.1.2 API

+
+

5.1.2 API

-
+
@@ -7934,8 +7934,8 @@ from applying the updates to the original matrix. -
-

5.1.3 Requirements

+
+

5.1.3 Requirements

  • context is not qmckl_null_context
  • @@ -7949,8 +7949,8 @@ from applying the updates to the original matrix.
-
-

5.1.4 Pedagogical kernel source (in Fortran)

+
+

5.1.4 Pedagogical kernel source (in Fortran)

The following source code written in Fortran is inteded to illustrate how the kernel works. Even though the kernel is @@ -8095,8 +8095,8 @@ not be used in real workloads.

-
-
5.1.4.1 C interface (not directly exposed)
+
+
5.1.4.1 C interface (not directly exposed)

The function qmckl_sm_splitting_core_doc makes sure that @@ -8109,8 +8109,8 @@ exposed in qmckl.h and qmckl_f.F90, but

-
-

5.1.5 C headers (exposed in qmckl.h)

+
+

5.1.5 C headers (exposed in qmckl.h)

qmckl_exit_code qmckl_woodbury_3x3 (
@@ -8153,8 +8153,8 @@ exposed in qmckl.h and qmckl_f.F90, but
 
-
-

5.1.6 C sources

+
+

5.1.6 C sources

qmckl_exit_code qmckl_woodbury_3x3_hpc(const qmckl_context context,
@@ -8264,7 +8264,7 @@ exposed in qmckl.h and qmckl_f.F90, but
 
-
static inline qmckl_exit_code qmckl_woodbury_3x3_{Dim}(
+
static inline qmckl_exit_code qmckl_woodbury_3x3_{Dim}(
     const qmckl_context context,
     const double* restrict Updates,
     const uint64_t* restrict Updates_index,
@@ -10634,14 +10634,14 @@ exposed in qmckl.h and qmckl_f.F90, but
 
-
-

5.1.7 Fortran interfaces (exposed in qmcklf.F90)

+
+

5.1.7 Fortran interfaces (exposed in qmcklf.F90)

-
-

5.1.8 Performance

+
+

5.1.8 Performance

This function is most efficient when used in cases where there are only 3 rank-1 updates and @@ -10650,8 +10650,8 @@ it is sure they will not result in a singular matrix.

-
-

5.1.9 Tests

+
+

5.1.9 Tests

assert(Updates3 != NULL);
@@ -10688,17 +10688,17 @@ rc = QMCKL_SUCCESS;
 
-
-

6 Sherman-Morrison with Slagel Splitting

+
+

6 Sherman-Morrison with Slagel Splitting

-
-

6.1 qmckl_sm_splitting

+
+

6.1 qmckl_sm_splitting

-
-

6.1.1 Introduction

+
+

6.1.1 Introduction

This is a variation on the 'Naive' Sherman-Morrison kernel. Whenever the denominator \(1+v_j^T S^{-1} u_j\) in @@ -10722,10 +10722,10 @@ from applying the updates to the original matrix.

-
-

6.1.2 API

+
+

6.1.2 API

-
+
@@ -10813,8 +10813,8 @@ from applying the updates to the original matrix. -
-

6.1.3 Requirements

+
+

6.1.3 Requirements

  • context is not QMCKL_NULL_CONTEXT
  • @@ -10829,8 +10829,8 @@ from applying the updates to the original matrix.
-
-

6.1.4 Pedagogical kernel source (in Fortran)

+
+

6.1.4 Pedagogical kernel source (in Fortran)

The following source code written in Fortran is inteded to illustrate how the kernel works. Even though the kernel is @@ -10909,8 +10909,8 @@ not be used in real workloads.

-
-
6.1.4.1 C interface to the pedagogical kernel (not directly exposed)
+
+
6.1.4.1 C interface to the pedagogical kernel (not directly exposed)

The following Fortran function qmckl_sm_splitting_core_doc makes sure @@ -10923,8 +10923,8 @@ for C users and in the module file 'qmcklf.F90' for Fortran users.

-
-

6.1.5 C headers (exposed in qmckl.h)

+
+

6.1.5 C headers (exposed in qmckl.h)

qmckl_exit_code qmckl_sm_splitting (
@@ -10970,11 +10970,11 @@ for C users and in the module file 'qmcklf.F90' for Fortran users.
 
-
-

6.1.6 C source

+
+

6.1.6 C source

-
text="""
+
text="""
 case {Dim}: {
   rc = qmckl_sm_splitting_core_{Dim}(
       context,
@@ -11377,14 +11377,14 @@ for C users and in the module file 'qmcklf.F90' for Fortran users.
 
-
-

6.1.7 Fortran interfaces (exposed in qmcklf.F90)

+
+

6.1.7 Fortran interfaces (exposed in qmcklf.F90)

-
-

6.1.8 Performance…

+
+

6.1.8 Performance…

This kernel performs best when there are 2 or more rank-1 update cycles and fail-rate is high. @@ -11392,8 +11392,8 @@ This kernel performs best when there are 2 or more rank-1 update cycles and fail

-
-

6.1.9 Test

+
+

6.1.9 Test

assert(Updates3 != NULL);
@@ -11431,8 +11431,8 @@ rc = QMCKL_SUCCESS;
 
 
 
-
-

7 End of files

+
+

7 End of files

assert (qmckl_context_destroy(context) == QMCKL_SUCCESS);
@@ -11446,7 +11446,7 @@ rc = QMCKL_SUCCESS;
 

Author: TREX CoE

-

Created: 2024-12-09 Mon 14:46

+

Created: 2024-12-13 Fri 02:01

Validate

diff --git a/qmckl_tests.html b/qmckl_tests.html index 7fd7810..b469df2 100644 --- a/qmckl_tests.html +++ b/qmckl_tests.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Data for Tests @@ -246,27 +246,27 @@ for the JavaScript code in this tag.

Table of Contents

-
-

1 CHBrClF

+
+

1 CHBrClF

This test is the all-electron Hartree-Fock wave function of CHClBr, @@ -350,8 +350,8 @@ and with a high maximum angular momentum.

-
-

1.1 XYZ coordinates

+
+

1.1 XYZ coordinates

   5
@@ -381,8 +381,8 @@ Nuclear coordinates are stored in atomic units in transposed format.
 
-
-

1.2 Atomic basis set

+
+

1.2 Atomic basis set

 HYDROGEN
@@ -1301,8 +1301,8 @@ F   1
 
-
-

1.3 Molecular orbitals

+
+

1.3 Molecular orbitals

#define chbrclf_mo_num ((int64_t) 224)
@@ -1316,8 +1316,8 @@ F   1
 
-
-

1.4 Electron coordinates

+
+

1.4 Electron coordinates

Electron coordinates are stored in atomic units in normal format. @@ -1476,8 +1476,8 @@ Electron coordinates are stored in atomic units in normal format.

-
-

2 N2

+
+

2 N2

This test is mainly for the Jastrow factor and was supplied by @@ -1518,8 +1518,8 @@ treated by pseudopotentials thus excluded from the actual calculation.

-
-

2.1 XYZ coordinates

+
+

2.1 XYZ coordinates

   2
@@ -1546,8 +1546,8 @@ Nuclear coordinates are stored in atomic units in transposed format.
 
-
-

2.2 Electron coordinates

+
+

2.2 Electron coordinates

Electron coordinates are stored in atomic units in normal format. @@ -1557,9 +1557,19 @@ Electron coordinates are stored in atomic units in normal format.

#define n2_elec_up_num  ((int64_t) 5)
 #define n2_elec_dn_num  ((int64_t) 5)
 #define n2_elec_num     ((int64_t) 10)
-#define n2_walk_num     ((int64_t) 1)
+#define n2_walk_num     ((int64_t) 2)
 
 double n2_elec_coord[n2_walk_num][n2_elec_num][3] = { {
+    {-0.250655104764153      ,  0.503070975550133      ,  -0.166554344502303},
+    {-0.587812193472177      , -0.128751981129274      ,   0.187773606533075},
+    { 1.61335569047166       , -0.615556732874863      ,  -1.43165470979934 },
+    {-4.901239896295210E-003 , -1.120440036458986E-002 ,   1.99761909330422 },
+    { 0.766647499681200      , -0.293515395797937      ,   3.66454589201239 },
+    {-0.127732483187947      , -0.138975497694196      ,  -8.669850480215846E-002},
+    {-0.232271834949124      , -1.059321673434182E-002 ,  -0.504862241464867},
+    { 1.09360863531826       , -2.036103063808752E-003 ,  -2.702796910818986E-002},
+    {-0.108090166832043      ,  0.189161729653261      ,   2.15398313919894},
+    { 0.397978144318712      , -0.254277292595981      ,   2.54553335476344}},{
     {-0.250655104764153      ,  0.503070975550133      ,  -0.166554344502303},
     {-0.587812193472177      , -0.128751981129274      ,   0.187773606533075},
     { 1.61335569047166       , -0.615556732874863      ,  -1.43165470979934 },
@@ -1576,8 +1586,8 @@ Electron coordinates are stored in atomic units in normal format.
 
-
-

2.3 Jastrow related data

+
+

2.3 Jastrow related data

This test is mainly for the Jastrow factor and was supplied by @@ -1676,7 +1686,7 @@ Ramon Panades Baruetta.

-

Created: 2024-12-09 Mon 14:46

+

Created: 2024-12-13 Fri 02:01

Validate

diff --git a/qmckl_trexio.html b/qmckl_trexio.html index 69105d6..7e9a192 100644 --- a/qmckl_trexio.html +++ b/qmckl_trexio.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + TREXIO I/O library @@ -324,53 +324,53 @@ for the JavaScript code in this tag.

Table of Contents

-
-

1 Local functions

+
+

1 Local functions

Functions defined in this section are all local: they should not be @@ -403,8 +403,8 @@ In the functions defined in this section, we use as local variables

-
-

1.1 Open file

+
+

1.1 Open file

We first define a helper function to open a file by first trying to @@ -442,8 +442,8 @@ groups of data by passing the trexio_t handle.

-
-

1.2 Electron

+
+

1.2 Electron

In this section we read all the data into the electron data structure. @@ -494,8 +494,8 @@ We read the number of up-spin and down-spin electrons.

-
-

1.3 Nucleus

+
+

1.3 Nucleus

In this section we read the number of nuclei, the molecular geometry and nuclear charges. @@ -515,8 +515,8 @@ In this section we read the number of nuclei, the molecular geometry and nuclear

-
-

1.3.1 Number of nuclei

+
+

1.3.1 Number of nuclei

int64_t nucleus_num = 0L;
@@ -539,8 +539,8 @@ rc = qmckl_set_nucleus_num(context, nucleus_num);
 
-
-

1.3.2 Nuclear charges

+
+

1.3.2 Nuclear charges

{
@@ -580,8 +580,8 @@ rc = qmckl_set_nucleus_num(context, nucleus_num);
 
-
-

1.3.3 Nuclear coordinates

+
+

1.3.3 Nuclear coordinates

Now, we read the molecular geometry. It is stored in normal format @@ -636,8 +636,8 @@ in the TREXIO file ('N'), so it will be automatically transposed in

-
-

1.4 Basis set and AOs

+
+

1.4 Basis set and AOs

In this section we read the atomic basis set and atomic orbitals. @@ -663,8 +663,8 @@ In this section we read the atomic basis set and atomic orbitals.

-
-

1.4.1 Basis set type

+
+

1.4.1 Basis set type

#define MAX_STR_LEN 1024
@@ -695,8 +695,8 @@ In this section we read the atomic basis set and atomic orbitals.
 
-
-

1.4.2 Number of shells

+
+

1.4.2 Number of shells

int64_t shell_num = 0L;
@@ -720,8 +720,8 @@ rc = qmckl_set_ao_basis_shell_num(context, shell_num);
 
-
-

1.4.3 Number of primitives

+
+

1.4.3 Number of primitives

int64_t prim_num = 0L;
@@ -745,8 +745,8 @@ rc = qmckl_set_ao_basis_prim_num(context, prim_num);
 
-
-

1.4.4 Number of atomic orbitals

+
+

1.4.4 Number of atomic orbitals

int64_t ao_num = 0;
@@ -770,8 +770,8 @@ rc = qmckl_set_ao_basis_ao_num(context, ao_num);
 
-
-

1.4.5 Nucleusindex array

+
+

1.4.5 Nucleusindex array

{
@@ -851,8 +851,8 @@ rc = qmckl_set_ao_basis_ao_num(context, ao_num);
 
-
-

1.4.6 Number of shells per nucleus

+
+

1.4.6 Number of shells per nucleus

{
@@ -937,8 +937,8 @@ rc = qmckl_set_ao_basis_ao_num(context, ao_num);
 
-
-

1.4.7 Angular momentum

+
+

1.4.7 Angular momentum

{
@@ -983,8 +983,8 @@ rc = qmckl_set_ao_basis_ao_num(context, ao_num);
 
-
-

1.4.8 Number of primitives per shell

+
+

1.4.8 Number of primitives per shell

{
@@ -1070,8 +1070,8 @@ rc = qmckl_set_ao_basis_ao_num(context, ao_num);
 
-
-

1.4.9 Indices of the primitives

+
+

1.4.9 Indices of the primitives

{
@@ -1151,8 +1151,8 @@ rc = qmckl_set_ao_basis_ao_num(context, ao_num);
 
-
-

1.4.10 Normalization of the shells

+
+

1.4.10 Normalization of the shells

{
@@ -1197,8 +1197,8 @@ rc = qmckl_set_ao_basis_ao_num(context, ao_num);
 
-
-

1.4.11 Exponents

+
+

1.4.11 Exponents

{
@@ -1243,8 +1243,8 @@ rc = qmckl_set_ao_basis_ao_num(context, ao_num);
 
-
-

1.4.12 Coefficients

+
+

1.4.12 Coefficients

{
@@ -1289,8 +1289,8 @@ rc = qmckl_set_ao_basis_ao_num(context, ao_num);
 
-
-

1.4.13 Normalization of the primitivies

+
+

1.4.13 Normalization of the primitivies

{
@@ -1335,8 +1335,8 @@ rc = qmckl_set_ao_basis_ao_num(context, ao_num);
 
-
-

1.4.14 AO Normalization

+
+

1.4.14 AO Normalization

{
@@ -1391,8 +1391,8 @@ rc = qmckl_set_ao_basis_ao_num(context, ao_num);
 
-
-

1.5 Molecular orbitals

+
+

1.5 Molecular orbitals

In this section we read the MO coefficients. @@ -1418,8 +1418,8 @@ In this section we read the MO coefficients.

-
-

1.5.1 Number of MOs

+
+

1.5.1 Number of MOs

int64_t mo_num = 0L;
@@ -1442,8 +1442,8 @@ rc = qmckl_set_mo_basis_mo_num(context, mo_num);
 
-
-

1.5.2 MO coefficients

+
+

1.5.2 MO coefficients

{
@@ -1492,12 +1492,12 @@ rc = qmckl_set_mo_basis_mo_num(context, mo_num);
 
-
-

1.6 TODO ECP

+
+

1.6 TODO ECP

-
-

2 Read everything

+
+

2 Read everything

qmckl_exit_code
@@ -1572,8 +1572,8 @@ rc = qmckl_set_mo_basis_mo_num(context, mo_num);
 
-
-

3 Test

+
+

3 Test

#ifdef HAVE_TREXIO
@@ -1597,8 +1597,8 @@ rc = qmckl_trexio_read(context, filename, 255);
 
-
-

3.0.1 Electrons

+
+

3.0.1 Electrons

printf("Electrons\n");
@@ -1616,8 +1616,8 @@ rc = qmckl_get_electron_down_num(context, &dn_num);
 
-
-

3.0.2 Nuclei

+
+

3.0.2 Nuclei

printf("Nuclei\n");
@@ -1657,8 +1657,8 @@ coord = NULL;
 
-
-

3.0.3 Atomic basis

+
+

3.0.3 Atomic basis

printf("Atomic basis\n");
@@ -1766,8 +1766,8 @@ prim_factor = NULL;
 
-
-

3.0.4 MO Basis

+
+

3.0.4 MO Basis

printf("MOs\n");
@@ -1798,7 +1798,7 @@ charge = NULL;
 

Author: TREX CoE

-

Created: 2024-12-09 Mon 14:46

+

Created: 2024-12-13 Fri 02:01

Validate

diff --git a/qmckl_verificarlo.html b/qmckl_verificarlo.html index e6c6685..10d62bc 100644 --- a/qmckl_verificarlo.html +++ b/qmckl_verificarlo.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Verificarlo CI @@ -324,22 +324,22 @@ for the JavaScript code in this tag.

Table of Contents

-
-

1 Verificarlo probes

+
+

1 Verificarlo probes

This file contains utility functions to enable the Verificarlo @@ -390,8 +390,8 @@ To learn more about Verificarlo CI :

-
-

1.1 Automatically initialize the vfc_probe object if VFC_CI is defined

+
+

1.1 Automatically initialize the vfc_probe object if VFC_CI is defined

void qmckl_init_probes();
@@ -409,8 +409,8 @@ To learn more about Verificarlo CI :
 
-
-

1.2 Standard probe, without check

+
+

1.2 Standard probe, without check

  • if VFC_CI is defined, place a standard probe
  • @@ -445,8 +445,8 @@ if VFC_CI is undefined, return false (no error)
-
-

1.3 Probe with absolute check

+
+

1.3 Probe with absolute check

  • if VFC_CI is defined, place a probe with an absolute check
  • @@ -486,8 +486,8 @@ and accuracy
-
-

1.4 Probe with relative check

+
+

1.4 Probe with relative check

  • if VFC_CI is defined, place a probe with a relative check
  • @@ -527,8 +527,8 @@ and accuracy
-
-

1.5 Automatically delete and dump the vfcprobe object if VFC_CI is defined

+
+

1.5 Automatically delete and dump the vfcprobe object if VFC_CI is defined

void qmckl_dump_probes();
@@ -547,8 +547,8 @@ and accuracy
 
-
-

2 Fortran wrappers

+
+

2 Fortran wrappers

bool qmckl_probe_f(
@@ -672,7 +672,7 @@ and accuracy
 

Author: TREX CoE

-

Created: 2024-12-09 Mon 14:46

+

Created: 2024-12-13 Fri 02:01

Validate