FLOSIC Code Hands On

August 8th, 2019

0. Hands on goals

  • Download and compile the FLOSIC code
  • Run FLOSIC calculations using the code
  • Learn FOD optimization options and optimize FOD

1. Downloading the FLOSIC code

The FLOSIC code is currently hosted at a server machine in UTEP. We use git to manage the version control and download the code.

Version History

There are a few versions available in the repository (from recent to old):


The SIC loop is reorganized to speed up the code.
Added effective core potential (ECP).
Added scaled-LBFGS FOD optimization.
Merged FLOSIC atomic force.


The initial release of FLOSIC-SCAN code.
SCAN mesh is hardcoded in this version.


Allows FLOSIC with GGA functionals.
Coulomb mesh screening is removed.
Fixed occupation mode is added.
Hamiltonian mixing is added.


Added group parallelization (MPI+MPI) where the FLO orbital loops and mesh integrations are parallelized.
FLOSIC atomic force is added later.


We merged the code name "PERFECT code" to UTEP-NRLMOL code.


You can download the FLOSIC code by using a git command in terminal.

For example, to download the curent version 0.2 FLOSIC code, run the followings,

In the terminal, run the command below to download the code. Password will be provided at the hands-on.

git clone flosicworkshop@quantum.utep.edu:0.2.git

2. Compiling the code

Before compiling the code, you most likely need to edit Makefile and PARAMA2 files.

2.1. Edit make file

First, copy the pre-prepared Makefile and make some adjustment.

cp Makefile.fedora Makefile

There are three sections that may need to be edited.

The Fedora option will most likely wrok for a Redhat linux (typical linux distributions used in workstations).

If you are compiling the code on Macbook, serial compilation is recommended at this hands-on exercise.

Uncomment or edit the line needed for your machine and comment out the lines not needed.

COMPILING OPTIONS, set Y or N for these options

# Parallel compilation
# Group calculation


# Fedora (quantum)
CC = gcc
FC = mpif90
FFF = mpif90
# MAC OSX (Darwin Unix)
#CC = gcc
#FC = gfortran 
#FFF = gfortran


nrlmol: condcomp $(OBJ)
#       $(FFF) $(LFLAGS) $(OBJ) -o $(BIN) $(PCM_LIBS) -Wl,-rpath,$(TACC_MKL_LIB) -L$(TACC_MKL_LIB) -Wl,--start-group \
#       -lmkl_scalapack_lp64 -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lmkl_blacs_intelmpi_lp64 -Wl,--end-group -lpthread -lm
# Fedora (Quantum/Luis local)
        $(FFF) $(LFLAGS) $(OBJ) -o $(BIN) $(PCM_LIBS) $(EFP_LIB) -llapack -lblas $(LIBS)
# Ubuntu
#       $(FFF) $(LFLAGS) $(OBJ) -o $(BIN) -llapack -lblas -lblacsCinit-openmpi -lblacs-openmpi -lscalapack-openmpi
# MAC OS machines
#       $(FFF) $(LFLAGS) $(OBJ) -o $(BIN) -llapack -lblas

2.2. Edit PARAMA2 file

The PARAMA2 files contains the static parameters used in the FLOSIC code. You may need to edit this file.


2.3. Type make to compile


If successful, this will create a binary file named nrlmol_exe.

3. Running a FLOSIC calculation

We prepared a set of sample calculations, download it from git.

git clone flosicworkshop@quantum.utep.edu:handson.git

Go to one of the directory just downloaded (Ne for example) and see how the input files are set up.

Copy the nrlmol_exe from the source code directory and try running the binary in one of the directories.

For a serial code:


For a parallel code:

mpirun -np 4 ./nrlmol_exe
  • Check screen output for any error message.

  • Check the SUMMARY file for total energies.

4. Optimizing FODs

FODs are already optimized in the example FLOSIC calculations at step 3.

In general, a user need to run the code multiple times to optimize those FOD positions.

Exercise 1:

Change one of the FODs in FRMIDT and run the code multiple times in the same directory.

After running the code, check the fande.out file.

  • Does the second column (total energy) go down as the numbers of SCF iterations?
  • Does the forces on the third and fourth column decrease?

Exercise 2:

There are two FOD optimizers available in the FLOSIC code - conjugate-gradient and scaled-LBFGS (default). You can choose this in NRLMOL_INPUT.DAT. Setting SCALEDLBFGSV = 'Y' uses the scaled-LBFGS, and setting it to = 'N' uses conjugate-gradient.

  • Try and compare those two FOD optimization methods.