Could reax/c/kk be used when lammps is compiled as a library?

Hi all users,

Anyone who has ever used reax/c/kk command as a library command called from other code?

I saw it on the manual that -k on option must be added when using this command directly.

So, how to use it when lammps is used as a library?

Best,

Xiao

Hi all users,

Anyone who has ever used reax/c/kk command as a library command called from
other code?

I saw it on the manual that -k on option must be added when using this
command directly.

So, how to use it when lammps is used as a library?

there should not be a problem because of such issues. since you need
to pass an argument vector when creating the LAMMPS object though the
library interface, this is not different from what happens, when the
LAMMPS executable is started.

please see library.cpp and main.cpp

axel.

Axel, thanks for your quick and kind reply.

I didnot know if I get it right.

I have tried with “lammps_command (***, ***)” interface command. And with that, I have added “package kokkos neigth half” in the input script and modified “reax/c” to “reax/c/kk”. Is that all I have to do? The manual reads “mpirun -np 16 lmp_mpi -k on -sf kk -in in.lj”. The -k on option didnot matter?

Best,

Xiao


Axel, thanks for your quick and kind reply.

I didnot know if I get it right.

I have tried with "lammps_command (***, ***)" interface command. And with
that, I have added "package kokkos neigth half" in the input script and
modified "reax/c" to "reax/c/kk". Is that all I have to do? The manual reads
"mpirun -np 16 lmp_mpi -k on -sf kk -in in.lj". The -k on option didnot
matter?

it *does* matter. in fact, the -kokkos flag can *only* be provided in
the argument vector as it triggers an action that is only available
during the instantiation of the LAMMPS object. for everything else
(package, suffix), there is an equivalent input file command and they
are exposed to the command line merely for convenience.

please re-read the documentation on the *library interface* more carefully.

axel.

What Axel is referring to are the arguments passed to

the lammps_open() function in the lib interface:

void lammps_open(int argc, char **argv, MPI_Comm communicator, void **ptr)

The argc,argv are exactly the optional strings (like -k etc) that follow

the lmp_machine in a command line like:

mpirun -np 4 lmp_machine -k … < in.script

So you can run LAMMPS as a lib, exactly as you would from the

command line. In fact the MPI_Comm arg is what mpirun creates

for you when you type “mpirun -np 4” at the command line.

So it also mimics the command line operation.

Steve

I suppose it is the same as all other styles – you just need to add the “-k on” prefix along with other suffixes to the command line.

Ray

Thank you all, Alex, Steve and Ray for your detailed instruction.