[lammps-users] Question about lammps as a library

Hi,
I have compiled Lammps as a library and wrote a wrapper to call Lammps. I am using the c++_driver.cpp file under examples/couple . Everything works great up to here.
I also need to parallelize my wrapper code using openmpi. My question is
MPI_init and MPI_comm calls at the c++_driver.cpp part interfere with parallelization of wrapper part? I tried it and unable to parallelize wrapper part and I think that it is caused by MPI calls at the c++_driver part.
Is there any way to call lammps without those MPI calls?
All the comments are wellcome.
Sincerely.

Hi,
I have compiled Lammps as a library and wrote a wrapper to call Lammps.
I am using the c++_driver.cpp file under examples/couple . Everything
works great up to here.

I also need to parallelize my wrapper code using openmpi. My question is
MPI_init and MPI_comm calls at the c++_driver.cpp part interfere with
parallelization of wrapper part? I tried it and unable to parallelize
wrapper part and I think that it is caused by MPI calls at the
c++_driver part.

i assume that you want to have the driver run in parallel
across groups of processors and each group run a parallel
lammps execution (if not please explain what you want to do).

to get this you have to partition your world communicator
into groups and then call the lammps library with these.

the c++_driver.cpp example already demonstrates the principle
of how to do this. you give the number of processors that
you want to dedicate to lammps as argument and then it
splits off a communicator for lammps containing exactly
that many processors. the rest are still available for
other tasks, but you have to create a subcommunicator
for them as well. you can basically do all kinds of
subdivisions. this is pretty standard MPI stuff and should
also be covered well in books and tutorials on MPI.

Is there any way to call lammps without those MPI calls?

of course not. you have to provide a proper communicator
to the lammps call. if you don't, the lammps library
will just run serially or crash.

cheers,
   axel.