Fortran interface to chemfiles

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
cd chemfiles.f03
mkdir build
# Configure for installation in PREFIX
# Build
# run tests (optional, but recommended)
# 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_f and chemfiles libraries to the linker arguments. On GNU/Linux and OS X, this is done by the -lchemfiles_f -lchemfiles flags. If you want to compile main.f90 with gfortran, you need to run

gfortran main.f90 -o main -lchemfiles_f -lchemfiles