[lammps-users] Building LAMMPS with MEAM

I'm having a lot of trouble building LAMMPS with MEAM and MPI support on a x86 Red-Hat linux cluster. I have tried both Intel's icc/mpicc compiler/linker (with Intel's MPI and MPICH) and GNU's gcc/mpicc compiler/linker with MPICH to compile. However, I can't get MEAM to link with LAMMPS.

Additionally, I noticed the curious behavior that MEAM compiles without a hitch using ifort, but will not compile using g95 (latest stable release)

I'm not worrying about FFTW for now although it causes another set of problems. I receive a huge number of errors if using Intel's MPI 2.0, but I can reduce the number of errors by using the same makefile, but with Intel's MPICH. The makefile and error log from the Intel compiler are attached.

Makefile:
#Compiler options
CC = icc
CCFLAGS = -I${HOME}/lammps/lib/meam -I${HOME}/fftw/include -I/opt/mpich/intel/include -O -DFFT_NONE -DGZIP -DMPICH_IGNORE_CXX_SEEK
DEPFLAGS = -M

#Linker options
LINK = mpicc
LINKFLAGS = -O -L${HOME}/lammps/lib/meam -L/opt/mpich/intel/lib -L/opt/intel/fce/9.0/lib -L${HOME}/lammps/src/MEAM/
USRLIB = -lmpich -lmeam -lifcore -lifcoremt -lcxaguard
SYSLIB = -lpthread -lstdc++
ARCHIVE = ar
ARFLAGS = -rc
SIZE =
...

The errors are:
IPO link: can not find "-lstdc++_shared"
icc: error: problem during multi-file optimization compilation (code 1)
make[1]: *** [../lmp_mpich] Error 1
make[1]: Leaving directory `/export/home/cjo123/lammps/src/Obj_mpich'
make: *** [mpich] Error 2

FYI:
When using Intel's MPI 2.0 in lieu of MPICH I receive the error:
/usr/bin/ld: skipping incompatible /export/home/cjo123/lammps/lib/meam/libmeam.a when searching for -lmeam
/usr/bin/ld: cannot find -lmeam
collect2: ld returned 1 exit status
make[1]: *** [../lmp_icc] Error 1
make[1]: Leaving directory `/export/home/cjo123/lammps/src/Obj_icc'
make: *** [icc] Error 2

I would greatly appreciate any help with this problem.

Christopher J. O'Brien
Graduate Student
The Pennsylvania State University
Department of Engineering Science and Mechanics

I typically don't use mpicc to compile or link. If you know where
the mpi.h and libmpi.a files are, you shouldn't need them - just
point to them with -I and -L like any other header/lib files.
Mpicc tends to do mysterious things invisibly to you.

The error with not finding -lmeam appears to be a linking error
that has nothing to do with MPI. The MEAM library has no MPI calls in it.
You could write your own 5-line C++ code and see if you can link with
that library, either using g++ or mpiCC as the linker.

Steve