mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2024-12-22 20:36:01 +01:00
Finished KE. #41
This commit is contained in:
parent
9722f09221
commit
9d542238e3
@ -307,8 +307,8 @@ qmckl_exit_code qmckl_provide_kinetic_energy(qmckl_context context) {
|
||||
ctx->det.mo_index_beta,
|
||||
ctx->mo_basis.mo_num,
|
||||
ctx->mo_basis.mo_vgl,
|
||||
ctx->det.det_vgl_alpha,
|
||||
ctx->det.det_vgl_beta,
|
||||
ctx->det.det_adj_matrix_alpha,
|
||||
ctx->det.det_adj_matrix_beta,
|
||||
ctx->local_energy.e_kin);
|
||||
} else {
|
||||
return qmckl_failwith( context,
|
||||
@ -326,7 +326,8 @@ qmckl_exit_code qmckl_provide_kinetic_energy(qmckl_context context) {
|
||||
return QMCKL_SUCCESS;
|
||||
}
|
||||
#+end_src
|
||||
*** Compute alpha
|
||||
|
||||
*** Compute kinetic enregy
|
||||
:PROPERTIES:
|
||||
:Name: qmckl_compute_kinetic_energy
|
||||
:CRetType: qmckl_exit_code
|
||||
@ -345,14 +346,14 @@ qmckl_exit_code qmckl_provide_kinetic_energy(qmckl_context context) {
|
||||
| ~int64_t~ | ~mo_index_beta[det_num_beta][walk_num][beta_num]~ | in | MO indices for electrons |
|
||||
| ~int64_t~ | ~mo_num~ | in | Number of MOs |
|
||||
| ~double~ | ~mo_vgl[5][walk_num][elec_num][mo_num]~ | in | Value, gradients and Laplacian of the MOs |
|
||||
| ~double~ | ~det_vgl_alpha[det_num_alpha][walk_num][5][alpha_num][alpha_num]~ | in | Value, gradients and Laplacian of the Det |
|
||||
| ~double~ | ~det_vgl_beta[det_num_beta][walk_num][5][beta_num][beta_num]~ | in | Value, gradients and Laplacian of the Det |
|
||||
| ~double~ | ~det_adj_matrix_alpha[det_num_alpha][walk_num][alpha_num][alpha_num]~ | in | Value, gradients and Laplacian of the Det |
|
||||
| ~double~ | ~det_adj_matrix_beta[det_num_beta][walk_num][beta_num][beta_num]~ | in | Value, gradients and Laplacian of the Det |
|
||||
| ~double~ | ~e_kin[walk_num]~ | out | Kinetic energy |
|
||||
|
||||
#+begin_src f90 :comments org :tangle (eval f) :noweb yes
|
||||
integer function qmckl_compute_kinetic_energy_f(context, walk_num, &
|
||||
det_num_alpha, det_num_beta, alpha_num, beta_num, elec_num, mo_index_alpha, mo_index_beta, &
|
||||
mo_num, mo_vgl, det_vgl_alpha, det_vgl_beta, e_kin) &
|
||||
mo_num, mo_vgl, det_adj_matrix_alpha, det_adj_matrix_beta, e_kin) &
|
||||
result(info)
|
||||
use qmckl
|
||||
implicit none
|
||||
@ -367,8 +368,8 @@ integer function qmckl_compute_kinetic_energy_f(context, walk_num, &
|
||||
integer*8, intent(in) :: mo_index_alpha(alpha_num, walk_num, det_num_alpha)
|
||||
integer*8, intent(in) :: mo_index_beta(beta_num, walk_num, det_num_beta)
|
||||
double precision, intent(in) :: mo_vgl(mo_num, elec_num, walk_num, 5)
|
||||
double precision, intent(in) :: det_vgl_alpha(alpha_num, alpha_num, 5, walk_num, det_num_alpha)
|
||||
double precision, intent(in) :: det_vgl_beta(beta_num, beta_num, 5, walk_num, det_num_beta)
|
||||
double precision, intent(in) :: det_adj_matrix_alpha(alpha_num, alpha_num, walk_num, det_num_alpha)
|
||||
double precision, intent(in) :: det_adj_matrix_beta(beta_num, beta_num, walk_num, det_num_beta)
|
||||
double precision, intent(inout) :: e_kin(walk_num)
|
||||
integer*8 :: idet, iwalk, ielec, mo_id, imo
|
||||
|
||||
@ -399,13 +400,26 @@ integer function qmckl_compute_kinetic_energy_f(context, walk_num, &
|
||||
return
|
||||
endif
|
||||
|
||||
idet = 1
|
||||
e_kin = 0.0d0
|
||||
do idet = 1, det_num_alpha
|
||||
do iwalk = 1, walk_num
|
||||
! Alpha part
|
||||
do imo = 1, alpha_num
|
||||
do ielec = 1, alpha_num
|
||||
mo_id = mo_index_beta(ielec, iwalk, idet)
|
||||
mo_id = mo_index_alpha(ielec, iwalk, idet)
|
||||
e_kin(iwalk) = e_kin(iwalk) - 0.5d0 * det_adj_matrix_alpha(imo, ielec, iwalk, idet) * &
|
||||
mo_vgl(mo_id, ielec, iwalk, 5)
|
||||
end do
|
||||
end do
|
||||
! Beta part
|
||||
do imo = 1, beta_num
|
||||
do ielec = 1, beta_num
|
||||
mo_id = mo_index_beta(ielec, iwalk, idet)
|
||||
e_kin(iwalk) = e_kin(iwalk) - 0.5d0 * det_adj_matrix_beta(imo, ielec, iwalk, idet) * &
|
||||
mo_vgl(mo_id, alpha_num + ielec, iwalk, 5)
|
||||
end do
|
||||
end do
|
||||
end do
|
||||
end do
|
||||
|
||||
end function qmckl_compute_kinetic_energy_f
|
||||
@ -427,8 +441,8 @@ end function qmckl_compute_kinetic_energy_f
|
||||
const int64_t* mo_index_beta,
|
||||
const int64_t mo_num,
|
||||
const double* mo_vgl,
|
||||
const double* det_vgl_alpha,
|
||||
const double* det_vgl_beta,
|
||||
const double* det_adj_matrix_alpha,
|
||||
const double* det_adj_matrix_beta,
|
||||
double* const e_kin );
|
||||
#+end_src
|
||||
|
||||
@ -448,8 +462,8 @@ end function qmckl_compute_kinetic_energy_f
|
||||
mo_index_beta, &
|
||||
mo_num, &
|
||||
mo_vgl, &
|
||||
det_vgl_alpha, &
|
||||
det_vgl_beta, &
|
||||
det_adj_matrix_alpha, &
|
||||
det_adj_matrix_beta, &
|
||||
e_kin) &
|
||||
bind(C) result(info)
|
||||
|
||||
@ -467,8 +481,8 @@ end function qmckl_compute_kinetic_energy_f
|
||||
integer (c_int64_t) , intent(in) :: mo_index_beta(beta_num,walk_num,det_num_beta)
|
||||
integer (c_int64_t) , intent(in) , value :: mo_num
|
||||
real (c_double ) , intent(in) :: mo_vgl(mo_num,elec_num,walk_num,5)
|
||||
real (c_double ) , intent(in) :: det_vgl_alpha(alpha_num,alpha_num,5,walk_num,det_num_alpha)
|
||||
real (c_double ) , intent(in) :: det_vgl_beta(beta_num,beta_num,5,walk_num,det_num_beta)
|
||||
real (c_double ) , intent(in) :: det_adj_matrix_alpha(alpha_num,alpha_num,walk_num,det_num_alpha)
|
||||
real (c_double ) , intent(in) :: det_adj_matrix_beta(beta_num,beta_num,walk_num,det_num_beta)
|
||||
real (c_double ) , intent(out) :: e_kin(walk_num)
|
||||
|
||||
integer(c_int32_t), external :: qmckl_compute_kinetic_energy_f
|
||||
@ -484,8 +498,8 @@ end function qmckl_compute_kinetic_energy_f
|
||||
mo_index_beta, &
|
||||
mo_num, &
|
||||
mo_vgl, &
|
||||
det_vgl_alpha, &
|
||||
det_vgl_beta, &
|
||||
det_adj_matrix_alpha, &
|
||||
det_adj_matrix_beta, &
|
||||
e_kin)
|
||||
|
||||
end function qmckl_compute_kinetic_energy
|
||||
|
Loading…
Reference in New Issue
Block a user