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

Collected small fixes and updates for the next patch release
This commit is contained in:
Axel Kohlmeyer 2020-03-13 19:44:04 -04:00 committed by GitHub
commit f1cc6c6e57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 47 additions and 185 deletions

View File

@ -406,8 +406,8 @@ interactions. Vacuum boundary conditions are not currently supported.
The *ewald/disp*\ , *ewald*\ , *pppm*\ , and *msm* styles support
non-orthogonal (triclinic symmetry) simulation boxes. However,
triclinic simulation cells may not yet be supported by suffix versions
of these styles.
triclinic simulation cells may not yet be supported by all suffix
versions of these styles.
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.

View File

@ -1,150 +0,0 @@
"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

View File

@ -69,7 +69,7 @@ CommandStyle(kim_init,KimInit)
#include <string>
// Forward declaration.
class KIM_Model;
typedef struct KIM_Model KIM_Model;
namespace LAMMPS_NS {

View File

@ -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 (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;
else if (strcmp(update->unit_style,"metal") == 0) units = METAL;

View File

@ -13,6 +13,7 @@
#include "server_mc.h"
#include "atom.h"
#include "domain.h"
#include "update.h"
#include "integrate.h"
#include "input.h"
@ -43,17 +44,17 @@ void ServerMC::loop()
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
input->one("run 0");
//update->whichflag = 1;
//lmp->init();
// loop on messages
// receive a message, process it, send return message if necessary
@ -123,8 +124,6 @@ void ServerMC::loop()
int nsteps = cs->unpack_int(1);
//input->one("run 100");
update->nsteps = nsteps;
update->firststep = update->ntimestep;
update->laststep = update->ntimestep + nsteps;

View File

@ -48,7 +48,7 @@ ServerMD::ServerMD(LAMMPS *lmp) : Pointers(lmp)
if (!atom->map_style) error->all(FLERR,"Server md requires atom map");
if (atom->tag_enable == 0) error->all(FLERR,"Server md requires atom IDs");
if (sizeof(tagint) != 4) error->all(FLERR,"Server md requires 4-byte atom IDs");
if (sizeof(tagint) != 4) error->all(FLERR,"Server md requires 32-bit atom IDs");
if (strcmp(update->unit_style,"real") == 0) units = REAL;
else if (strcmp(update->unit_style,"metal") == 0) units = METAL;

View File

@ -62,6 +62,7 @@ enum{FORWARD_IK, FORWARD_AD, FORWARD_IK_PERATOM, FORWARD_AD_PERATOM,
PPPMDispIntel::PPPMDispIntel(LAMMPS *lmp) : PPPMDisp(lmp)
{
suffix_flag |= Suffix::INTEL;
triclinic_support = 0;
order = 7;
order_6 = 7; //sets default stencil sizes to 7

View File

@ -208,16 +208,23 @@ void PPPMIntel::compute_first(int eflag, int vflag)
// find grid points for all my particles
// map my particle charge onto my local 3d density grid
// optimized versions can only be used for orthogonal boxes
if (fix->precision() == FixIntel::PREC_MODE_MIXED) {
particle_map<float,double>(fix->get_mixed_buffers());
make_rho<float,double>(fix->get_mixed_buffers());
} else if (fix->precision() == FixIntel::PREC_MODE_DOUBLE) {
particle_map<double,double>(fix->get_double_buffers());
make_rho<double,double>(fix->get_double_buffers());
if (triclinic) {
PPPM::particle_map();
PPPM::make_rho();
} else {
particle_map<float,float>(fix->get_single_buffers());
make_rho<float,float>(fix->get_single_buffers());
if (fix->precision() == FixIntel::PREC_MODE_MIXED) {
particle_map<float,double>(fix->get_mixed_buffers());
make_rho<float,double>(fix->get_mixed_buffers());
} else if (fix->precision() == FixIntel::PREC_MODE_DOUBLE) {
particle_map<double,double>(fix->get_double_buffers());
make_rho<double,double>(fix->get_double_buffers());
} else {
particle_map<float,float>(fix->get_single_buffers());
make_rho<float,float>(fix->get_single_buffers());
}
}
// all procs communicate density values from their ghost cells
@ -258,21 +265,26 @@ void PPPMIntel::compute_second(int /*eflag*/, int /*vflag*/)
int i,j;
// calculate the force on my particles
// optimized versions can only be used for orthogonal boxes
if (differentiation_flag == 1) {
if (fix->precision() == FixIntel::PREC_MODE_MIXED)
fieldforce_ad<float,double>(fix->get_mixed_buffers());
else if (fix->precision() == FixIntel::PREC_MODE_DOUBLE)
fieldforce_ad<double,double>(fix->get_double_buffers());
else
fieldforce_ad<float,float>(fix->get_single_buffers());
if (triclinic) {
PPPM::fieldforce();
} else {
if (fix->precision() == FixIntel::PREC_MODE_MIXED)
fieldforce_ik<float,double>(fix->get_mixed_buffers());
else if (fix->precision() == FixIntel::PREC_MODE_DOUBLE)
fieldforce_ik<double,double>(fix->get_double_buffers());
else
fieldforce_ik<float,float>(fix->get_single_buffers());
if (differentiation_flag == 1) {
if (fix->precision() == FixIntel::PREC_MODE_MIXED)
fieldforce_ad<float,double>(fix->get_mixed_buffers());
else if (fix->precision() == FixIntel::PREC_MODE_DOUBLE)
fieldforce_ad<double,double>(fix->get_double_buffers());
else
fieldforce_ad<float,float>(fix->get_single_buffers());
} else {
if (fix->precision() == FixIntel::PREC_MODE_MIXED)
fieldforce_ik<float,double>(fix->get_mixed_buffers());
else if (fix->precision() == FixIntel::PREC_MODE_DOUBLE)
fieldforce_ik<double,double>(fix->get_double_buffers());
else
fieldforce_ik<float,float>(fix->get_single_buffers());
}
}
// extra per-atom energy/virial communication

View File

@ -314,7 +314,7 @@ int MinFire::iterate(int maxiter)
for (int i = 0; i < nlocal; i++)
v[i][0] = v[i][1] = v[i][2] = 0.0;
}
// min dtv over replicas, if necessary
// this communicator would be invalid for multiprocess replicas

View File

@ -742,7 +742,7 @@ void PairHybrid::read_restart(FILE *fp)
keywords[m] = new char[n];
if (me == 0) utils::sfread(FLERR,keywords[m],sizeof(char),n,fp,NULL,error);
MPI_Bcast(keywords[m],n,MPI_CHAR,0,world);
styles[m] = force->new_pair(keywords[m],0,dummy);
styles[m] = force->new_pair(keywords[m],1,dummy);
styles[m]->read_restart_settings(fp);
// read back per style special settings, if present
special_lj[m] = special_coul[m] = NULL;