convert "ms" pair style flag for MEAM into meam/ms pair style

This commit is contained in:
Axel Kohlmeyer
2023-01-26 15:09:14 -05:00
parent d88a4a768d
commit b7f2c3feda
13 changed files with 195 additions and 59 deletions

View File

@ -200,6 +200,7 @@ OPT.
* :doc:`mdpd <pair_mesodpd>`
* :doc:`mdpd/rhosum <pair_mesodpd>`
* :doc:`meam (k) <pair_meam>`
* :doc:`meam/ms (k) <pair_meam>`
* :doc:`meam/spline (o) <pair_meam_spline>`
* :doc:`meam/sw/spline <pair_meam_sw_spline>`
* :doc:`mesocnt <pair_mesocnt>`

View File

@ -1,19 +1,26 @@
.. index:: pair_style meam
.. index:: pair_style meam/kk
.. index:: pair_style meam/ms
.. index:: pair_style meam/ms/kk
pair_style meam command
=========================
Accelerator Variants: *meam/kk*
pair_style meam/ms command
==========================
Accelerator Variants: *meam/ms/kk*
Syntax
""""""
.. code-block:: LAMMPS
pair_style meam [ms]
pair_style style
* ms = use multi-state MEAM (optional)
* style = *meam* or *meam/ms*
Examples
""""""""
@ -24,6 +31,9 @@ Examples
pair_coeff * * ../potentials/library.meam Si ../potentials/si.meam Si
pair_coeff * * ../potentials/library.meam Ni Al NULL Ni Al Ni Ni
pair_style meam/ms
pair_coeff * * ../potentials/library.msmeam H Ga ../potentials/HGa.meam H Ga
Description
"""""""""""
@ -33,16 +43,23 @@ Description
as of November 2010; see description below of the mixture_ref_t
parameter
Pair style *meam* computes non-bonded interactions for a variety of materials
using the modified embedded-atom method (MEAM)
:ref:`(Baskes) <Baskes>`. Conceptually, it is an extension to the original
:doc:`EAM method <pair_eam>` which adds angular forces. It is
thus suitable for modeling metals and alloys with fcc, bcc, hcp and
diamond cubic structures, as well as materials with covalent interactions
like silicon and carbon. This *meam* pair style is a translation of the
original Fortran version to C++. It is functionally equivalent but more
efficient and has additional features. The Fortran version of the *meam*
pair style has been removed from LAMMPS after the 12 December 2018 release.
Pair style *meam* computes non-bonded interactions for a variety of
materials using the modified embedded-atom method (MEAM) :ref:`(Baskes)
<Baskes>`. Conceptually, it is an extension to the original :doc:`EAM
method <pair_eam>` which adds angular forces. It is thus suitable for
modeling metals and alloys with fcc, bcc, hcp and diamond cubic
structures, as well as materials with covalent interactions like silicon
and carbon.
The *meam* pair style is a translation of the original Fortran version
to C++. It is functionally equivalent but more efficient and has
additional features. The Fortran version of the *meam* pair style has
been removed from LAMMPS after the 12 December 2018 release.
Pair style *meam/ms* uses the multi-state MEAM (MS-MEAM) method
according to :ref:`(Baskes2) <Baskes2>`, which is an extension to MEAM.
This pair style is mostly equivalent to *meam* and is use differs only
where noted in the documentation below.
In the MEAM formulation, the total energy E of a system of atoms is
given by:
@ -353,13 +370,15 @@ Most published MEAM parameter sets use the default values *attrac* = *repulse* =
Setting *repuls* = *attrac* = *delta* corresponds to the form used in several
recent published MEAM parameter sets, such as :ref:`(Valone) <Valone>`
The optional *ms* flag activates multi-state MEAM (MS-MEAM) according to :ref:`(Baskes2) <Baskes2>`.
This requires 6 extra parameters in the MEAM library file, resulting in 25 parameters ordered like:
Then using *meam/ms* pair style the multi-state MEAM (MS-MEAM) method is
activated. This requires 6 extra parameters in the MEAM library file,
resulting in 25 parameters ordered that are ordered like this:
elt, lat, z, ielement, atwt, alpha, b0, b1, b2, b3, b1m, b2m, b3m, alat, esub, asub,
t0, t1, t2, t3, t1m, t2m, t3m, rozero, ibar
The 6 extra MS-MEAM parameters are *b1m, b2m, b3m, t1m, t2m, t3m*.
In the LAMMPS ``potentials`` folder, compatible files have an ".msmeam" extension.
----------
@ -403,16 +422,15 @@ This pair style can only be used via the *pair* keyword of the
Restrictions
""""""""""""
The *meam* style is provided in the MEAM package. It is
only enabled if LAMMPS was built with that package.
The *meam* and *meam/ms* pair styles are provided in the MEAM
package. They are only enabled if LAMMPS was built with that package.
See the :doc:`Build package <Build_package>` page for more info.
The maximum number of elements, that can be read from the MEAM
library file, is determined at compile time. The default is 5.
If you need support for more elements, you have to change the
define for the constant 'maxelt' at the beginning of the file
src/MEAM/meam.h and update/recompile LAMMPS. There is no
limit on the number of atoms types.
The maximum number of elements, that can be read from the MEAM library
file, is determined at compile time. The default is 5. If you need
support for more elements, you have to change the the constant 'maxelt'
at the beginning of the file ``src/MEAM/meam.h`` and update/recompile
LAMMPS. There is no limit on the number of atoms types.
Related commands
""""""""""""""""

View File

@ -277,7 +277,8 @@ accelerated styles exist.
* :doc:`lubricateU/poly <pair_lubricateU>` - hydrodynamic lubrication forces for Fast Lubrication with polydispersity
* :doc:`mdpd <pair_mesodpd>` - mDPD particle interactions
* :doc:`mdpd/rhosum <pair_mesodpd>` - mDPD particle interactions for mass density
* :doc:`meam <pair_meam>` - modified embedded atom method (MEAM) in C
* :doc:`meam <pair_meam>` - modified embedded atom method (MEAM)
* :doc:`meam/ms <pair_meam>` - multi-state modified embedded atom method (MS-MEAM)
* :doc:`meam/spline <pair_meam_spline>` - splined version of MEAM
* :doc:`meam/sw/spline <pair_meam_sw_spline>` - splined version of MEAM with a Stillinger-Weber term
* :doc:`mesocnt <pair_mesocnt>` - mesoscopic vdW potential for (carbon) nanotubes

View File

@ -51,6 +51,7 @@ PairMEAMKokkos<DeviceType>::PairMEAMKokkos(LAMMPS *lmp) : PairMEAM(lmp)
delete meam_inst;
meam_inst_kk = new MEAMKokkos<DeviceType>(memory);
meam_inst = meam_inst_kk;
myname = "meam/kk";
}
/* ---------------------------------------------------------------------- */

View File

@ -13,12 +13,12 @@
#ifdef PAIR_CLASS
// clang-format off
PairStyle(meam/c/kk,PairMEAMKokkos<LMPDeviceType>)
PairStyle(meam/c/kk/device,PairMEAMKokkos<LMPDeviceType>)
PairStyle(meam/c/kk/host,PairMEAMKokkos<LMPHostType>)
PairStyle(meam/kk,PairMEAMKokkos<LMPDeviceType>)
PairStyle(meam/kk/device,PairMEAMKokkos<LMPDeviceType>)
PairStyle(meam/kk/host,PairMEAMKokkos<LMPHostType>)
PairStyle(meam/c/kk,PairMEAMKokkos<LMPDeviceType>);
PairStyle(meam/c/kk/device,PairMEAMKokkos<LMPDeviceType>);
PairStyle(meam/c/kk/host,PairMEAMKokkos<LMPHostType>);
PairStyle(meam/kk,PairMEAMKokkos<LMPDeviceType>);
PairStyle(meam/kk/device,PairMEAMKokkos<LMPDeviceType>);
PairStyle(meam/kk/host,PairMEAMKokkos<LMPHostType>);
// clang-format on
#else

View File

@ -0,0 +1,32 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/ Sandia National Laboratories
LAMMPS development team: developers@lammps.org
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#include "pair_meam_ms_kokkos.h"
#include "meam.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
template<class DeviceType>
PairMEAMMSKokkos<DeviceType>::PairMEAMMSKokkos(LAMMPS *lmp) : PairMEAMKokkos<DeviceType>(lmp)
{
this->meam_inst->msmeamflag = this->msmeamflag = 1;
this->myname = "meam/ms/kk";
}
namespace LAMMPS_NS {
template class PairMEAMMSKokkos<LMPDeviceType>;
#ifdef KOKKOS_ENABLE_CUDA
template class PairMEAMMSKokkos<LMPHostType>;
#endif
}

View File

@ -0,0 +1,36 @@
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/ Sandia National Laboratories
LAMMPS development team: developers@lammps.org
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifdef PAIR_CLASS
// clang-format off
PairStyle(meam/ms/kk,PairMEAMMSKokkos<LMPDeviceType>);
PairStyle(meam/ms/kk/device,PairMEAMMSKokkos<LMPDeviceType>);
PairStyle(meam/ms/kk/host,PairMEAMMSKokkos<LMPHostType>);
// clang-format on
#else
#ifndef LMP_PAIR_MEAM_MS_KOKKOS_H
#define LMP_PAIR_MEAM_MS_KOKKOS_H
#include "pair_meam_kokkos.h"
namespace LAMMPS_NS {
template <class DeviceType>
class PairMEAMMSKokkos : public PairMEAMKokkos<DeviceType> {
public:
PairMEAMMSKokkos(class LAMMPS *);
};
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -17,7 +17,7 @@
#include <cmath>
#include <string>
#define maxelt 5
constexpr int maxelt = 5;
namespace LAMMPS_NS {
class Memory;

View File

@ -836,9 +836,9 @@ void MEAM::get_densref(double r, int a, int b, double* rho01, double* rho11, dou
*rho21 = *rho21 / denom * *rho01;
} else
*rho21 = 8. / 3. * (rhoa21 - rhoa22) * (rhoa21 - rhoa22);
if (this->msmeamflag) {
*rho2m1 = 8. / 3. * (rhoa2m1 - rhoa2m2) * (rhoa2m1 - rhoa2m2);
}
if (this->msmeamflag) {
*rho2m1 = 8. / 3. * (rhoa2m1 - rhoa2m2) * (rhoa2m1 - rhoa2m2);
}
break;
case B2:
*rho01 = 8.0 * rhoa02;

View File

@ -54,12 +54,15 @@ PairMEAM::PairMEAM(LAMMPS *lmp) : Pair(lmp)
one_coeff = 1;
manybody_flag = 1;
centroidstressflag = CENTROID_NOTAVAIL;
msmeamflag = 0;
allocated = 0;
nlibelements = 0;
meam_inst = new MEAM(memory);
meam_inst->msmeamflag = msmeamflag = 0;
myname = "meam";
scale = nullptr;
}
@ -181,18 +184,9 @@ void PairMEAM::allocate()
global settings
------------------------------------------------------------------------- */
void PairMEAM::settings(int narg, char **arg)
void PairMEAM::settings(int narg, char ** /*arg*/)
{
if (narg > 1) error->all(FLERR,"Illegal pair_style meam command");
meam_inst->msmeamflag = 0;
if (narg == 1) {
if (strcmp("ms", arg[0]) == 0) {
msmeamflag = meam_inst->msmeamflag = 1;
} else
error->all(FLERR, "Unknown pair style meam option {}", arg[0]);
}
if (narg != 0) error->all(FLERR,"Illegal pair_style {} command", myname);
// set comm size needed by this Pair
@ -215,12 +209,7 @@ void PairMEAM::coeff(int narg, char **arg)
if (!allocated) allocate();
if (narg < 6) error->all(FLERR,"Incorrect args for pair coefficients");
// insure I,J args are * *
if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0)
error->all(FLERR,"Incorrect args for pair coefficients");
if (narg < 6) error->all(FLERR,"Incorrect args for pair style {} coefficients", myname);
// check for presence of first meam file
@ -248,7 +237,7 @@ void PairMEAM::coeff(int narg, char **arg)
}
if (paridx < 0) error->all(FLERR,"No MEAM parameter file in pair coefficients");
if ((narg - paridx - 1) != atom->ntypes)
error->all(FLERR,"Incorrect args for pair coefficients");
error->all(FLERR,"Incorrect args for pair style {} coefficients", myname);
// MEAM element names between 2 filenames
// nlibelements = # of MEAM elements
@ -291,7 +280,7 @@ void PairMEAM::coeff(int narg, char **arg)
if (libelements[j] == arg[i]) break;
if (j < nlibelements) map[m] = j;
else if (strcmp(arg[i],"NULL") == 0) map[m] = -1;
else error->all(FLERR,"Incorrect args for pair coefficients");
else error->all(FLERR,"Incorrect args for pair style {} coefficients", myname);
}
// clear setflag since coeff() called once with I,J = * *
@ -316,7 +305,7 @@ void PairMEAM::coeff(int narg, char **arg)
}
}
if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients");
if (count == 0) error->all(FLERR,"Incorrect args for pair style {} coefficients", myname);
}
/* ----------------------------------------------------------------------
@ -326,7 +315,7 @@ void PairMEAM::coeff(int narg, char **arg)
void PairMEAM::init_style()
{
if (force->newton_pair == 0)
error->all(FLERR,"Pair style MEAM requires newton pair on");
error->all(FLERR,"Pair style {} requires newton pair on", myname);
// need a full and a half neighbor list
@ -436,8 +425,7 @@ void PairMEAM::read_global_meam_file(const std::string &globalfile)
std::string lattice_type = values.next_string();
if (!MEAM::str_to_lat(lattice_type, true, lat[index]))
error->one(FLERR,"Unrecognized lattice type in MEAM "
"library file: {}", lattice_type);
error->one(FLERR,"Unrecognized lattice type in MEAM library file: {}", lattice_type);
// store parameters
@ -470,11 +458,11 @@ void PairMEAM::read_global_meam_file(const std::string &globalfile)
ibar[index] = values.next_int();
if (!isone(t0[index]))
error->one(FLERR,"Unsupported parameter in MEAM library file: t0!=1");
error->one(FLERR,"Unsupported parameter in MEAM library file: t0 != 1");
// z given is ignored: if this is mismatched, we definitely won't do what the user said -> fatal error
if (z[index] != MEAM::get_Zij(lat[index]))
error->one(FLERR,"Mismatched parameter in MEAM library file: z!=lat");
error->one(FLERR,"Mismatched parameter in MEAM library file: z != lat");
nset++;
} catch (TokenizerException &e) {

View File

@ -48,6 +48,7 @@ class PairMEAM : public Pair {
double cutmax; // max cutoff for all elements
int nlibelements; // # of library elements
int msmeamflag; // 0 (default) for normal MEAM, 1 for MS-MEAM
std::string myname; // name of the pair style
std::vector<std::string> libelements; // names of library elements
std::vector<double> mass; // mass of library element

25
src/MEAM/pair_meam_ms.cpp Normal file
View File

@ -0,0 +1,25 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/ Sandia National Laboratories
LAMMPS development team: developers@lammps.org
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#include "pair_meam_ms.h"
#include "meam.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
PairMEAMMS::PairMEAMMS(LAMMPS *lmp) : PairMEAM(lmp)
{
meam_inst->msmeamflag = msmeamflag = 1;
myname = "meam/ms";
}

33
src/MEAM/pair_meam_ms.h Normal file
View File

@ -0,0 +1,33 @@
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/ Sandia National Laboratories
LAMMPS development team: developers@lammps.org
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifdef PAIR_CLASS
// clang-format off
PairStyle(meam/ms,PairMEAMMS);
// clang-format on
#else
#ifndef LMP_PAIR_MEAM_MS_H
#define LMP_PAIR_MEAM_MS_H
#include "pair_meam.h"
namespace LAMMPS_NS {
class PairMEAMMS : public PairMEAM {
public:
PairMEAMMS(class LAMMPS *);
};
} // namespace LAMMPS_NS
#endif
#endif