2021-06-16 14:04:10 +02:00
2021-03-02 14:30:46 +01:00
# TREXIO
2022-06-16 17:18:56 +02:00
< img src = "https://trex-coe.eu/sites/default/files/styles/responsive_no_crop/public/2022-01/TREXIO%20Code.png" width = 200 >
2021-03-29 00:46:06 +02:00
2021-06-25 11:51:06 +02:00
[![build ](https://github.com/TREX-CoE/trexio/actions/workflows/actions.yml/badge.svg )](https://github.com/TREX-CoE/trexio/actions/workflows/actions.yml)
![GitHub release (latest by date) ](https://img.shields.io/github/v/release/TREX-CoE/trexio )
2023-01-11 19:34:27 +01:00
TREX library for efficient I/O.
2021-05-03 15:27:01 +02:00
2021-05-03 15:58:01 +02:00
## Minimal requirements (for users):
2021-05-03 15:27:01 +02:00
2022-07-04 14:35:24 +02:00
- Autotools (autoconf >= 2.69, automake >= 1.11, libtool >= 2.2) or CMake (>= 3.16)
2021-06-11 09:55:37 +02:00
- C compiler (gcc/icc/clang)
- Fortran compiler (gfortran/ifort)
2022-07-04 14:35:24 +02:00
- HDF5 library (>= 1.8) [optional, recommended for high performance]
2021-05-03 15:58:01 +02:00
## Installation procedure from the tarball (for users):
1. Download the `trexio-<version>.tar.gz` file
2. `gzip -cd trexio-<version>.tar.gz | tar xvf -`
2021-05-05 11:37:48 +02:00
3. `cd trexio-<version>`
2021-11-01 10:23:47 +01:00
4. `./configure`
2023-04-03 23:41:02 +02:00
5. ```make -j`getconf _NPROCESSORS_ONLN` ```
6. ```make -j`getconf _NPROCESSORS_ONLN` check```
2021-05-05 11:37:48 +02:00
7. `sudo make install`
2021-05-03 15:58:01 +02:00
2022-01-18 15:38:48 +01:00
**Note: on systems with no `sudo` access, one can replace `./configure` with `./configure prefix=${PWD}/build` in order to execute `make install/uninstall` commands without `sudo` privileges.**
2021-05-03 15:58:01 +02:00
2022-01-18 15:38:48 +01:00
**Note: when linking against an MPI-enabled HDF5 library one usually has to specify the MPI wrapper for the C compiler by adding, e.g., `CC=mpicc` to the `./configure` command.**
2021-05-03 15:58:01 +02:00
## Additional requirements (for developers):
2021-06-11 09:55:37 +02:00
- python3 (>= 3.6)
- Emacs (>= 26.0)
2022-06-03 09:46:23 +02:00
- SWIG (>= 4.0) [required for the Python API]
2021-05-03 15:58:01 +02:00
2023-01-11 19:34:27 +01:00
**Note:** The source code is auto-generated from the Emacs org-mode (`.org`) files following the literate programming approach. This is why the `src` directory is initially empty.
2021-05-03 15:58:01 +02:00
## Installation procedure from the GitHub repo clone (for developers):
2021-04-30 14:29:43 +02:00
1. `git clone https://github.com/TREX-CoE/trexio.git`
2021-05-05 11:37:48 +02:00
2. `cd trexio`
2021-05-27 23:29:38 +02:00
3. `./autogen.sh`
2021-11-01 10:23:47 +01:00
4. `./configure`
2023-04-03 23:41:02 +02:00
5. ```make -j`getconf _NPROCESSORS_ONLN` ```
6. ```make -j`getconf _NPROCESSORS_ONLN` check```
2021-05-27 23:29:38 +02:00
7. `sudo make install`
2021-05-03 15:27:01 +02:00
2021-11-18 15:39:04 +01:00
## Installation procedure for CMake users (from the tarball or GitHub repo clone):
2022-01-17 19:14:58 +01:00
The aforementioned instructions rely on [Autotools ](https://www.gnu.org/software/automake/manual/html_node/Autotools-Introduction.html ) build system.
2021-11-18 15:39:04 +01:00
[CMake ](https://cmake.org ) users can achieve the same with the following steps (an example of out-of-source build):
1. `cmake -S. -Bbuild`
2. `cd build`
2023-04-03 23:41:02 +02:00
3. ```make -j`getconf _NPROCESSORS_ONLN` ```
4. ```ctest -j`getconf _NPROCESSORS_ONLN` ```
2021-11-18 15:39:04 +01:00
5. `sudo make install`
2022-01-18 15:38:48 +01:00
**Note: on systems with no `sudo` access, one can add `-DCMAKE_INSTALL_PREFIX=build` as an argument to the `cmake` command so that `make install/uninstall` can be run without `sudo` privileges.**
**Note: when linking against an MPI-enabled HDF5 library one usually has to specify the MPI wrapper for the C compiler by adding, e.g., `-DCMAKE_C_COMPILER=mpicc` to the `cmake` command.**
2022-06-01 17:02:41 +02:00
## Installation procedure for conda users
2022-06-03 11:32:15 +02:00
[![Anaconda-Server Badge ](https://anaconda.org/conda-forge/trexio/badges/version.svg )](https://anaconda.org/conda-forge/trexio)
[![Anaconda-Server Badge ](https://anaconda.org/conda-forge/trexio/badges/platforms.svg )](https://anaconda.org/conda-forge/trexio)
2022-06-03 09:46:23 +02:00
The official releases of TREXIO `>2.0.0` are also available via the `conda-forge` channel.
2022-06-01 17:02:41 +02:00
The pre-compiled stable binaries of `trexio` can be installed as follows:
```
2023-04-03 23:41:02 +02:00
conda install -c conda-forge trexio
2022-06-01 17:02:41 +02:00
```
More details can be found in the corresponding [trexio-feedstock ](https://github.com/conda-forge/trexio-feedstock ).
Note that both parallel (see `mpi_openmpi` prefix) and serial (`nompi`) variants are provided.
2022-07-26 14:05:55 +02:00
## Installation procedure for Guix users
The official releases of TREXIO `>=2.0.0` can be installed using the
2022-07-28 13:48:56 +02:00
[GNU Guix ](https://guix.gnu.org ) functional package manager.
The [trexio.scm ](https://github.com/TREX-CoE/trexio/blob/master/tools/trexio.scm )
2022-07-26 14:05:55 +02:00
Schema file contains the manifest specification for the `trexio` package.
2023-01-11 19:34:27 +01:00
It can be installed as follows:
2022-07-26 14:05:55 +02:00
```
2023-04-03 23:41:02 +02:00
guix package --cores=`getconf _NPROCESSORS_ONLN` --install-from-file=trexio.scm
2022-07-28 13:48:56 +02:00
```
## Installation procedure for Spack users
The official releases `>=2.0.0` and the development version of TREXIO can be installed using the
[Spack ](https://spack.io/ ) package manager.
The [trexio/package.py ](https://github.com/spack/spack/blob/develop/var/spack/repos/builtin/packages/trexio/package.py )
file contains the Spack specifications required to build different variants of `trexio` library.
It can be installed as follows
```
2023-04-03 23:41:02 +02:00
spack install --jobs `getconf _NPROCESSORS_ONLN` trexio
2022-07-26 14:05:55 +02:00
```
2023-01-11 19:34:27 +01:00
## Installation procedure for Debian/Ubuntu users
The official release of TREXIO `2.2.0` is available as a Debian (`.deb`) package thanks to the [Debichem Team ](https://wiki.debian.org/Debichem ).
The source code is hosted [here ](https://salsa.debian.org/debichem-team/libtrexio ) and
the pre-built binary files are available via the [Debian package registry ](https://packages.debian.org/bookworm/libtrexio-dev ).
TREXIO is also available on [Ubuntu 23.04 (Lunar Lobster) ](https://packages.ubuntu.com/lunar/libtrexio-dev ) and newer and can be installed as follows:
```
sudo apt-get update & & sudo apt-get install libtrexio-dev
```
2021-11-01 12:15:19 +01:00
## Compilation without the HDF5 library
By default, the configuration step proceeds to search for the [HDF5 library ](https://portal.hdfgroup.org/display/HDF5/HDF5 ).
This search can be disabled if HDF5 is not present/installable on the user machine.
2021-11-18 15:39:04 +01:00
To build TREXIO without HDF5 back end, append `--without-hdf5` option to `configure` script or `-DENABLE_HDF5=OFF` option to `cmake` . For example,
2021-11-01 12:15:19 +01:00
2021-11-18 15:39:04 +01:00
- `./configure --without-hdf5`
- `cmake -S. -Bbuild -DENABLE_HDF5=OFF`
2021-05-03 15:27:01 +02:00
2021-10-07 14:06:56 +02:00
## Linking to your program
The `make install` command takes care of installing the TREXIO shared library on the user machine.
2023-04-03 23:41:02 +02:00
After installation, append `-ltrexio` to the list of compiler (`$LIBS`) options.
2021-10-25 11:40:07 +02:00
2023-04-03 23:41:02 +02:00
In some cases (e.g. when using custom installation prefix during configuration), the TREXIO library might end up installed in a directory, which is absent in the default `$LD_LIBRARY_PATH` .
In order to link the program against TREXIO, the search path can be modified as follows:
2021-10-25 11:40:07 +02:00
2023-04-03 23:41:02 +02:00
`export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<path_to_trexio>/lib`
2021-10-25 11:40:07 +02:00
2023-04-03 23:41:02 +02:00
where the `<path_to_trexio>` has to be replaced by the prefix used during the installation.
2021-10-25 11:40:07 +02:00
2022-01-17 19:14:58 +01:00
If your project relies on CMake build system, feel free to use the
2021-11-18 15:39:04 +01:00
[FindTREXIO.cmake ](https://github.com/TREX-CoE/trexio/blob/master/cmake/FindTREXIO.cmake )
module to find and link TREXIO library automatically.
2021-10-07 14:06:56 +02:00
In Fortran applications, make sure that the `trexio_f.f90` module file is included in the source tree.
You might have to manually copy it into your program source directory.
The `trexio_f.f90` module file can be found in the `include/` directory of the TREXIO source code distribution.
**Note:** there is no need to include `trexio.h` header file during compilation of Fortran programs.
Only the installed library and the Fortran module file are required.
2021-06-25 13:32:02 +02:00
## Naming convention
The primary TREXIO API is composed of the following functions:
- `trexio_open`
- `trexio_write_[group]_[variable]`
- `trexio_read_[group]_[variable]`
- `trexio_has_[group]_[variable]`
- `trexio_close`
2021-11-01 10:23:47 +01:00
where `[group]` and `[variable]` substitutions correspond to the contents of the `trex.json` configuration file
2021-09-14 09:48:55 +02:00
(for more details, see the corresponding [documentation ](https://trex-coe.github.io/trexio/trex.html ) page).
2021-06-25 13:32:02 +02:00
For example, consider the `coord` variable (array), which belongs to the `nucleus` group. The TREXIO user can write or read it using `trexio_write_nucleus_coord` or `trexio_read_nucleus_coord` functions, respectively.
2021-11-01 10:23:47 +01:00
Note: the `[variable]` names have to be unique only within the corresponding parent `[group]` .
There is no naming conflict when, for example, `num` variable exists both in the `nucleus` group (i.e. the number of nuclei) and in the `mo` group (i.e. the number of molecular orbitals).
2021-06-25 13:32:02 +02:00
These quantities can be accessed using the corresponding `trexio_[has|read|write]_nucleus_num` and `trexio_[has|read|write]_mo_num` , respectively.
2021-09-08 19:34:16 +02:00
## Python API
2022-01-17 19:14:58 +01:00
[![PyPI version ](https://badge.fury.io/py/trexio.svg )](https://badge.fury.io/py/trexio)
2021-11-01 10:23:47 +01:00
For more details regarding the installation and usage of the TREXIO Python API,
2021-09-14 09:48:55 +02:00
see [this page ](python/README.md ).
2021-09-08 19:34:16 +02:00
2022-04-29 12:52:05 +02:00
The aforementioned instructions are adapted for users installing from the source code distribution (periodically updated).
In order to install the Python API with the latest changes, follow the developer installation guide and run the following command in the end
```
make python-install
```
**Note: this implies that both HDF5 and SWIG are installed and available.
At the moment, it is not possible to configure the Python API without HDF5 library.**
2022-06-01 17:02:41 +02:00
We rely on the `pytest` package for unit testing. It can be installed via `pip install pytest` . To test the installation, run
```
make python-test
```
2022-04-29 12:52:05 +02:00
We highly recommend to use virtual environments to avoid compatibility issues and to improve reproducibility.
2021-09-08 19:34:16 +02:00
2021-05-03 15:27:01 +02:00
## Tutorial
2021-11-01 10:23:47 +01:00
TREXIO tutorials in Jupyter notebook format can be found in the
2021-09-13 17:20:51 +02:00
[corresponding GitHub repository ](https://github.com/TREX-CoE/trexio-tutorials )
or on [Binder ](https://mybinder.org/v2/gh/TREX-CoE/trexio-tutorials/HEAD ).
2021-05-03 15:27:01 +02:00
2021-11-01 10:23:47 +01:00
For example, the tutorial covering TREXIO basics using benzene molecule as an example can be viewed and executed online by clicking on this badge:
2021-09-14 09:48:55 +02:00
[![Binder ](https://mybinder.org/badge_logo.svg )](https://mybinder.org/v2/gh/TREX-CoE/trexio-tutorials/HEAD?filepath=notebooks%2Ftutorial_benzene.ipynb)
2021-05-03 15:58:01 +02:00
2021-10-07 14:06:56 +02:00
## Documentation
2021-05-03 15:27:01 +02:00
2021-06-25 11:51:06 +02:00
[Documentation generated from TREXIO org-mode files. ](https://trex-coe.github.io/trexio/ )
2021-05-03 15:58:01 +02:00
2021-05-03 15:27:01 +02:00
2023-05-08 16:38:07 +02:00
## Citation
The journal article reference describing TREXIO can be cited as follows:
```
@article {10.1063/5.0148161,
author = {Posenitskiy, Evgeny and Chilkuri, Vijay Gopal and Ammar, Abdallah and Hapka, Michał and Pernal, Katarzyna and Shinde, Ravindra and Landinez Borda, Edgar Josué and Filippi, Claudia and Nakano, Kosuke and Kohulák, Otto and Sorella, Sandro and de Oliveira Castro, Pablo and Jalby, William and Ríos, Pablo López and Alavi, Ali and Scemama, Anthony},
title = "{TREXIO: A file format and library for quantum chemistry}",
journal = {The Journal of Chemical Physics},
volume = {158},
number = {17},
year = {2023},
month = {05},
issn = {0021-9606},
doi = {10.1063/5.0148161},
url = {https://doi.org/10.1063/5.0148161},
note = {174801},
eprint = {https://pubs.aip.org/aip/jcp/article-pdf/doi/10.1063/5.0148161/17355866/174801\_1\_5.0148161.pdf},
}
```
Journal paper: [![doi ](https://img.shields.io/badge/doi-10.1063/5.0148161-5077AB.svg )](https://doi.org/10.1063/5.0148161)
2023-05-08 16:41:40 +02:00
2023-05-08 16:38:07 +02:00
ArXiv paper: [![arXiv ](https://img.shields.io/badge/arXiv-2302.14793-b31b1b.svg )](https://arxiv.org/abs/2302.14793)
2021-05-03 15:27:01 +02:00
### Miscellaneous
2021-04-30 14:29:43 +02:00
2023-05-08 16:41:40 +02:00
The code should be compliant with the C99
2021-11-01 10:23:47 +01:00
[CERT C coding standard ](https://resources.sei.cmu.edu/downloads/secure-coding/assets/sei-cert-c-coding-standard-2016-v01.pdf ).
2021-09-14 09:48:55 +02:00
This can be checked with the `cppcheck` tool.
2021-05-03 15:58:01 +02:00
2021-07-15 14:43:54 +02:00
-----------------
![European flag ](https://trex-coe.eu/sites/default/files/inline-images/euflag.jpg )
[TREX: Targeting Real Chemical Accuracy at the Exascale ](https://trex-coe.eu ) project has received funding from the European Union’ s Horizon 2020 - Research and Innovation program - under grant agreement no. 952165. The content of this document does not represent the opinion of the European Union, and the European Union is not responsible for any use that might be made of such content.