Hello,
I am working on an existing c program that calls the LAMMPS library. The "lammps_open" command is not correctly applying command line options for subsequent "lammps_command" calls. I am using the 3Mar2020 stable release and have verified that it is built correctly by running the binary with identical input commands. Therefore, I believe there is something wrong with my implementation of the library call.
Specifically, I am trying to allow my software to utilize kokkos by passing in the "-k on" option to "lammps_open" before individual "lammps_command" calls. However, despite my best efforts, the "-k on" is not applied. Here is my MWE.
I have 4 files, with global variables to contain the command line args.
main.h:
extern char **cmds;
extern double call_lammps ();
int nargs
lammps.h:
#include "main.h"
char **cmds;
double call_lammps ();
main.c:
#include "main.h"
#include "lammps.h"
nargs = 3
cmds = (char **) calloc (nargs, sizeof (char *));
cmds[0] = "";
cmds[1] = "-k";
cmds[2] = "on";
err = call_lammps ();
lammps.c:
#include "library.h"
#include "lammps.h"
double call_lammps () {
char *line;
lammps_open (nargs, cmds, comm, &ptr);
sprintf (line, "package kokkos");
lammps_command (ptr, line);
}
I have also verified that in my function “call_lammps", the variable "cmds" indeed contains the correct command line args immediately before "lammps_open." But when the "package kokkos" command is sent to "lammps_command," I receive the error:
ERROR: Package kokkos command without KOKKOS package enabled
Last command: package kokkos
Which indicates that "-k on" did not successfully enable kokkos for this instance of LAMMPS. I do not understand why.
Can anyone suggest what I can do to debug this?
Thanks