Skip to content

Compile DFTB with lammps support

qzhu2017 edited this page Sep 12, 2017 · 6 revisions

This page documents the compilation of DFTB+ with lammps support in Xsede-supermic cluster http://www.hpc.lsu.edu/docs/guides.php?system=SuperMIC

1, load the proper modules in supermic

Currently Loaded Modulefiles:

  • INTEL/14.0.2
  • intel/14.0.2
  • mvapich2/2.0/INTEL-14.0.2

2, Compile lammps

  • download the most recent version of lammps (lammps-11Aug17) from http://lammps.sandia.gov/download.html
  • [qiangz@smic1]$ tar -xf lammps-stable.tar.gz
  • [qiangz@smic1]$ cd lammps-11Aug17/src
  • [qiangz@smic1 src]$ make mpi

This will end up with a compiled executable called lmp_mpi in src directory

3, Compile lammps static library

To make it work with dftb+, we also need to compile a static library in /src by ivoking

  • [qiangz@smic1 src]$$ gmake mpi mode=lib

which will return two library files called liblammps.a and liblammps_mpi.a

4, Compile lammps module

  • one needs to go to example/COUPLE/fortran_dftb

[qiangz@smic1 src]$ cd ../examples/COUPLE/fortran_dftb/

  • modify the makefile as follows
FC = mpif90 # replace with your Fortran compiler
CXX = mpic++ # replace with your C++ compiler
        $(FC) $(FFLAGS) simple.o -o simpleF.x liblammps_fortran.a $(LAMMPS_SRC)/liblammps_mpi.a  -lstdc++ /home/qiangz/impi-5-fftw3/lib/libfftw3.a
  • [qiangz@smic1 fortran_dftb]$ make

This will generate the following new files

  • liblammps_fortran.a
  • liblammps_fortran.so
  • lammps.mod

5, Compile DFTB+

The modified DFTB+ package (_dftb+mvapich.tar) was kindly offered by Dr Nir Goldman from LLNL.

  • tar -xf dftb+_mvapich.tar
  • cd dftb+_mvapich

Take a look at the README file before compilation, there would be a few files which one needs to change.

In Makefile.objdir

        cp /home/qiangz/lammps-11Aug17/examples/COUPLE/fortran_dftb/lammps.mod $(OBJDIR)

In sysmakes/make.x86_64-linux-ifort

FXX = mpif90
FXXOPT = -O2 -ip # -openmp

# Library paths
MKL_LIBDIR = $(MKLROOT)/lib/intel64
LAMMPS_DIR = /home/qiangz/lammps-11Aug17/examples/COUPLE/fortran_dftb
LAMMPS_DIR2 = /home/qiangz/lammps-11Aug17/src
LIB_BLAS   = -L$(MKL_LIBDIR) -Wl,--start-group \
  -lmkl_scalapack_lp64 -lmkl_intel_lp64 \
  -lmkl_intel_thread -lmkl_core \
  -lmkl_blacs_intelmpi_lp64 -lmkl_blacs_intelmpi_ilp64 \
  -Wl,--end-group
LIB_LAPACK =
LIB_LAPACK += $(LAMMPS_DIR)/liblammps_fortran.a $(LAMMPS_DIR2)/liblammps_mpi.a #liblammps_mvapich.a

# Any other libraries to be linked
OTHERLIBS = -liomp5 -lstdc++ -lpthread /home/qiangz/fftw-3.3.6/lib/libfftw3f.a
  • $ cd prog_dftb/
  • $ make

The successful compilation will generate an executable in _src/prg_dftb/obj_x86_64-linux-ifort/dftb+

5, Run Example

Dr. Goldman provides an example of running a short MD configuration of water under ambient conditions using mio-1-1 parameter set (see _dftb+mvapich/example)

The parameter set could be downloaded from http://www.dftb.org/parameters/download/mio/mio-1-1-cc/

    Prefix = "/home/qiangz/dftb+_mvapich/mio-1-1/"
  • run the test by

    $ mpirun -np 2 ~/dftb+_mvapich/src/prg_dftb/_obj_x86_64-linux-ifort/dftb+

Troubleshooting

When running dftb+ calculation, it appears that dftb+ could be successfully invoked. However, the calculation stopped at the end of the 1st cycle of electronic calculation when it is supposed to communicate with lammps.

================================================================================
==
==   DFTB+ (Density Functional Tight Binding and much more)
==
==                          Unofficial release (r4423)
==
==                            (ParserVersion = 4)
==
================================================================================

********************************************************************************
** Parsing and initializing
********************************************************************************

Interpreting input file 'dftb_in.hsd'
--------------------------------------------------------------------------------
***  Converting input from version  3 to version  4 ...
***  Done.

Reading SK-files:
  /home/qiangz/dftb+_mvapich/mio-1-1/O-O.skf
  /home/qiangz/dftb+_mvapich/mio-1-1/O-H.skf
  /home/qiangz/dftb+_mvapich/mio-1-1/H-O.skf
  /home/qiangz/dftb+_mvapich/mio-1-1/H-H.skf
Done.


Processed input in HSD format written to 'dftb_pin.hsd'

Starting initialization...
--------------------------------------------------------------------------------
PGRID:ORBITAL: 1 x 1 x 2
PGRID:ALLPROC: 1 x 2
PGRID:ATOM: 1 x 2
RECLATPOINTS: 73
Mode:                        MD without scaling of velocities
                             (a.k.a. NVE ensemble)
Self consistent charges:     Yes
SCC-tolerance:                 0.100000E-05
Max. scc iterations:                      4
Ewald alpha parameter:         0.146801E+00
Spin polarisation:           No
Nr. of up electrons:           128.000000
Nr. of down electrons:         128.000000
Periodic boundaries:         Yes
Diagonalizer:                Standard
Maximal SCC-cycles:                       4
Time step:                     0.826827E+01
Temperature:                   0.943711E-03
Random seed:                          12345
Initial charges:             Set automatically (system chrg:   0.000E+00)
Included shells:              O:  s, p
                              H:  s
K-points and weights:           1:  0.000000  0.000000  0.000000     1.000000
Extra options:
LAMMPS (11 Aug 2017)
Reading data file ...
  triclinic box = (0 0 0) to (9.855 9.855 9.855) with tilt (0 0 0)
  1 by 1 by 2 MPI processor grid
  reading atoms ...
  96 atoms
 run           10  upto                                                         
                      
Neighbor list info ...
  update every 1 steps, delay 10 steps, check yes
  max neighbors/atom: 2000, page size: 100000
  master list distance cutoff = 0
  ghost atom cutoff = 0
  binsize = 9.855, bins = 1 1 1
  0 neighbor lists, perpetual/occasional/extra = 0 0 0
Setting up Verlet run ...
  Unit style    : real
  Current step  : 0
  Time step     : 0.2
RECLATPOINTS: 73
  iSCC Total electronic   Diff electronic      SCC error    
    1   -0.13254394E+03    0.00000000E+00    0.81936451E+00
    2   -0.13259454E+03   -0.50593002E-01    0.62477159E+00
    3   -0.13266329E+03   -0.68756719E-01    0.34144446E-01
    4   -0.13266348E+03   -0.18701402E-03    0.18185590E-01
scc total               CPU:     0.08       Wall:     0.08
 
 Total DFTB Energy:               -130.6808254718 H
 Total Mermin free energy:        -130.6808254718 H
 TS value:                           0.0000000000
force total             CPU:     0.10       Wall:     0.10
 Volume:                             0.645902E+04 au^3
 Pressure:                          -0.496936E-04 au    -0.146204E+10 Pa
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image              PC                Routine            Line        Source             
dftb+              0000000000C62F89  Unknown               Unknown  Unknown
dftb+              0000000000C6185E  Unknown               Unknown  Unknown
dftb+              0000000000C0FC62  Unknown               Unknown  Unknown
dftb+              0000000000BC19D3  Unknown               Unknown  Unknown
dftb+              0000000000BC658B  Unknown               Unknown  Unknown
libpthread.so.0    000000338740F7E0  Unknown               Unknown  Unknown
dftb+              00000000007693E5  Unknown               Unknown  Unknown
dftb+              00000000007897C1  Unknown               Unknown  Unknown
dftb+              0000000000B42809  Unknown               Unknown  Unknown
dftb+              0000000000B2DA9A  Unknown               Unknown  Unknown
dftb+              0000000000AAE169  Unknown               Unknown  Unknown
dftb+              0000000000AA7955  Unknown               Unknown  Unknown
dftb+              0000000000AA8701  Unknown               Unknown  Unknown
dftb+              0000000000763CC2  Unknown               Unknown  Unknown
dftb+              0000000000464A4C  Unknown               Unknown  Unknown
dftb+              0000000000433256  Unknown               Unknown  Unknown
dftb+              00000000004331E6  Unknown               Unknown  Unknown
libc.so.6          0000003386C1ED1D  Unknown               Unknown  Unknown
dftb+              00000000004330D9  Unknown               Unknown  Unknown

===================================================================================
=   BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES
=   PID 7314 RUNNING AT smic1
=   EXIT CODE: 174
=   CLEANING UP REMAINING PROCESSES
=   YOU CAN IGNORE THE BELOW CLEANUP MESSAGES
===================================================================================