diff --git a/examples/COUPLE/plugin/liblammpsplugin.c b/examples/COUPLE/plugin/liblammpsplugin.c index 09912448d7..996a27524f 100644 --- a/examples/COUPLE/plugin/liblammpsplugin.c +++ b/examples/COUPLE/plugin/liblammpsplugin.c @@ -67,7 +67,10 @@ liblammpsplugin_t *liblammpsplugin_load(const char *lib) #if defined(LAMMPS_LIB_MPI) ADDSYM(open); +#else + lmp->open = NULL; #endif + ADDSYM(open_no_mpi); ADDSYM(open_fortran); ADDSYM(close); diff --git a/examples/COUPLE/plugin/liblammpsplugin.h b/examples/COUPLE/plugin/liblammpsplugin.h index 0fc993fca8..0865be6bb9 100644 --- a/examples/COUPLE/plugin/liblammpsplugin.h +++ b/examples/COUPLE/plugin/liblammpsplugin.h @@ -111,6 +111,8 @@ struct _liblammpsplugin { void *handle; #if defined(LAMMPS_LIB_MPI) void *(*open)(int, char **, MPI_Comm, void **); +#else + void *open; #endif void *(*open_no_mpi)(int, char **, void **); void *(*open_fortran)(int, char **, void **, int); diff --git a/examples/COUPLE/plugin/simple.c b/examples/COUPLE/plugin/simple.c index 1401a22f49..0ca5726072 100644 --- a/examples/COUPLE/plugin/simple.c +++ b/examples/COUPLE/plugin/simple.c @@ -93,7 +93,13 @@ int main(int narg, char **arg) MPI_Abort(MPI_COMM_WORLD,1); } } - if (lammps == 1) lmp = plugin->open(0,NULL,comm_lammps,NULL); + if (lammps == 1) { + if (plugin->open == NULL) { + printf("ERROR: liblammpsmpi.c must be compiled with -DLAMMPS_LIB_MPI=1 for this program\n"); + MPI_Abort(MPI_COMM_WORLD,2); + } + lmp = plugin->open(0,NULL,comm_lammps,NULL); + } while (1) { if (me == 0) {