Skip to content

Commit

Permalink
Merge branch 'dev-stable' of https://github.com/QuantumPackage/qp2 in…
Browse files Browse the repository at this point in the history
…to dev-stable
  • Loading branch information
eginer committed Dec 16, 2024
2 parents fe675fa + f6661b6 commit b3f481b
Show file tree
Hide file tree
Showing 2 changed files with 129 additions and 39 deletions.
164 changes: 125 additions & 39 deletions src/determinants/ref_bitmask.irp.f
Original file line number Diff line number Diff line change
@@ -1,84 +1,170 @@
BEGIN_PROVIDER [ double precision, ref_bitmask_energy ]
&BEGIN_PROVIDER [ double precision, ref_bitmask_one_e_energy ]
&BEGIN_PROVIDER [ double precision, ref_bitmask_kinetic_energy ]
&BEGIN_PROVIDER [ double precision, ref_bitmask_n_e_energy ]
&BEGIN_PROVIDER [ double precision, ref_bitmask_two_e_energy ]
&BEGIN_PROVIDER [ double precision, ref_bitmask_energy_ab ]
&BEGIN_PROVIDER [ double precision, ref_bitmask_energy_bb ]
&BEGIN_PROVIDER [ double precision, ref_bitmask_energy_aa ]
BEGIN_PROVIDER [ double precision, ref_bitmask_one_e_energy ]

use bitmasks
implicit none
BEGIN_DOC
! Energy of the reference bitmask used in Slater rules
! One-electron energy of the reference bitmask used in Slater rules
END_DOC

integer :: occ(N_int*bit_kind_size,2)
integer :: i,j
integer :: i

call bitstring_to_list(ref_bitmask(1,1), occ(1,1), i, N_int)
call bitstring_to_list(ref_bitmask(1,2), occ(1,2), i, N_int)


ref_bitmask_energy = 0.d0
ref_bitmask_one_e_energy = 0.d0

do i = 1, elec_beta_num
ref_bitmask_one_e_energy += mo_one_e_integrals(occ(i,1),occ(i,1)) + mo_one_e_integrals(occ(i,2),occ(i,2))
enddo

do i = elec_beta_num+1,elec_alpha_num
ref_bitmask_one_e_energy += mo_one_e_integrals(occ(i,1),occ(i,1))
enddo

END_PROVIDER

BEGIN_PROVIDER [ double precision, ref_bitmask_kinetic_energy ]

use bitmasks
implicit none
BEGIN_DOC
! Kinetic energy of the reference bitmask used in Slater rules
END_DOC

integer :: occ(N_int*bit_kind_size,2)
integer :: i

call bitstring_to_list(ref_bitmask(1,1), occ(1,1), i, N_int)
call bitstring_to_list(ref_bitmask(1,2), occ(1,2), i, N_int)


ref_bitmask_kinetic_energy = 0.d0
ref_bitmask_n_e_energy = 0.d0
ref_bitmask_two_e_energy = 0.d0

do i = 1, elec_beta_num
ref_bitmask_energy += mo_one_e_integrals(occ(i,1),occ(i,1)) + mo_one_e_integrals(occ(i,2),occ(i,2))
ref_bitmask_kinetic_energy += mo_kinetic_integrals(occ(i,1),occ(i,1)) + mo_kinetic_integrals(occ(i,2),occ(i,2))
enddo

do i = elec_beta_num+1,elec_alpha_num
ref_bitmask_kinetic_energy += mo_kinetic_integrals(occ(i,1),occ(i,1))
enddo

END_PROVIDER

BEGIN_PROVIDER [ double precision, ref_bitmask_n_e_energy ]

use bitmasks
implicit none
BEGIN_DOC
! Nucleus-electron energy of the reference bitmask used in Slater rules
END_DOC

integer :: occ(N_int*bit_kind_size,2)
integer :: i

call bitstring_to_list(ref_bitmask(1,1), occ(1,1), i, N_int)
call bitstring_to_list(ref_bitmask(1,2), occ(1,2), i, N_int)


ref_bitmask_n_e_energy = 0.d0

do i = 1, elec_beta_num
ref_bitmask_n_e_energy += mo_integrals_n_e(occ(i,1),occ(i,1)) + mo_integrals_n_e(occ(i,2),occ(i,2))
enddo

do i = elec_beta_num+1,elec_alpha_num
ref_bitmask_n_e_energy += mo_integrals_n_e(occ(i,1),occ(i,1))
enddo

END_PROVIDER

BEGIN_PROVIDER [ double precision, ref_bitmask_two_e_energy ]

use bitmasks
implicit none
BEGIN_DOC
! Energy of the reference bitmask used in Slater rules
END_DOC

integer :: occ(N_int*bit_kind_size,2)
integer :: i,j

call bitstring_to_list(ref_bitmask(1,1), occ(1,1), i, N_int)
call bitstring_to_list(ref_bitmask(1,2), occ(1,2), i, N_int)

ref_bitmask_two_e_energy = 0.d0

do i = 1, elec_beta_num
do j = i+1, elec_alpha_num
ref_bitmask_two_e_energy += mo_two_e_integrals_jj_anti(occ(j,1),occ(i,1))
ref_bitmask_energy += mo_two_e_integrals_jj_anti(occ(j,1),occ(i,1))
enddo
do j= 1, elec_alpha_num
ref_bitmask_two_e_energy += mo_two_e_integrals_jj(occ(j,1),occ(i,2))
ref_bitmask_energy += mo_two_e_integrals_jj(occ(j,1),occ(i,2))
enddo
do j = i+1, elec_beta_num
ref_bitmask_two_e_energy += mo_two_e_integrals_jj_anti(occ(j,2),occ(i,2))
ref_bitmask_energy += mo_two_e_integrals_jj_anti(occ(j,2),occ(i,2))
enddo
enddo

do i = elec_beta_num+1,elec_alpha_num
ref_bitmask_energy += mo_one_e_integrals(occ(i,1),occ(i,1))
ref_bitmask_kinetic_energy += mo_kinetic_integrals(occ(i,1),occ(i,1))
ref_bitmask_n_e_energy += mo_integrals_n_e(occ(i,1),occ(i,1))
do j = i+1, elec_alpha_num
ref_bitmask_two_e_energy += mo_two_e_integrals_jj_anti(occ(j,1),occ(i,1))
ref_bitmask_energy += mo_two_e_integrals_jj_anti(occ(j,1),occ(i,1))
enddo
enddo

ref_bitmask_one_e_energy = ref_bitmask_kinetic_energy + ref_bitmask_n_e_energy
END_PROVIDER

ref_bitmask_energy_ab = 0.d0
do i = 1, elec_alpha_num
do j = 1, elec_beta_num
ref_bitmask_energy_ab += mo_two_e_integrals_jj(occ(i,1),occ(j,2))
BEGIN_PROVIDER [ double precision, ref_bitmask_energy_ab ]
&BEGIN_PROVIDER [ double precision, ref_bitmask_energy_bb ]
&BEGIN_PROVIDER [ double precision, ref_bitmask_energy_aa ]

use bitmasks
implicit none
BEGIN_DOC
! Energy of the reference bitmask used in Slater rules
END_DOC

integer :: occ(N_int*bit_kind_size,2)
integer :: i,j

call bitstring_to_list(ref_bitmask(1,1), occ(1,1), i, N_int)
call bitstring_to_list(ref_bitmask(1,2), occ(1,2), i, N_int)

ref_bitmask_energy_ab = 0.d0
do i = 1, elec_alpha_num
do j = 1, elec_beta_num
ref_bitmask_energy_ab += mo_two_e_integrals_jj(occ(i,1),occ(j,2))
enddo
enddo
enddo

ref_bitmask_energy_aa = 0.d0
do i = 1, elec_alpha_num
do j = 1, elec_alpha_num
ref_bitmask_energy_aa += mo_two_e_integrals_jj_anti(occ(i,1),occ(j,1))
ref_bitmask_energy_aa = 0.d0
do i = 1, elec_alpha_num
do j = 1, elec_alpha_num
ref_bitmask_energy_aa += mo_two_e_integrals_jj_anti(occ(i,1),occ(j,1))
enddo
enddo
enddo
ref_bitmask_energy_aa = ref_bitmask_energy_aa * 0.5d0
ref_bitmask_energy_aa = ref_bitmask_energy_aa * 0.5d0

ref_bitmask_energy_bb = 0.d0
do i = 1, elec_beta_num
do j = 1, elec_beta_num
ref_bitmask_energy_bb += mo_two_e_integrals_jj_anti(occ(i,2),occ(j,2))
ref_bitmask_energy_bb = 0.d0
do i = 1, elec_beta_num
do j = 1, elec_beta_num
ref_bitmask_energy_bb += mo_two_e_integrals_jj_anti(occ(i,2),occ(j,2))
enddo
enddo
enddo
ref_bitmask_energy_bb = ref_bitmask_energy_bb * 0.5d0
ref_bitmask_energy_bb = ref_bitmask_energy_bb * 0.5d0

END_PROVIDER

BEGIN_PROVIDER [ double precision, ref_bitmask_energy ]

use bitmasks
implicit none
BEGIN_DOC
! Energy of the reference bitmask used in Slater rules
END_DOC

ref_bitmask_energy = ref_bitmask_one_e_energy + ref_bitmask_two_e_energy


END_PROVIDER
Expand Down
4 changes: 4 additions & 0 deletions src/trexio/import_trexio_integrals.irp.f
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ subroutine run(f)
write(iunit) tmp(:,:,:)
close(iunit)
call ezfio_set_ao_two_e_ints_io_ao_cholesky('Read')
call ezfio_set_ao_two_e_ints_do_ao_cholesky(.True.)

deallocate(Vi, V, tmp)
print *, 'Cholesky AO integrals read from TREXIO file'
Expand Down Expand Up @@ -206,6 +207,7 @@ subroutine run(f)

call map_save_to_disk(trim(ezfio_filename)//'/work/ao_ints',ao_integrals_map)
call ezfio_set_ao_two_e_ints_io_ao_two_e_integrals('Read')
call ezfio_set_ao_two_e_ints_do_ao_cholesky(.False.)

deallocate(buffer_i, buffer_values, Vi, V)
print *, 'AO integrals read from TREXIO file'
Expand Down Expand Up @@ -274,6 +276,7 @@ subroutine run(f)
write(iunit) tmp(:,:,:)
close(iunit)
call ezfio_set_mo_two_e_ints_io_mo_cholesky('Read')
call ezfio_set_ao_two_e_ints_do_ao_cholesky(.True.)

deallocate(Vi, V, tmp)
print *, 'Cholesky MO integrals read from TREXIO file'
Expand Down Expand Up @@ -314,6 +317,7 @@ subroutine run(f)

call map_save_to_disk(trim(ezfio_filename)//'/work/mo_ints',mo_integrals_map)
call ezfio_set_mo_two_e_ints_io_mo_two_e_integrals('Read')
call ezfio_set_ao_two_e_ints_do_ao_cholesky(.False.)
deallocate(buffer_i, buffer_values, Vi, V)
print *, 'MO integrals read from TREXIO file'
endif
Expand Down

0 comments on commit b3f481b

Please sign in to comment.