Resources: LibEFP

Contents

  1. What is LibEFP?
  2. LibEFP Web Page
  3. How to compile LibEFP 1.5.0?
    1. On Ubuntu 18.04 LTS
      1. Preparing the operative system
      2. Installing required basic software and libraries
      3. Cleaning unused libraries
      4. Cloning the GitHub repository
      5. Contents of the config.inc file
      6. Compilation
      7. Creating paths for LibEFP
    2. On Clusters of the Rosen Center for Advanced Computing (RCAC) at Purdue University
      1. Cloning the GitHub repository
      2. Contents of the config.inc file
      3. Loading required modules (Developers subversion on RCAC's Carter)
      4. Compilation
  4. How to run LibEFP?
    1. LibEFP/EFPMD input template
    2. LibEFP/EFPMD PBS file template to run in the RCAC clusters at Purdue University

What is LibEFP?

LibEFP is a full implementation of the Effective Fragment Potential (EFP) method (EFP can be viewed as an advanced first-principles-based force-field, see Kaliman et al., JCC, 2013). LibEFP facilitates extension of unique electronic structure methodologies designed for accurate simulations in the gas phase to condensed phases via QM/EFP. LibEFP is designed to give developers of quantum chemistry software an easy way to add EFP support to their favorite package.

LibEFP Web Page

To find more detailed information about LibEFP, go to: libefp - The Effective Fragment Potential method implementation

How to compile LibEFP 1.5.0?

On Ubuntu 18.04 LTS

This is an effective method to compile LibEFP on Ubuntu Desktop 18.04 LTS. This set of instructions asumes you start with a fresh installation of Ubuntu Desktop 18.04 LTS. Consequently, some of the steps described here, such as the installation of libraries, may not be required for your system. This procedure was last tested on June 1st, 2018:

Preparing the operative system

Make sure your system is up-to-date.

sudo apt update
sudo apt upgrade
sudo apt dist-upgrade

Installing required basic software and libraries

Install compilers.

sudo apt install build-essential
sudo apt install gfortran

Install Math Libraries.

sudo apt install libatlas-base-dev
sudo apt install libblas-dev
sudo apt install liblapack-dev

Install MPI.

sudo apt install mpich
sudo apt install mpich-doc

Install Git.

sudo apt install git

Cleaning unused libraries

Clean after yourself (optional).

sudo apt autoremove
sudo apt autoclean
sudo apt clean

Cloning the GitHub repository

First, go to the directory where you want to download the source code, for example:

cd ~/Gits/

To compile LibEFP 1.5.0, you need to get the files for installation. This can be done using Git.

git clone git://github.com/libefp/libefp.git

This will create a directory named libefp in your present working directory. You may want to rename it to include the version and other details of the code you are to compile:

mv libefp libefp-1.5.0-2018.06.01

To explore the contents of the code go to the directory you just renamed.

cd ~/Gits/libefp-1.5.0-2018.06.01/

Contents of the config.inc file

You also need a configuration file. This config.inc file contains a set of instructions for the system to recognize the compilers, installation directory, and other options.

Several templates can be found in the config/ directory.

This is an example of the configuration file, based on gcc-netlib-openmpi.inc:

# C compiler
CC= mpicc

# Fortran compiler
FC= gfortran

# install prefix
PREFIX= /home/carlosborca/libefp

# fragment library path
FRAGLIB= $(PREFIX)/fraglib-installed

# additional link libraries
MYLIBS= -lblas -llapack -lgfortran

# additional linker flags
MYLDFLAGS=

# additional C flags
MYCFLAGS= -DEFP_USE_MPI -std=c99 -O3 -g -fopenmp

# additional Fortran flags
MYFFLAGS= -g

Compilation

Compilation should be straightforward now. First you will run the make command. This will verify that all things are in order and try compilation of the whole package (if you only need the library, not the Molecular Dynamics engine EFPMD, you can use make libefp, instead).

make

If make did not result in error, you may now check that the compiled code is running properly. That is done by executing a series of preloaded test calculations that run through a script called with the make check commands. You should at least perform the first one:

make check

To test OpenMP parallel code (Parallelization between cores):

make checkomp

To test MPI parallel code (Parallelization between nodes):

make checkmpi

Finally, to install the program in the $(PREFIX) directory, run the make install command.

make install

Creating paths for LibEFP

If you installed the library in directory different than the default, you may need to create paths for LibEFP binaries on your .bashrc (optional).

export PATH="/home/carlosborca/libefp/bin:$PATH"

On Clusters of the Rosen Center for Advanced Computing at Purdue University

Cloning the GitHub repository

First, go to the LibEFP directory inside the Apps directory of the Slipchenko Group:

cd /group/lslipche/apps/libefp/

To compile LibEFP 1.4.2, you need to get the files for installation. This can be done using Git.

git clone git://github.com/libefp/libefp.git

This will create a directory named libefp in your present working directory. You may want to rename it to include the version and other details of the compilation you are about to execute:

mv libefp libefp-1.4.2-beta-2017.05.23

To explore the contents of the code go to the directory you just renamed.

cd /group/lslipche/apps/libefp/libefp-1.4.2-beta-2017.05.23/

Contents of the config.inc file

You also need a configuration file. This config.inc file contains all the instructions for the system to recognize the compilers, installation directory, and other options.

An example of such file is given below:

# C compiler
CC= mpicc

# Fortran compiler
FC= ifort

# install prefix
PREFIX= /group/lslipche/apps/libefp/libefp-1.4.2-beta-2017.05.23

# fragment library path
FRAGLIB= $(PREFIX)/fraglib-installed

# additional link libraries
MYLIBS= -lifcore

# additional linker flags
MYLDFLAGS=

# additional C flags
MYCFLAGS= -DWITH_MPI -std=c99 -O3 -g -mkl=sequential -fopenmp

# additional Fortran flags
MYFFLAGS= -g

# ar command
AR= ar rc

# ranlib command
RANLIB= ranlib

# rm command
RM= rm -f

# tags program
CTAGS= ctags

# tags file
TAGS= tags

Loading required modules (Developers subversion on RCAC's Carter)

If compiling on RCAC's Carter, you need to load the environmental variables for the Intel Compiler suite and OpenMPI. You can do that with the following commands:

module load intel
module load openmpi

Compilation

Compilation should be now straightforward. First you will run the make command. This will verify that all things are in order for compilation of the whole package (if you only need the library you can use make libefp, instead.).

make

If make did not result in error, you may now check that the program is running properly. That is done by executing a series of preloaded calculations that run through a script called with the make check commands. You should at least perform the first one:

make check

To test OpenMP parallel code (Parallelization between cores):

make check-omp

To test MPI parallel code (Parallelization between nodes):

make check-mpi

Finally, to compile the whole program, run the make install command.

make install

How to run LibEFP?

If the library has been already compiled properly, to run a LibEFP job the user will need and input file and a parameters file .efp.

With the parameters file located in the same directory as the input file, LibEFP jobs can be run using the command:

libefp LibEFP_INPUT_NAME.in > LibEFP_OUTPUT_NAME.out

EFP-MD jobs can be run with the command:

efpmd EFPMD_INPUT_NAME.in > EFPMD_OUTPUT_NAME.out

More options can be found below.

LibEFP/EFPMD input template

A short example of an NPT EFP-MD run input file:

 run_type md
 ensemble npt
 time_step 2
 print_step 1
 velocitize true
 pressure 1.0
 coord points
 terms elec pol disp xr
 elec_damp overlap
 disp_damp overlap
 pol_damp tt
 enable_pbc true
 periodic_box 30.0 30.0 30.0
 enable_cutoff true
 swf_cutoff 10
 max_steps 250000
 userlib_path .
 temperature 300

fragment water
        -0.533          -2.036          -1.134
         0.341          -1.814          -1.517
        -0.337          -2.300          -0.211

fragment water
        -0.398           1.367          -1.467
         0.387           0.828          -1.697
        -0.112           1.901          -0.696

fragment water
         2.127           0.178           0.834
         1.680           1.046           0.921
         1.483          -0.381           0.351

fragment water
        -1.318           0.502           1.736
        -0.520           0.717           2.262
        -1.006          -0.146           1.070

LibEFP/EFPMD PBS file template to run in the RCAC clusters at Purdue University

Several versions of LibEFP are already properly compiled in the RCAC clusters. To run a LibEFP job through the PBS queueing service the user can use the following template:

#!/bin/bash -l
# FILENAME: EFPMD_JOB_NAME.pbs

# SHORT NAME OF THE JOB
#PBS -N EFPMD_JOB_NAME

# DECLARE THIS AS A NON-RERUNABLE JOB
#PBS -r n

# NAME OF THE QUEUE IN USE
#PBS -q yourqueue

# USER EMAIL FOR JOB STATUS UPDATES
#PBS -M youremail@purdue.edu

# SEND UPDATES WHEN ABORTING AND EXITING
#PBS -m ae

# AMOUNT OF RESERVED TIME IN THE COMMUNITY CLUSTER (ONE WEEK = 168 HOURS)
#PBS -l walltime=24:00:00

# AMOUNT OF NODES AND PROCESSORS PER NODE REQUESTED
#PBS -l nodes=4:ppn=16

# AMOUNT OF MEMORY (FOR ALL THE PROCESSORS) REQUESTED. OPTIONAL.
#PBS -l mem=128000MB

# LOAD INTEL AND OPENMPI LIBRARIES
module load intel
module load openmpi

# STORE PBS VARIABLES TO A FILE
cat $PBS_NODEFILE | uniq > pbsnodefile.$PBS_JOBID

# ENABLE PARALLEL COMPUTATION UP TO THE DESIRED NUMBER OF PARALLEL THREADS
export OMP_NUM_THREADS=16

# CHANGE TO THE DIRECTORY FROM WHICH YOU ORIGINALLY SUBMITTED THIS JOB
cd $PBS_O_WORKDIR

# EXECUTE 'EFPMD_JOB_NAME_EFPMD.in' WITH LIBEFP 1.3.1 WITH OUTPUT TO 'EFPMD_JOB_NAME.out'
mpirun -np 4 -machinefile pbsnodefile.$PBS_JOBID /group/lslipche/apps/libefp/libefp-1.3.1-beta-2015.11.13/bin/efpmd EFPMD_JOB_NAME.in > EFPMD_JOB_NAME.out

# PROCESS 'EFPMD_JOB_NAME_EFPMD.out' TO PRODUCE THE TRAJECTORY FILE 'EFPMD_JOB_NAME.xyz'
/group/lslipche/apps/libefp/libefp-1.3.1-beta-2015.11.13/bin/trajectory.pl EFPMD_JOB_NAME.out > EFPMD_JOB_NAME.xyz