mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2025-01-03 10:06:09 +01:00
Changed variable kappa etc to rescaled_factor_kappa. #15
This commit is contained in:
parent
2e955f230d
commit
43197f390a
@ -796,18 +796,18 @@ assert(test_qmckl_dist(context) == QMCKL_SUCCESS);
|
||||
the leading dimension: ~[n][3]~ in C and ~(3,n)~ in Fortran.
|
||||
|
||||
#+NAME: qmckl_distance_rescaled_args
|
||||
| qmckl_context | context | in | Global state |
|
||||
| char | transa | in | Array ~A~ is ~'N'~: Normal, ~'T'~: Transposed |
|
||||
| char | transb | in | Array ~B~ is ~'N'~: Normal, ~'T'~: Transposed |
|
||||
| int64_t | m | in | Number of points in the first set |
|
||||
| int64_t | n | in | Number of points in the second set |
|
||||
| double | A[][lda] | in | Array containing the $m \times 3$ matrix $A$ |
|
||||
| int64_t | lda | in | Leading dimension of array ~A~ |
|
||||
| double | B[][ldb] | in | Array containing the $n \times 3$ matrix $B$ |
|
||||
| int64_t | ldb | in | Leading dimension of array ~B~ |
|
||||
| double | C[n][ldc] | out | Array containing the $m \times n$ matrix $C$ |
|
||||
| int64_t | ldc | in | Leading dimension of array ~C~ |
|
||||
| double | kappa | in | Factor for calculating rescaled distances |
|
||||
| qmckl_context | context | in | Global state |
|
||||
| char | transa | in | Array ~A~ is ~'N'~: Normal, ~'T'~: Transposed |
|
||||
| char | transb | in | Array ~B~ is ~'N'~: Normal, ~'T'~: Transposed |
|
||||
| int64_t | m | in | Number of points in the first set |
|
||||
| int64_t | n | in | Number of points in the second set |
|
||||
| double | A[][lda] | in | Array containing the $m \times 3$ matrix $A$ |
|
||||
| int64_t | lda | in | Leading dimension of array ~A~ |
|
||||
| double | B[][ldb] | in | Array containing the $n \times 3$ matrix $B$ |
|
||||
| int64_t | ldb | in | Leading dimension of array ~B~ |
|
||||
| double | C[n][ldc] | out | Array containing the $m \times n$ matrix $C$ |
|
||||
| int64_t | ldc | in | Leading dimension of array ~C~ |
|
||||
| double | rescale_factor_kappa | in | Factor for calculating rescaled distances |
|
||||
|
||||
*** Requirements
|
||||
|
||||
@ -841,13 +841,13 @@ assert(test_qmckl_dist(context) == QMCKL_SUCCESS);
|
||||
const int64_t ldb,
|
||||
double* const C,
|
||||
const int64_t ldc,
|
||||
const double kappa);
|
||||
const double rescale_factor_kappa);
|
||||
#+end_src
|
||||
|
||||
*** Source
|
||||
#+begin_src f90 :tangle (eval f)
|
||||
integer function qmckl_distance_rescaled_f(context, transa, transb, m, n, &
|
||||
A, LDA, B, LDB, C, LDC, kappa) &
|
||||
A, LDA, B, LDB, C, LDC, rescale_factor_kappa) &
|
||||
result(info)
|
||||
use qmckl
|
||||
implicit none
|
||||
@ -860,13 +860,13 @@ integer function qmckl_distance_rescaled_f(context, transa, transb, m, n, &
|
||||
real*8 , intent(in) :: B(ldb,*)
|
||||
integer*8 , intent(in) :: ldc
|
||||
real*8 , intent(out) :: C(ldc,*)
|
||||
real*8 , intent(in) :: kappa
|
||||
real*8 , intent(in) :: rescale_factor_kappa
|
||||
|
||||
integer*8 :: i,j
|
||||
real*8 :: x, y, z, dist, kappa_inv
|
||||
real*8 :: x, y, z, dist, rescale_factor_kappa_inv
|
||||
integer :: transab
|
||||
|
||||
kappa_inv = 1.0d0/kappa;
|
||||
rescale_factor_kappa_inv = 1.0d0/rescale_factor_kappa;
|
||||
|
||||
info = QMCKL_SUCCESS
|
||||
|
||||
@ -937,7 +937,7 @@ integer function qmckl_distance_rescaled_f(context, transa, transb, m, n, &
|
||||
y = A(2,i) - B(2,j)
|
||||
z = A(3,i) - B(3,j)
|
||||
dist = dsqrt(x*x + y*y + z*z)
|
||||
C(i,j) = (1.0d0 - dexp(-kappa * dist)) * kappa_inv
|
||||
C(i,j) = (1.0d0 - dexp(-rescale_factor_kappa * dist)) * rescale_factor_kappa_inv
|
||||
end do
|
||||
end do
|
||||
|
||||
@ -949,7 +949,7 @@ integer function qmckl_distance_rescaled_f(context, transa, transb, m, n, &
|
||||
y = A(i,2) - B(2,j)
|
||||
z = A(i,3) - B(3,j)
|
||||
dist = dsqrt(x*x + y*y + z*z)
|
||||
C(i,j) = (1.0d0 - dexp(-kappa * dist)) * kappa_inv
|
||||
C(i,j) = (1.0d0 - dexp(-rescale_factor_kappa * dist)) * rescale_factor_kappa_inv
|
||||
end do
|
||||
end do
|
||||
|
||||
@ -961,7 +961,7 @@ integer function qmckl_distance_rescaled_f(context, transa, transb, m, n, &
|
||||
y = A(2,i) - B(j,2)
|
||||
z = A(3,i) - B(j,3)
|
||||
dist = dsqrt(x*x + y*y + z*z)
|
||||
C(i,j) = (1.0d0 - dexp(-kappa * dist)) * kappa_inv
|
||||
C(i,j) = (1.0d0 - dexp(-rescale_factor_kappa * dist)) * rescale_factor_kappa_inv
|
||||
end do
|
||||
end do
|
||||
|
||||
@ -973,7 +973,7 @@ integer function qmckl_distance_rescaled_f(context, transa, transb, m, n, &
|
||||
y = A(i,2) - B(j,2)
|
||||
z = A(i,3) - B(j,3)
|
||||
dist = dsqrt(x*x + y*y + z*z)
|
||||
C(i,j) = (1.0d0 - dexp(-kappa * dist)) * kappa_inv
|
||||
C(i,j) = (1.0d0 - dexp(-rescale_factor_kappa * dist)) * rescale_factor_kappa_inv
|
||||
end do
|
||||
end do
|
||||
|
||||
@ -993,7 +993,7 @@ end function qmckl_distance_rescaled_f
|
||||
#+RESULTS:
|
||||
#+begin_src f90 :tangle (eval f) :comments org :exports none
|
||||
integer(c_int32_t) function qmckl_distance_rescaled &
|
||||
(context, transa, transb, m, n, A, lda, B, ldb, C, ldc, kappa) &
|
||||
(context, transa, transb, m, n, A, lda, B, ldb, C, ldc, rescale_factor_kappa) &
|
||||
bind(C) result(info)
|
||||
|
||||
use, intrinsic :: iso_c_binding
|
||||
@ -1010,11 +1010,11 @@ end function qmckl_distance_rescaled_f
|
||||
integer (c_int64_t) , intent(in) , value :: ldb
|
||||
real (c_double ) , intent(out) :: C(ldc,n)
|
||||
integer (c_int64_t) , intent(in) , value :: ldc
|
||||
real (c_double ) , intent(in) , value :: kappa
|
||||
real (c_double ) , intent(in) , value :: rescale_factor_kappa
|
||||
|
||||
integer(c_int32_t), external :: qmckl_distance_rescaled_f
|
||||
info = qmckl_distance_rescaled_f &
|
||||
(context, transa, transb, m, n, A, lda, B, ldb, C, ldc, kappa)
|
||||
(context, transa, transb, m, n, A, lda, B, ldb, C, ldc, rescale_factor_kappa)
|
||||
|
||||
end function qmckl_distance_rescaled
|
||||
#+end_src
|
||||
@ -1025,7 +1025,7 @@ end function qmckl_distance_rescaled_f
|
||||
#+begin_src f90 :tangle (eval fh_func) :comments org :exports none
|
||||
interface
|
||||
integer(c_int32_t) function qmckl_distance_rescaled &
|
||||
(context, transa, transb, m, n, A, lda, B, ldb, C, ldc, kappa) &
|
||||
(context, transa, transb, m, n, A, lda, B, ldb, C, ldc, rescale_factor_kappa) &
|
||||
bind(C)
|
||||
use, intrinsic :: iso_c_binding
|
||||
import
|
||||
@ -1042,7 +1042,7 @@ end function qmckl_distance_rescaled_f
|
||||
integer (c_int64_t) , intent(in) , value :: ldb
|
||||
real (c_double ) , intent(out) :: C(ldc,n)
|
||||
integer (c_int64_t) , intent(in) , value :: ldc
|
||||
real (c_double ) , intent(in) , value :: kappa
|
||||
real (c_double ) , intent(in) , value :: rescale_factor_kappa
|
||||
|
||||
end function qmckl_distance_rescaled
|
||||
end interface
|
||||
|
@ -68,8 +68,8 @@ int main() {
|
||||
| ~up_num~ | int64_t | Number of up-spin electrons |
|
||||
| ~down_num~ | int64_t | Number of down-spin electrons |
|
||||
| ~walk_num~ | int64_t | Number of walkers |
|
||||
| ~kappa_ee~ | double | The distance scaling factor |
|
||||
| ~kappa_en~ | double | The distance scaling factor |
|
||||
| ~rescale_factor_kappa_ee~ | double | The distance scaling factor |
|
||||
| ~rescale_factor_kappa_en~ | double | The distance scaling factor |
|
||||
| ~provided~ | bool | If true, ~electron~ is valid |
|
||||
| ~coord_new~ | double[walk_num][3][num] | New set of electron coordinates |
|
||||
| ~coord_old~ | double[walk_num][3][num] | Old set of electron coordinates |
|
||||
@ -91,8 +91,8 @@ typedef struct qmckl_electron_struct {
|
||||
int64_t up_num;
|
||||
int64_t down_num;
|
||||
int64_t walk_num;
|
||||
double kappa_ee;
|
||||
double kappa_en;
|
||||
double rescale_factor_kappa_ee;
|
||||
double rescale_factor_kappa_en;
|
||||
int64_t coord_new_date;
|
||||
int64_t ee_distance_date;
|
||||
int64_t en_distance_date;
|
||||
@ -287,23 +287,23 @@ qmckl_get_electron_walk_num (const qmckl_context context, int64_t* const walk_nu
|
||||
*** Scaling factors Kappa
|
||||
|
||||
#+begin_src c :comments org :tangle (eval h_func) :exports none
|
||||
qmckl_exit_code qmckl_get_kappa_ee (const qmckl_context context, double* const kappa_ee);
|
||||
qmckl_exit_code qmckl_get_kappa_en (const qmckl_context context, double* const kappa_en);
|
||||
qmckl_exit_code qmckl_get_kappa_ee (const qmckl_context context, double* const rescale_factor_kappa_ee);
|
||||
qmckl_exit_code qmckl_get_kappa_en (const qmckl_context context, double* const rescale_factor_kappa_en);
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :comments org :tangle (eval c) :noweb yes :exports none
|
||||
qmckl_exit_code
|
||||
qmckl_get_kappa_ee (const qmckl_context context, double* const kappa_ee) {
|
||||
qmckl_get_kappa_ee (const qmckl_context context, double* const rescale_factor_kappa_ee) {
|
||||
|
||||
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
|
||||
return QMCKL_INVALID_CONTEXT;
|
||||
}
|
||||
|
||||
if (kappa_ee == NULL) {
|
||||
if (rescale_factor_kappa_ee == NULL) {
|
||||
return qmckl_failwith( context,
|
||||
QMCKL_INVALID_ARG_2,
|
||||
"qmckl_get_kappa_ee",
|
||||
"kappa_ee is a null pointer");
|
||||
"rescale_factor_kappa_ee is a null pointer");
|
||||
}
|
||||
|
||||
qmckl_context_struct* const ctx = (qmckl_context_struct* const) context;
|
||||
@ -315,23 +315,23 @@ qmckl_get_kappa_ee (const qmckl_context context, double* const kappa_ee) {
|
||||
return QMCKL_NOT_PROVIDED;
|
||||
}
|
||||
|
||||
// TODO: assert (ctx->electron.kappa_ee > (double) 0);
|
||||
,*kappa_ee = ctx->electron.kappa_ee;
|
||||
// TODO: assert (ctx->electron.rescale_factor_kappa_ee > (double) 0);
|
||||
,*rescale_factor_kappa_ee = ctx->electron.rescale_factor_kappa_ee;
|
||||
return QMCKL_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
qmckl_exit_code
|
||||
qmckl_get_kappa_en (const qmckl_context context, double* const kappa_en) {
|
||||
qmckl_get_kappa_en (const qmckl_context context, double* const rescale_factor_kappa_en) {
|
||||
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
|
||||
return QMCKL_INVALID_CONTEXT;
|
||||
}
|
||||
|
||||
if (kappa_en == NULL) {
|
||||
if (rescale_factor_kappa_en == NULL) {
|
||||
return qmckl_failwith( context,
|
||||
QMCKL_INVALID_ARG_2,
|
||||
"qmckl_get_kappa_en",
|
||||
"kappa_en is a null pointer");
|
||||
"rescale_factor_kappa_en is a null pointer");
|
||||
}
|
||||
|
||||
qmckl_context_struct* const ctx = (qmckl_context_struct* const) context;
|
||||
@ -343,8 +343,8 @@ qmckl_get_kappa_en (const qmckl_context context, double* const kappa_en) {
|
||||
return QMCKL_NOT_PROVIDED;
|
||||
}
|
||||
|
||||
// TODO: assert (ctx->electron.kappa_en > (double) 0);
|
||||
,*kappa_en = ctx->electron.kappa_en;
|
||||
// TODO: assert (ctx->electron.rescale_factor_kappa_en > (double) 0);
|
||||
,*rescale_factor_kappa_en = ctx->electron.rescale_factor_kappa_en;
|
||||
return QMCKL_SUCCESS;
|
||||
}
|
||||
#+end_src
|
||||
@ -436,7 +436,7 @@ qmckl_get_electron_coord (const qmckl_context context, const char transp, double
|
||||
|
||||
#+begin_src c :comments org :tangle (eval h_func)
|
||||
qmckl_exit_code qmckl_set_electron_num (qmckl_context context, const int64_t up_num, const int64_t down_num);
|
||||
qmckl_exit_code qmckl_set_kappa (qmckl_context context, const double kappa_ee, const double kappa_en);
|
||||
qmckl_exit_code qmckl_set_kappa (qmckl_context context, const double rescale_factor_kappa_ee, const double rescale_factor_kappa_en);
|
||||
qmckl_exit_code qmckl_set_electron_walk_num (qmckl_context context, const int64_t walk_num);
|
||||
qmckl_exit_code qmckl_set_electron_coord (qmckl_context context, const char transp, const double* coord);
|
||||
#+end_src
|
||||
@ -552,29 +552,29 @@ qmckl_set_electron_walk_num(qmckl_context context, const int64_t walk_num) {
|
||||
#+begin_src c :comments org :tangle (eval c) :noweb yes :exports none
|
||||
qmckl_exit_code
|
||||
qmckl_set_kappa(qmckl_context context,
|
||||
const double kappa_ee,
|
||||
const double kappa_en) {
|
||||
const double rescale_factor_kappa_ee,
|
||||
const double rescale_factor_kappa_en) {
|
||||
<<pre2>>
|
||||
|
||||
// TODO: Check for 0 values
|
||||
//if (kappa_ee != 0) {
|
||||
//if (rescale_factor_kappa_ee != 0) {
|
||||
// return qmckl_failwith( context,
|
||||
// QMCKL_INVALID_ARG_2,
|
||||
// "qmckl_set_kappa",
|
||||
// "kappa_ee == 0");
|
||||
// "rescale_factor_kappa_ee == 0");
|
||||
//}
|
||||
|
||||
//if (kappa_en <= 0) {
|
||||
//if (rescale_factor_kappa_en <= 0) {
|
||||
// return qmckl_failwith( context,
|
||||
// QMCKL_INVALID_ARG_3,
|
||||
// "qmckl_set_kappa",
|
||||
// "kappa_en == 0");
|
||||
// "rescale_factor_kappa_en == 0");
|
||||
//}
|
||||
|
||||
int32_t mask = 1 << 2;
|
||||
|
||||
ctx->electron.kappa_ee = kappa_ee;
|
||||
ctx->electron.kappa_en = kappa_en;
|
||||
ctx->electron.rescale_factor_kappa_ee = rescale_factor_kappa_ee;
|
||||
ctx->electron.rescale_factor_kappa_en = rescale_factor_kappa_en;
|
||||
|
||||
<<post2>>
|
||||
}
|
||||
@ -680,14 +680,14 @@ int64_t walk_num = chbrclf_walk_num;
|
||||
int64_t elec_num = chbrclf_elec_num;
|
||||
int64_t elec_up_num = chbrclf_elec_up_num;
|
||||
int64_t elec_dn_num = chbrclf_elec_dn_num;
|
||||
double kappa_ee = 1.0; // TODO Get kappa_ee from chbrclf
|
||||
double kappa_en = 1.0; // TODO Get kappa_en from chbrclf
|
||||
double rescale_factor_kappa_ee = 1.0; // TODO Get rescale_factor_kappa_ee from chbrclf
|
||||
double rescale_factor_kappa_en = 1.0; // TODO Get rescale_factor_kappa_en from chbrclf
|
||||
double* elec_coord = &(chbrclf_elec_coord[0][0][0]);
|
||||
|
||||
int64_t nucl_num = chbrclf_nucl_num;
|
||||
double* charge = chbrclf_charge;
|
||||
double* nucl_coord = &(chbrclf_nucl_coord[0][0]);
|
||||
double nucl_kappa = 1.0; // TODO Change get kappa from chbrclf example
|
||||
double nucl_rescale_factor_kappa = 1.0; // TODO Change get rescale_factor_kappa from chbrclf example
|
||||
|
||||
/* --- */
|
||||
|
||||
@ -730,17 +730,17 @@ assert(rc == QMCKL_NOT_PROVIDED);
|
||||
rc = qmckl_get_kappa_en (context, &k_en);
|
||||
assert(rc == QMCKL_NOT_PROVIDED);
|
||||
|
||||
rc = qmckl_set_kappa (context, kappa_ee, kappa_en);
|
||||
rc = qmckl_set_kappa (context, rescale_factor_kappa_ee, rescale_factor_kappa_en);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
assert(!qmckl_electron_provided(context));
|
||||
|
||||
rc = qmckl_get_kappa_ee (context, &k_ee);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
assert(k_ee == kappa_ee);
|
||||
assert(k_ee == rescale_factor_kappa_ee);
|
||||
|
||||
rc = qmckl_get_kappa_en (context, &k_en);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
assert(k_en == kappa_en);
|
||||
assert(k_en == rescale_factor_kappa_en);
|
||||
|
||||
|
||||
int64_t w;
|
||||
@ -1080,7 +1080,7 @@ qmckl_exit_code qmckl_provide_ee_distance_rescaled(qmckl_context context)
|
||||
qmckl_exit_code rc =
|
||||
qmckl_compute_ee_distance_rescaled(context,
|
||||
ctx->electron.num,
|
||||
ctx->electron.kappa_en,
|
||||
ctx->electron.rescale_factor_kappa_en,
|
||||
ctx->electron.walk_num,
|
||||
ctx->electron.coord_new,
|
||||
ctx->electron.ee_distance_rescaled);
|
||||
@ -1105,19 +1105,20 @@ qmckl_exit_code qmckl_provide_ee_distance_rescaled(qmckl_context context)
|
||||
#+NAME: qmckl_ee_distance_rescaled_args
|
||||
| qmckl_context | context | in | Global state |
|
||||
| int64_t | elec_num | in | Number of electrons |
|
||||
| double | kappa_ee | in | Factor to rescale ee distances |
|
||||
| double | rescale_factor_kappa_ee | in | Factor to rescale ee distances |
|
||||
| int64_t | walk_num | in | Number of walkers |
|
||||
| double | coord[walk_num][3][elec_num] | in | Electron coordinates |
|
||||
| double | ee_distance[walk_num][elec_num][elec_num] | out | Electron-electron distances |
|
||||
|
||||
#+begin_src f90 :comments org :tangle (eval f) :noweb yes
|
||||
integer function qmckl_compute_ee_distance_rescaled_f(context, elec_num, kappa_ee, walk_num, coord, ee_distance_rescaled) &
|
||||
integer function qmckl_compute_ee_distance_rescaled_f(context, elec_num, rescale_factor_kappa_ee, walk_num, &
|
||||
coord, ee_distance_rescaled) &
|
||||
result(info)
|
||||
use qmckl
|
||||
implicit none
|
||||
integer(qmckl_context), intent(in) :: context
|
||||
integer*8 , intent(in) :: elec_num
|
||||
double precision , intent(in) :: kappa_ee
|
||||
double precision , intent(in) :: rescale_factor_kappa_ee
|
||||
integer*8 , intent(in) :: walk_num
|
||||
double precision , intent(in) :: coord(elec_num,3,walk_num)
|
||||
double precision , intent(out) :: ee_distance_rescaled(elec_num,elec_num,walk_num)
|
||||
@ -1145,7 +1146,7 @@ integer function qmckl_compute_ee_distance_rescaled_f(context, elec_num, kappa_e
|
||||
info = qmckl_distance_rescaled(context, 'T', 'T', elec_num, elec_num, &
|
||||
coord(1,1,k), elec_num, &
|
||||
coord(1,1,k), elec_num, &
|
||||
ee_distance_rescaled(1,1,k), elec_num, kappa_ee)
|
||||
ee_distance_rescaled(1,1,k), elec_num, rescale_factor_kappa_ee)
|
||||
if (info /= QMCKL_SUCCESS) then
|
||||
exit
|
||||
endif
|
||||
@ -1158,7 +1159,7 @@ end function qmckl_compute_ee_distance_rescaled_f
|
||||
qmckl_exit_code qmckl_compute_ee_distance_rescaled (
|
||||
const qmckl_context context,
|
||||
const int64_t elec_num,
|
||||
const double kappa_ee,
|
||||
const double rescale_factor_kappa_ee,
|
||||
const int64_t walk_num,
|
||||
const double* coord,
|
||||
double* const ee_distance_rescaled );
|
||||
@ -1169,7 +1170,7 @@ qmckl_exit_code qmckl_compute_ee_distance_rescaled (
|
||||
#+RESULTS:
|
||||
#+begin_src f90 :tangle (eval f) :comments org :exports none
|
||||
integer(c_int32_t) function qmckl_compute_ee_distance_rescaled &
|
||||
(context, elec_num, kappa_ee, walk_num, coord, ee_distance_rescaled) &
|
||||
(context, elec_num, rescale_factor_kappa_ee, walk_num, coord, ee_distance_rescaled) &
|
||||
bind(C) result(info)
|
||||
|
||||
use, intrinsic :: iso_c_binding
|
||||
@ -1177,14 +1178,14 @@ qmckl_exit_code qmckl_compute_ee_distance_rescaled (
|
||||
|
||||
integer (c_int64_t) , intent(in) , value :: context
|
||||
integer (c_int64_t) , intent(in) , value :: elec_num
|
||||
real (c_double ) , intent(in) , value :: kappa_ee
|
||||
real (c_double ) , intent(in) , value :: rescale_factor_kappa_ee
|
||||
integer (c_int64_t) , intent(in) , value :: walk_num
|
||||
real (c_double ) , intent(in) :: coord(elec_num,3,walk_num)
|
||||
real (c_double ) , intent(out) :: ee_distance_rescaled(elec_num,elec_num,walk_num)
|
||||
|
||||
integer(c_int32_t), external :: qmckl_compute_ee_distance_rescaled_f
|
||||
info = qmckl_compute_ee_distance_rescaled_f &
|
||||
(context, elec_num, kappa_ee, walk_num, coord, ee_distance_rescaled)
|
||||
(context, elec_num, rescale_factor_kappa_ee, walk_num, coord, ee_distance_rescaled)
|
||||
|
||||
end function qmckl_compute_ee_distance_rescaled
|
||||
#+end_src
|
||||
@ -1474,7 +1475,7 @@ assert(qmckl_electron_provided(context));
|
||||
rc = qmckl_set_nucleus_num (context, nucl_num);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
rc = qmckl_set_nucleus_kappa (context, nucl_kappa);
|
||||
rc = qmckl_set_nucleus_kappa (context, nucl_rescale_factor_kappa);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
rc = qmckl_set_nucleus_charge (context, charge);
|
||||
@ -1587,7 +1588,7 @@ qmckl_exit_code qmckl_provide_en_distance_rescaled(qmckl_context context)
|
||||
qmckl_compute_en_distance_rescaled(context,
|
||||
ctx->electron.num,
|
||||
ctx->nucleus.num,
|
||||
ctx->electron.kappa_en,
|
||||
ctx->electron.rescale_factor_kappa_en,
|
||||
ctx->electron.walk_num,
|
||||
ctx->electron.coord_new,
|
||||
ctx->nucleus.coord,
|
||||
@ -1614,14 +1615,14 @@ qmckl_exit_code qmckl_provide_en_distance_rescaled(qmckl_context context)
|
||||
| qmckl_context | context | in | Global state |
|
||||
| int64_t | elec_num | in | Number of electrons |
|
||||
| int64_t | nucl_num | in | Number of nuclei |
|
||||
| double | kappa_en | in | The factor for rescaled distances |
|
||||
| double | rescale_factor_kappa_en | in | The factor for rescaled distances |
|
||||
| int64_t | walk_num | in | Number of walkers |
|
||||
| double | elec_coord[walk_num][3][elec_num] | in | Electron coordinates |
|
||||
| double | nucl_coord[3][elec_num] | in | Nuclear coordinates |
|
||||
| double | en_distance_rescaled_date[walk_num][nucl_num][elec_num] | out | Electron-nucleus distances |
|
||||
|
||||
#+begin_src f90 :comments org :tangle (eval f) :noweb yes
|
||||
integer function qmckl_compute_en_distance_rescaled_f(context, elec_num, nucl_num, kappa_en, walk_num, elec_coord, &
|
||||
integer function qmckl_compute_en_distance_rescaled_f(context, elec_num, nucl_num, rescale_factor_kappa_en, walk_num, elec_coord, &
|
||||
nucl_coord, en_distance_rescaled) &
|
||||
result(info)
|
||||
use qmckl
|
||||
@ -1629,7 +1630,7 @@ integer function qmckl_compute_en_distance_rescaled_f(context, elec_num, nucl_nu
|
||||
integer(qmckl_context), intent(in) :: context
|
||||
integer*8 , intent(in) :: elec_num
|
||||
integer*8 , intent(in) :: nucl_num
|
||||
double precision , intent(in) :: kappa_en
|
||||
double precision , intent(in) :: rescale_factor_kappa_en
|
||||
integer*8 , intent(in) :: walk_num
|
||||
double precision , intent(in) :: elec_coord(elec_num,3,walk_num)
|
||||
double precision , intent(in) :: nucl_coord(nucl_num,3)
|
||||
@ -1655,7 +1656,7 @@ integer function qmckl_compute_en_distance_rescaled_f(context, elec_num, nucl_nu
|
||||
endif
|
||||
|
||||
! TODO: comparison with 0
|
||||
!if (kappa_en <= 0) then
|
||||
!if (rescale_factor_kappa_en <= 0) then
|
||||
! info = QMCKL_INVALID_ARG_4
|
||||
! return
|
||||
!endif
|
||||
@ -1669,7 +1670,7 @@ integer function qmckl_compute_en_distance_rescaled_f(context, elec_num, nucl_nu
|
||||
info = qmckl_distance_rescaled(context, 'T', 'T', elec_num, nucl_num, &
|
||||
elec_coord(1,1,k), elec_num, &
|
||||
nucl_coord, nucl_num, &
|
||||
en_distance_rescaled(1,1,k), elec_num, kappa_en)
|
||||
en_distance_rescaled(1,1,k), elec_num, rescale_factor_kappa_en)
|
||||
if (info /= QMCKL_SUCCESS) then
|
||||
exit
|
||||
endif
|
||||
@ -1683,7 +1684,7 @@ qmckl_exit_code qmckl_compute_en_distance_rescaled (
|
||||
const qmckl_context context,
|
||||
const int64_t elec_num,
|
||||
const int64_t nucl_num,
|
||||
const double kappa_en,
|
||||
const double rescale_factor_kappa_en,
|
||||
const int64_t walk_num,
|
||||
const double* elec_coord,
|
||||
const double* nucl_coord,
|
||||
@ -1695,7 +1696,7 @@ qmckl_exit_code qmckl_compute_en_distance_rescaled (
|
||||
#+RESULTS:
|
||||
#+begin_src f90 :tangle (eval f) :comments org :exports none
|
||||
integer(c_int32_t) function qmckl_compute_en_distance_rescaled &
|
||||
(context, elec_num, nucl_num, kappa_en, walk_num, elec_coord, nucl_coord, en_distance_rescaled) &
|
||||
(context, elec_num, nucl_num, rescale_factor_kappa_en, walk_num, elec_coord, nucl_coord, en_distance_rescaled) &
|
||||
bind(C) result(info)
|
||||
|
||||
use, intrinsic :: iso_c_binding
|
||||
@ -1704,7 +1705,7 @@ qmckl_exit_code qmckl_compute_en_distance_rescaled (
|
||||
integer (c_int64_t) , intent(in) , value :: context
|
||||
integer (c_int64_t) , intent(in) , value :: elec_num
|
||||
integer (c_int64_t) , intent(in) , value :: nucl_num
|
||||
real (c_double ) , intent(in) , value :: kappa_en
|
||||
real (c_double ) , intent(in) , value :: rescale_factor_kappa_en
|
||||
integer (c_int64_t) , intent(in) , value :: walk_num
|
||||
real (c_double ) , intent(in) :: elec_coord(elec_num,3,walk_num)
|
||||
real (c_double ) , intent(in) :: nucl_coord(elec_num,3)
|
||||
@ -1712,7 +1713,7 @@ qmckl_exit_code qmckl_compute_en_distance_rescaled (
|
||||
|
||||
integer(c_int32_t), external :: qmckl_compute_en_distance_rescaled_f
|
||||
info = qmckl_compute_en_distance_rescaled_f &
|
||||
(context, elec_num, nucl_num, kappa_en, walk_num, elec_coord, nucl_coord, en_distance_rescaled)
|
||||
(context, elec_num, nucl_num, rescale_factor_kappa_en, walk_num, elec_coord, nucl_coord, en_distance_rescaled)
|
||||
|
||||
end function qmckl_compute_en_distance_rescaled
|
||||
#+end_src
|
||||
@ -1752,7 +1753,7 @@ assert(qmckl_electron_provided(context));
|
||||
rc = qmckl_set_nucleus_num (context, nucl_num);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
rc = qmckl_set_nucleus_kappa (context, nucl_kappa);
|
||||
rc = qmckl_set_nucleus_kappa (context, nucl_rescale_factor_kappa);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
rc = qmckl_set_nucleus_charge (context, charge);
|
||||
|
@ -73,7 +73,7 @@ int main() {
|
||||
| ~nn_distance_rescaled_date~ | int64_t | Date when Nucleus-nucleus rescaled distances were computed |
|
||||
| ~repulsion~ | double | Nuclear repulsion energy |
|
||||
| ~repulsion_date~ | int64_t | Date when the nuclear repulsion energy was computed |
|
||||
| ~kappa~ | double | The distance scaling factor |
|
||||
| ~rescale_factor_kappa~ | double | The distance scaling factor |
|
||||
|
||||
** Data structure
|
||||
|
||||
@ -88,7 +88,7 @@ typedef struct qmckl_nucleus_struct {
|
||||
double* nn_distance;
|
||||
double* nn_distance_rescaled;
|
||||
double repulsion;
|
||||
double kappa;
|
||||
double rescale_factor_kappa;
|
||||
int32_t uninitialized;
|
||||
bool provided;
|
||||
} qmckl_nucleus_struct;
|
||||
@ -104,7 +104,7 @@ typedef struct qmckl_nucleus_struct {
|
||||
#+begin_src c :comments org :tangle (eval h_func) :exports none
|
||||
qmckl_exit_code qmckl_get_nucleus_num (const qmckl_context context, int64_t* const num);
|
||||
qmckl_exit_code qmckl_get_nucleus_charge (const qmckl_context context, double* const charge);
|
||||
qmckl_exit_code qmckl_get_nucleus_kappa (const qmckl_context context, double* const kappa);
|
||||
qmckl_exit_code qmckl_get_nucleus_kappa (const qmckl_context context, double* const rescale_factor_kappa);
|
||||
qmckl_exit_code qmckl_get_nucleus_coord (const qmckl_context context, const char transp, double* const coord);
|
||||
#+end_src
|
||||
|
||||
@ -187,7 +187,7 @@ qmckl_get_nucleus_charge (const qmckl_context context, double* const charge) {
|
||||
|
||||
|
||||
qmckl_exit_code
|
||||
qmckl_get_nucleus_kappa (const qmckl_context context, double* const kappa) {
|
||||
qmckl_get_nucleus_kappa (const qmckl_context context, double* const rescale_factor_kappa) {
|
||||
|
||||
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
|
||||
return QMCKL_INVALID_CONTEXT;
|
||||
@ -205,7 +205,7 @@ qmckl_get_nucleus_kappa (const qmckl_context context, double* const kappa) {
|
||||
"nucleus data is not provided");
|
||||
}
|
||||
|
||||
(*kappa) = ctx->nucleus.kappa;
|
||||
(*rescale_factor_kappa) = ctx->nucleus.rescale_factor_kappa;
|
||||
|
||||
return QMCKL_SUCCESS;
|
||||
}
|
||||
@ -295,7 +295,7 @@ bool qmckl_nucleus_provided(const qmckl_context context) {
|
||||
#+begin_src c :comments org :tangle (eval h_func)
|
||||
qmckl_exit_code qmckl_set_nucleus_num (qmckl_context context, const int64_t num);
|
||||
qmckl_exit_code qmckl_set_nucleus_charge (qmckl_context context, const double* charge);
|
||||
qmckl_exit_code qmckl_set_nucleus_kappa (qmckl_context context, const double kappa);
|
||||
qmckl_exit_code qmckl_set_nucleus_kappa (qmckl_context context, const double rescale_factor_kappa);
|
||||
qmckl_exit_code qmckl_set_nucleus_coord (qmckl_context context, const char transp, const double* coord);
|
||||
#+end_src
|
||||
|
||||
@ -388,15 +388,15 @@ qmckl_set_nucleus_charge(qmckl_context context, const double* charge) {
|
||||
|
||||
#+begin_src c :comments org :tangle (eval c) :noweb yes :exports none
|
||||
qmckl_exit_code
|
||||
qmckl_set_nucleus_kappa(qmckl_context context, const double kappa) {
|
||||
qmckl_set_nucleus_kappa(qmckl_context context, const double rescale_factor_kappa) {
|
||||
<<pre2>>
|
||||
|
||||
//TODO: Check for small values of kappa
|
||||
//if (kappa == 0) {
|
||||
//if (rescale_factor_kappa == 0) {
|
||||
// return qmckl_failwith( context,
|
||||
// QMCKL_INVALID_ARG_2,
|
||||
// "qmckl_set_nucleus_kappa",
|
||||
// "kappa cannot be 0");
|
||||
// "rescale_factor_kappa cannot be 0");
|
||||
//}
|
||||
|
||||
int32_t mask = 1 << 2;
|
||||
@ -404,7 +404,7 @@ qmckl_set_nucleus_kappa(qmckl_context context, const double kappa) {
|
||||
int64_t num;
|
||||
qmckl_exit_code rc;
|
||||
|
||||
ctx->nucleus.kappa = kappa;
|
||||
ctx->nucleus.rescale_factor_kappa = rescale_factor_kappa;
|
||||
|
||||
<<post2>>
|
||||
}
|
||||
@ -462,7 +462,7 @@ qmckl_set_nucleus_coord(qmckl_context context, const char transp, const double*
|
||||
const int64_t nucl_num = chbrclf_nucl_num;
|
||||
const double* nucl_charge = chbrclf_charge;
|
||||
const double* nucl_coord = &(chbrclf_nucl_coord[0][0]);
|
||||
const double nucl_kappa = 1.0; // TODO Change get kappa from chbrclf example
|
||||
const double nucl_rescale_factor_kappa = 1.0; // TODO Change get rescale_factor_kappa from chbrclf example
|
||||
|
||||
/* --- */
|
||||
|
||||
@ -488,13 +488,13 @@ rc = qmckl_get_nucleus_kappa (context, &k);
|
||||
assert(rc == QMCKL_NOT_PROVIDED);
|
||||
|
||||
|
||||
rc = qmckl_set_nucleus_kappa (context, nucl_kappa);
|
||||
rc = qmckl_set_nucleus_kappa (context, nucl_rescale_factor_kappa);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
assert(!qmckl_nucleus_provided(context));
|
||||
|
||||
rc = qmckl_get_nucleus_kappa (context, &k);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
assert(k == nucl_kappa);
|
||||
assert(k == nucl_rescale_factor_kappa);
|
||||
|
||||
double nucl_coord2[3*nucl_num];
|
||||
|
||||
@ -780,7 +780,7 @@ qmckl_exit_code qmckl_provide_nn_distance_rescaled(qmckl_context context)
|
||||
qmckl_exit_code rc =
|
||||
qmckl_compute_nn_distance_rescaled(context,
|
||||
ctx->nucleus.num,
|
||||
ctx->nucleus.kappa,
|
||||
ctx->nucleus.rescale_factor_kappa,
|
||||
ctx->nucleus.coord,
|
||||
ctx->nucleus.nn_distance_rescaled);
|
||||
if (rc != QMCKL_SUCCESS) {
|
||||
@ -802,13 +802,13 @@ qmckl_exit_code qmckl_provide_nn_distance_rescaled(qmckl_context context)
|
||||
| double | nn_distance_rescaled[nucl_num][nucl_num] | out | Nucleus-nucleus rescaled distances (au) |
|
||||
|
||||
#+begin_src f90 :comments org :tangle (eval f) :noweb yes
|
||||
integer function qmckl_compute_nn_distance_rescaled_f(context, nucl_num, kappa, coord, nn_distance_rescaled) &
|
||||
integer function qmckl_compute_nn_distance_rescaled_f(context, nucl_num, rescale_factor_kappa, coord, nn_distance_rescaled) &
|
||||
result(info)
|
||||
use qmckl
|
||||
implicit none
|
||||
integer(qmckl_context), intent(in) :: context
|
||||
integer*8 , intent(in) :: nucl_num
|
||||
double precision , intent(in) :: kappa
|
||||
double precision , intent(in) :: rescale_factor_kappa
|
||||
double precision , intent(in) :: coord(nucl_num,3)
|
||||
double precision , intent(out) :: nn_distance_rescaled(nucl_num,nucl_num)
|
||||
|
||||
@ -829,7 +829,7 @@ integer function qmckl_compute_nn_distance_rescaled_f(context, nucl_num, kappa,
|
||||
info = qmckl_distance_rescaled(context, 'T', 'T', nucl_num, nucl_num, &
|
||||
coord, nucl_num, &
|
||||
coord, nucl_num, &
|
||||
nn_distance_rescaled, nucl_num, kappa)
|
||||
nn_distance_rescaled, nucl_num, rescale_factor_kappa)
|
||||
|
||||
end function qmckl_compute_nn_distance_rescaled_f
|
||||
#+end_src
|
||||
@ -838,7 +838,7 @@ end function qmckl_compute_nn_distance_rescaled_f
|
||||
qmckl_exit_code qmckl_compute_nn_distance_rescaled (
|
||||
const qmckl_context context,
|
||||
const int64_t nucl_num,
|
||||
const double kappa,
|
||||
const double rescale_factor_kappa,
|
||||
const double* coord,
|
||||
double* const nn_distance_rescaled );
|
||||
#+end_src
|
||||
@ -849,7 +849,7 @@ qmckl_exit_code qmckl_compute_nn_distance_rescaled (
|
||||
#+RESULTS:
|
||||
#+begin_src f90 :tangle (eval f) :comments org :exports none
|
||||
integer(c_int32_t) function qmckl_compute_nn_distance_rescaled &
|
||||
(context, nucl_num, kappa, coord, nn_distance_rescaled) &
|
||||
(context, nucl_num, rescale_factor_kappa, coord, nn_distance_rescaled) &
|
||||
bind(C) result(info)
|
||||
|
||||
use, intrinsic :: iso_c_binding
|
||||
@ -857,13 +857,13 @@ qmckl_exit_code qmckl_compute_nn_distance_rescaled (
|
||||
|
||||
integer (c_int64_t) , intent(in) , value :: context
|
||||
integer (c_int64_t) , intent(in) , value :: nucl_num
|
||||
real (c_double ) , intent(in) , value :: kappa
|
||||
real (c_double ) , intent(in) , value :: rescale_factor_kappa
|
||||
real (c_double ) , intent(in) :: coord(nucl_num,3)
|
||||
real (c_double ) , intent(out) :: nn_distance_rescaled(nucl_num,nucl_num)
|
||||
|
||||
integer(c_int32_t), external :: qmckl_compute_nn_distance_rescaled_f
|
||||
info = qmckl_compute_nn_distance_rescaled_f &
|
||||
(context, nucl_num, kappa, coord, nn_distance_rescaled)
|
||||
(context, nucl_num, rescale_factor_kappa, coord, nn_distance_rescaled)
|
||||
|
||||
end function qmckl_compute_nn_distance_rescaled
|
||||
#+end_src
|
||||
|
Loading…
Reference in New Issue
Block a user