Unverified Commit f1cc6c6e authored by Axel Kohlmeyer's avatar Axel Kohlmeyer Committed by GitHub
Browse files

Merge pull request #1928 from akohlmey/collected-small-fixes

Collected small fixes and updates for the next patch release
parents a946a3b1 6d9064f9
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -406,8 +406,8 @@ interactions. Vacuum boundary conditions are not currently supported.


The *ewald/disp*\ , *ewald*\ , *pppm*\ , and *msm* styles support
The *ewald/disp*\ , *ewald*\ , *pppm*\ , and *msm* styles support
non-orthogonal (triclinic symmetry) simulation boxes. However,
non-orthogonal (triclinic symmetry) simulation boxes. However,
triclinic simulation cells may not yet be supported by suffix versions
triclinic simulation cells may not yet be supported by all suffix
of these styles.
versions of these styles.


All of the kspace styles are part of the KSPACE package.  They are
All of the kspace styles are part of the KSPACE package.  They are
only enabled if LAMMPS was built with that package.  See the :doc:`Build package <Build_package>` doc page for more info.
only enabled if LAMMPS was built with that package.  See the :doc:`Build package <Build_package>` doc page for more info.

doc/src/server_md.txt

deleted100644 → 0
+0 −150
Original line number Original line Diff line number Diff line
"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c

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

:line

server md command :h3

[Syntax:]

server md :pre

md = the protocol argument to the "server"_server.html command

[Examples:]

server md :pre

[Description:]

This command starts LAMMPS running in "server" mode, where it will
expect messages from a separate "client" code that match the {md}
protocol for format and content explained below.  For each message
LAMMPS receives it will send a message back to the client.

The "Howto client/server"_Howto_client_server.html doc page gives an
overview of client/server coupling of LAMMPS with another code where
one code is the "client" and sends request messages to a "server"
code.  The server responds to each request with a reply message.  This
enables the two codes to work in tandem to perform a simulation.

When this command is invoked, LAMMPS will run in server mode in an
endless loop, waiting for messages from the client code.  The client
signals when it is done sending messages to LAMMPS, at which point the
loop will exit, and the remainder of the LAMMPS script will be
processed.

The "server"_server.html doc page gives other options for using LAMMPS
in server mode.  See an example of how this command is used in
examples/message/in.message.server.

:line

When using this command, LAMMPS (as the server code) receives the
current coordinates of all particles from the client code each
timestep, computes their interaction, and returns the energy, forces,
and pressure for the interacting particles to the client code, so it
can complete the timestep.  This command could also be used with a
client code that performs energy minimization, using the server to
compute forces and energy each iteration of its minimizer.

When using the "fix client/md"_fix_client_md.html command, LAMMPS (as
the client code) does the timestepping and receives needed energy,
forces, and pressure values from the server code.

The format and content of the exchanged messages are explained here in
a conceptual sense.  Python-style pseudo code for the library calls to
the CSlib is shown, which performs the actual message exchange between
the two codes.  See the "CSlib website"_http://cslib.sandia.gov doc
pages for more details on the actual library syntax.  The "cs" object
in this pseudo code is a pointer to an instance of the CSlib.

See the src/MESSAGE/server_md.cpp and src/MESSAGE/fix_client_md.cpp
files for details on how LAMMPS uses these messages.  See the
examples/COUPLE/lammps_vasp/vasp_wrap.py or
examples/COUPLE/lammps_nwchem/nwchem_wrap.py files for examples of how
a quantum code (VASP or NWChem) can use these messages.

The following pseudo-code uses these values, defined as enums.

Define:

SETUP=1, STEP=2
DIM=1, PERIODICITY=2, ORIGIN=3, BOX=4, NATOMS=5, NTYPES=6, TYPES=7, COORDS=8, UNITS-9, CHARGE=10
FORCES=1, ENERGY=2, PRESSURE=3, ERROR=4 :pre

[Client sends 2 kinds of messages]:

# required fields: DIM, PERIODICTY, ORIGIN, BOX, NATOMS, NTYPES, TYPES, COORDS
# optional fields: UNITS, CHARGE :pre

cs->send(SETUP,nfields)        # msgID with nfields :pre

cs->pack_int(DIM,dim)          # dimension (2,3) of simulation
cs->pack(PERIODICITY,3,xyz)    # periodicity flags in 3 dims
cs->pack(ORIGIN,3,origin)      # lower-left corner of simulation box
cs->pack(BOX,9,box)            # 3 edge vectors of simulation box
cs->pack_int(NATOMS,natoms)    # total number of atoms
cs->pack_int(NTYPES,ntypes)    # number of atom types
cs->pack(TYPES,natoms,type)    # vector of per-atom types
cs->pack(COORDS,3*natoms,x)    # vector of 3N atom coords
cs->pack_string(UNITS,units)   # units = "lj", "real", "metal", etc
cs->pack(CHARGE,natoms,q)      # vector of per-atom charge :pre

# required fields: COORDS
# optional fields: ORIGIN, BOX :pre

cs->send(STEP,nfields)         # msgID with nfields :pre

cs->pack(COORDS,3*natoms,x)    # vector of 3N atom coords
cs->pack(ORIGIN,3,origin)      # lower-left corner of simulation box
cs->pack(BOX,9,box)            # 3 edge vectors of simulation box :pre

[Server replies to either kind of message]:

# required fields: FORCES, ENERGY, PRESSURE
# optional fields: ERROR :pre

cs->send(msgID,nfields)      # msgID with nfields
cs->pack(FORCES,3*Natoms,f)  # vector of 3N forces on atoms
cs->pack(ENERGY,1,poteng)    # total potential energy of system
cs->pack(PRESSURE,6,press)   # global pressure tensor (6-vector)
cs->pack_int(ERROR,flag)     # server had an error (e.g. DFT non-convergence) :pre

:line

The units for various quantities that are sent and received iva
messages are defined for atomic-scale simulations in the table below.
The client and server codes (including LAMMPS) can use internal units
different than these (e.g. "real units"_units.html in LAMMPS), so long
as they convert to these units for messaging.

COORDS, ORIGIN, BOX = Angstroms
CHARGE = multiple of electron charge (1.0 is a proton)
ENERGY = eV
FORCES = eV/Angstrom
PRESSURE = bars :ul

Note that these are "metal units"_units.html in LAMMPS.

If you wish to run LAMMPS in another its non-atomic units, e.g. "lj
units"_units.html, then the client and server should exchange a UNITS
message as indicated above, and both the client and server should
agree on the units for the data they exchange.

:line

[Restrictions:]

This command is part of the MESSAGE package.  It is only enabled if
LAMMPS was built with that package.  See the "Build
package"_Build_package.html doc page for more info.

[Related commands:]

"message"_message.html, "fix client/md"_fix_client_md.html

[Default:] none
+1 −1
Original line number Original line Diff line number Diff line
@@ -69,7 +69,7 @@ CommandStyle(kim_init,KimInit)
#include <string>
#include <string>


// Forward declaration.
// Forward declaration.
class KIM_Model;
typedef struct KIM_Model KIM_Model;


namespace LAMMPS_NS {
namespace LAMMPS_NS {


+1 −1
Original line number Original line Diff line number Diff line
@@ -45,7 +45,7 @@ FixClientMD::FixClientMD(LAMMPS *lmp, int narg, char **arg) :
  if (!atom->map_style) error->all(FLERR,"Fix client/md requires atom map");
  if (!atom->map_style) error->all(FLERR,"Fix client/md requires atom map");


  if (sizeof(tagint) != 4)
  if (sizeof(tagint) != 4)
    error->all(FLERR,"Fix client/md requires 4-byte atom IDs");
    error->all(FLERR,"Fix client/md only supports 32-bit atom IDs");


  if (strcmp(update->unit_style,"real") == 0) units = REAL;
  if (strcmp(update->unit_style,"real") == 0) units = REAL;
  else if (strcmp(update->unit_style,"metal") == 0) units = METAL;
  else if (strcmp(update->unit_style,"metal") == 0) units = METAL;
+6 −7
Original line number Original line Diff line number Diff line
@@ -13,6 +13,7 @@


#include "server_mc.h"
#include "server_mc.h"
#include "atom.h"
#include "atom.h"
#include "domain.h"
#include "update.h"
#include "update.h"
#include "integrate.h"
#include "integrate.h"
#include "input.h"
#include "input.h"
@@ -43,17 +44,17 @@ void ServerMC::loop()


  CSlib *cs = (CSlib *) lmp->cslib;
  CSlib *cs = (CSlib *) lmp->cslib;


  // require atom map
  if (domain->box_exist == 0)
    error->all(FLERR,"Server command before simulation box is defined");


  if (!atom->map_style) error->all(FLERR,"Server mode requires atom map");
  if (!atom->map_style) error->all(FLERR,"Server mc requires atom map");
  if (atom->tag_enable == 0) error->all(FLERR,"Server mc requires atom IDs");
  if (sizeof(tagint) != 4) error->all(FLERR,"Server mc requires 32-bit atom IDs");


  // initialize LAMMPS for dynamics
  // initialize LAMMPS for dynamics


  input->one("run 0");
  input->one("run 0");


  //update->whichflag = 1;
  //lmp->init();

  // loop on messages
  // loop on messages
  // receive a message, process it, send return message if necessary
  // receive a message, process it, send return message if necessary


@@ -123,8 +124,6 @@ void ServerMC::loop()


      int nsteps = cs->unpack_int(1);
      int nsteps = cs->unpack_int(1);


      //input->one("run 100");

      update->nsteps = nsteps;
      update->nsteps = nsteps;
      update->firststep = update->ntimestep;
      update->firststep = update->ntimestep;
      update->laststep = update->ntimestep + nsteps;
      update->laststep = update->ntimestep + nsteps;
Loading