Coupling LAMMPS to other codes

Hi Lammps peopĺe!

I am trying to couple Lammps to other code and would like to see if
someone can help me in some difficulties.

As a starting point, I am trying to compile the example included
in ~/examples/COUPLE/lammps-quest

It was possible to build lammps as a library, using a modification of
the Makefile.openmpi file and a file called liblammps_openmpi.a was
created.
After that, when I try to compile the lmpqst.cpp using
make -f Makefile.openmpi

I receive the error message ():

...
lmpqst.o: In function `quest_callback(void*, long, int, int*, double**, double**)':
lmpqst.cpp:(.text+0x42): undefined reference to `lammps_extract_global'
lmpqst.cpp:(.text+0x5a): undefined reference to `lammps_extract_global'
lmpqst.cpp:(.text+0x72): undefined reference to `lammps_extract_global'
lmpqst.cpp:(.text+0x8a): undefined reference to `lammps_extract_global'
lmpqst.cpp:(.text+0xa2): undefined reference to `lammps_extract_global'
lmpqst.o:lmpqst.cpp:(.text+0xba): more undefined references to `lammps_extract_global' follow
lmpqst.o: In function `main':
lmpqst.cpp:(.text.startup+0x113): undefined reference to `LAMMPS_NS::LAMMPS::LAMMPS(int, char**, ompi_communicator_t*)'
lmpqst.cpp:(.text.startup+0x11f): undefined reference to `LAMMPS_NS::Input::file(char const*)'
lmpqst.cpp:(.text.startup+0x146): undefined reference to `LAMMPS_NS::Modify::find_fix(char const*)'
lmpqst.cpp:(.text.startup+0x166): undefined reference to `LAMMPS_NS::FixExternal::set_callback(void (*)(void*, long, int, int*, double**, double**), void*)'
lmpqst.cpp:(.text.startup+0x188): undefined reference to `LAMMPS_NS::Input::one(char const*)'
lmpqst.cpp:(.text.startup+0x190): undefined reference to `LAMMPS_NS::LAMMPS::~LAMMPS()'
collect2: error: ld returned 1 exit status
make: ** [lmpqst] Erro 1

it seems to me that the compiler doesn't find
lammps_extract_global
which is a function included in the library.cpp code, included in
~/src

Can someone indicate to me how to make this function to be found ?

Thank you in advance,
Ricardo

After that, when I try to compile the lmpqst.cpp using
make -f Makefile.openmpi
I receive the error message …

Why would you do that? Makefile.openmpi as you described

it is a lo-level Makefile used to build LAMMPS itself as a library.

It has nothing to do with building the umbrella code that couples

LAMMPS and the quantum code Quest.

There is a Makefile.g++ provided in the lammps_quest dir,
which is what you should start with. It simply uses g++
to build the code in that dir, and expects to link to the library file

you previously built for LAMMPS. So you might
have to change the settings in Makefile.g++ for the name
of the LAMMPS lib you created, or to point at the OpenMPI

lib, but that is it.

Steve

.