mdi_engine command




This command is used to have LAMMPS act as a server with another client code to effectively couple the two codes together in client/server mode.

More specifically, this command causes LAMMPS to begin using the MDI Library to run as an MDI engine (server), responding to commands made by an external MDI driver code (client). See the Howto mdi page for more information about how LAMMPS can work as both an MDI driver or engine.

General information about launching codes that communicate using the MDI Library can be found in the corresponding page of the MDI Library’s documentation.

This command should typically be used in an input script after LAMMPS has setup the system it is going to model in collaboration with the driver code. Depending on how the driver code tells the LAMMPS engine to exit, other commands can be executed after this command, but typically it should be used at the end of the LAMMPS input script.

To act as a MD-based MDI engine, this is the list of MDI commands from a driver code which LAMMPS currently recognizes. See more details about these commands in the MDI library documentation .. NOTE: Taylor - is this the best link for this info? Can we flesh this .. out with the full list of supported commands? Maybe the distinction .. of what “node” the commands refer to is not needed in this table?

Command name



Driver sends the number of atoms in the system


Driver requests the number of atoms in the system


Driver requests 3*N double-precision atom coordinates


Driver sends 3*N double-precision atom forces


Driver requests 3*N double-precision atom forces


Driver tells the engine (LAMMPS) to exit engine mode

If these commands are not sufficient to support what a driver which you write needs, additional commands can be defined by simply using a new command name not in this list. Code to support the new command needs to be added to the MDI package within LAMMPS; see its src/MDI/mdi_engine.cpp and fix_mdi_engine.cpp files.


This command is part of the MDI package. It is only enabled if LAMMPS was built with that package. See the Build package page for more info.