Resources: LibEFP

Contents

  1. What is LibEFP?
  2. LibEFP Web Page
  3. How to compile LibEFP 1.4.2?
    1. On Ubuntu 16.04 LTS
      1. Preparing the operative system
      2. Installing required basic libraries
      3. Cleaning unused libraries
      4. Cloning the GIT 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 Univeristy
      1. Cloning the GIT 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 Univeristy

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.4.2?

On Ubuntu 16.04 LTS

This is an effective method to compile LibEFP on Ubuntu Desktop 16.04 LTS. It was tested on May 23rd, 2017:

Preparing the operative system

Make sure your system is up-to-date.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

Installing required basic libraries

Install compilers.

sudo apt-get install build-essential
sudo apt-get install gfortran

Install Math Libraries.

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

Cleaning unused libraries

Clean after yourself.

sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get clean

Cloning the GIT repository

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

cd ~/

In order to compile LibEFP 1.4.2, you need to get the files for installation. This can be done using GIT Hub.

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 ~/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.

Several templates can be found in the config/ directory.

An example of the configuration file, based on gcc-netlib-openmpi.inc, is given below:

# 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= -DWITH_MPI -std=c99 -O3 -g -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

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

Creating paths for LibEFP

If you did not installed in the default directory, you may need to create paths for LibEFP binaries on your .profile.

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

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

Cloning the GIT repository

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

cd /group/lslipche/apps/libefp/

In order to compile LibEFP 1.4.2, you need to get the files for installation. This can be done using GIT Hub.

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 Univeristy

Several versions of LibEFP are already properly compiled in the RCAC clusters. In order 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