Running Lammps inside Matlab on Linux

Hello LAMMPS users,

I am trying to run a script inside Matlab on Linux, I have already tested the LAMMPS script alone and it works, the problem comes when I call it from Matlab like this

command_line = [’./lmp_linux < script.in’];
system(command_line);
the simulation starts to create the atom structure but then suddenly stops and shows me this error:
./lmp_linux: symbol lookup error: ./lmp_linux: undefined symbol: __svml_exp2
I have already tryed this Matlab script in another machine running Windows 7 and it found no problem, but still I need to make it work on Linux.
I believe that this is no LAMMPS problem but perhaps someone has found the same problem while running their scripts in Matlab.

Thank you,

Mario Muralles
Materials, Theory and Technology Laboratory
Department of Mechanical Engineering
KyungHee University, South Korea

I don’t know, but one thing that might
help you debug it is to run ‘./lmp_linux -echo screen < script.in
so you can see exactly what command it is crashing on.

Steve

I don't know, but one thing that might
help you debug it is to run './lmp_linux -echo screen < script.in'
so you can see exactly what command it is crashing on.

​steve,

this is a dynamic linker issue. apparently, both MATLAB and LAMMPS were
compiled with the intel compiler and both linking the intel compiler
runtime libraries dynamically. however, those were not compatible versions.
particularly, MATLAB was compiled against an older version. due to MATLAB
resetting $LD_LIBRARY_PATH, the ​LAMMPS executable is trying to load an
older, incompatible intel library and cannot resolve a symbol that was
inserted by the compiler.

there are four workarounds:
- don't launch LAMMPS from within MATLAB, but write a shell script.
- write a wrapper shell script that resets LD_LIBRARY_PATH according to the
compiler that was used to compile lammps which will then call the LAMMPS
executable
- use the -static-intel flag when linking the LAMMPS executable
- use GCC/g++ as compiler to compile LAMMPS.

axel.