error when compiling with reax


I am trying to compile with reax on ubuntu.

I first downloaded the newest version of LAMMPS (May 22nd)

I then went to lib/reax and precompiled using: make -f Makefile.gfortran

I checked to make sure that libreax.a and Makefile.lammps were created (They were).

I then went to my makefile in /src/MAKE and added -I…/…/lib/reax to CCFLAGS as Axel suggested in a previous post.

Then I did:

make-clean all
make yes-user-reaxc

make yes-reax
make yes-meam
make yes-replica
make yes-body

Then I compiled lammps. Everything runs as expected until the very end when this happens as shown below.

What have I missed in making reax with lammps?

fix_reax_bonds.o: In function LAMMPS_NS::FixReaxBonds::OutputReaxBonds(long, _IO_FILE*)': fix_reax_bonds.cpp:(.text+0x286): undefined reference to getnsbmax_’
fix_reax_bonds.cpp:(.text+0x290): undefined reference to getcutof3_' fix_reax_bonds.cpp:(.text+0x3ea): undefined reference to cbkia_’
fix_reax_bonds.cpp:(.text+0x45c): undefined reference to cbknubon2_' fix_reax_bonds.cpp:(.text+0x46b): undefined reference to cbkbo_’
fix_reax_bonds.cpp:(.text+0x489): undefined reference to cbkia_' fix_reax_bonds.cpp:(.text+0x498): undefined reference to cbkc_’
fix_reax_bonds.cpp:(.text+0x4ec): undefined reference to cbknubon2_' fix_reax_bonds.cpp:(.text+0x4fb): undefined reference to cbkbo_’
fix_reax_bonds.cpp:(.text+0x52e): undefined reference to cbkabo_' fix_reax_bonds.cpp:(.text+0x53e): undefined reference to cbklonpar_’
pair_meam.o: In function LAMMPS_NS::PairMEAM::~PairMEAM()': pair_meam.cpp:(.text+0xe7f): undefined reference to meam_cleanup_’
pair_meam.o: In function LAMMPS_NS::PairMEAM::read_files(char*, char*)': pair_meam.cpp:(.text+0x20ae): undefined reference to meam_setup_global_’
pair_meam.cpp:(.text+0x2741): undefined reference to meam_setup_param_' pair_meam.o: In function LAMMPS_NS::PairMEAM::coeff(int, char**)’:
pair_meam.cpp:(.text+0x29f9): undefined reference to meam_setup_done_' pair_meam.o: In function LAMMPS_NS::PairMEAM::compute(int, int)’:
pair_meam.cpp:(.text+0x381c): undefined reference to meam_dens_init_' pair_meam.cpp:(.text+0x3a22): undefined reference to meam_dens_final_’
pair_meam.cpp:(.text+0x3cf0): undefined reference to meam_force_' pair_reax.o: In function LAMMPS_NS::PairREAX::pack_comm(int, int*, double*, int, int*)’:
pair_reax.cpp:(.text+0x30): undefined reference to cbkabo_' pair_reax.o: In function LAMMPS_NS::PairREAX::unpack_comm(int, int, double*)’:
pair_reax.cpp:(.text+0x8e): undefined reference to cbkabo_' pair_reax.o: In function LAMMPS_NS::PairREAX::write_reax_positions()’:
pair_reax.cpp:(.text+0x67b): undefined reference to rsmall_' pair_reax.cpp:(.text+0x681): undefined reference to rsmall_’
pair_reax.cpp:(.text+0x6d0): undefined reference to cbkc_' pair_reax.cpp:(.text+0x6e2): undefined reference to cbkc_’
pair_reax.cpp:(.text+0x6f4): undefined reference to cbkc_' pair_reax.cpp:(.text+0x704): undefined reference to cbkch_’
pair_reax.cpp:(.text+0x718): undefined reference to cbkia_' pair_reax.cpp:(.text+0x72c): undefined reference to cbkia_’
pair_reax.cpp:(.text+0x736): undefined reference to cbkc_' pair_reax.o: In function LAMMPS_NS::PairREAX::write_reax_vlist()’:
pair_reax.cpp:(.text+0x92e): undefined reference to cbkpairs_' pair_reax.cpp:(.text+0x940): undefined reference to cbkpairs_’
pair_reax.cpp:(.text+0x947): undefined reference to cbknvlbo_' pair_reax.cpp:(.text+0x962): undefined reference to cbknvlbo_’
pair_reax.cpp:(.text+0x970): undefined reference to cbknvlown_' pair_reax.cpp:(.text+0x981): undefined reference to cbknvlown_’
pair_reax.cpp:(.text+0x99b): undefined reference to cbknvlown_' pair_reax.cpp:(.text+0x9c9): undefined reference to cbknvlown_’
pair_reax.cpp:(.text+0xa05): undefined reference to cbknvlown_' pair_reax.o:pair_reax.cpp:(.text+0xa3d): more undefined references to cbknvlown_’ follow
pair_reax.o: In function LAMMPS_NS::PairREAX::write_reax_vlist()': pair_reax.cpp:(.text+0xb4f): undefined reference to cbkpairs_’
pair_reax.cpp:(.text+0xb5e): undefined reference to cbkpairs_' pair_reax.cpp:(.text+0xb65): undefined reference to cbknvlbo_’
pair_reax.cpp:(.text+0xb80): undefined reference to cbknvlbo_' pair_reax.cpp:(.text+0xb8e): undefined reference to cbknvlown_’
pair_reax.cpp:(.text+0xbb0): undefined reference to cbkpairs_' pair_reax.cpp:(.text+0xbb9): undefined reference to cbkpairs_’
pair_reax.o: In function LAMMPS_NS::PairREAX::read_reax_forces()': pair_reax.cpp:(.text+0xbf5): undefined reference to cbkd_’
pair_reax.cpp:(.text+0xc04): undefined reference to cbkd_' pair_reax.o: In function LAMMPS_NS::PairREAX::init_style()’:
pair_reax.cpp:(.text+0x12f4): undefined reference to readc_' pair_reax.cpp:(.text+0x12f9): undefined reference to reaxinit_’
pair_reax.cpp:(.text+0x12fe): undefined reference to ffinpt_' pair_reax.cpp:(.text+0x1303): undefined reference to tap7th_’
pair_reax.cpp:(.text+0x1312): undefined reference to setngeofor_' pair_reax.cpp:(.text+0x1327): undefined reference to readgeo_’
pair_reax.cpp:(.text+0x1333): undefined reference to getswb_' pair_reax.cpp:(.text+0x1365): undefined reference to getvlbora_’
pair_reax.cpp:(.text+0x1381): undefined reference to getnso_' pair_reax.cpp:(.text+0x138d): undefined reference to getswa_’
pair_reax.cpp:(.text+0x13f1): undefined reference to cbkchb_' pair_reax.cpp:(.text+0x13fa): undefined reference to cbkchb_’
pair_reax.cpp:(.text+0x1403): undefined reference to cbkchb_' pair_reax.o: In function LAMMPS_NS::PairREAX::compute(int, int)’:
pair_reax.cpp:(.text+0x23e8): undefined reference to cbkvirial_' pair_reax.cpp:(.text+0x23fb): undefined reference to cbkvirial_’
pair_reax.cpp:(.text+0x25b2): undefined reference to srtbon1_' pair_reax.cpp:(.text+0x25d1): undefined reference to molec_’
pair_reax.cpp:(.text+0x25d6): undefined reference to encalc_' pair_reax.cpp:(.text+0x25e9): undefined reference to mdsav_’
pair_reax.cpp:(.text+0x2606): undefined reference to cbkenergies_' pair_reax.cpp:(.text+0x261a): undefined reference to cbkenergies_’
pair_reax.cpp:(.text+0x2622): undefined reference to cbkenergies_' pair_reax.cpp:(.text+0x262a): undefined reference to cbkenergies_’
pair_reax.cpp:(.text+0x2632): undefined reference to cbkenergies_' pair_reax.o:pair_reax.cpp:(.text+0x263a): more undefined references to cbkenergies_’ follow
pair_reax.o: In function LAMMPS_NS::PairREAX::compute(int, int)': pair_reax.cpp:(.text+0x27eb): undefined reference to cbkd_’
pair_reax.cpp:(.text+0x2815): undefined reference to cbkvirial_' pair_reax.cpp:(.text+0x2829): undefined reference to cbkvirial_’
pair_reax.cpp:(.text+0x283d): undefined reference to cbkvirial_' pair_reax.cpp:(.text+0x2851): undefined reference to cbkvirial_’
pair_reax.cpp:(.text+0x2865): undefined reference to cbkvirial_' pair_reax.o:pair_reax.cpp:(.text+0x2879): more undefined references to cbkvirial_’ follow
collect2: error: ld returned 1 exit status
make[1]: *** […/lmp_ubuntu_parallel] Error 1
make[1]: Leaving directory `/home/bjcowen/Desktop/lammps-22May14/src/Obj_ubuntu_parallel’
make: *** [ubuntu_parallel] Error 2

First, if your goal is to compile reax and isolate the problem, why did you install other packages, especially MEAM, at the same time? Why complicate things?

Second, there is more to adding “-I…/…/lib/reax to CCFLAGS”. Have you looked at $LAMMPS/lib/reax/README?


Yes I have been reading it.
I think the part that is causing the issues has to do with the 3 variables in the Makefile.lammps

Currently, the file looks like:

Settings that the LAMMPS build will import when this package library is used

reax_SYSINC =
reax_SYSLIB = -lgfortran
reax_SYSPATH =

The README file says that the Makefile.lammps should have 3 variables as shown below. First of all, is there in an issue in that my Makefile.lammps had reax_ instead of user-reax?

The first one is fine as is says to leave it blank. I think the problem may be with the SYSPATH because I am not sure what path to put in to “where those libraries are.”

user-reax_SYSINC = leave blank for this package
user-reax_SYSLIB = auxiliary F90 libs needed to link a F90 lib with
a C++ program (LAMMPS) via a C++ compiler
user-reax_SYSPATH = path(s) to where those libraries are

Because you have a F90 compiler on your system, you should have these
libraries. But you will have to figure out which ones are needed and
where they are. Examples of common configurations are in the
Makefile.lammps.* files.


don’t compile with reax, it’s obsolete. Build user-reaxc instead.


Benjamin Cowen <[email protected]…24…> 24 мая 2014 г. 3:27:20 написал:

Doesn’t building user-reaxc still require pre-compiling as reax does? Would I not run into the same issue?

No you won’t. It’s written in C++ and is compiled with the rest of LAMMPS.


Benjamin Cowen <[email protected]…24…> 24 мая 2014 г. 3:54:38 написал:

You’re making a couple conceptual mistakes. The

building with packages section of the manual explains
all of this in detail:

  1. to compile with the Fotran ReaxFF (package REAX),

you’ve correctly compile the lib in lib/reax and have a Makefile.lammps
there. In your LAMMPS build, the only edit you might have to do
in your src/MAKE/ is not to CCFLAGS - don’t touch
that or add what you did. Rather these 3 varaibles are the only
thing to possibly change:

reax_SYSINC =
reax_SYSLIB = -lgfortran
reax_SYSPATH =

Any they have nothing to do with LAMMPS. They are any
system/compiler Fortran libs needed to link a C++ code (like LAMMPS)
with a Fortran library (the one you build in lib/reax). The link
errors you are getting indicate you are not finding some system

routines that are needed. You have to figure out what your C++
and Fortran compilers need to do cross-language linking.

  1. You’re also getting MEAM errors, b/c MEAM also uses a
    Fortran lib in lib/meam. So you have to go thru the same steps
    to build with package MEAM.

  2. As Oleg said, pakcage USER-REAXC is different. There
    is no lib and no Fortran. All the files are in the package. Just

make yes-user-reaxc
make foo

and you should be good to go.