Running LAMMPS on GPU from python script

Dear All

I am trying to run a coupled CFD-MD simulation in which both the CFD and MD codes are called from a python script. I am using LAMMPS as the MD solver. I have compiled LAMMPS as a shared library. I could find the instructions to make the MPI call from a python script, from LAMMPS documentation. Could anyone help me understand how to run LAMMPS on GPU via python script? For running LAMMPS directly, without the python interface, I understand that we must use the -sf and -pk flags. I am a little confused about getting this done from a python script.

The -sf and -pk command line flags are merely available for convenience. They are effectively passing their arguments on to the suffix command — LAMMPS documentation and the package command — LAMMPS documentation, respectively.

That said, all command line flags are arguments to the constructor of the LAMMPS instance, so they can be passed as a list to the corresponding function in the library interface or the Python wrapper that utilizes it. Please see the API documentation: 2.3.4. Creating or deleting a LAMMPS object — LAMMPS documentation and 1.1.1. Creating or deleting a LAMMPS object — LAMMPS documentation and 1.4.1. Using the C++ API directly — LAMMPS documentation

In general, if you don’t find detailed documentation for the Python method, look up the corresponding C-library function, and - if available - the original C+±API.

1 Like