LAMMPS CPL interface

From cpl-wiki
Jump to: navigation, search

Overview of the CPL library LAMMPS interface

LAMMPS works through a series of user defined fixes. These are objects the user can define by inheretiting from a base class called fix with a pre-definied structure. These are automatically registered with LAMMPS and instantiated (created when LAMMPS runs). The use can then defined a range of "hook"* functions with names like post_setup or pre_force, which can be used to inject code where you want (after the setup or before the force calcultation respectivly) in the overall LAMMPS solver. The addition code is included in LAMMPS by writing user add on packages which can be included when LAMMPS is complied. Provided LAMMPS has been built with the extra package, they can then be used, often by keywords to switch these on from the user input.

For CPL library, the package is USER_CPL and the code inside includes fix_cpl_init, fix_cpl_force and CPLSocketLAMMPS. The socket is the bulk of the code which handles getting information from LAMMPS, fix_cpl_force applies the constraint force and fix_cpl_init is the top level function to handle communication and call the CPLSocketLAMMPS/fix_cpl_force routines.

  • The concept of a hook here is a programming term for a pre-defined place in a software package when you can stick in your own code. LAMMPS is designed to be almost entirly built up of various user packages so provides hooks to get at almost every possible point in the solver.