Skip to content

Commit

Permalink
Merge branch 'main' of github.com:filippi-claudia/champ
Browse files Browse the repository at this point in the history
  • Loading branch information
neelravi committed Aug 20, 2024
2 parents 718553c + 51730bb commit fd07b16
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")

# List of Fortran flags for Intel's ifort compiler begins here
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
list(APPEND Fortran_FLAGS "-O2")
list(APPEND Fortran_FLAGS "-O2" "-diag-disable=all")
list(APPEND Fortran_FLAGS "-fPIC")
list(APPEND Fortran_FLAGS "-implicitnone")
list(APPEND Fortran_FLAGS "-ipo")
Expand Down
2 changes: 2 additions & 0 deletions src/vmc/metrop_slat.f90
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ subroutine metrop6_moveall(ipass,irun)
areao=one
rratio=one

call check_orbitals

! Start loop over electrons
do i=1,nelec
!call compute_determinante_grad(i,psido(1),psido,psijo,vold(1,i),1)
Expand Down
106 changes: 106 additions & 0 deletions src/vmc/optorb.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1063,8 +1063,62 @@ subroutine check_orbitals
! Do not compute virtual orbitals during single-electron move
use orbval, only: nadorb
use optorb_mod, only: nadorb_save
use slater, only: norb

#if defined(TREXIO_FOUND) && defined(QMCKL_FOUND)
use qmckl_data
#endif

implicit none

#if defined(TREXIO_FOUND) && defined(QMCKL_FOUND)
integer(qmckl_exit_code) :: rc
integer*8 :: n8
integer*8 :: norb_qmckl
integer, allocatable :: keep(:)
#endif

#if defined(TREXIO_FOUND) && defined(QMCKL_FOUND)
if (use_qmckl) then

nadorb_save=nadorb
nadorb=0
!! to check change in mo's number to be computed by qmckl inside champ
norb_qmckl=norb+nadorb

!!get mo's number should correspond to norb_tot
rc = qmckl_get_mo_basis_mo_num(qmckl_ctx, n8)
if (rc /= QMCKL_SUCCESS) then
call fatal_error('INPUT: QMCkl getting mo_num from verify orbitals')
end if

if (n8 > norb_qmckl) then

!! allocate orbital selection array for qmckl
allocate(keep(n8))

!! selecting range of orbitals to compute qith QMCkl
keep(1:norb_qmckl) = 1
keep((norb_qmckl+1):n8) = 0

rc = qmckl_mo_basis_select_mo(qmckl_ctx, keep, n8)
if (rc /= QMCKL_SUCCESS) call fatal_error('Error 01 selecting MOs in verify orbitals')

!!deallocate keep
deallocate(keep)

!!getting new number of orbitals to be computed
rc = qmckl_get_mo_basis_mo_num(qmckl_ctx, n8)
if (rc /= QMCKL_SUCCESS) call fatal_error('QMCkl mo_num from verify orbitals')

!! checking if the current number of orbitals in qmckl is consistent
if (n8 /= norb_qmckl) call fatal_error('Problem in MO selection in QMCkl verify orb')

endif
endif
#endif


nadorb_save=nadorb
nadorb=0

Expand All @@ -1073,8 +1127,60 @@ subroutine check_orbitals
subroutine check_orbitals_reset
use orbval, only: nadorb
use optorb_mod, only: nadorb_save
use slater, only: norb

#if defined(TREXIO_FOUND) && defined(QMCKL_FOUND)
use qmckl_data
#endif

implicit none

#if defined(TREXIO_FOUND) && defined(QMCKL_FOUND)
integer(qmckl_exit_code) :: rc
integer*8 :: n8
integer*8 :: norb_qmckl
integer, allocatable :: keep(:)
#endif

#if defined(TREXIO_FOUND) && defined(QMCKL_FOUND)
if (use_qmckl) then

nadorb=nadorb_save
!! to check change in mo's number to be computed by qmckl inside champ
norb_qmckl=norb+nadorb

!!get mo's number should correspond to norb_tot
rc = qmckl_get_mo_basis_mo_num(qmckl_ctx, n8)
if (rc /= QMCKL_SUCCESS) then
call fatal_error('INPUT: QMCkl getting mo_num from verify orbitals')
end if

if (n8 > norb_qmckl) then

!! allocate orbital selection array for qmckl
allocate(keep(n8))

!! selecting range of orbitals to compute qith QMCkl
keep(1:norb_qmckl) = 1
keep((norb_qmckl+1):n8) = 0

rc = qmckl_mo_basis_select_mo(qmckl_ctx, keep, n8)
if (rc /= QMCKL_SUCCESS) call fatal_error('Error 01 selecting MOs in verify orbitals')

!!deallocate keep
deallocate(keep)

!!getting new number of orbitals to be computed
rc = qmckl_get_mo_basis_mo_num(qmckl_ctx, n8)
if (rc /= QMCKL_SUCCESS) call fatal_error('QMCkl mo_num from verify orbitals')

!! checking if the current number of orbitals in qmckl is consistent
if (n8 /= norb_qmckl) call fatal_error('Problem in MO selection in QMCkl verify orb')

endif
endif
#endif

nadorb=nadorb_save

end subroutine
Expand Down

0 comments on commit fd07b16

Please sign in to comment.