Installing NJOY

Both NJOY21 and NJOY2016 use the same configuration and build process. Additionally, all of the supporting components use the same process. The steps on this page are for building NJOY21, but are equally applicable to NJOY2016.

For the impatient

# Download the latest version of the code
git clone --branch v1.2.1 https://github.com/njoy/NJOY21.git

cd NJOY21

# Configure the build process
mkdir bin
cd bin
cmake -D CMAKE_BUILD_TYPE=Release ..

# Build NJOY21
make

# Test NJOY21
make test

Prerequisites

Development for NJOY uses the latest published language standards that are widely supported by compiler vendors, at the start of development. Therefore, the minimum language standards are

Additionally, we use CMake to configure the build system and git for version control.

Windows

When building on Windows, we only support using the Windows Subsystem for Linux. The build system is the same.

Build Process

To download NJOY21, simply git clone the repository. First move into the directory where you want the source code, then execute:

git clone https://github.com/njoy/NJOY21.git

This will get the latest version of the code. If you are interested in a particular version, you need to specify the git branch corresponding to that version like this for version 1.2.1:

git clone --branch v1.2.1 https://github.com/njoy/NJOY21.git

Please note that getting versions of NJOY21 prior to version 1.2.1 was different—and more convoluted. For information on how to do that see this page.

The configuration and build is performed in a directory (bin) inside the source directory

cd NJOY21
mkdir bin
cd bin
cmake -D CMAKE_BUILD_TYPE=Release ../

Note this will require a connection to the internet as cmake command will download the necessary dependencies.

make

You can provide the command-line option -j n (where n is the number of concurrent/parallel “jobs”) to speed up the compilation step.

make test

Like for the compiling step, you can pass the -j command-line option here as well.

If all the tests pass, you should see something that looks like:

100% tests passed, 0 tests failed out of 90

For this configuration/build process, a connection to the internet is required as subprojects are downloaded from GitHub. There are many instances when one would need to build NJOY on a machine that is not connected to the internet. To do that, please use these steps:

# Download the source code
git clone https://github.com/njoy/NJOY21.git

# Configure the build process
cd NJOY21

#### Transfer the entire NJOY21 directory to machine
#### not connected to the internet

cd NJOY21
mkdir bin
cd bin
cmake -D CMAKE_BUILD_TYPE=Release ..

# Build NJOY21
make

# Test NJOY21
make test

Compliant Compilers

We have tested NJOY2016 and NJOY21 with the following compilers.

C++17 Compliant Compiler

We strongly suggest building with the LLVM C++ compiler. We have found this compiler to be much faster in compiling as well as being fast at runtime.

  • Mac:

    • LLVM 9.0.1. The version that comes with XCode will be sufficient.
  • Linux:

    Note that in Windows we currently support compiling and running under the Windows Subsystem for Linux

Fortran 2003 Compliant Compiler

  • Linux:
    • gfortran This is included as part of the standard gcc suite of compilers.
  • Mac:

Other compilers will most likely compile without any problems, but may give different answers. The differences are typically small and due to different ways of optimizing the code from each compiler. The differences are not likely to be significant.