"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c

:link(lws,http://lammps.sandia.gov)
:link(ld,Manual.html)
:link(lc,Section_commands.html#comm)

:line

fix external command :h3

[Syntax:]

fix ID group-ID external :pre

ID, group-ID are documented in "fix"_fix.html command
external = style name of this fix command :ul

[Examples:]

fix 1 all external :pre

[Description:]

This fix makes a callback each timestep or minimization iteration to
an external driver program that is using LAMMPS as a library.  This is
a way to let another program compute forces on atoms which LAMMPS will
include in its dynamics performed by the "run"_run.html command or its
iterations performed by the "minimize"_minimize.html command

The callback function "foo" will be invoked every timestep or
iteration as:

foo(ptr,timestep,nlocal,ids,x,fexternal); :pre

which has this prototype:

void foo(void *, int, int, int *, double **, double **);

The arguments are as follows:

ptr = pointer provided by and simply passed back to external driver
timestep = current LAMMPS timestep
nlocal = # of atoms on this processor
ids = list of atom IDs on this processor
x = coordinates of atoms on this processor
fexternal = forces on atoms on this processor :ul

Fexternal are the forces returned by the driver program,
which LAMMPS adds to the current force on each atom.

See the couple/lammps_quest/lmpqst.cpp file in the LAMMPS distribution
for an example of a coupling application that uses this fix, and how
it makes a call to the fix to specify what function the fix should
callback to.  The sample application performs classical MD using
quantum forces computed by a density functional code "Quest"_quest.

:link(quest,http://dft.sandia.gov/Quest)

[Restart, fix_modify, output, run start/stop, minimize info:]

No information about this fix is written to "binary restart
files"_restart.html.  None of the "fix_modify"_fix_modify.html options
are relevant to this fix.  No global or per-atom quantities are stored
by this fix for access by various "output
commands"_Section_howto.html#howto_15.  No parameter of this fix can
be used with the {start/stop} keywords of the "run"_run.html command.

The forces due to this fix are imposed during an energy minimization,
invoked by the "minimize"_minimize.html command.  However, LAMMPS
knows nothing about the energy associated with these forces.  So you
should perform the minimization based on a force tolerance, not an
energy tolerance.

[Restrictions:] none

[Related commands:] none

[Default:] none
