mirror of
https://github.com/TREX-CoE/trexio.git
synced 2025-01-09 12:44:11 +01:00
Add UHF possibility (#96)
This commit is contained in:
parent
2b20776615
commit
a8c3619655
@ -6,6 +6,7 @@ CHANGES
|
||||
|
||||
- Added `trexio_has_group` functionality
|
||||
- Added OCaml binding
|
||||
- Added spin and energy in MOs
|
||||
|
||||
2.2
|
||||
---
|
||||
|
@ -10,10 +10,10 @@ TREX library for efficient I/O.
|
||||
|
||||
## Minimal requirements (for users):
|
||||
|
||||
- Autotools (autoconf >= 2.69, automake >= 1.11, libtool >= 2.2) or CMake (>= 3.16)
|
||||
- Autotools (autoconf >= 2.69, automake >= 1.11, libtool >= 2.2) or CMake (>= 3.16)
|
||||
- C compiler (gcc/icc/clang)
|
||||
- Fortran compiler (gfortran/ifort)
|
||||
- HDF5 library (>= 1.8) [optional, recommended for high performance]
|
||||
- HDF5 library (>= 1.8) [optional, recommended for high performance]
|
||||
|
||||
|
||||
## Installation procedure from the tarball (for users):
|
||||
|
@ -63,6 +63,8 @@ subroutine test_write(file_name, back_end)
|
||||
|
||||
character(len=:), allocatable :: sym_str
|
||||
character(len=:), allocatable :: label(:)
|
||||
double precision, allocatable :: energy(:)
|
||||
integer , allocatable :: spin(:)
|
||||
|
||||
! sparse data
|
||||
integer(4) :: index_sparse_ao_2e_int_eri(4,100)
|
||||
@ -183,12 +185,29 @@ subroutine test_write(file_name, back_end)
|
||||
call trexio_assert(rc, TREXIO_SUCCESS, 'SUCCESS WRITE MO NUM')
|
||||
endif
|
||||
|
||||
allocate(energy(mo_num))
|
||||
do i=1,mo_num
|
||||
energy(i) = dble(i)-100.d0
|
||||
enddo
|
||||
rc = trexio_write_mo_energy(trex_file, energy)
|
||||
call trexio_assert(rc, TREXIO_SUCCESS, 'SUCCESS WRITE ENERGY')
|
||||
deallocate(energy)
|
||||
|
||||
allocate(spin(mo_num))
|
||||
spin(:) = 0
|
||||
do i=mo_num/2+1,mo_num
|
||||
spin(i) = 1
|
||||
enddo
|
||||
rc = trexio_write_mo_spin(trex_file, spin)
|
||||
call trexio_assert(rc, TREXIO_SUCCESS, 'SUCCESS WRITE SPIN')
|
||||
deallocate(spin)
|
||||
|
||||
|
||||
offset = 0
|
||||
do i = 1,n_buffers
|
||||
rc = trexio_write_ao_2e_int_eri(trex_file, offset, buf_size_sparse, &
|
||||
index_sparse_ao_2e_int_eri(1,offset+1), &
|
||||
value_sparse_ao_2e_int_eri(offset+1))
|
||||
index_sparse_ao_2e_int_eri(1,offset+1), &
|
||||
value_sparse_ao_2e_int_eri(offset+1))
|
||||
call trexio_assert(rc, TREXIO_SUCCESS, 'SUCCESS WRITE SPARSE')
|
||||
offset = offset + buf_size_sparse
|
||||
enddo
|
||||
@ -196,7 +215,7 @@ subroutine test_write(file_name, back_end)
|
||||
offset = 0
|
||||
do i = 1,n_buffers
|
||||
rc = trexio_write_determinant_list(trex_file, offset, buf_size_det, &
|
||||
det_list(1,offset+1))
|
||||
det_list(1,offset+1))
|
||||
call trexio_assert(rc, TREXIO_SUCCESS, 'SUCCESS WRITE DET LIST')
|
||||
offset = offset + buf_size_det
|
||||
enddo
|
||||
@ -252,6 +271,9 @@ subroutine test_read(file_name, back_end)
|
||||
character(len=4) :: label(12) ! also works with allocatable arrays
|
||||
|
||||
character(len=32) :: sym_str
|
||||
integer :: mo_num
|
||||
double precision, allocatable :: energy(:)
|
||||
integer , allocatable :: spin(:)
|
||||
|
||||
! sparse data
|
||||
integer(4) :: index_sparse_ao_2e_int_eri(4,20)
|
||||
@ -358,8 +380,8 @@ subroutine test_read(file_name, back_end)
|
||||
|
||||
|
||||
rc = trexio_read_ao_2e_int_eri(trex_file, offset_read, read_buf_size, &
|
||||
index_sparse_ao_2e_int_eri(1, offset_data_read + 1), &
|
||||
value_sparse_ao_2e_int_eri(offset_data_read + 1))
|
||||
index_sparse_ao_2e_int_eri(1, offset_data_read + 1), &
|
||||
value_sparse_ao_2e_int_eri(offset_data_read + 1))
|
||||
!do i = 1,20
|
||||
! write(*,*) index_sparse_ao_2e_int_eri(1,i)
|
||||
!enddo
|
||||
@ -376,8 +398,8 @@ subroutine test_read(file_name, back_end)
|
||||
! attempt to read reaching EOF: should return TREXIO_END and
|
||||
! NOT increment the existing values in the buffer (only upd with what has been read)
|
||||
rc = trexio_read_ao_2e_int_eri(trex_file, offset_eof, read_buf_size, &
|
||||
index_sparse_ao_2e_int_eri(1, offset_data_eof + 1), &
|
||||
value_sparse_ao_2e_int_eri(offset_data_eof + 1))
|
||||
index_sparse_ao_2e_int_eri(1, offset_data_eof + 1), &
|
||||
value_sparse_ao_2e_int_eri(offset_data_eof + 1))
|
||||
!do i = 1,20
|
||||
! write(*,*) index_sparse_ao_2e_int_eri(1,i)
|
||||
!enddo
|
||||
@ -415,7 +437,7 @@ subroutine test_read(file_name, back_end)
|
||||
|
||||
! read a chunk of determinants
|
||||
rc = trexio_read_determinant_list(trex_file, offset_det_read, read_buf_det_size, &
|
||||
det_list(1, offset_det_data_read + 1))
|
||||
det_list(1, offset_det_data_read + 1))
|
||||
!do i = 1,50
|
||||
! write(*,*) det_list(1,i)
|
||||
!enddo
|
||||
@ -455,6 +477,26 @@ subroutine test_read(file_name, back_end)
|
||||
call exit(-1)
|
||||
endif
|
||||
|
||||
rc = trexio_read_mo_num(trex_file, mo_num)
|
||||
call trexio_assert(rc, TREXIO_SUCCESS)
|
||||
|
||||
allocate(spin(mo_num), energy(mo_num))
|
||||
rc = trexio_read_mo_energy(trex_file, energy)
|
||||
call trexio_assert(rc, TREXIO_SUCCESS)
|
||||
|
||||
if (energy(10) /= -90.d0) then
|
||||
print *, 'Failure to read MO energy: ', energy(10)
|
||||
call exit(-1)
|
||||
end if
|
||||
|
||||
rc = trexio_read_mo_spin(trex_file, spin)
|
||||
call trexio_assert(rc, TREXIO_SUCCESS)
|
||||
|
||||
if (sum(spin) /= mo_num/2) then
|
||||
print *, 'Failure to read MO spin', mo_num, sum(spin)
|
||||
call exit(-1)
|
||||
end if
|
||||
|
||||
! close the file
|
||||
rc = trexio_close(trex_file)
|
||||
call trexio_assert(rc, TREXIO_SUCCESS)
|
||||
|
180
trex.org
180
trex.org
@ -70,19 +70,19 @@ means that the source code is not produced by the generator, but hand-written.
|
||||
|
||||
#+CALL: json(data=metadata, title="metadata")
|
||||
#+RESULTS:
|
||||
:RESULTS:
|
||||
:results:
|
||||
#+begin_src python :tangle trex.json
|
||||
"metadata": {
|
||||
"code_num" : [ "dim", [] ]
|
||||
, "code" : [ "str", [ "metadata.code_num" ] ]
|
||||
, "author_num" : [ "dim", [] ]
|
||||
, "author" : [ "str", [ "metadata.author_num" ] ]
|
||||
, "package_version" : [ "str", [] ]
|
||||
, "description" : [ "str", [] ]
|
||||
, "unsafe" : [ "int", [] ]
|
||||
"code_num" : [ "dim", [] ]
|
||||
, "code" : [ "str", [ "metadata.code_num" ] ]
|
||||
, "author_num" : [ "dim", [] ]
|
||||
, "author" : [ "str", [ "metadata.author_num" ] ]
|
||||
, "package_version" : [ "str", [] ]
|
||||
, "description" : [ "str", [] ]
|
||||
, "unsafe" : [ "int", [] ]
|
||||
} ,
|
||||
#+end_src
|
||||
:END:
|
||||
:end:
|
||||
|
||||
* Electron (electron group)
|
||||
|
||||
@ -197,20 +197,20 @@ If you encounter the aforementioned issue, please report it to our [[https://git
|
||||
#+CALL: json(data=ecp, title="ecp")
|
||||
|
||||
#+RESULTS:
|
||||
:RESULTS:
|
||||
:results:
|
||||
#+begin_src python :tangle trex.json
|
||||
"ecp": {
|
||||
"max_ang_mom_plus_1" : [ "int" , [ "nucleus.num" ] ]
|
||||
, "z_core" : [ "int" , [ "nucleus.num" ] ]
|
||||
, "num" : [ "dim" , [] ]
|
||||
, "ang_mom" : [ "int" , [ "ecp.num" ] ]
|
||||
, "nucleus_index" : [ "index", [ "ecp.num" ] ]
|
||||
, "exponent" : [ "float", [ "ecp.num" ] ]
|
||||
, "coefficient" : [ "float", [ "ecp.num" ] ]
|
||||
, "power" : [ "int" , [ "ecp.num" ] ]
|
||||
"max_ang_mom_plus_1" : [ "int" , [ "nucleus.num" ] ]
|
||||
, "z_core" : [ "int" , [ "nucleus.num" ] ]
|
||||
, "num" : [ "dim" , [] ]
|
||||
, "ang_mom" : [ "int" , [ "ecp.num" ] ]
|
||||
, "nucleus_index" : [ "index", [ "ecp.num" ] ]
|
||||
, "exponent" : [ "float", [ "ecp.num" ] ]
|
||||
, "coefficient" : [ "float", [ "ecp.num" ] ]
|
||||
, "power" : [ "int" , [ "ecp.num" ] ]
|
||||
} ,
|
||||
#+end_src
|
||||
:END:
|
||||
:end:
|
||||
|
||||
** Example
|
||||
|
||||
@ -324,22 +324,22 @@ power = [
|
||||
#+CALL: json(data=basis, title="basis")
|
||||
|
||||
#+RESULTS:
|
||||
:RESULTS:
|
||||
:results:
|
||||
#+begin_src python :tangle trex.json
|
||||
"basis": {
|
||||
"type" : [ "str" , [] ]
|
||||
, "prim_num" : [ "dim" , [] ]
|
||||
, "shell_num" : [ "dim" , [] ]
|
||||
, "nucleus_index" : [ "index", [ "basis.shell_num" ] ]
|
||||
, "shell_ang_mom" : [ "int" , [ "basis.shell_num" ] ]
|
||||
, "shell_factor" : [ "float", [ "basis.shell_num" ] ]
|
||||
, "shell_index" : [ "index", [ "basis.prim_num" ] ]
|
||||
, "exponent" : [ "float", [ "basis.prim_num" ] ]
|
||||
, "coefficient" : [ "float", [ "basis.prim_num" ] ]
|
||||
, "prim_factor" : [ "float", [ "basis.prim_num" ] ]
|
||||
"type" : [ "str" , [] ]
|
||||
, "prim_num" : [ "dim" , [] ]
|
||||
, "shell_num" : [ "dim" , [] ]
|
||||
, "nucleus_index" : [ "index", [ "basis.shell_num" ] ]
|
||||
, "shell_ang_mom" : [ "int" , [ "basis.shell_num" ] ]
|
||||
, "shell_factor" : [ "float", [ "basis.shell_num" ] ]
|
||||
, "shell_index" : [ "index", [ "basis.prim_num" ] ]
|
||||
, "exponent" : [ "float", [ "basis.prim_num" ] ]
|
||||
, "coefficient" : [ "float", [ "basis.prim_num" ] ]
|
||||
, "prim_factor" : [ "float", [ "basis.prim_num" ] ]
|
||||
} ,
|
||||
#+end_src
|
||||
:END:
|
||||
:end:
|
||||
|
||||
** Example
|
||||
|
||||
@ -470,16 +470,16 @@ prim_factor =
|
||||
#+CALL: json(data=ao, title="ao")
|
||||
|
||||
#+RESULTS:
|
||||
:RESULTS:
|
||||
:results:
|
||||
#+begin_src python :tangle trex.json
|
||||
"ao": {
|
||||
"cartesian" : [ "int" , [] ]
|
||||
, "num" : [ "dim" , [] ]
|
||||
, "shell" : [ "index", [ "ao.num" ] ]
|
||||
, "normalization" : [ "float", [ "ao.num" ] ]
|
||||
"cartesian" : [ "int" , [] ]
|
||||
, "num" : [ "dim" , [] ]
|
||||
, "shell" : [ "index", [ "ao.num" ] ]
|
||||
, "normalization" : [ "float", [ "ao.num" ] ]
|
||||
} ,
|
||||
#+end_src
|
||||
:END:
|
||||
:end:
|
||||
|
||||
** One-electron integrals (~ao_1e_int~ group)
|
||||
:PROPERTIES:
|
||||
@ -514,22 +514,22 @@ prim_factor =
|
||||
#+CALL: json(data=ao_1e_int, title="ao_1e_int")
|
||||
|
||||
#+RESULTS:
|
||||
:RESULTS:
|
||||
:results:
|
||||
#+begin_src python :tangle trex.json
|
||||
"ao_1e_int": {
|
||||
"overlap" : [ "float", [ "ao.num", "ao.num" ] ]
|
||||
, "kinetic" : [ "float", [ "ao.num", "ao.num" ] ]
|
||||
, "potential_n_e" : [ "float", [ "ao.num", "ao.num" ] ]
|
||||
, "ecp" : [ "float", [ "ao.num", "ao.num" ] ]
|
||||
, "core_hamiltonian" : [ "float", [ "ao.num", "ao.num" ] ]
|
||||
, "overlap_im" : [ "float", [ "ao.num", "ao.num" ] ]
|
||||
, "kinetic_im" : [ "float", [ "ao.num", "ao.num" ] ]
|
||||
, "potential_n_e_im" : [ "float", [ "ao.num", "ao.num" ] ]
|
||||
, "ecp_im" : [ "float", [ "ao.num", "ao.num" ] ]
|
||||
, "core_hamiltonian_im" : [ "float", [ "ao.num", "ao.num" ] ]
|
||||
"overlap" : [ "float", [ "ao.num", "ao.num" ] ]
|
||||
, "kinetic" : [ "float", [ "ao.num", "ao.num" ] ]
|
||||
, "potential_n_e" : [ "float", [ "ao.num", "ao.num" ] ]
|
||||
, "ecp" : [ "float", [ "ao.num", "ao.num" ] ]
|
||||
, "core_hamiltonian" : [ "float", [ "ao.num", "ao.num" ] ]
|
||||
, "overlap_im" : [ "float", [ "ao.num", "ao.num" ] ]
|
||||
, "kinetic_im" : [ "float", [ "ao.num", "ao.num" ] ]
|
||||
, "potential_n_e_im" : [ "float", [ "ao.num", "ao.num" ] ]
|
||||
, "ecp_im" : [ "float", [ "ao.num", "ao.num" ] ]
|
||||
, "core_hamiltonian_im" : [ "float", [ "ao.num", "ao.num" ] ]
|
||||
} ,
|
||||
#+end_src
|
||||
:END:
|
||||
:end:
|
||||
|
||||
** Two-electron integrals (~ao_2e_int~ group)
|
||||
:PROPERTIES:
|
||||
@ -581,23 +581,27 @@ prim_factor =
|
||||
| ~class~ | ~str~ | ~(mo.num)~ | Choose among: Core, Inactive, Active, Virtual, Deleted |
|
||||
| ~symmetry~ | ~str~ | ~(mo.num)~ | Symmetry in the point group |
|
||||
| ~occupation~ | ~float~ | ~(mo.num)~ | Occupation number |
|
||||
| ~energy~ | ~float~ | ~(mo.num)~ | For canonical MOs, corresponding eigenvalue |
|
||||
| ~spin~ | ~int~ | ~(mo.num)~ | For UHF wave functions, 0 is $\alpha$ and 1 is $\beta$ |
|
||||
|
||||
#+CALL: json(data=mo, title="mo")
|
||||
|
||||
#+RESULTS:
|
||||
:RESULTS:
|
||||
:results:
|
||||
#+begin_src python :tangle trex.json
|
||||
"mo": {
|
||||
"type" : [ "str" , [] ]
|
||||
, "num" : [ "dim" , [] ]
|
||||
, "coefficient" : [ "float", [ "mo.num", "ao.num" ] ]
|
||||
, "coefficient_im" : [ "float", [ "mo.num", "ao.num" ] ]
|
||||
, "class" : [ "str" , [ "mo.num" ] ]
|
||||
, "symmetry" : [ "str" , [ "mo.num" ] ]
|
||||
, "occupation" : [ "float", [ "mo.num" ] ]
|
||||
"type" : [ "str" , [] ]
|
||||
, "num" : [ "dim" , [] ]
|
||||
, "coefficient" : [ "float", [ "mo.num", "ao.num" ] ]
|
||||
, "coefficient_im" : [ "float", [ "mo.num", "ao.num" ] ]
|
||||
, "class" : [ "str" , [ "mo.num" ] ]
|
||||
, "symmetry" : [ "str" , [ "mo.num" ] ]
|
||||
, "occupation" : [ "float", [ "mo.num" ] ]
|
||||
, "energy" : [ "float", [ "mo.num" ] ]
|
||||
, "spin" : [ "int" , [ "mo.num" ] ]
|
||||
} ,
|
||||
#+end_src
|
||||
:END:
|
||||
:end:
|
||||
|
||||
** One-electron integrals (~mo_1e_int~ group)
|
||||
|
||||
@ -622,22 +626,22 @@ prim_factor =
|
||||
#+CALL: json(data=mo_1e_int, title="mo_1e_int")
|
||||
|
||||
#+RESULTS:
|
||||
:RESULTS:
|
||||
:results:
|
||||
#+begin_src python :tangle trex.json
|
||||
"mo_1e_int": {
|
||||
"overlap" : [ "float", [ "mo.num", "mo.num" ] ]
|
||||
, "kinetic" : [ "float", [ "mo.num", "mo.num" ] ]
|
||||
, "potential_n_e" : [ "float", [ "mo.num", "mo.num" ] ]
|
||||
, "ecp" : [ "float", [ "mo.num", "mo.num" ] ]
|
||||
, "core_hamiltonian" : [ "float", [ "mo.num", "mo.num" ] ]
|
||||
, "overlap_im" : [ "float", [ "mo.num", "mo.num" ] ]
|
||||
, "kinetic_im" : [ "float", [ "mo.num", "mo.num" ] ]
|
||||
, "potential_n_e_im" : [ "float", [ "mo.num", "mo.num" ] ]
|
||||
, "ecp_im" : [ "float", [ "mo.num", "mo.num" ] ]
|
||||
, "core_hamiltonian_im" : [ "float", [ "mo.num", "mo.num" ] ]
|
||||
"overlap" : [ "float", [ "mo.num", "mo.num" ] ]
|
||||
, "kinetic" : [ "float", [ "mo.num", "mo.num" ] ]
|
||||
, "potential_n_e" : [ "float", [ "mo.num", "mo.num" ] ]
|
||||
, "ecp" : [ "float", [ "mo.num", "mo.num" ] ]
|
||||
, "core_hamiltonian" : [ "float", [ "mo.num", "mo.num" ] ]
|
||||
, "overlap_im" : [ "float", [ "mo.num", "mo.num" ] ]
|
||||
, "kinetic_im" : [ "float", [ "mo.num", "mo.num" ] ]
|
||||
, "potential_n_e_im" : [ "float", [ "mo.num", "mo.num" ] ]
|
||||
, "ecp_im" : [ "float", [ "mo.num", "mo.num" ] ]
|
||||
, "core_hamiltonian_im" : [ "float", [ "mo.num", "mo.num" ] ]
|
||||
} ,
|
||||
#+end_src
|
||||
:END:
|
||||
:end:
|
||||
|
||||
** Two-electron integrals (~mo_2e_int~ group)
|
||||
|
||||
@ -701,15 +705,15 @@ prim_factor =
|
||||
#+CALL: json(data=determinant, title="determinant")
|
||||
|
||||
#+RESULTS:
|
||||
:RESULTS:
|
||||
:results:
|
||||
#+begin_src python :tangle trex.json
|
||||
"determinant": {
|
||||
"num" : [ "dim readonly" , [] ]
|
||||
, "list" : [ "int special" , [ "determinant.num" ] ]
|
||||
, "coefficient" : [ "float special", [ "determinant.num", "state.num" ] ]
|
||||
"num" : [ "dim readonly" , [] ]
|
||||
, "list" : [ "int special" , [ "determinant.num" ] ]
|
||||
, "coefficient" : [ "float special", [ "determinant.num", "state.num" ] ]
|
||||
} ,
|
||||
#+end_src
|
||||
:END:
|
||||
:end:
|
||||
|
||||
* Excited states (state group)
|
||||
|
||||
@ -727,14 +731,14 @@ prim_factor =
|
||||
#+CALL: json(data=state, title="state")
|
||||
|
||||
#+RESULTS:
|
||||
:RESULTS:
|
||||
:results:
|
||||
#+begin_src python :tangle trex.json
|
||||
"state": {
|
||||
"num" : [ "dim", [] ]
|
||||
, "label" : [ "str", [ "state.num" ] ]
|
||||
"num" : [ "dim", [] ]
|
||||
, "label" : [ "str", [ "state.num" ] ]
|
||||
} ,
|
||||
#+end_src
|
||||
:END:
|
||||
:end:
|
||||
|
||||
* Reduced density matrices (rdm group)
|
||||
|
||||
@ -819,15 +823,15 @@ prim_factor =
|
||||
#+CALL: json(data=cell, title="cell")
|
||||
|
||||
#+RESULTS:
|
||||
:RESULTS:
|
||||
:results:
|
||||
#+begin_src python :tangle trex.json
|
||||
"cell": {
|
||||
"a" : [ "float", [ "3" ] ]
|
||||
, "b" : [ "float", [ "3" ] ]
|
||||
, "c" : [ "float", [ "3" ] ]
|
||||
"a" : [ "float", [ "3" ] ]
|
||||
, "b" : [ "float", [ "3" ] ]
|
||||
, "c" : [ "float", [ "3" ] ]
|
||||
} ,
|
||||
#+end_src
|
||||
:END:
|
||||
:end:
|
||||
|
||||
* Periodic boundary calculations (pbc group)
|
||||
|
||||
@ -840,14 +844,14 @@ prim_factor =
|
||||
#+CALL: json(data=pbc, title="pbc")
|
||||
|
||||
#+RESULTS:
|
||||
:RESULTS:
|
||||
:results:
|
||||
#+begin_src python :tangle trex.json
|
||||
"pbc": {
|
||||
"periodic" : [ "int" , [] ]
|
||||
, "k_point" : [ "float", [ "3" ] ]
|
||||
"periodic" : [ "int" , [] ]
|
||||
, "k_point" : [ "float", [ "3" ] ]
|
||||
} ,
|
||||
#+end_src
|
||||
:END:
|
||||
:end:
|
||||
|
||||
* Quantum Monte Carlo data (qmc group)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user