Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ ExternalProject_Add(libxc

ExternalProject_Add(libtagarray
PREFIX ${CMAKE_SOURCE_DIR}/external/libtagarray
URL https://github.com/foxtran/libtagarray/archive/refs/tags/v0.0.6.tar.gz
URL_HASH SHA256=9c844092f123276bb461e37e3451068c097b5a1fec9d65514ad3018baaeb2b32
URL https://github.com/foxtran/libtagarray/archive/refs/tags/v0.0.7.tar.gz
URL_HASH SHA256=d37a1cd16f2f46c27daa57f4997d5c2f684ad46c0ca3ea958a5e578e409e5094
# GIT_REPOSITORY https://github.com/foxtran/libtagarray.git
# GIT_TAG master
BINARY_DIR ${CMAKE_BINARY_DIR}/external/libtagarray/src/libtagarray-build-${CMAKE_Fortran_COMPILER_ID}
Expand All @@ -81,6 +81,7 @@ ExternalProject_Add(libtagarray
INSTALL_COMMAND ""
CMAKE_ARGS -DENABLE_FORTRAN=ON
-DENABLE_TESTING=OFF
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER}
-DCMAKE_GENERATOR:INTERNAL=${CMAKE_GENERATOR}
Expand Down
15 changes: 7 additions & 8 deletions source/c_interop.F90
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ function oqp_get(c_handle, code, type_id, ndims, dims, v) result(n) bind(C, name
type(c_ptr), intent(out) :: v
integer(c_int32_t) :: type_id
integer(c_int32_t) :: ndims
integer(c_int64_t) :: dims(TA_DIMENSIONS_LENGTH)
integer(c_int64_t) :: dims(TA_MAX_DIMENSIONS_LENGTH)

type(information), pointer :: inf
character(:), allocatable :: code_str
Expand Down Expand Up @@ -311,23 +311,22 @@ function oqp_alloc(c_handle, tag, type_id, ndims, dims, v) result(n) bind(C, nam
type(c_ptr), intent(out) :: v
integer(c_int32_t) :: type_id
integer(c_int32_t) :: ndims
integer(c_int64_t) :: dims(TA_DIMENSIONS_LENGTH)
integer(c_int64_t) :: dims(TA_MAX_DIMENSIONS_LENGTH)

type(information), pointer :: inf
character(:), allocatable :: tag_str
integer(c_int64_t) :: data_size
integer(c_int32_t) :: status_

n = -1
if (.not.c_associated(c_handle%inf)) return
call c_f_pointer(c_handle%inf, inf)

tag_str = trim(adjustl(c_f_char(tag)))

! 1. check, if the data already exist, and clean it if yes
call inf%dat%remove_records([tag_str])
! 2. allocate the memory in container
call inf%dat%reserve_data(tag_str, type_id, product(dims(:ndims)), dims(:ndims))
! 3. Get the pointer to the freshly allocated data
! 1. allocate the memory in container (override, if exists)
status_ = inf%dat%create(tag_str, type_id, dims(:ndims), override=.true._4)
! 2. Get the pointer to the freshly allocated data
n = tagarray_get_cptr(inf%dat, tag_str, v, type_id, ndims, dims, data_size)
if (.not.c_associated(v)) n = -2

Expand Down Expand Up @@ -366,7 +365,7 @@ function oqp_del(c_handle, tag) result(n) bind(C, name='oqp_del')
if (stat /= TA_OK) return

n = -3
call inf%dat%remove_records([tag_str])
call inf%dat%erase([tag_str])

n = 0

Expand Down
12 changes: 7 additions & 5 deletions source/modules/get_basis_overlap.F90
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ end subroutine get_structures_ao_overlap_c
!> Old MO energies (e_a_old) are taken from mol.data["OQP::E_MO_A_old"]
!>
subroutine get_structures_ao_overlap(infos)
use, intrinsic :: iso_c_binding, only: c_int32_t
use precision, only: dp
use io_constants, only: iw
use oqp_tagarray_driver
Expand All @@ -85,6 +86,7 @@ subroutine get_structures_ao_overlap(infos)
integer :: i, nbf

! Tagarray definitions and data pointers
integer(c_int32_t) :: stat
character(len=*), parameter :: tags_general(*) = (/ character(len=80) :: &
OQP_XYZ_old, OQP_VEC_MO_A, OQP_E_MO_A, OQP_VEC_MO_A_old, OQP_E_MO_A_old /)
character(len=*), parameter :: tags_alloc(*) = (/ character(len=80) :: &
Expand All @@ -104,11 +106,11 @@ subroutine get_structures_ao_overlap(infos)
nbf = basis%nbf

! Allocate and prepare data for output
call infos%dat%remove_records(tags_alloc)
call infos%dat%reserve_data(OQP_overlap_mo, TA_TYPE_REAL64, &
nbf*nbf, (/ nbf, nbf /), comment=OQP_overlap_mo_comment)
call infos%dat%reserve_data(OQP_overlap_ao, TA_TYPE_REAL64, &
nbf*nbf, (/ nbf, nbf /), comment=OQP_overlap_ao_comment)
call infos%dat%erase(tags_alloc)
stat = infos%dat%create(OQP_overlap_mo, TA_TYPE_REAL64, &
(/ nbf, nbf /), description=OQP_overlap_mo_comment)
stat = infos%dat%create(OQP_overlap_ao, TA_TYPE_REAL64, &
(/ nbf, nbf /), description=OQP_overlap_ao_comment)
call data_has_tags(infos%dat, tags_alloc, module_name, subroutine_name, with_abort)
call tagarray_get_data(infos%dat, OQP_overlap_mo, overlap_mo_out)
call tagarray_get_data(infos%dat, OQP_overlap_ao, overlap_ao_out)
Expand Down
16 changes: 9 additions & 7 deletions source/modules/get_states_overlap.F90
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ end subroutine get_state_overlap_c
!>
subroutine get_states_overlap(infos)

use, intrinsic :: iso_c_binding, only: c_int32_t
use precision, only: dp
use io_constants, only: iw
use oqp_tagarray_driver
Expand All @@ -59,6 +60,7 @@ subroutine get_states_overlap(infos)
real(kind=dp), allocatable, target :: bvec(:,:), bvec_old(:,:)

! Tagarray
integer(c_int32_t) :: stat
character(len=*), parameter :: tags_general(*) = (/ character(len=80) :: &
OQP_td_bvec_mo_old, OQP_td_bvec_mo, OQP_overlap_mo /)
character(len=*), parameter :: tags_alloc(*) = (/ character(len=80) :: &
Expand All @@ -83,13 +85,13 @@ subroutine get_states_overlap(infos)
ndtlf = infos%tddft%tlf

! Allocate data for outputing in python level
call infos%dat%remove_records(tags_alloc)
call infos%dat%reserve_data(OQP_td_states_phase, ta_type_real64, &
nstates, (/ nstates /), comment=OQP_td_states_phase_comment)
call infos%dat%reserve_data(OQP_td_states_overlap, ta_type_real64, &
nstates*nstates, (/ nstates, nstates /), comment=OQP_td_states_overlap_comment)
call infos%dat%reserve_data(OQP_nac, ta_type_real64, &
nstates*nstates, (/ nstates, nstates /), comment=OQP_nac_comment)
call infos%dat%erase(tags_alloc)
stat = infos%dat%create(OQP_td_states_phase, ta_type_real64, &
(/ nstates /), description=OQP_td_states_phase_comment)
stat = infos%dat%create(OQP_td_states_overlap, ta_type_real64, &
(/ nstates, nstates /), description=OQP_td_states_overlap_comment)
stat = infos%dat%create(OQP_nac, ta_type_real64, &
(/ nstates, nstates /), description=OQP_nac_comment)

! Load data from python level
call data_has_tags(infos%dat, tags_general, module_name, subroutine_name, with_abort)
Expand Down
18 changes: 10 additions & 8 deletions source/modules/guess_hcore.F90
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ subroutine guess_hcore_C(c_handle) bind(C, name="guess_hcore")
end subroutine guess_hcore_C

subroutine guess_hcore(infos)
use, intrinsic :: iso_c_binding, only: c_int32_t
use precision, only: dp
use types, only: information
use io_constants, only: IW
Expand All @@ -41,6 +42,7 @@ subroutine guess_hcore(infos)
type(basis_set), pointer :: basis
!
! tagarray
integer(c_int32_t) :: stat
real(kind=dp), contiguous, pointer :: &
Hcore(:), Smat(:), &
dmat_a(:), mo_a(:,:), mo_energy_a(:), &
Expand Down Expand Up @@ -73,18 +75,18 @@ subroutine guess_hcore(infos)
if (ok /= 0) call show_message('Cannot allocate memory', WITH_ABORT)

! clean data
call infos%dat%remove_records(tags_alpha)
call infos%dat%remove_records(tags_beta)
call infos%dat%erase(tags_alpha)
call infos%dat%erase(tags_beta)

! load general data
call data_has_tags(infos%dat, tags_general, module_name, subroutine_name, WITH_ABORT)
call tagarray_get_data(infos%dat, OQP_SM, smat)
call tagarray_get_data(infos%dat, OQP_Hcore, hcore)

! allocate alpha
call infos%dat%reserve_data(OQP_DM_A, TA_TYPE_REAL64, nbf2, comment=OQP_DM_A_comment)
call infos%dat%reserve_data(OQP_E_MO_A, TA_TYPE_REAL64, nbf, comment=OQP_E_MO_A_comment)
call infos%dat%reserve_data(OQP_VEC_MO_A, TA_TYPE_REAL64, nbf*nbf, (/ nbf, nbf /), comment=OQP_VEC_MO_A_comment)
stat = infos%dat%create(OQP_DM_A, TA_TYPE_REAL64, (/ nbf2 /), description=OQP_DM_A_comment)
stat = infos%dat%create(OQP_E_MO_A, TA_TYPE_REAL64, (/ nbf /), description=OQP_E_MO_A_comment)
stat = infos%dat%create(OQP_VEC_MO_A, TA_TYPE_REAL64, (/ nbf, nbf /), description=OQP_VEC_MO_A_comment)

! load alpha data
call data_has_tags(infos%dat, tags_alpha, module_name, subroutine_name, WITH_ABORT)
Expand All @@ -95,9 +97,9 @@ subroutine guess_hcore(infos)
! UHF/ROHF
if (infos%control%scftype >= 2) then
! allocate beta
call infos%dat%reserve_data(OQP_DM_B, TA_TYPE_REAL64, nbf2, comment=OQP_DM_B_comment)
call infos%dat%reserve_data(OQP_E_MO_B, TA_TYPE_REAL64, nbf, comment=OQP_E_MO_B_comment)
call infos%dat%reserve_data(OQP_VEC_MO_B, TA_TYPE_REAL64, nbf*nbf, (/ nbf, nbf /), comment=OQP_VEC_MO_B_comment)
stat = infos%dat%create(OQP_DM_B, TA_TYPE_REAL64, (/ nbf2 /), description=OQP_DM_B_comment)
stat = infos%dat%create(OQP_E_MO_B, TA_TYPE_REAL64, (/ nbf /), description=OQP_E_MO_B_comment)
stat = infos%dat%create(OQP_VEC_MO_B, TA_TYPE_REAL64, (/ nbf, nbf /), description=OQP_VEC_MO_B_comment)

! load beta
call data_has_tags(infos%dat, tags_beta, module_name, subroutine_name, WITH_ABORT)
Expand Down
18 changes: 10 additions & 8 deletions source/modules/guess_huckel.F90
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ subroutine guess_huckel_C(c_handle) bind(C, name="guess_huckel")
end subroutine guess_huckel_C

subroutine guess_huckel(infos)
use, intrinsic :: iso_c_binding, only: c_int32_t
use precision, only: dp
use types, only: information
use io_constants, only: IW
Expand Down Expand Up @@ -46,6 +47,7 @@ subroutine guess_huckel(infos)
integer , parameter :: root = 0
type(par_env_t) :: pe
! tagarray
integer(c_int32_t) :: stat
real(kind=dp), contiguous, pointer :: &
Smat(:), &
dmat_a(:), mo_a(:,:), mo_energy_a(:), &
Expand Down Expand Up @@ -96,17 +98,17 @@ subroutine guess_huckel(infos)
nbf2 =nbf*(nbf+1)/2

! clean data
call infos%dat%remove_records(tags_alpha)
call infos%dat%remove_records(tags_beta)
call infos%dat%erase(tags_alpha)
call infos%dat%erase(tags_beta)

! load general data
call data_has_tags(infos%dat, tags_general, module_name, subroutine_name, WITH_ABORT)
call tagarray_get_data(infos%dat, OQP_SM, smat)

! allocate alpha
call infos%dat%reserve_data(OQP_DM_A, TA_TYPE_REAL64, nbf2, comment=OQP_DM_A_comment)
call infos%dat%reserve_data(OQP_E_MO_A, TA_TYPE_REAL64, nbf, comment=OQP_E_MO_A_comment)
call infos%dat%reserve_data(OQP_VEC_MO_A, TA_TYPE_REAL64, nbf*nbf, (/ nbf, nbf /), comment=OQP_VEC_MO_A_comment)
stat = infos%dat%create(OQP_DM_A, TA_TYPE_REAL64, (/ nbf2 /), description=OQP_DM_A_comment)
stat = infos%dat%create(OQP_E_MO_A, TA_TYPE_REAL64, (/ nbf /), description=OQP_E_MO_A_comment)
stat = infos%dat%create(OQP_VEC_MO_A, TA_TYPE_REAL64, (/ nbf, nbf /), description=OQP_VEC_MO_A_comment)

! load alpha data
call data_has_tags(infos%dat, tags_alpha, module_name, subroutine_name, WITH_ABORT)
Expand All @@ -117,9 +119,9 @@ subroutine guess_huckel(infos)
! UHF/ROHF
if (infos%control%scftype >= 2) then
! allocate beta
call infos%dat%reserve_data(OQP_DM_B, TA_TYPE_REAL64, nbf2, comment=OQP_DM_B_comment)
call infos%dat%reserve_data(OQP_E_MO_B, TA_TYPE_REAL64, nbf, comment=OQP_E_MO_B_comment)
call infos%dat%reserve_data(OQP_VEC_MO_B, TA_TYPE_REAL64, nbf*nbf, (/ nbf, nbf /), comment=OQP_VEC_MO_B_comment)
stat = infos%dat%create(OQP_DM_B, TA_TYPE_REAL64, (/ nbf2 /), description=OQP_DM_B_comment)
stat = infos%dat%create(OQP_E_MO_B, TA_TYPE_REAL64, (/ nbf /), description=OQP_E_MO_B_comment)
stat = infos%dat%create(OQP_VEC_MO_B, TA_TYPE_REAL64, (/ nbf, nbf /), description=OQP_VEC_MO_B_comment)

! load beta
call data_has_tags(infos%dat, tags_beta, module_name, subroutine_name, WITH_ABORT)
Expand Down
14 changes: 9 additions & 5 deletions source/modules/hf_energy.f90
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ subroutine hf_energy_C(c_handle) bind(C, name="hf_energy")
end subroutine hf_energy_C

subroutine hf_energy(infos)
use, intrinsic :: iso_c_binding, only: c_int32_t
use io_constants, only: iw
use basis_tools, only: basis_set
use messages, only: show_message
Expand All @@ -42,6 +43,9 @@ subroutine hf_energy(infos)
type(basis_set), pointer :: basis
type(dft_grid_t) :: molGrid

! tagarray
integer(c_int32_t) :: stat

urohf = infos%control%scftype == 2 .or. infos%control%scftype == 3
dft = infos%control%hamilton == 20

Expand All @@ -60,14 +64,14 @@ subroutine hf_energy(infos)
nsh2 = (basis%nshell**2+basis%nshell)/2

! clean data
call infos%dat%remove_records((/ character(len=80) :: OQP_FOCK_A, OQP_FOCK_B /))
call infos%dat%erase((/ character(len=80) :: OQP_FOCK_A, OQP_FOCK_B /))

call infos%dat%reserve_data(OQP_FOCK_A, TA_TYPE_REAL64, nbf2, comment=OQP_FOCK_A_comment)
call check_status(infos%dat%get_status(), module_name, subroutine_name, OQP_FOCK_A)
stat = infos%dat%create(OQP_FOCK_A, TA_TYPE_REAL64, (/ nbf2 /), description=OQP_FOCK_A_comment)
call check_status(stat, module_name, subroutine_name, OQP_FOCK_A)

if (urohf) then
call infos%dat%reserve_data(OQP_FOCK_B, TA_TYPE_REAL64, nbf2, comment=OQP_FOCK_B_comment)
call check_status(infos%dat%get_status(), module_name, subroutine_name, OQP_FOCK_B)
stat = infos%dat%create(OQP_FOCK_B, TA_TYPE_REAL64, (/ nbf2 /), description=OQP_FOCK_B_comment)
call check_status(stat, module_name, subroutine_name, OQP_FOCK_B)
end if

! Prepare dft grid
Expand Down
10 changes: 6 additions & 4 deletions source/modules/int1e.F90
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ end subroutine int1e_C
!> @brief Calculate the basic H, S, and T 1e-integrals
subroutine int1e(infos)

use, intrinsic :: iso_c_binding, only: c_int32_t
use types, only: information
use oqp_tagarray_driver
use precision, only: dp
Expand All @@ -45,6 +46,7 @@ subroutine int1e(infos)
integer :: i, nbf, nat, nbf2

! tagarray
integer(c_int32_t) :: stat
real(kind=dp), contiguous, pointer :: &
hcore(:), tmat(:), smat(:)
character(len=*), parameter :: tags_general(3) = (/ character(len=80) :: &
Expand Down Expand Up @@ -79,11 +81,11 @@ subroutine int1e(infos)
! Allocate H, S and T matrices
nbf2 = basis%nbf*(basis%nbf+1)/2

call infos%dat%remove_records(tags_general)
call infos%dat%erase(tags_general)

call infos%dat%reserve_data(OQP_SM, TA_TYPE_REAL64, nbf2, comment=OQP_SM_comment)
call infos%dat%reserve_data(OQP_TM, TA_TYPE_REAL64, nbf2, comment=OQP_TM_comment)
call infos%dat%reserve_data(OQP_Hcore, TA_TYPE_REAL64, nbf2, comment=OQP_Hcore_comment)
stat = infos%dat%create(OQP_SM, TA_TYPE_REAL64, (/ nbf2 /), description=OQP_SM_comment)
stat = infos%dat%create(OQP_TM, TA_TYPE_REAL64, (/ nbf2 /), description=OQP_TM_comment)
stat = infos%dat%create(OQP_Hcore, TA_TYPE_REAL64, (/ nbf2 /), description=OQP_Hcore_comment)

call data_has_tags(infos%dat, tags_general, module_name, subroutine_name, WITH_ABORT)
call tagarray_get_data(infos%dat, OQP_SM, smat)
Expand Down
28 changes: 15 additions & 13 deletions source/modules/tdhf_energy.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ subroutine tdhf_energy_C(c_handle) bind(C, name="tdhf_energy")
end subroutine tdhf_energy_C

subroutine tdhf_energy(infos)
use, intrinsic :: iso_c_binding, only: c_int32_t
use io_constants, only: iw
use oqp_tagarray_driver
use types, only: information
Expand Down Expand Up @@ -81,6 +82,7 @@ subroutine tdhf_energy(infos)
logical :: dft

! tagarray
integer(c_int32_t) :: stat
real(kind=dp), contiguous, pointer :: &
mo_energy_a(:), mo_a(:,:), td_t(:,:), &
xpy(:,:), xmy(:,:), td_energies(:)
Expand Down Expand Up @@ -313,27 +315,27 @@ subroutine tdhf_energy(infos)
vro(:,ist) = vro(:,ist) * norm
end do

call infos%dat%remove_records(tags_alloc)
call infos%dat%erase(tags_alloc)

call infos%dat%reserve_data(OQP_td_t, &
stat = infos%dat%create(OQP_td_t, &
TA_TYPE_REAL64, &
nbf2, [nbf2, 1], &
comment=OQP_td_t_comment)
[nbf2, 1], &
description=OQP_td_t_comment)

call infos%dat%reserve_data(OQP_td_xpy, &
stat = infos%dat%create(OQP_td_xpy, &
TA_TYPE_REAL64, &
lexc*nstates, [lexc, nstates], &
comment="(X+Y) vector for target state in TD-DFT calculations")
[lexc, nstates], &
description="(X+Y) vector for target state in TD-DFT calculations")

call infos%dat%reserve_data(OQP_td_xmy, &
stat = infos%dat%create(OQP_td_xmy, &
TA_TYPE_REAL64, &
lexc*nstates, [lexc, nstates], &
comment="(X-Y) vector for target state in TD-DFT calculations")
[lexc, nstates], &
description="(X-Y) vector for target state in TD-DFT calculations")

call infos%dat%reserve_data(OQP_td_energies, &
stat = infos%dat%create(OQP_td_energies, &
TA_TYPE_REAL64, &
nstates, [nstates], &
comment=OQP_td_energies_comment)
[nstates], &
description=OQP_td_energies_comment)

call tagarray_get_data(infos%dat, OQP_td_t, td_t)
call tagarray_get_data(infos%dat, OQP_td_xpy, xpy)
Expand Down
Loading
Loading