potfit uses the waf build system, which is fast, easy to use and very flexible. It is written in Python and requires a Python runtime to be available on the system.
The old Makefile-based build system is still available for compatibility reasons. It may not support all features and will be removed at some point.
The potfit source tree contains the waf binary in its root folder. It is used for all build related operations like configuration, building and cleanup. It provides an exhaustive help page when called with the –help argument:
Building potfit is split up into two stages: first a configuration stage and then a build stage. The configuration stage checks if all requirements for a building a binary with the requested options is possible and the build stage then invokes the compiler to create the binary.
The configuration uses the
configure command from waf:
./waf configure <additional arguments>
A minimal configuration needs to specify at least the interaction (-i) and maybe the potential model (-m):
./waf configure -i pair -m apot
After the configuration stage is complete a summary of selected options will be shown:
potfit has been configured with the following options: potential model = apot interaction = pair math library = mkl
The build process can be start with the
build command from waf:
build is the default command it can also be omitted for brevity.
Once the build process is complete, there will be a line indicating the name of the created binary:
---> Successfully moved potfit_apot_pair_mkl to bin/ folder <---
Special options when compiling potfit can be set using the
–enable- command line options during the configure stage. All available options are listed in the
–help page from waf.
To enable support from stress, provide the
–enable-stress option like this:
./waf configure -i pair -m apot --enable-stress
All enabled options will also be listed on the summary of the configuration stage:
potfit has been configured with the following options: potential model = apot interaction = pair math library = mkl options = stress
Some examples for compiling potfit with the waf build system are shown here.
Most issues with the waf build systems can be resolved using the information provided on the
Here are some common issues and their recommended solution:
The default path for the MKL libraries is
/opt/intel/mkl. If your installation resides in a different location you can use the
–math-lib-base-dir option like this:
./waf configure -i pair -m apot --math-lib-base-dir=/my/custom/location
By default waf will search for the following compilers (in the same order as provided here):
To select a particular compiler use the
–check-c-compiler option like this:
./waf configure -i pair -m apot --check-c-compiler=clang
Waf will search for the compiler in the default paths.
Additionally it is possible to use the
CC environment variable to override the compiler during the configuration phase of waf.
Depending on the selected compiler the following debug options are available:
–debugAdds debug information to the potfit binary for debugging potfit
–asanEnable the address sanitizer
–profileAdd profiling information to the potfit binary
When waf encounters an error there is usually a message which provides detailed information about the command which failed. If this is not the case it is possible to enable more logging by adding
-v to the command line:
./waf configure -i pair -m apot -v
Logging can be increased even further by adding additional
A short introduction to extending the waf build system for potfit is available here.