diff --git a/devel/trexio/EZFIO.cfg b/devel/trexio/EZFIO.cfg index 6fb6815..3b09bc1 100644 --- a/devel/trexio/EZFIO.cfg +++ b/devel/trexio/EZFIO.cfg @@ -1,6 +1,12 @@ -[backend] +[trexio_backend] type: integer doc: Back-end used in TREXIO. 0: HDF5, 1:Text interface: ezfio, ocaml, provider default: 0 +[trexio_file] +type: character*(256) +doc: Name of the exported TREXIO file +interface: ezfio, ocaml, provider +default: None + diff --git a/devel/trexio/LIB b/devel/trexio/LIB index 91c0923..05990cb 100644 --- a/devel/trexio/LIB +++ b/devel/trexio/LIB @@ -1,2 +1 @@ --ltrexio - +-L/home/scemama/TREX/trexio/_install/lib -L/usr/lib/x86_64-linux-gnu/hdf5/serial -ltrexio -lm -lpthread -lhdf5_hl -lhdf5 diff --git a/devel/trexio/export_trexio.irp.f b/devel/trexio/export_trexio.irp.f index d6d9cb0..e2439c8 100644 --- a/devel/trexio/export_trexio.irp.f +++ b/devel/trexio/export_trexio.irp.f @@ -1,18 +1,67 @@ -program trexio - use trexio - implicit none - BEGIN_DOC -! Exports the wave function in TREXIO format - END_DOC - - integer(8) :: trexio_file - integer :: rc +program export_trexio + use trexio + implicit none + BEGIN_DOC + ! Exports the wave function in TREXIO format + END_DOC - character*(256) :: filename - - filename = trim(ezfio_work_dir)//'/trexio.h5' -! Electrons + integer(8) :: f ! TREXIO file handle + integer :: rc + + print *, 'TREXIO file : '//trim(trexio_filename) + print *, '' + + if (trexio_backend == 0) then + f = trexio_open(trexio_filename, 'w', TREXIO_HDF5) + else if (trexio_backend == 1) then + f = trexio_open(trexio_filename, 'w', TREXIO_TEXT) + endif + if (f == 0) then + print *, 'Unable to open TREXIO file for writing' + stop -1 + endif + + ! Nuclei + rc = trexio_write_nucleus_num(f, nucl_num) + call check_success(rc) + + rc = trexio_write_nucleus_charge(f, nucl_charge) + call check_success(rc) + + rc = trexio_write_nucleus_coord(f, nucl_coord_transp) + call check_success(rc) + + ! Electrons +! rc = trexio_write_electron_up_num(f, elec_alpha_num) +! call check_success(rc) +! +! rc = trexio_write_electron_dn_num(f, elec_beta_num) +! call check_success(rc) + + ! Basis +! rc = trexio_write_basis_type(f, 'Gaussian') +! call check_success(rc) + + rc = trexio_write_basis_shell_num(f, sum(Nucl_num_shell_Aos)) + call check_success(rc) + + + rc = trexio_close(f) + call check_success(rc) end + +subroutine check_success(rc) + use trexio + implicit none + integer, intent(in) :: rc + character*(128) :: str + if (rc /= TREXIO_SUCCESS) then + call trexio_string_of_error(rc,str) + print *, str + stop -1 + endif +end + ! -*- mode: f90 -*- diff --git a/devel/trexio/trexio.irp.f b/devel/trexio/trexio.irp.f deleted file mode 100644 index d97b444..0000000 --- a/devel/trexio/trexio.irp.f +++ /dev/null @@ -1,8 +0,0 @@ -BEGIN_PROVIDER [ character*(1024), trexio_filename ] - implicit none - BEGIN_DOC - ! Name of the TREXIO file - END_DOC - filename = trim(ezfio_work_dir)//'/trexio.h5' -END_PROVIDER -