Calling lammps

Dear all,

I am trying to call lammps something like in the code below (initialising lammps) . But I am getting a run time line error like this:

[pcw3735:2381] *** An error occurred in MPI_Comm_dup
[pcw3735:2381] *** on communicator MPI_COMM_WORLD
[pcw3735:2381] *** MPI_ERR_COMM: invalid communicator
[pcw3735:2381] *** MPI_ERRORS_ARE_FATAL (your MPI job will now abort)

This used to work with a previous version of lammps, But I am not sure, whats wrong here. I have spotted the error exactly where it gives error. Please help.

void softParticleCloud::initLammps() {
int i, N;

string lamString;

lamString = string(“in.lammps”);
N = lamString.length();

char * lmpInputScript = new char[N+1];
lmpInputScript[N] = ‘\0’;

for(i = 0; i < N; i++)
lmpInputScript[i] = lamString[i];

// ERROR HERE !!

MPI_Comm commLammps;
// int iLammps = 1;
// MPI_Comm_split(MPI_COMM_WORLD,iLammps,0,);

MPI_Comm_dup(MPI_COMM_WORLD, &commLammps);

lmp = new LAMMPS(0,NULL,commLammps);

// ///

Best wishes
Prashant

Dear all,

I am trying to call lammps something like in the code below (initialising
lammps) . But I am getting a run time line error like this:

[pcw3735:2381] *** An error occurred in MPI_Comm_dup
[pcw3735:2381] *** on communicator MPI_COMM_WORLD
[pcw3735:2381] *** MPI_ERR_COMM: invalid communicator
[pcw3735:2381] *** MPI_ERRORS_ARE_FATAL (your MPI job will now abort)

This used to work with a previous version of lammps, But I am not sure,
whats wrong here. I have spotted the error exactly where it gives error.
Please help.

this is not an error originating from LAMMPS, but an error from your MPI
library. the most likely explanation is that the constant MPI_COMM_WORLD is
not imported from the correct MPI library. check out the error message.

axel.

Thanks Axel checked it , you were right. I think executable in STUBS directory is renamed from from the previous version. Thanks for your time. Sorry. posted this a bit too early.

     Thanks Axel checked it , you were right. I think executable in STUBS
directory is renamed from from the previous version.

no. mpi.h has always been called mpi.h. but you cannot mix and match
the mpi.h files from different MPI libraries and the code in STUBS
being one of them is thus incompatible with OpenMPI (which is
obviously the library throwing the error message).

axel.