Migrating to the new application programmers’ interface¶
This is a short guide to migrating to the new application programmers’ interface
(API) and build system for XCFun. We assume that you have successfully built and
tested XCFun and installed it to <install-prefix>
.
The layout of the install tree will be as follows:
<install-prefix>/
├── include
│ └── XCFun
│ ├── config.hpp
│ ├── densvars.hpp
│ ├── functional.hpp
│ ├── functionals
│ ├── specmath.hpp
│ ├── XCFunctional.hpp
│ ├── XCFunExport.h
│ ├── xcfun.f90
│ ├── xcfun.h
│ └── xcint.hpp
├── lib
│ └── python
│ └── xcfun
├── lib64
│ ├── libxcfun.a
│ ├── libxcfun.so -> libxcfun.so.2
│ └── libxcfun.so.2
└── share
└── cmake
└── XCFun
C/C++ host programs¶
Types and function signatures are in the header file xcfun.h
.
In your source code, apply the following changes:
Remove any of the calls to the functions that have been removed from the API. Open an issue if these functions are essential to your workflow and you would like them to be reinstated.
Replace
xc_functional
withxcfun_t *
.Replace
xc_new_functional
withxcfun_new
.Replace
xc_enumerate_parameters
withxcfun_enumerate_parameters
.Replace
xc_enumerate_aliases
withxcfun_enumerate_aliases
.Replace
xc_set
withxcfun_set
.Replace
xc_get
withxcfun_get
.Replace
xc_describe_short
withxcfun_describe_short
.Replace
xc_describe_long
withxcfun_describe_long
.Replace
xc_is_gga
withxcfun_is_gga
.Replace
xc_is_metagga
withxcfun_is_metagga
.Replace
xc_eval_setup
withxcfun_eval_setup
.Replace
xc_user_eval_setup
withxcfun_user_eval_setup
.Replace
xc_input_length
withxcfun_input_length
.Replace
xc_output_length
withxcfun_output_length
.Replace
xc_eval
withxcfun_eval
.Replace
xc_eval_vec
withxcfun_eval_vec
.
Fortran host programs¶
The Fortran/C interoperability layer for types and function signatures is in the source file xcfun.f90
.
In your source code, apply the following changes:
Use the intrinsic
iso_c_binding
module:use, intrinsic :: iso_c_binding
.Remove any of the calls to the functions that have been removed from the API. Open an issue if these functions are essential to your workflow and you would like them to be reinstated.
You should call the intrinsic
trim
on functions returning strings:xcfun_version
,xcfun_splash
,xcfun_authors
,xcfun_enumerate_paramters
,xcfun_enumerate_aliases
,xcfun_describe_short
,xcfun_describe_long
.Replace the type for the
xc_functional
object (nowxcfun_t *
) frominteger
totype(c_ptr)
.Replace
xc_new_functional
withxcfun_new
.Replace
xc_enumerate_parameters
withxcfun_enumerate_parameters
.Replace
xc_enumerate_aliases
withxcfun_enumerate_aliases
.Replace
xc_set
withxcfun_set
.Replace
xc_get
withxcfun_get
.Replace
xc_describe_short
withxcfun_describe_short
.Replace
xc_describe_long
withxcfun_describe_long
.Replace
xc_is_gga
withxcfun_is_gga
.Replace
xc_is_metagga
withxcfun_is_metagga
.Replace
xc_eval_setup
withxcfun_eval_setup
.Replace
xc_user_eval_setup
withxcfun_user_eval_setup
.Replace
xc_input_length
withxcfun_input_length
.Replace
xc_output_length
withxcfun_output_length
.Replace
xc_eval
withxcfun_eval
.Replace
xc_eval_vec
withxcfun_eval_vec
.