mirror of
https://github.com/TREX-CoE/trexio.git
synced 2024-11-03 20:54:07 +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 `trexio_has_group` functionality
|
||||||
- Added OCaml binding
|
- Added OCaml binding
|
||||||
|
- Added spin and energy in MOs
|
||||||
|
|
||||||
2.2
|
2.2
|
||||||
---
|
---
|
||||||
|
@ -63,6 +63,8 @@ subroutine test_write(file_name, back_end)
|
|||||||
|
|
||||||
character(len=:), allocatable :: sym_str
|
character(len=:), allocatable :: sym_str
|
||||||
character(len=:), allocatable :: label(:)
|
character(len=:), allocatable :: label(:)
|
||||||
|
double precision, allocatable :: energy(:)
|
||||||
|
integer , allocatable :: spin(:)
|
||||||
|
|
||||||
! sparse data
|
! sparse data
|
||||||
integer(4) :: index_sparse_ao_2e_int_eri(4,100)
|
integer(4) :: index_sparse_ao_2e_int_eri(4,100)
|
||||||
@ -183,6 +185,23 @@ subroutine test_write(file_name, back_end)
|
|||||||
call trexio_assert(rc, TREXIO_SUCCESS, 'SUCCESS WRITE MO NUM')
|
call trexio_assert(rc, TREXIO_SUCCESS, 'SUCCESS WRITE MO NUM')
|
||||||
endif
|
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
|
offset = 0
|
||||||
do i = 1,n_buffers
|
do i = 1,n_buffers
|
||||||
@ -252,6 +271,9 @@ subroutine test_read(file_name, back_end)
|
|||||||
character(len=4) :: label(12) ! also works with allocatable arrays
|
character(len=4) :: label(12) ! also works with allocatable arrays
|
||||||
|
|
||||||
character(len=32) :: sym_str
|
character(len=32) :: sym_str
|
||||||
|
integer :: mo_num
|
||||||
|
double precision, allocatable :: energy(:)
|
||||||
|
integer , allocatable :: spin(:)
|
||||||
|
|
||||||
! sparse data
|
! sparse data
|
||||||
integer(4) :: index_sparse_ao_2e_int_eri(4,20)
|
integer(4) :: index_sparse_ao_2e_int_eri(4,20)
|
||||||
@ -455,6 +477,26 @@ subroutine test_read(file_name, back_end)
|
|||||||
call exit(-1)
|
call exit(-1)
|
||||||
endif
|
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
|
! close the file
|
||||||
rc = trexio_close(trex_file)
|
rc = trexio_close(trex_file)
|
||||||
call trexio_assert(rc, TREXIO_SUCCESS)
|
call trexio_assert(rc, TREXIO_SUCCESS)
|
||||||
|
48
trex.org
48
trex.org
@ -70,7 +70,7 @@ means that the source code is not produced by the generator, but hand-written.
|
|||||||
|
|
||||||
#+CALL: json(data=metadata, title="metadata")
|
#+CALL: json(data=metadata, title="metadata")
|
||||||
#+RESULTS:
|
#+RESULTS:
|
||||||
:RESULTS:
|
:results:
|
||||||
#+begin_src python :tangle trex.json
|
#+begin_src python :tangle trex.json
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"code_num" : [ "dim", [] ]
|
"code_num" : [ "dim", [] ]
|
||||||
@ -82,7 +82,7 @@ means that the source code is not produced by the generator, but hand-written.
|
|||||||
, "unsafe" : [ "int", [] ]
|
, "unsafe" : [ "int", [] ]
|
||||||
} ,
|
} ,
|
||||||
#+end_src
|
#+end_src
|
||||||
:END:
|
:end:
|
||||||
|
|
||||||
* Electron (electron group)
|
* Electron (electron group)
|
||||||
|
|
||||||
@ -197,7 +197,7 @@ If you encounter the aforementioned issue, please report it to our [[https://git
|
|||||||
#+CALL: json(data=ecp, title="ecp")
|
#+CALL: json(data=ecp, title="ecp")
|
||||||
|
|
||||||
#+RESULTS:
|
#+RESULTS:
|
||||||
:RESULTS:
|
:results:
|
||||||
#+begin_src python :tangle trex.json
|
#+begin_src python :tangle trex.json
|
||||||
"ecp": {
|
"ecp": {
|
||||||
"max_ang_mom_plus_1" : [ "int" , [ "nucleus.num" ] ]
|
"max_ang_mom_plus_1" : [ "int" , [ "nucleus.num" ] ]
|
||||||
@ -210,7 +210,7 @@ If you encounter the aforementioned issue, please report it to our [[https://git
|
|||||||
, "power" : [ "int" , [ "ecp.num" ] ]
|
, "power" : [ "int" , [ "ecp.num" ] ]
|
||||||
} ,
|
} ,
|
||||||
#+end_src
|
#+end_src
|
||||||
:END:
|
:end:
|
||||||
|
|
||||||
** Example
|
** Example
|
||||||
|
|
||||||
@ -324,7 +324,7 @@ power = [
|
|||||||
#+CALL: json(data=basis, title="basis")
|
#+CALL: json(data=basis, title="basis")
|
||||||
|
|
||||||
#+RESULTS:
|
#+RESULTS:
|
||||||
:RESULTS:
|
:results:
|
||||||
#+begin_src python :tangle trex.json
|
#+begin_src python :tangle trex.json
|
||||||
"basis": {
|
"basis": {
|
||||||
"type" : [ "str" , [] ]
|
"type" : [ "str" , [] ]
|
||||||
@ -339,7 +339,7 @@ power = [
|
|||||||
, "prim_factor" : [ "float", [ "basis.prim_num" ] ]
|
, "prim_factor" : [ "float", [ "basis.prim_num" ] ]
|
||||||
} ,
|
} ,
|
||||||
#+end_src
|
#+end_src
|
||||||
:END:
|
:end:
|
||||||
|
|
||||||
** Example
|
** Example
|
||||||
|
|
||||||
@ -470,7 +470,7 @@ prim_factor =
|
|||||||
#+CALL: json(data=ao, title="ao")
|
#+CALL: json(data=ao, title="ao")
|
||||||
|
|
||||||
#+RESULTS:
|
#+RESULTS:
|
||||||
:RESULTS:
|
:results:
|
||||||
#+begin_src python :tangle trex.json
|
#+begin_src python :tangle trex.json
|
||||||
"ao": {
|
"ao": {
|
||||||
"cartesian" : [ "int" , [] ]
|
"cartesian" : [ "int" , [] ]
|
||||||
@ -479,7 +479,7 @@ prim_factor =
|
|||||||
, "normalization" : [ "float", [ "ao.num" ] ]
|
, "normalization" : [ "float", [ "ao.num" ] ]
|
||||||
} ,
|
} ,
|
||||||
#+end_src
|
#+end_src
|
||||||
:END:
|
:end:
|
||||||
|
|
||||||
** One-electron integrals (~ao_1e_int~ group)
|
** One-electron integrals (~ao_1e_int~ group)
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
@ -514,7 +514,7 @@ prim_factor =
|
|||||||
#+CALL: json(data=ao_1e_int, title="ao_1e_int")
|
#+CALL: json(data=ao_1e_int, title="ao_1e_int")
|
||||||
|
|
||||||
#+RESULTS:
|
#+RESULTS:
|
||||||
:RESULTS:
|
:results:
|
||||||
#+begin_src python :tangle trex.json
|
#+begin_src python :tangle trex.json
|
||||||
"ao_1e_int": {
|
"ao_1e_int": {
|
||||||
"overlap" : [ "float", [ "ao.num", "ao.num" ] ]
|
"overlap" : [ "float", [ "ao.num", "ao.num" ] ]
|
||||||
@ -529,7 +529,7 @@ prim_factor =
|
|||||||
, "core_hamiltonian_im" : [ "float", [ "ao.num", "ao.num" ] ]
|
, "core_hamiltonian_im" : [ "float", [ "ao.num", "ao.num" ] ]
|
||||||
} ,
|
} ,
|
||||||
#+end_src
|
#+end_src
|
||||||
:END:
|
:end:
|
||||||
|
|
||||||
** Two-electron integrals (~ao_2e_int~ group)
|
** Two-electron integrals (~ao_2e_int~ group)
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
@ -581,11 +581,13 @@ prim_factor =
|
|||||||
| ~class~ | ~str~ | ~(mo.num)~ | Choose among: Core, Inactive, Active, Virtual, Deleted |
|
| ~class~ | ~str~ | ~(mo.num)~ | Choose among: Core, Inactive, Active, Virtual, Deleted |
|
||||||
| ~symmetry~ | ~str~ | ~(mo.num)~ | Symmetry in the point group |
|
| ~symmetry~ | ~str~ | ~(mo.num)~ | Symmetry in the point group |
|
||||||
| ~occupation~ | ~float~ | ~(mo.num)~ | Occupation number |
|
| ~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")
|
#+CALL: json(data=mo, title="mo")
|
||||||
|
|
||||||
#+RESULTS:
|
#+RESULTS:
|
||||||
:RESULTS:
|
:results:
|
||||||
#+begin_src python :tangle trex.json
|
#+begin_src python :tangle trex.json
|
||||||
"mo": {
|
"mo": {
|
||||||
"type" : [ "str" , [] ]
|
"type" : [ "str" , [] ]
|
||||||
@ -595,9 +597,11 @@ prim_factor =
|
|||||||
, "class" : [ "str" , [ "mo.num" ] ]
|
, "class" : [ "str" , [ "mo.num" ] ]
|
||||||
, "symmetry" : [ "str" , [ "mo.num" ] ]
|
, "symmetry" : [ "str" , [ "mo.num" ] ]
|
||||||
, "occupation" : [ "float", [ "mo.num" ] ]
|
, "occupation" : [ "float", [ "mo.num" ] ]
|
||||||
|
, "energy" : [ "float", [ "mo.num" ] ]
|
||||||
|
, "spin" : [ "int" , [ "mo.num" ] ]
|
||||||
} ,
|
} ,
|
||||||
#+end_src
|
#+end_src
|
||||||
:END:
|
:end:
|
||||||
|
|
||||||
** One-electron integrals (~mo_1e_int~ group)
|
** One-electron integrals (~mo_1e_int~ group)
|
||||||
|
|
||||||
@ -622,7 +626,7 @@ prim_factor =
|
|||||||
#+CALL: json(data=mo_1e_int, title="mo_1e_int")
|
#+CALL: json(data=mo_1e_int, title="mo_1e_int")
|
||||||
|
|
||||||
#+RESULTS:
|
#+RESULTS:
|
||||||
:RESULTS:
|
:results:
|
||||||
#+begin_src python :tangle trex.json
|
#+begin_src python :tangle trex.json
|
||||||
"mo_1e_int": {
|
"mo_1e_int": {
|
||||||
"overlap" : [ "float", [ "mo.num", "mo.num" ] ]
|
"overlap" : [ "float", [ "mo.num", "mo.num" ] ]
|
||||||
@ -637,7 +641,7 @@ prim_factor =
|
|||||||
, "core_hamiltonian_im" : [ "float", [ "mo.num", "mo.num" ] ]
|
, "core_hamiltonian_im" : [ "float", [ "mo.num", "mo.num" ] ]
|
||||||
} ,
|
} ,
|
||||||
#+end_src
|
#+end_src
|
||||||
:END:
|
:end:
|
||||||
|
|
||||||
** Two-electron integrals (~mo_2e_int~ group)
|
** Two-electron integrals (~mo_2e_int~ group)
|
||||||
|
|
||||||
@ -701,7 +705,7 @@ prim_factor =
|
|||||||
#+CALL: json(data=determinant, title="determinant")
|
#+CALL: json(data=determinant, title="determinant")
|
||||||
|
|
||||||
#+RESULTS:
|
#+RESULTS:
|
||||||
:RESULTS:
|
:results:
|
||||||
#+begin_src python :tangle trex.json
|
#+begin_src python :tangle trex.json
|
||||||
"determinant": {
|
"determinant": {
|
||||||
"num" : [ "dim readonly" , [] ]
|
"num" : [ "dim readonly" , [] ]
|
||||||
@ -709,7 +713,7 @@ prim_factor =
|
|||||||
, "coefficient" : [ "float special", [ "determinant.num", "state.num" ] ]
|
, "coefficient" : [ "float special", [ "determinant.num", "state.num" ] ]
|
||||||
} ,
|
} ,
|
||||||
#+end_src
|
#+end_src
|
||||||
:END:
|
:end:
|
||||||
|
|
||||||
* Excited states (state group)
|
* Excited states (state group)
|
||||||
|
|
||||||
@ -727,14 +731,14 @@ prim_factor =
|
|||||||
#+CALL: json(data=state, title="state")
|
#+CALL: json(data=state, title="state")
|
||||||
|
|
||||||
#+RESULTS:
|
#+RESULTS:
|
||||||
:RESULTS:
|
:results:
|
||||||
#+begin_src python :tangle trex.json
|
#+begin_src python :tangle trex.json
|
||||||
"state": {
|
"state": {
|
||||||
"num" : [ "dim", [] ]
|
"num" : [ "dim", [] ]
|
||||||
, "label" : [ "str", [ "state.num" ] ]
|
, "label" : [ "str", [ "state.num" ] ]
|
||||||
} ,
|
} ,
|
||||||
#+end_src
|
#+end_src
|
||||||
:END:
|
:end:
|
||||||
|
|
||||||
* Reduced density matrices (rdm group)
|
* Reduced density matrices (rdm group)
|
||||||
|
|
||||||
@ -819,7 +823,7 @@ prim_factor =
|
|||||||
#+CALL: json(data=cell, title="cell")
|
#+CALL: json(data=cell, title="cell")
|
||||||
|
|
||||||
#+RESULTS:
|
#+RESULTS:
|
||||||
:RESULTS:
|
:results:
|
||||||
#+begin_src python :tangle trex.json
|
#+begin_src python :tangle trex.json
|
||||||
"cell": {
|
"cell": {
|
||||||
"a" : [ "float", [ "3" ] ]
|
"a" : [ "float", [ "3" ] ]
|
||||||
@ -827,7 +831,7 @@ prim_factor =
|
|||||||
, "c" : [ "float", [ "3" ] ]
|
, "c" : [ "float", [ "3" ] ]
|
||||||
} ,
|
} ,
|
||||||
#+end_src
|
#+end_src
|
||||||
:END:
|
:end:
|
||||||
|
|
||||||
* Periodic boundary calculations (pbc group)
|
* Periodic boundary calculations (pbc group)
|
||||||
|
|
||||||
@ -840,14 +844,14 @@ prim_factor =
|
|||||||
#+CALL: json(data=pbc, title="pbc")
|
#+CALL: json(data=pbc, title="pbc")
|
||||||
|
|
||||||
#+RESULTS:
|
#+RESULTS:
|
||||||
:RESULTS:
|
:results:
|
||||||
#+begin_src python :tangle trex.json
|
#+begin_src python :tangle trex.json
|
||||||
"pbc": {
|
"pbc": {
|
||||||
"periodic" : [ "int" , [] ]
|
"periodic" : [ "int" , [] ]
|
||||||
, "k_point" : [ "float", [ "3" ] ]
|
, "k_point" : [ "float", [ "3" ] ]
|
||||||
} ,
|
} ,
|
||||||
#+end_src
|
#+end_src
|
||||||
:END:
|
:end:
|
||||||
|
|
||||||
* Quantum Monte Carlo data (qmc group)
|
* Quantum Monte Carlo data (qmc group)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user