mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2025-01-03 18:16:28 +01:00
Fix merge issue with qmckl_ao.org
This commit is contained in:
parent
c84deac647
commit
3cf86817f4
@ -65,7 +65,6 @@ gradients and Laplacian of the atomic basis functions.
|
||||
#include "chbrclf.h"
|
||||
#include "qmckl_ao_private_func.h"
|
||||
|
||||
|
||||
int main() {
|
||||
qmckl_context context;
|
||||
context = qmckl_context_create();
|
||||
@ -119,7 +118,6 @@ int main() {
|
||||
|
||||
Computed data:
|
||||
|
||||
|
||||
|--------------------------+----------------------------+-----------------------------------------------------------------------------------------------|
|
||||
| ~coefficient_normalized~ | ~[prim_num]~ | Normalized primitive coefficients |
|
||||
| ~nucleus_prim_index~ | ~[nucl_num]~ | Index of the first primitive for each nucleus |
|
||||
@ -138,7 +136,6 @@ int main() {
|
||||
| ~coeff_norm_sorted~ | ~[prim_num]~ | Array of normalized coefficients for sorted primitives |
|
||||
| ~prim_factor_sorted~ | ~[prim_num]~ | Normalization factors of the sorted primtives |
|
||||
|
||||
|
||||
For H_2 with the following basis set,
|
||||
|
||||
#+NAME: basis
|
||||
@ -1747,7 +1744,6 @@ end function qmckl_ao_gaussian_vgl
|
||||
# Test
|
||||
#+begin_src f90 :tangle (eval f_test)
|
||||
integer(c_int32_t) function test_qmckl_ao_gaussian_vgl(context) bind(C)
|
||||
|
||||
use qmckl
|
||||
use qmckl_probes_f
|
||||
|
||||
@ -1783,6 +1779,7 @@ integer(c_int32_t) function test_qmckl_ao_gaussian_vgl(context) bind(C)
|
||||
A(i) = 0.0013 * dble(ishft(1,i))
|
||||
end do
|
||||
|
||||
|
||||
test_qmckl_ao_gaussian_vgl = &
|
||||
qmckl_ao_gaussian_vgl(context, X, R, n, A, VGL, ldv)
|
||||
|
||||
@ -1837,8 +1834,8 @@ integer(c_int32_t) function test_qmckl_ao_gaussian_vgl(context) bind(C)
|
||||
#endif
|
||||
|
||||
test_qmckl_ao_gaussian_vgl = 0
|
||||
deallocate(VGL)
|
||||
|
||||
deallocate(VGL)
|
||||
end function test_qmckl_ao_gaussian_vgl
|
||||
#+end_src
|
||||
|
||||
@ -1959,7 +1956,6 @@ qmckl_exit_code qmckl_provide_ao_basis_primitive_vgl(qmckl_context context)
|
||||
:END:
|
||||
|
||||
#+NAME: qmckl_ao_basis_primitive_gaussian_vgl_args
|
||||
|
||||
| qmckl_context | context | in | Global state |
|
||||
| int64_t | prim_num | in | Number of primitives |
|
||||
| int64_t | elec_num | in | Number of electrons |
|
||||
@ -1969,7 +1965,7 @@ qmckl_exit_code qmckl_provide_ao_basis_primitive_vgl(qmckl_context context)
|
||||
| double | nucl_coord[3][elec_num] | in | Nuclear coordinates |
|
||||
| double | expo[prim_num] | in | Exponents of the primitives |
|
||||
| double | primitive_vgl[5][elec_num][prim_num] | out | Value, gradients and Laplacian of the primitives |
|
||||
|
||||
|
||||
#+begin_src f90 :comments org :tangle (eval f) :noweb yes
|
||||
integer function qmckl_compute_ao_basis_primitive_gaussian_vgl_f(context, &
|
||||
prim_num, elec_num, nucl_num, &
|
||||
@ -1998,11 +1994,10 @@ integer function qmckl_compute_ao_basis_primitive_gaussian_vgl_f(context, &
|
||||
do inucl=1,nucl_num
|
||||
! C is zero-based, so shift bounds by one
|
||||
do iprim = nucleus_prim_index(inucl)+1, nucleus_prim_index(inucl+1)
|
||||
|
||||
do ielec = 1, elec_num
|
||||
x = elec_coord(ielec,1) - nucl_coord(inucl,1)
|
||||
y = elec_coord(ielec,2) - nucl_coord(inucl,2)
|
||||
z = elec_coord(ielec,3) - nucl_coord(inucl,3)
|
||||
x = elec_coord(ielec,1) - nucl_coord(inucl,1)
|
||||
y = elec_coord(ielec,2) - nucl_coord(inucl,2)
|
||||
z = elec_coord(ielec,3) - nucl_coord(inucl,3)
|
||||
|
||||
r2 = x*x + y*y + z*z
|
||||
ar2 = expo(iprim)*r2
|
||||
@ -2012,7 +2007,7 @@ integer function qmckl_compute_ao_basis_primitive_gaussian_vgl_f(context, &
|
||||
two_a = -2.d0 * expo(iprim) * v
|
||||
|
||||
primitive_vgl(iprim, ielec, 1) = v
|
||||
primitive_vgl(iprim, ielec, 2) = two_a * x
|
||||
primitive_vgl(iprim, ielec, 2) = two_a * x
|
||||
primitive_vgl(iprim, ielec, 3) = two_a * y
|
||||
primitive_vgl(iprim, ielec, 4) = two_a * z
|
||||
primitive_vgl(iprim, ielec, 5) = two_a * (3.d0 - 2.d0*ar2)
|
||||
@ -2160,7 +2155,7 @@ assert( fabs(prim_vgl[1][26][7] - (-7.5014974095310560E-004)) < 1.e-14 );
|
||||
assert( fabs(prim_vgl[2][26][7] - (-3.8250692897610380E-003)) < 1.e-14 );
|
||||
assert( fabs(prim_vgl[3][26][7] - ( 3.4950559194080275E-003)) < 1.e-14 );
|
||||
assert( fabs(prim_vgl[4][26][7] - ( 2.0392163767356572E-002)) < 1.e-14 );
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -2173,14 +2168,13 @@ assert( fabs(prim_vgl[4][26][7] - ( 2.0392163767356572E-002)) < 1.e-14 );
|
||||
// l : primitives
|
||||
|
||||
k=0;
|
||||
|
||||
for (j=0 ; j<elec_num ; ++j) {
|
||||
for (i=0 ; i<nucl_num ; ++i) {
|
||||
|
||||
|
||||
r2 = nucl_elec_dist[i][j];
|
||||
|
||||
|
||||
if (r2 < nucl_radius2[i]) {
|
||||
|
||||
|
||||
for (l=0 ; l<prim_num ; ++l) {
|
||||
tmp[k].i = i;
|
||||
tmp[k].j = j;
|
||||
@ -2332,7 +2326,6 @@ qmckl_exit_code qmckl_provide_ao_basis_shell_vgl(qmckl_context context)
|
||||
:END:
|
||||
|
||||
#+NAME: qmckl_ao_basis_shell_gaussian_vgl_args
|
||||
|
||||
| ~qmckl_context~ | ~context~ | in | Global state |
|
||||
| ~int64_t~ | ~prim_num~ | in | Number of primitives |
|
||||
| ~int64_t~ | ~shell_num~ | in | Number of shells |
|
||||
@ -2347,7 +2340,7 @@ qmckl_exit_code qmckl_provide_ao_basis_shell_vgl(qmckl_context context)
|
||||
| ~double~ | ~expo[prim_num]~ | in | Exponents of the primitives |
|
||||
| ~double~ | ~coef_normalized[prim_num]~ | in | Coefficients of the primitives |
|
||||
| ~double~ | ~shell_vgl[5][elec_num][shell_num]~ | out | Value, gradients and Laplacian of the shells |
|
||||
|
||||
|
||||
#+begin_src f90 :comments org :tangle (eval f) :noweb yes
|
||||
integer function qmckl_compute_ao_basis_shell_gaussian_vgl_f(context, &
|
||||
prim_num, shell_num, elec_num, nucl_num, &
|
||||
@ -2382,12 +2375,11 @@ integer function qmckl_compute_ao_basis_shell_gaussian_vgl_f(context, &
|
||||
|
||||
do inucl=1,nucl_num
|
||||
|
||||
|
||||
do ielec = 1, elec_num
|
||||
|
||||
x = elec_coord(ielec,1) - nucl_coord(inucl,1)
|
||||
y = elec_coord(ielec,2) - nucl_coord(inucl,2)
|
||||
z = elec_coord(ielec,3) - nucl_coord(inucl,3)
|
||||
x = elec_coord(ielec,1) - nucl_coord(inucl,1)
|
||||
y = elec_coord(ielec,2) - nucl_coord(inucl,2)
|
||||
z = elec_coord(ielec,3) - nucl_coord(inucl,3)
|
||||
|
||||
r2 = x*x + y*y + z*z
|
||||
|
||||
@ -2410,18 +2402,17 @@ integer function qmckl_compute_ao_basis_shell_gaussian_vgl_f(context, &
|
||||
v = coef_normalized(iprim) * dexp(-ar2)
|
||||
two_a = -2.d0 * expo(iprim) * v
|
||||
|
||||
|
||||
shell_vgl(ishell, ielec, 1) = &
|
||||
shell_vgl(ishell, ielec, 1) + v
|
||||
|
||||
shell_vgl(ishell, ielec, 2) = &
|
||||
shell_vgl(ishell, ielec, 2) + two_a * x
|
||||
shell_vgl(ishell, ielec, 2) + two_a * x
|
||||
|
||||
shell_vgl(ishell, ielec, 3) = &
|
||||
shell_vgl(ishell, ielec, 3) + two_a * y
|
||||
shell_vgl(ishell, ielec, 3) + two_a * y
|
||||
|
||||
shell_vgl(ishell, ielec, 4) = &
|
||||
shell_vgl(ishell, ielec, 4) + two_a * z
|
||||
shell_vgl(ishell, ielec, 4) + two_a * z
|
||||
|
||||
shell_vgl(ishell, ielec, 5) = &
|
||||
shell_vgl(ishell, ielec, 5) + two_a * (3.d0 - 2.d0*ar2)
|
||||
@ -2429,7 +2420,6 @@ integer function qmckl_compute_ao_basis_shell_gaussian_vgl_f(context, &
|
||||
end do
|
||||
|
||||
end do
|
||||
|
||||
end do
|
||||
|
||||
end do
|
||||
@ -2607,15 +2597,15 @@ printf(" shell_vgl[1][1][26] %25.15e\n", shell_vgl[1][26][1]);
|
||||
printf(" shell_vgl[1][2][26] %25.15e\n", shell_vgl[2][26][1]);
|
||||
printf(" shell_vgl[1][3][26] %25.15e\n", shell_vgl[3][26][1]);
|
||||
printf(" shell_vgl[1][4][26] %25.15e\n", shell_vgl[4][26][1]);
|
||||
|
||||
|
||||
assert( fabs(shell_vgl[0][26][1] - ( 3.564393437193868e-02)) < 1.e-14 );
|
||||
assert( fabs(shell_vgl[1][26][1] - (-6.030177987072189e-03)) < 1.e-14 );
|
||||
assert( fabs(shell_vgl[2][26][1] - (-3.074832579537582e-02)) < 1.e-14 );
|
||||
assert( fabs(shell_vgl[3][26][1] - ( 2.809546963519935e-02)) < 1.e-14 );
|
||||
assert( fabs(shell_vgl[4][26][1] - ( 1.896046117183968e-02)) < 1.e-14 );
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#+end_src
|
||||
|
||||
* Polynomial part
|
||||
@ -2783,7 +2773,6 @@ end function qmckl_ao_power_f
|
||||
|
||||
#+begin_src f90 :tangle (eval f_test)
|
||||
integer(c_int32_t) function test_qmckl_ao_power(context) bind(C)
|
||||
|
||||
use qmckl
|
||||
use qmckl_probes_f
|
||||
|
||||
@ -3380,7 +3369,6 @@ qmckl_exit_code qmckl_provide_ao_vgl(qmckl_context context)
|
||||
:END:
|
||||
|
||||
#+NAME: qmckl_ao_vgl_args
|
||||
|
||||
| ~qmckl_context~ | ~context~ | in | Global state |
|
||||
| ~int64_t~ | ~ao_num~ | in | Number of AOs |
|
||||
| ~int64_t~ | ~shell_num~ | in | Number of shells |
|
||||
@ -3396,7 +3384,7 @@ qmckl_exit_code qmckl_provide_ao_vgl(qmckl_context context)
|
||||
| ~double~ | ~ao_factor[ao_num]~ | in | Normalization factor of the AOs |
|
||||
| ~double~ | ~shell_vgl[5][elec_num][shell_num]~ | in | Value, gradients and Laplacian of the shells |
|
||||
| ~double~ | ~ao_vgl[5][elec_num][ao_num]~ | out | Value, gradients and Laplacian of the AOs |
|
||||
|
||||
|
||||
#+begin_src f90 :comments org :tangle (eval f) :noweb yes
|
||||
integer function qmckl_compute_ao_vgl_f(context, &
|
||||
ao_num, shell_num, elec_num, nucl_num, &
|
||||
@ -3447,7 +3435,6 @@ integer function qmckl_compute_ao_vgl_f(context, &
|
||||
! TODO : Use numerical precision here
|
||||
cutoff = -dlog(1.d-15)
|
||||
|
||||
|
||||
do ielec = 1, elec_num
|
||||
e_coord(1) = elec_coord(ielec,1)
|
||||
e_coord(2) = elec_coord(ielec,2)
|
||||
@ -3647,7 +3634,7 @@ norm = sqrt(3.)
|
||||
print ( "[0][26][219] : %25.15e"%(f(a,x,y) * (x[0] - y[0])**2) )
|
||||
print ( "[1][26][219] : %25.15e"%(df(a,x,y,1)* (x[0] - y[0]) * (x[1] - y[1]) + 2.*f(a,x,y) * (x[0] - y[0])) )
|
||||
|
||||
print ( "[0][26][220] : %25.15e"%(norm*f(a,x,y) * (x[0] - y[0]) * (x[1] - y[1]) ))
|
||||
print ( "[0][26][220] : %25.15e"%(norm*f(a,x,y) * (x[0] - y[0]) * (x[1] - y[1]) ))
|
||||
print ( "[1][26][220] : %25.15e"%(norm*df(a,x,y,1)* (x[0] - y[0]) * (x[1] - y[1]) + norm*f(a,x,y) * (x[1] - y[1])) )
|
||||
|
||||
print ( "[0][26][221] : %25.15e"%(norm*f(a,x,y) * (x[0] - y[0]) * (x[2] - y[2])) )
|
||||
@ -3725,7 +3712,6 @@ printf(" ao_vgl ao_vgl[0][26][224] %25.15e\n", ao_vgl[0][26][224]);
|
||||
printf(" ao_vgl ao_vgl[1][26][224] %25.15e\n", ao_vgl[1][26][224]);
|
||||
printf("\n");
|
||||
|
||||
|
||||
assert( fabs(ao_vgl[0][26][219] - ( 1.020298798341620e-08)) < 1.e-14 );
|
||||
assert( fabs(ao_vgl[1][26][219] - (-4.928035238010602e-08)) < 1.e-14 );
|
||||
assert( fabs(ao_vgl[0][26][220] - ( 1.516643537739178e-08)) < 1.e-14 );
|
||||
@ -3738,8 +3724,8 @@ assert( fabs(ao_vgl[0][26][223] - (-4.021908374204471e-09)) < 1.e-14 );
|
||||
assert( fabs(ao_vgl[1][26][223] - ( 2.154644255710413e-08)) < 1.e-14 );
|
||||
assert( fabs(ao_vgl[0][26][224] - ( 7.175045873560788e-10)) < 1.e-14 );
|
||||
assert( fabs(ao_vgl[1][26][224] - (-3.843864637762753e-09)) < 1.e-14 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#+end_src
|
||||
|
||||
* End of files :noexport:
|
||||
|
Loading…
Reference in New Issue
Block a user