This is the documentation for the Fortran 2003 interface to the chemfiles library.
This Fortran interface to chemfiles is built in an object-oriented fashion, using the
C interface of chemfiles and the
iso_c_binding intrisic module.
All the functionalities are in the
chemfiles module, which should be used in
all the programs using chemfiles. The
iso_fortran_env instrisic module can also
be usefull to set the kind of real and doubles where needed.
The fortran interface have the same dependencies as the main C++ library, which are documented here.
It also need a modern fortran compiler.
gfortran (4.9) and
ifort (14) are
known to work with
chemfiles.f03. If you manage to build it with another
compiler, please tell me so that I can add it here.
# Get the sources: git clone --recursive https://github.com/chemfiles/chemfiles.f03 cd chemfiles.f03 mkdir build # Configure for installation in PREFIX cmake -DCMAKE_INSTALL_PREFIX=<PREFIX> .. # Build make # run tests (optional, but recommended) ctest # install to `PREFIX` make install
Other options are available and documented with the main C++ library.
To compile your own code using
chemfiles, you need to
use chemfiles in your
program, and add the
chemfiles libraries to the linker
arguments. On GNU/Linux and OS X, this is done by the
flags. If you want to compile
main.f90 with gfortran, you need to run
gfortran main.f90 -o main -lchemfiles_f -lchemfiles
This section contains example of how to use chemfiles, and the complete interface reference for all the types and subroutines in chemfiles.