# potfit wiki

open source force-matching

### Sidebar

User Guide

Examples

Potential Databases

More

compiling:main

# Compiling potfit

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 eventually.

## Basics

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:

./waf --help

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 building a potfit binary with the requested options is possible and the build stage then invokes the compiler to create the binary.

#### 1. Configuration

The configuration uses the configure command from waf:

./waf configure <additional arguments>

A minimal configuration needs to specify at least the interaction (-i) and 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

#### 2. Build

The build process can be start with the build command from waf:

./waf build

Since 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 <---

## Setting options

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 –help page. Here are some common issues and their recommended solution:

#### Setting MKL path

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

#### Setting compiler

By default waf will search for the following compilers (in the same order as provided here):

• Intel Compiler Collection
• Clang
• GCC

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.

#### Setting debug options

Depending on the selected compiler the following debug options are available:

• –debug Adds debug information to the potfit binary for debugging potfit
• –asan Enable the address sanitizer
• –profile Add profiling information to the potfit binary

## Troubleshooting

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 -v arguments.

## Developer guide

A short introduction to extending the waf build system for potfit is available here.