Merge branch 'lammps:develop' into mliappy_unified
This commit is contained in:
22
src/.gitignore
vendored
22
src/.gitignore
vendored
@ -409,8 +409,8 @@
|
||||
/angle_mm3.h
|
||||
/angle_quartic.cpp
|
||||
/angle_quartic.h
|
||||
/angle_sdk.cpp
|
||||
/angle_sdk.h
|
||||
/angle_spica.cpp
|
||||
/angle_spica.h
|
||||
/angle_table.cpp
|
||||
/angle_table.h
|
||||
/atom_vec_angle.cpp
|
||||
@ -990,7 +990,7 @@
|
||||
/improper_umbrella.h
|
||||
/interlayer_taper.h
|
||||
/kissfft.h
|
||||
/lj_sdk_common.h
|
||||
/lj_spica_common.h
|
||||
/math_complex.h
|
||||
/math_vector.h
|
||||
/message.cpp
|
||||
@ -1218,12 +1218,12 @@
|
||||
/pair_lj_long_tip4p_long.h
|
||||
/pair_lj_cut_tgpu.cpp
|
||||
/pair_lj_cut_tgpu.h
|
||||
/pair_lj_sdk.cpp
|
||||
/pair_lj_sdk.h
|
||||
/pair_lj_sdk_coul_long.cpp
|
||||
/pair_lj_sdk_coul_long.h
|
||||
/pair_lj_sdk_coul_msm.cpp
|
||||
/pair_lj_sdk_coul_msm.h
|
||||
/pair_lj_spica.cpp
|
||||
/pair_lj_spica.h
|
||||
/pair_lj_spica_coul_long.cpp
|
||||
/pair_lj_spica_coul_long.h
|
||||
/pair_lj_spica_coul_msm.cpp
|
||||
/pair_lj_spica_coul_msm.h
|
||||
/pair_lj_sf_dipole_sf.cpp
|
||||
/pair_lj_sf_dipole_sf.h
|
||||
/pair_lj_switch3_coulgauss_long.cpp
|
||||
@ -1522,6 +1522,8 @@
|
||||
/fix_smd_wall_surface.h
|
||||
/fix_srp.cpp
|
||||
/fix_srp.h
|
||||
/fix_srp_react.cpp
|
||||
/fix_srp_react.h
|
||||
/fix_tfmc.cpp
|
||||
/fix_tfmc.h
|
||||
/fix_ttm.cpp
|
||||
@ -1562,6 +1564,8 @@
|
||||
/pair_smd_ulsph.h
|
||||
/pair_srp.cpp
|
||||
/pair_srp.h
|
||||
/pair_srp_react.cpp
|
||||
/pair_srp_react.h
|
||||
/pair_thole.cpp
|
||||
/pair_thole.h
|
||||
/pair_buck_mdf.cpp
|
||||
|
||||
@ -1,39 +0,0 @@
|
||||
This package implements 4 commands which can be used in a LAMMPS input
|
||||
script:
|
||||
|
||||
pair_style lj/sdk
|
||||
pair_style lj/sdk/coul/long
|
||||
pair_style lj/sdk/coul/msm
|
||||
angle_style sdk
|
||||
|
||||
These styles allow coarse grained MD simulations with the
|
||||
parametrization of Shinoda, DeVane, Klein, Mol Sim, 33, 27 (2007)
|
||||
(SDK), with extensions to simulate ionic liquids, electrolytes,
|
||||
lipids and charged amino acids.
|
||||
|
||||
See the doc pages for these commands for details.
|
||||
|
||||
There are example scripts for using this package in
|
||||
examples/PACKAGES/cgsdk
|
||||
|
||||
This is the second generation implementation reducing the the clutter
|
||||
of the previous version. For many systems with long range
|
||||
electrostatics, it will be faster to use pair_style hybrid/overlay
|
||||
with lj/sdk and coul/long instead of the combined lj/sdk/coul/long
|
||||
style, since the number of charged atom types is usually small.
|
||||
To exploit this property, the use of the kspace_style pppm/cg is
|
||||
recommended over regular pppm.
|
||||
|
||||
The person who created this package is Axel Kohlmeyer at Temple U
|
||||
(akohlmey at gmail.com). Contact him directly if you have questions.
|
||||
|
||||
---------------------------------
|
||||
|
||||
Thanks for contributions, support and testing goes to
|
||||
|
||||
Wataru Shinoda (Nagoya University)
|
||||
Russell DeVane (Procter & Gamble)
|
||||
Michael L. Klein (Temple University, Philadelphia)
|
||||
Balasubramanian Sundaram (JNCASR, Bangalore)
|
||||
|
||||
version: 1.0 / 2017-04-26
|
||||
@ -28,12 +28,12 @@ action () {
|
||||
|
||||
# list of files with optional dependcies
|
||||
|
||||
action angle_sdk.cpp
|
||||
action angle_sdk.h
|
||||
action lj_sdk_common.h
|
||||
action pair_lj_sdk.cpp
|
||||
action pair_lj_sdk.h
|
||||
action pair_lj_sdk_coul_long.cpp pppm.cpp
|
||||
action pair_lj_sdk_coul_long.h pppm.cpp
|
||||
action pair_lj_sdk_coul_msm.cpp msm.cpp
|
||||
action pair_lj_sdk_coul_msm.h msm.cpp
|
||||
action angle_spica.cpp
|
||||
action angle_spica.h
|
||||
action lj_spica_common.h
|
||||
action pair_lj_spica.cpp
|
||||
action pair_lj_spica.h
|
||||
action pair_lj_spica_coul_long.cpp pppm.cpp
|
||||
action pair_lj_spica_coul_long.h pppm.cpp
|
||||
action pair_lj_spica_coul_msm.cpp msm.cpp
|
||||
action pair_lj_spica_coul_msm.h msm.cpp
|
||||
55
src/CG-SPICA/README
Normal file
55
src/CG-SPICA/README
Normal file
@ -0,0 +1,55 @@
|
||||
This package implements 4 commands which can be used in a LAMMPS input
|
||||
script:
|
||||
|
||||
pair_style lj/spica
|
||||
pair_style lj/spica/coul/long
|
||||
pair_style lj/spica/coul/msm
|
||||
angle_style spica
|
||||
|
||||
These styles allow coarse grained MD simulations with the
|
||||
parametrization of the SPICA (formerly called SDK) and the pSPICA
|
||||
force fields, to simulate biological or soft material systems.
|
||||
For details about the force fields using this implementation,
|
||||
see the following papers:
|
||||
SDK - Shinoda, DeVane, Klein, Mol Sim, 33, 27-36 (2007).
|
||||
SPICA - Seo, Shinoda, J Chem Theory Comput, 15, 762-774 (2019).
|
||||
pSPICA - Miyazaki, Okazaki, Shinoda, J Chem Theory Comput, 16, 782-793 (2020).
|
||||
Summary information on these force fields can be found at this web site:
|
||||
https://www.spica-ff.org
|
||||
|
||||
See the doc pages for these commands for details.
|
||||
|
||||
There are example scripts for using this package in
|
||||
examples/PACKAGES/cgspica
|
||||
|
||||
This is the third generation implementation (version 2.0) changing style
|
||||
names and adding a new function type. The following pair and angle styles
|
||||
are available for backward compatibility:
|
||||
pair_style lj/sdk
|
||||
pair_style lj/sdk/coul/long
|
||||
pair_style lj/sdk/coul/msm
|
||||
angle_style sdk
|
||||
|
||||
The second generation implementation (version 1.0) is to reduce the clutter
|
||||
of the previous version. For many systems with long range
|
||||
electrostatics, it will be faster to use pair_style hybrid/overlay
|
||||
with lj/spica and coul/long instead of the combined lj/spica/coul/long
|
||||
style, since the number of charged atom types is usually small.
|
||||
To exploit this property, the use of the kspace_style pppm/cg is
|
||||
recommended over regular pppm.
|
||||
|
||||
Original Author: Axel Kohlmeyer (akohlmey at gmail.com) at Temple U .
|
||||
Maintainers : Yusuke Miyazaki (ymiyazaki93 at gmail.com) and
|
||||
Wataru Shinoda (shinoda at okayama-u.ac.jp) at Okayama U.
|
||||
Contact them if you have questions.
|
||||
|
||||
---------------------------------
|
||||
|
||||
Thanks for contributions, support and testing goes to
|
||||
|
||||
Russell DeVane (Procter & Gamble)
|
||||
Michael L. Klein (Temple University, Philadelphia)
|
||||
Balasubramanian Sundaram (JNCASR, Bangalore)
|
||||
|
||||
version: 1.0 / 2017-04-26
|
||||
version: 2.0 / 2022-07-08
|
||||
@ -16,10 +16,10 @@
|
||||
Contributing author: Axel Kohlmeyer (Temple U)
|
||||
|
||||
Variant of the harmonic angle potential for use with the
|
||||
lj/sdk potential for coarse grained MD simulations.
|
||||
lj/spica potential for coarse grained MD simulations.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "angle_sdk.h"
|
||||
#include "angle_spica.h"
|
||||
|
||||
#include <cmath>
|
||||
#include "atom.h"
|
||||
@ -33,21 +33,21 @@
|
||||
#include "error.h"
|
||||
|
||||
|
||||
#include "lj_sdk_common.h"
|
||||
#include "lj_spica_common.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace MathConst;
|
||||
using namespace LJSDKParms;
|
||||
using namespace LJSPICAParms;
|
||||
|
||||
#define SMALL 0.001
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
AngleSDK::AngleSDK(LAMMPS *lmp) : Angle(lmp) { repflag = 0;}
|
||||
AngleSPICA::AngleSPICA(LAMMPS *lmp) : Angle(lmp) { repflag = 0;}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
AngleSDK::~AngleSDK()
|
||||
AngleSPICA::~AngleSPICA()
|
||||
{
|
||||
if (allocated) {
|
||||
memory->destroy(setflag);
|
||||
@ -61,7 +61,7 @@ AngleSDK::~AngleSDK()
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void AngleSDK::compute(int eflag, int vflag)
|
||||
void AngleSPICA::compute(int eflag, int vflag)
|
||||
{
|
||||
int i1,i2,i3,n,type;
|
||||
double delx1,dely1,delz1,delx2,dely2,delz2,delx3,dely3,delz3;
|
||||
@ -158,6 +158,13 @@ void AngleSDK::compute(int eflag, int vflag)
|
||||
|
||||
f13 = r6inv*(lj1[type1][type3]*r6inv - lj2[type1][type3]);
|
||||
if (eflag) e13 = r6inv*(lj3[type1][type3]*r6inv - lj4[type1][type3]);
|
||||
|
||||
} else if (ljt == LJ12_5) {
|
||||
const double r5inv = r2inv*r2inv*sqrt(r2inv);
|
||||
const double r7inv = r5inv*r2inv;
|
||||
|
||||
f13 = r5inv*(lj1[type1][type3]*r7inv - lj2[type1][type3]);
|
||||
if (eflag) e13 = r5inv*(lj3[type1][type3]*r7inv - lj4[type1][type3]);
|
||||
}
|
||||
|
||||
// make sure energy is 0.0 at the cutoff.
|
||||
@ -217,7 +224,7 @@ void AngleSDK::compute(int eflag, int vflag)
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void AngleSDK::allocate()
|
||||
void AngleSPICA::allocate()
|
||||
{
|
||||
allocated = 1;
|
||||
int n = atom->nangletypes;
|
||||
@ -234,7 +241,7 @@ void AngleSDK::allocate()
|
||||
set coeffs for one or more types
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void AngleSDK::coeff(int narg, char **arg)
|
||||
void AngleSPICA::coeff(int narg, char **arg)
|
||||
{
|
||||
if ((narg < 3) || (narg > 6))
|
||||
error->all(FLERR,"Incorrect args for angle coefficients");
|
||||
@ -278,21 +285,21 @@ void AngleSDK::coeff(int narg, char **arg)
|
||||
error check and initialize all values needed for force computation
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void AngleSDK::init_style()
|
||||
void AngleSPICA::init_style()
|
||||
{
|
||||
|
||||
// make sure we use an SDK pair_style and that we need the 1-3 repulsion
|
||||
// make sure we use an SPICA pair_style and that we need the 1-3 repulsion
|
||||
|
||||
repflag = 0;
|
||||
for (int i = 1; i <= atom->nangletypes; i++)
|
||||
if (repscale[i] > 0.0) repflag = 1;
|
||||
|
||||
// set up pointers to access SDK LJ parameters for 1-3 interactions
|
||||
// set up pointers to access SPICA LJ parameters for 1-3 interactions
|
||||
|
||||
if (repflag) {
|
||||
int itmp;
|
||||
if (force->pair == nullptr)
|
||||
error->all(FLERR,"Angle style SDK requires use of a compatible with Pair style");
|
||||
error->all(FLERR,"Angle style SPICA requires use of a compatible with Pair style");
|
||||
|
||||
lj1 = (double **) force->pair->extract("lj1",itmp);
|
||||
lj2 = (double **) force->pair->extract("lj2",itmp);
|
||||
@ -303,13 +310,13 @@ void AngleSDK::init_style()
|
||||
emin = (double **) force->pair->extract("emin",itmp);
|
||||
|
||||
if (!lj1 || !lj2 || !lj3 || !lj4 || !lj_type || !rminsq || !emin)
|
||||
error->all(FLERR,"Angle style SDK is incompatible with Pair style");
|
||||
error->all(FLERR,"Angle style SPICA is incompatible with Pair style");
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double AngleSDK::equilibrium_angle(int i)
|
||||
double AngleSPICA::equilibrium_angle(int i)
|
||||
{
|
||||
return theta0[i];
|
||||
}
|
||||
@ -318,7 +325,7 @@ double AngleSDK::equilibrium_angle(int i)
|
||||
proc 0 writes out coeffs to restart file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void AngleSDK::write_restart(FILE *fp)
|
||||
void AngleSPICA::write_restart(FILE *fp)
|
||||
{
|
||||
fwrite(&k[1],sizeof(double),atom->nangletypes,fp);
|
||||
fwrite(&theta0[1],sizeof(double),atom->nangletypes,fp);
|
||||
@ -329,7 +336,7 @@ void AngleSDK::write_restart(FILE *fp)
|
||||
proc 0 reads coeffs from restart file, bcasts them
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void AngleSDK::read_restart(FILE *fp)
|
||||
void AngleSPICA::read_restart(FILE *fp)
|
||||
{
|
||||
allocate();
|
||||
|
||||
@ -349,7 +356,7 @@ void AngleSDK::read_restart(FILE *fp)
|
||||
proc 0 writes to data file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void AngleSDK::write_data(FILE *fp)
|
||||
void AngleSPICA::write_data(FILE *fp)
|
||||
{
|
||||
for (int i = 1; i <= atom->nangletypes; i++)
|
||||
fprintf(fp,"%d %g %g\n",i,k[i],theta0[i]/MY_PI*180.0);
|
||||
@ -357,7 +364,7 @@ void AngleSDK::write_data(FILE *fp)
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void AngleSDK::ev_tally13(int i, int j, int nlocal, int newton_bond,
|
||||
void AngleSPICA::ev_tally13(int i, int j, int nlocal, int newton_bond,
|
||||
double evdwl, double fpair,
|
||||
double delx, double dely, double delz)
|
||||
{
|
||||
@ -439,7 +446,7 @@ void AngleSDK::ev_tally13(int i, int j, int nlocal, int newton_bond,
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double AngleSDK::single(int type, int i1, int i2, int i3)
|
||||
double AngleSPICA::single(int type, int i1, int i2, int i3)
|
||||
{
|
||||
double **x = atom->x;
|
||||
|
||||
@ -493,6 +500,12 @@ double AngleSDK::single(int type, int i1, int i2, int i3)
|
||||
const double r6inv = r2inv*r2inv*r2inv;
|
||||
|
||||
e13 = r6inv*(lj3[type1][type3]*r6inv - lj4[type1][type3]);
|
||||
|
||||
} else if (ljt == LJ12_5) {
|
||||
const double r5inv = r2inv*r2inv*sqrt(r2inv);
|
||||
const double r7inv = r5inv*r2inv;
|
||||
|
||||
e13 = r5inv*(lj3[type1][type3]*r7inv - lj4[type1][type3]);
|
||||
}
|
||||
|
||||
// make sure energy is 0.0 at the cutoff.
|
||||
@ -13,21 +13,22 @@
|
||||
|
||||
#ifdef ANGLE_CLASS
|
||||
// clang-format off
|
||||
AngleStyle(sdk,AngleSDK);
|
||||
AngleStyle(spica,AngleSPICA);
|
||||
AngleStyle(sdk,AngleSPICA);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_ANGLE_SDK_H
|
||||
#define LMP_ANGLE_SDK_H
|
||||
#ifndef LMP_ANGLE_SPICA_H
|
||||
#define LMP_ANGLE_SPICA_H
|
||||
|
||||
#include "angle.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class AngleSDK : public Angle {
|
||||
class AngleSPICA : public Angle {
|
||||
public:
|
||||
AngleSDK(class LAMMPS *);
|
||||
~AngleSDK() override;
|
||||
AngleSPICA(class LAMMPS *);
|
||||
~AngleSPICA() override;
|
||||
void compute(int, int) override;
|
||||
void coeff(int, char **) override;
|
||||
void init_style() override;
|
||||
@ -42,7 +43,7 @@ class AngleSDK : public Angle {
|
||||
|
||||
// scaling factor for repulsive 1-3 interaction
|
||||
double *repscale;
|
||||
// parameters from SDK pair style
|
||||
// parameters from SPICA pair style
|
||||
int **lj_type;
|
||||
double **lj1, **lj2, **lj3, **lj4;
|
||||
double **rminsq, **emin;
|
||||
@ -14,20 +14,21 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
Common data for the Shinoda, DeVane, Klein (SDK) coarse grain model
|
||||
Contributing author: Axel Kohlmeyer (Temple U)
|
||||
Contributing author (added LJ12_5) : Yusuke Miyazaki (Okayama U)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef LMP_LJ_SDK_COMMON_H
|
||||
#define LMP_LJ_SDK_COMMON_H
|
||||
#ifndef LMP_LJ_SPICA_COMMON_H
|
||||
#define LMP_LJ_SPICA_COMMON_H
|
||||
|
||||
#include <cstring>
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
namespace LJSDKParms {
|
||||
namespace LJSPICAParms {
|
||||
|
||||
// LJ type flags. list of supported LJ exponent combinations
|
||||
enum { LJ_NOT_SET = 0, LJ9_6, LJ12_4, LJ12_6, NUM_LJ_TYPES };
|
||||
enum { LJ_NOT_SET = 0, LJ9_6, LJ12_4, LJ12_6, LJ12_5, NUM_LJ_TYPES };
|
||||
|
||||
#if defined(LMP_NEED_SDK_FIND_LJ_TYPE)
|
||||
#if defined(LMP_NEED_SPICA_FIND_LJ_TYPE)
|
||||
static int find_lj_type(const char *label, const char *const *const list)
|
||||
{
|
||||
for (int i = 0; i < NUM_LJ_TYPES; ++i)
|
||||
@ -38,11 +39,11 @@ namespace LJSDKParms {
|
||||
#endif
|
||||
|
||||
// clang-format off
|
||||
static const char *const lj_type_list[] = {"none", "lj9_6", "lj12_4", "lj12_6"};
|
||||
static constexpr double lj_prefact[] = {0.0, 6.75, 2.59807621135332, 4.0};
|
||||
static constexpr double lj_pow1[] = {0.0, 9.00, 12.0, 12.0};
|
||||
static constexpr double lj_pow2[] = {0.0, 6.00, 4.0, 6.0};
|
||||
static const char *const lj_type_list[] = {"none", "lj9_6", "lj12_4", "lj12_6", "lj12_5"};
|
||||
static constexpr double lj_prefact[] = {0.0, 6.75, 2.59807621135332, 4.0, 3.20377984125109};
|
||||
static constexpr double lj_pow1[] = {0.0, 9.00, 12.0, 12.0, 12.0};
|
||||
static constexpr double lj_pow2[] = {0.0, 6.00, 4.0, 6.0, 5.0};
|
||||
// clang-format on
|
||||
} // namespace LJSDKParms
|
||||
} // namespace LJSPICAParms
|
||||
} // namespace LAMMPS_NS
|
||||
#endif
|
||||
@ -17,7 +17,7 @@
|
||||
This style is a simplified re-implementation of the CG/CMM pair style
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "pair_lj_sdk.h"
|
||||
#include "pair_lj_spica.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
@ -29,15 +29,15 @@
|
||||
#include "error.h"
|
||||
|
||||
|
||||
#define LMP_NEED_SDK_FIND_LJ_TYPE 1
|
||||
#include "lj_sdk_common.h"
|
||||
#define LMP_NEED_SPICA_FIND_LJ_TYPE 1
|
||||
#include "lj_spica_common.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace LJSDKParms;
|
||||
using namespace LJSPICAParms;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
PairLJSDK::PairLJSDK(LAMMPS *lmp) : Pair(lmp)
|
||||
PairLJSPICA::PairLJSPICA(LAMMPS *lmp) : Pair(lmp)
|
||||
{
|
||||
respa_enable = 0;
|
||||
single_enable = 1;
|
||||
@ -46,7 +46,7 @@ PairLJSDK::PairLJSDK(LAMMPS *lmp) : Pair(lmp)
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
PairLJSDK::~PairLJSDK()
|
||||
PairLJSPICA::~PairLJSPICA()
|
||||
{
|
||||
if (copymode) return;
|
||||
|
||||
@ -73,7 +73,7 @@ PairLJSDK::~PairLJSDK()
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairLJSDK::compute(int eflag, int vflag)
|
||||
void PairLJSPICA::compute(int eflag, int vflag)
|
||||
{
|
||||
ev_init(eflag,vflag);
|
||||
|
||||
@ -96,7 +96,7 @@ void PairLJSDK::compute(int eflag, int vflag)
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template <int EVFLAG, int EFLAG, int NEWTON_PAIR>
|
||||
void PairLJSDK::eval()
|
||||
void PairLJSPICA::eval()
|
||||
{
|
||||
int i,j,ii,jj,jtype;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair;
|
||||
@ -170,6 +170,16 @@ void PairLJSDK::eval()
|
||||
if (EFLAG)
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r6inv
|
||||
- lj4[itype][jtype]) - offset[itype][jtype];
|
||||
|
||||
} else if (ljt == LJ12_5) {
|
||||
const double r5inv = r2inv*r2inv*sqrt(r2inv);
|
||||
const double r7inv = r5inv*r2inv;
|
||||
forcelj = r5inv*(lj1[itype][jtype]*r7inv
|
||||
- lj2[itype][jtype]);
|
||||
if (EFLAG)
|
||||
evdwl = r5inv*(lj3[itype][jtype]*r7inv
|
||||
- lj4[itype][jtype]) - offset[itype][jtype];
|
||||
|
||||
} else continue;
|
||||
|
||||
fpair = factor_lj*forcelj*r2inv;
|
||||
@ -198,7 +208,7 @@ void PairLJSDK::eval()
|
||||
allocate all arrays
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLJSDK::allocate()
|
||||
void PairLJSPICA::allocate()
|
||||
{
|
||||
allocated = 1;
|
||||
int n = atom->ntypes;
|
||||
@ -233,7 +243,7 @@ void PairLJSDK::allocate()
|
||||
global settings
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLJSDK::settings(int narg, char **arg)
|
||||
void PairLJSPICA::settings(int narg, char **arg)
|
||||
{
|
||||
if (narg != 1) error->all(FLERR,"Illegal pair_style command");
|
||||
|
||||
@ -253,7 +263,7 @@ void PairLJSDK::settings(int narg, char **arg)
|
||||
set coeffs for one or more type pairs
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLJSDK::coeff(int narg, char **arg)
|
||||
void PairLJSPICA::coeff(int narg, char **arg)
|
||||
{
|
||||
if (narg < 5 || narg > 6) error->all(FLERR,"Incorrect args for pair coefficients");
|
||||
if (!allocated) allocate();
|
||||
@ -291,10 +301,10 @@ void PairLJSDK::coeff(int narg, char **arg)
|
||||
init for one type pair i,j and corresponding j,i
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
double PairLJSDK::init_one(int i, int j)
|
||||
double PairLJSPICA::init_one(int i, int j)
|
||||
{
|
||||
if (setflag[i][j] == 0)
|
||||
error->all(FLERR,"No mixing support for lj/sdk. "
|
||||
error->all(FLERR,"No mixing support for lj/spica. "
|
||||
"Coefficients for all pairs need to be set explicitly.");
|
||||
|
||||
const int ljt = lj_type[i][j];
|
||||
@ -321,7 +331,7 @@ double PairLJSDK::init_one(int i, int j)
|
||||
offset[j][i] = offset[i][j];
|
||||
lj_type[j][i] = lj_type[i][j];
|
||||
|
||||
// compute derived parameters for SDK angle potential
|
||||
// compute derived parameters for SPICA angle potential
|
||||
|
||||
const double eps = epsilon[i][j];
|
||||
const double sig = sigma[i][j];
|
||||
@ -338,7 +348,7 @@ double PairLJSDK::init_one(int i, int j)
|
||||
// count total # of atoms of type I and J via Allreduce
|
||||
|
||||
if (tail_flag)
|
||||
error->all(FLERR,"Tail flag not supported by lj/sdk pair style");
|
||||
error->all(FLERR,"Tail flag not supported by lj/spica pair style");
|
||||
|
||||
return cut[i][j];
|
||||
}
|
||||
@ -347,7 +357,7 @@ double PairLJSDK::init_one(int i, int j)
|
||||
proc 0 writes to restart file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLJSDK::write_restart(FILE *fp)
|
||||
void PairLJSPICA::write_restart(FILE *fp)
|
||||
{
|
||||
write_restart_settings(fp);
|
||||
|
||||
@ -368,7 +378,7 @@ void PairLJSDK::write_restart(FILE *fp)
|
||||
proc 0 reads from restart file, bcasts
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLJSDK::read_restart(FILE *fp)
|
||||
void PairLJSPICA::read_restart(FILE *fp)
|
||||
{
|
||||
read_restart_settings(fp);
|
||||
allocate();
|
||||
@ -398,7 +408,7 @@ void PairLJSDK::read_restart(FILE *fp)
|
||||
proc 0 writes to restart file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLJSDK::write_restart_settings(FILE *fp)
|
||||
void PairLJSPICA::write_restart_settings(FILE *fp)
|
||||
{
|
||||
fwrite(&cut_global,sizeof(double),1,fp);
|
||||
fwrite(&offset_flag,sizeof(int),1,fp);
|
||||
@ -410,7 +420,7 @@ void PairLJSDK::write_restart_settings(FILE *fp)
|
||||
proc 0 reads from restart file, bcasts
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLJSDK::read_restart_settings(FILE *fp)
|
||||
void PairLJSPICA::read_restart_settings(FILE *fp)
|
||||
{
|
||||
int me = comm->me;
|
||||
if (me == 0) {
|
||||
@ -426,12 +436,12 @@ void PairLJSDK::read_restart_settings(FILE *fp)
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
lj/sdk does not support per atom type output with mixing
|
||||
lj/spica does not support per atom type output with mixing
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLJSDK::write_data(FILE *)
|
||||
void PairLJSPICA::write_data(FILE *)
|
||||
{
|
||||
error->one(FLERR, "Pair style lj/sdk requires using "
|
||||
error->one(FLERR, "Pair style lj/spica requires using "
|
||||
"write_data with the 'pair ij' option");
|
||||
}
|
||||
|
||||
@ -439,7 +449,7 @@ void PairLJSDK::write_data(FILE *)
|
||||
proc 0 writes all pairs to data file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLJSDK::write_data_all(FILE *fp)
|
||||
void PairLJSPICA::write_data_all(FILE *fp)
|
||||
{
|
||||
for (int i = 1; i <= atom->ntypes; i++)
|
||||
for (int j = i; j <= atom->ntypes; j++)
|
||||
@ -449,7 +459,7 @@ void PairLJSDK::write_data_all(FILE *fp)
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double PairLJSDK::single(int, int, int itype, int jtype, double rsq,
|
||||
double PairLJSPICA::single(int, int, int itype, int jtype, double rsq,
|
||||
double, double factor_lj, double &fforce)
|
||||
{
|
||||
|
||||
@ -475,7 +485,7 @@ double PairLJSDK::single(int, int, int itype, int jtype, double rsq,
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void *PairLJSDK::extract(const char *str, int &dim)
|
||||
void *PairLJSPICA::extract(const char *str, int &dim)
|
||||
{
|
||||
dim = 2;
|
||||
if (strcmp(str,"epsilon") == 0) return (void *) epsilon;
|
||||
@ -492,7 +502,7 @@ void *PairLJSDK::extract(const char *str, int &dim)
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double PairLJSDK::memory_usage()
|
||||
double PairLJSPICA::memory_usage()
|
||||
{
|
||||
double bytes = Pair::memory_usage();
|
||||
int n = atom->ntypes;
|
||||
@ -17,21 +17,22 @@
|
||||
|
||||
#ifdef PAIR_CLASS
|
||||
// clang-format off
|
||||
PairStyle(lj/sdk,PairLJSDK);
|
||||
PairStyle(lj/spica,PairLJSPICA);
|
||||
PairStyle(lj/sdk,PairLJSPICA);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_PAIR_LJ_SDK_H
|
||||
#define LMP_PAIR_LJ_SDK_H
|
||||
#ifndef LMP_PAIR_LJ_SPICA_H
|
||||
#define LMP_PAIR_LJ_SPICA_H
|
||||
|
||||
#include "pair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class PairLJSDK : public Pair {
|
||||
class PairLJSPICA : public Pair {
|
||||
public:
|
||||
PairLJSDK(LAMMPS *);
|
||||
~PairLJSDK() override;
|
||||
PairLJSPICA(LAMMPS *);
|
||||
~PairLJSPICA() override;
|
||||
void compute(int, int) override;
|
||||
void settings(int, char **) override;
|
||||
void coeff(int, char **) override;
|
||||
@ -54,7 +55,7 @@ class PairLJSDK : public Pair {
|
||||
double **lj1, **lj2, **lj3, **lj4, **offset;
|
||||
|
||||
// cutoff and offset for minimum of LJ potential
|
||||
// to be used in SDK angle potential, which
|
||||
// to be used in SPICA angle potential, which
|
||||
// uses only the repulsive part of the potential
|
||||
|
||||
double **rminsq, **emin;
|
||||
@ -16,7 +16,7 @@
|
||||
This style is a simplified re-implementation of the CG/CMM pair style
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "pair_lj_sdk_coul_long.h"
|
||||
#include "pair_lj_spica_coul_long.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
@ -30,11 +30,11 @@
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
|
||||
#define LMP_NEED_SDK_FIND_LJ_TYPE 1
|
||||
#include "lj_sdk_common.h"
|
||||
#define LMP_NEED_SPICA_FIND_LJ_TYPE 1
|
||||
#include "lj_spica_common.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace LJSDKParms;
|
||||
using namespace LJSPICAParms;
|
||||
|
||||
#define EWALD_F 1.12837917
|
||||
#define EWALD_P 0.3275911
|
||||
@ -46,7 +46,7 @@ using namespace LJSDKParms;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
PairLJSDKCoulLong::PairLJSDKCoulLong(LAMMPS *lmp) : Pair(lmp)
|
||||
PairLJSPICACoulLong::PairLJSPICACoulLong(LAMMPS *lmp) : Pair(lmp)
|
||||
{
|
||||
ewaldflag = pppmflag = 1;
|
||||
respa_enable = 0;
|
||||
@ -56,7 +56,7 @@ PairLJSDKCoulLong::PairLJSDKCoulLong(LAMMPS *lmp) : Pair(lmp)
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
PairLJSDKCoulLong::~PairLJSDKCoulLong()
|
||||
PairLJSPICACoulLong::~PairLJSPICACoulLong()
|
||||
{
|
||||
if (allocated) {
|
||||
memory->destroy(setflag);
|
||||
@ -83,7 +83,7 @@ PairLJSDKCoulLong::~PairLJSDKCoulLong()
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairLJSDKCoulLong::compute(int eflag, int vflag)
|
||||
void PairLJSPICACoulLong::compute(int eflag, int vflag)
|
||||
{
|
||||
ev_init(eflag, vflag);
|
||||
|
||||
@ -111,7 +111,7 @@ void PairLJSDKCoulLong::compute(int eflag, int vflag)
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template <int EVFLAG, int EFLAG, int NEWTON_PAIR> void PairLJSDKCoulLong::eval()
|
||||
template <int EVFLAG, int EFLAG, int NEWTON_PAIR> void PairLJSPICACoulLong::eval()
|
||||
{
|
||||
int i, ii, j, jj, jtype, itable;
|
||||
double qtmp, xtmp, ytmp, ztmp, delx, dely, delz, evdwl, ecoul, fpair;
|
||||
@ -223,6 +223,14 @@ template <int EVFLAG, int EFLAG, int NEWTON_PAIR> void PairLJSDKCoulLong::eval()
|
||||
if (EFLAG)
|
||||
evdwl =
|
||||
r6inv * (lj3[itype][jtype] * r6inv - lj4[itype][jtype]) - offset[itype][jtype];
|
||||
|
||||
} else if (ljt == LJ12_5) {
|
||||
const double r5inv = r2inv * r2inv * sqrt(r2inv);
|
||||
const double r7inv = r5inv * r2inv;
|
||||
forcelj = r5inv * (lj1[itype][jtype] * r7inv - lj2[itype][jtype]);
|
||||
if (EFLAG)
|
||||
evdwl =
|
||||
r5inv * (lj3[itype][jtype] * r7inv - lj4[itype][jtype]) - offset[itype][jtype];
|
||||
}
|
||||
forcelj *= factor_lj;
|
||||
if (EFLAG) evdwl *= factor_lj;
|
||||
@ -252,7 +260,7 @@ template <int EVFLAG, int EFLAG, int NEWTON_PAIR> void PairLJSDKCoulLong::eval()
|
||||
allocate all arrays
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLJSDKCoulLong::allocate()
|
||||
void PairLJSPICACoulLong::allocate()
|
||||
{
|
||||
allocated = 1;
|
||||
int np1 = atom->ntypes + 1;
|
||||
@ -288,7 +296,7 @@ void PairLJSDKCoulLong::allocate()
|
||||
global settings
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLJSDKCoulLong::settings(int narg, char **arg)
|
||||
void PairLJSPICACoulLong::settings(int narg, char **arg)
|
||||
{
|
||||
if (narg < 1 || narg > 2) error->all(FLERR, "Illegal pair_style command");
|
||||
|
||||
@ -312,7 +320,7 @@ void PairLJSDKCoulLong::settings(int narg, char **arg)
|
||||
set coeffs for one or more type pairs
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLJSDKCoulLong::coeff(int narg, char **arg)
|
||||
void PairLJSPICACoulLong::coeff(int narg, char **arg)
|
||||
{
|
||||
if (narg < 5 || narg > 6) error->all(FLERR, "Incorrect args for pair coefficients");
|
||||
if (!allocated) allocate();
|
||||
@ -349,7 +357,7 @@ void PairLJSDKCoulLong::coeff(int narg, char **arg)
|
||||
init specific to this pair style
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLJSDKCoulLong::init_style()
|
||||
void PairLJSPICACoulLong::init_style()
|
||||
{
|
||||
if (!atom->q_flag) error->all(FLERR, "Pair style lj/cut/coul/long requires atom attribute q");
|
||||
|
||||
@ -371,11 +379,11 @@ void PairLJSDKCoulLong::init_style()
|
||||
init for one type pair i,j and corresponding j,i
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
double PairLJSDKCoulLong::init_one(int i, int j)
|
||||
double PairLJSPICACoulLong::init_one(int i, int j)
|
||||
{
|
||||
if (setflag[i][j] == 0)
|
||||
error->all(FLERR,
|
||||
"No mixing support for lj/sdk/coul/long. "
|
||||
"No mixing support for lj/spica/coul/long. "
|
||||
"Coefficients for all pairs need to be set explicitly.");
|
||||
|
||||
const int ljt = lj_type[i][j];
|
||||
@ -406,7 +414,7 @@ double PairLJSDKCoulLong::init_one(int i, int j)
|
||||
offset[j][i] = offset[i][j];
|
||||
lj_type[j][i] = lj_type[i][j];
|
||||
|
||||
// compute LJ derived parameters for SDK angle potential (LJ only!)
|
||||
// compute LJ derived parameters for SPICA angle potential (LJ only!)
|
||||
|
||||
const double eps = epsilon[i][j];
|
||||
const double sig = sigma[i][j];
|
||||
@ -422,7 +430,7 @@ double PairLJSDKCoulLong::init_one(int i, int j)
|
||||
// compute I,J contribution to long-range tail correction
|
||||
// count total # of atoms of type I and J via Allreduce
|
||||
|
||||
if (tail_flag) error->all(FLERR, "Tail flag not supported by lj/sdk/coul/long pair style");
|
||||
if (tail_flag) error->all(FLERR, "Tail flag not supported by lj/spica/coul/long pair style");
|
||||
|
||||
return cut;
|
||||
}
|
||||
@ -431,7 +439,7 @@ double PairLJSDKCoulLong::init_one(int i, int j)
|
||||
proc 0 writes to restart file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLJSDKCoulLong::write_restart(FILE *fp)
|
||||
void PairLJSPICACoulLong::write_restart(FILE *fp)
|
||||
{
|
||||
write_restart_settings(fp);
|
||||
|
||||
@ -452,7 +460,7 @@ void PairLJSDKCoulLong::write_restart(FILE *fp)
|
||||
proc 0 reads from restart file, bcasts
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLJSDKCoulLong::read_restart(FILE *fp)
|
||||
void PairLJSPICACoulLong::read_restart(FILE *fp)
|
||||
{
|
||||
read_restart_settings(fp);
|
||||
allocate();
|
||||
@ -482,7 +490,7 @@ void PairLJSDKCoulLong::read_restart(FILE *fp)
|
||||
proc 0 writes to restart file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLJSDKCoulLong::write_restart_settings(FILE *fp)
|
||||
void PairLJSPICACoulLong::write_restart_settings(FILE *fp)
|
||||
{
|
||||
fwrite(&cut_lj_global, sizeof(double), 1, fp);
|
||||
fwrite(&cut_coul, sizeof(double), 1, fp);
|
||||
@ -497,7 +505,7 @@ void PairLJSDKCoulLong::write_restart_settings(FILE *fp)
|
||||
proc 0 reads from restart file, bcasts
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLJSDKCoulLong::read_restart_settings(FILE *fp)
|
||||
void PairLJSPICACoulLong::read_restart_settings(FILE *fp)
|
||||
{
|
||||
if (comm->me == 0) {
|
||||
utils::sfread(FLERR, &cut_lj_global, sizeof(double), 1, fp, nullptr, error);
|
||||
@ -518,13 +526,13 @@ void PairLJSDKCoulLong::read_restart_settings(FILE *fp)
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
lj/sdk does not support per atom type output with mixing
|
||||
lj/spica does not support per atom type output with mixing
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLJSDKCoulLong::write_data(FILE *)
|
||||
void PairLJSPICACoulLong::write_data(FILE *)
|
||||
{
|
||||
error->one(FLERR,
|
||||
"Pair style lj/sdk/coul/* requires using "
|
||||
"Pair style lj/spica/coul/* requires using "
|
||||
"write_data with the 'pair ij' option");
|
||||
}
|
||||
|
||||
@ -532,7 +540,7 @@ void PairLJSDKCoulLong::write_data(FILE *)
|
||||
proc 0 writes all pairs to data file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLJSDKCoulLong::write_data_all(FILE *fp)
|
||||
void PairLJSPICACoulLong::write_data_all(FILE *fp)
|
||||
{
|
||||
for (int i = 1; i <= atom->ntypes; i++)
|
||||
for (int j = i; j <= atom->ntypes; j++)
|
||||
@ -542,7 +550,7 @@ void PairLJSDKCoulLong::write_data_all(FILE *fp)
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double PairLJSDKCoulLong::single(int i, int j, int itype, int jtype, double rsq, double factor_coul,
|
||||
double PairLJSPICACoulLong::single(int i, int j, int itype, int jtype, double rsq, double factor_coul,
|
||||
double factor_lj, double &fforce)
|
||||
{
|
||||
double r2inv, r, grij, expm2, t, erfc, prefactor;
|
||||
@ -605,6 +613,12 @@ double PairLJSDKCoulLong::single(int i, int j, int itype, int jtype, double rsq,
|
||||
const double r6inv = r2inv * r2inv * r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype] * r6inv - lj2[itype][jtype]);
|
||||
philj = r6inv * (lj3[itype][jtype] * r6inv - lj4[itype][jtype]) - offset[itype][jtype];
|
||||
|
||||
} else if (ljt == LJ12_5) {
|
||||
const double r5inv = r2inv * r2inv * sqrt(r2inv);
|
||||
const double r7inv = r5inv * r2inv;
|
||||
forcelj = r5inv * (lj1[itype][jtype] * r7inv - lj2[itype][jtype]);
|
||||
philj = r5inv * (lj3[itype][jtype] * r7inv - lj4[itype][jtype]) - offset[itype][jtype];
|
||||
}
|
||||
forcelj *= factor_lj;
|
||||
philj *= factor_lj;
|
||||
@ -617,7 +631,7 @@ double PairLJSDKCoulLong::single(int i, int j, int itype, int jtype, double rsq,
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void *PairLJSDKCoulLong::extract(const char *str, int &dim)
|
||||
void *PairLJSPICACoulLong::extract(const char *str, int &dim)
|
||||
{
|
||||
dim = 2;
|
||||
if (strcmp(str, "epsilon") == 0) return (void *) epsilon;
|
||||
@ -637,7 +651,7 @@ void *PairLJSDKCoulLong::extract(const char *str, int &dim)
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double PairLJSDKCoulLong::memory_usage()
|
||||
double PairLJSPICACoulLong::memory_usage()
|
||||
{
|
||||
double bytes = Pair::memory_usage();
|
||||
int n = atom->ntypes;
|
||||
@ -17,21 +17,22 @@
|
||||
|
||||
#ifdef PAIR_CLASS
|
||||
// clang-format off
|
||||
PairStyle(lj/sdk/coul/long,PairLJSDKCoulLong);
|
||||
PairStyle(lj/spica/coul/long,PairLJSPICACoulLong);
|
||||
PairStyle(lj/sdk/coul/long,PairLJSPICACoulLong);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_PAIR_LJ_SDK_COUL_LONG_H
|
||||
#define LMP_PAIR_LJ_SDK_COUL_LONG_H
|
||||
#ifndef LMP_PAIR_LJ_SPICA_COUL_LONG_H
|
||||
#define LMP_PAIR_LJ_SPICA_COUL_LONG_H
|
||||
|
||||
#include "pair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class PairLJSDKCoulLong : public Pair {
|
||||
class PairLJSPICACoulLong : public Pair {
|
||||
public:
|
||||
PairLJSDKCoulLong(class LAMMPS *);
|
||||
~PairLJSDKCoulLong() override;
|
||||
PairLJSPICACoulLong(class LAMMPS *);
|
||||
~PairLJSPICACoulLong() override;
|
||||
void compute(int, int) override;
|
||||
void settings(int, char **) override;
|
||||
void coeff(int, char **) override;
|
||||
@ -55,7 +56,7 @@ class PairLJSDKCoulLong : public Pair {
|
||||
int **lj_type;
|
||||
|
||||
// cutoff and offset for minimum of LJ potential
|
||||
// to be used in SDK angle potential, which
|
||||
// to be used in SPICA angle potential, which
|
||||
// uses only the repulsive part of the potential
|
||||
|
||||
double **rminsq, **emin;
|
||||
@ -17,7 +17,7 @@
|
||||
This style is a simplified re-implementation of the CG/CMM pair style
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "pair_lj_sdk_coul_msm.h"
|
||||
#include "pair_lj_spica_coul_msm.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "error.h"
|
||||
@ -28,14 +28,14 @@
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
|
||||
#include "lj_sdk_common.h"
|
||||
#include "lj_spica_common.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace LJSDKParms;
|
||||
using namespace LJSPICAParms;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
PairLJSDKCoulMSM::PairLJSDKCoulMSM(LAMMPS *lmp) : PairLJSDKCoulLong(lmp)
|
||||
PairLJSPICACoulMSM::PairLJSPICACoulMSM(LAMMPS *lmp) : PairLJSPICACoulLong(lmp)
|
||||
{
|
||||
ewaldflag = pppmflag = 0;
|
||||
msmflag = 1;
|
||||
@ -45,7 +45,7 @@ PairLJSDKCoulMSM::PairLJSDKCoulMSM(LAMMPS *lmp) : PairLJSDKCoulLong(lmp)
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairLJSDKCoulMSM::compute(int eflag, int vflag)
|
||||
void PairLJSPICACoulMSM::compute(int eflag, int vflag)
|
||||
{
|
||||
if (force->kspace->scalar_pressure_flag)
|
||||
error->all(FLERR,"Must use 'kspace_modify pressure/scalar no' with Pair style");
|
||||
@ -71,7 +71,7 @@ void PairLJSDKCoulMSM::compute(int eflag, int vflag)
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template <int EVFLAG, int EFLAG, int NEWTON_PAIR>
|
||||
void PairLJSDKCoulMSM::eval_msm()
|
||||
void PairLJSPICACoulMSM::eval_msm()
|
||||
{
|
||||
int i,ii,j,jj,jtype,itable;
|
||||
double qtmp,xtmp,ytmp,ztmp,delx,dely,delz,evdwl,ecoul,fpair;
|
||||
@ -187,6 +187,15 @@ void PairLJSDKCoulMSM::eval_msm()
|
||||
if (EFLAG)
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r6inv
|
||||
- lj4[itype][jtype]) - offset[itype][jtype];
|
||||
|
||||
} else if (ljt == LJ12_5) {
|
||||
const double r5inv = r2inv*r2inv*sqrt(r2inv);
|
||||
const double r7inv = r5inv*r2inv;
|
||||
forcelj = r5inv*(lj1[itype][jtype]*r7inv
|
||||
- lj2[itype][jtype]);
|
||||
if (EFLAG)
|
||||
evdwl = r5inv*(lj3[itype][jtype]*r7inv
|
||||
- lj4[itype][jtype]) - offset[itype][jtype];
|
||||
}
|
||||
forcelj *= factor_lj;
|
||||
if (EFLAG) evdwl *= factor_lj;
|
||||
@ -215,7 +224,7 @@ void PairLJSDKCoulMSM::eval_msm()
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double PairLJSDKCoulMSM::single(int i, int j, int itype, int jtype,
|
||||
double PairLJSPICACoulMSM::single(int i, int j, int itype, int jtype,
|
||||
double rsq,
|
||||
double factor_coul, double factor_lj,
|
||||
double &fforce)
|
||||
@ -283,6 +292,14 @@ double PairLJSDKCoulMSM::single(int i, int j, int itype, int jtype,
|
||||
- lj2[itype][jtype]);
|
||||
philj = r6inv*(lj3[itype][jtype]*r6inv
|
||||
- lj4[itype][jtype]) - offset[itype][jtype];
|
||||
|
||||
} else if (ljt == LJ12_5) {
|
||||
const double r5inv = r2inv*r2inv*sqrt(r2inv);
|
||||
const double r7inv = r5inv*r2inv;
|
||||
forcelj = r5inv*(lj1[itype][jtype]*r7inv
|
||||
- lj2[itype][jtype]);
|
||||
philj = r5inv*(lj3[itype][jtype]*r7inv
|
||||
- lj4[itype][jtype]) - offset[itype][jtype];
|
||||
}
|
||||
forcelj *= factor_lj;
|
||||
philj *= factor_lj;
|
||||
@ -295,7 +312,7 @@ double PairLJSDKCoulMSM::single(int i, int j, int itype, int jtype,
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void *PairLJSDKCoulMSM::extract(const char *str, int &dim)
|
||||
void *PairLJSPICACoulMSM::extract(const char *str, int &dim)
|
||||
{
|
||||
dim = 2;
|
||||
if (strcmp(str,"epsilon") == 0) return (void *) epsilon;
|
||||
@ -17,20 +17,21 @@
|
||||
|
||||
#ifdef PAIR_CLASS
|
||||
// clang-format off
|
||||
PairStyle(lj/sdk/coul/msm,PairLJSDKCoulMSM);
|
||||
PairStyle(lj/spica/coul/msm,PairLJSPICACoulMSM);
|
||||
PairStyle(lj/sdk/coul/msm,PairLJSPICACoulMSM);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_PAIR_LJ_SDK_COUL_MSM_H
|
||||
#define LMP_PAIR_LJ_SDK_COUL_MSM_H
|
||||
#ifndef LMP_PAIR_LJ_SPICA_COUL_MSM_H
|
||||
#define LMP_PAIR_LJ_SPICA_COUL_MSM_H
|
||||
|
||||
#include "pair_lj_sdk_coul_long.h"
|
||||
#include "pair_lj_spica_coul_long.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class PairLJSDKCoulMSM : public PairLJSDKCoulLong {
|
||||
class PairLJSPICACoulMSM : public PairLJSPICACoulLong {
|
||||
public:
|
||||
PairLJSDKCoulMSM(class LAMMPS *);
|
||||
PairLJSPICACoulMSM(class LAMMPS *);
|
||||
void compute(int, int) override;
|
||||
double single(int, int, int, int, double, double, double, double &) override;
|
||||
void *extract(const char *, int &) override;
|
||||
@ -106,7 +106,7 @@ if (test $1 = "INTERLAYER") then
|
||||
fi
|
||||
|
||||
if (test $1 = "KSPACE") then
|
||||
depend CG-SDK
|
||||
depend CG-SPICA
|
||||
depend CORESHELL
|
||||
depend DIELECTRIC
|
||||
depend GPU
|
||||
@ -128,6 +128,10 @@ if (test $1 = "MANYBODY") then
|
||||
depend OPENMP
|
||||
fi
|
||||
|
||||
if (test $1 = "MC") then
|
||||
depend MISC
|
||||
fi
|
||||
|
||||
if (test $1 = "MEAM") then
|
||||
depend KOKKOS
|
||||
fi
|
||||
@ -168,7 +172,7 @@ if (test $1 = "ML-SNAP") then
|
||||
depend ML-IAP
|
||||
fi
|
||||
|
||||
if (test $1 = "CG-SDK") then
|
||||
if (test $1 = "CG-SPICA") then
|
||||
depend GPU
|
||||
depend KOKKOS
|
||||
depend OPENMP
|
||||
|
||||
@ -121,10 +121,10 @@ action pair_lj_expand_coul_long_gpu.cpp pair_lj_expand_coul_long.cpp
|
||||
action pair_lj_expand_coul_long_gpu.h pair_lj_expand_coul_long.cpp
|
||||
action pair_lj_gromacs_gpu.cpp pair_lj_gromacs.cpp
|
||||
action pair_lj_gromacs_gpu.h pair_lj_gromacs.h
|
||||
action pair_lj_sdk_coul_long_gpu.cpp pair_lj_sdk_coul_long.cpp
|
||||
action pair_lj_sdk_coul_long_gpu.h pair_lj_sdk_coul_long.cpp
|
||||
action pair_lj_sdk_gpu.cpp pair_lj_sdk.cpp
|
||||
action pair_lj_sdk_gpu.h pair_lj_sdk.cpp
|
||||
action pair_lj_spica_coul_long_gpu.cpp pair_lj_spica_coul_long.cpp
|
||||
action pair_lj_spica_coul_long_gpu.h pair_lj_spica_coul_long.cpp
|
||||
action pair_lj_spica_gpu.cpp pair_lj_spica.cpp
|
||||
action pair_lj_spica_gpu.h pair_lj_spica.cpp
|
||||
action pair_mie_cut_gpu.cpp pair_mie_cut.cpp
|
||||
action pair_mie_cut_gpu.h pair_mie_cut.h
|
||||
action pair_morse_gpu.cpp
|
||||
|
||||
@ -275,7 +275,7 @@ void FixGPU::init()
|
||||
// also disallow GPU neighbor lists for hybrid styles
|
||||
|
||||
if (force->pair_match("^hybrid",0) != nullptr) {
|
||||
auto hybrid = dynamic_cast<PairHybrid *>( force->pair);
|
||||
auto hybrid = dynamic_cast<PairHybrid *>(force->pair);
|
||||
for (int i = 0; i < hybrid->nstyles; i++)
|
||||
if (!utils::strmatch(hybrid->keywords[i],"/gpu$"))
|
||||
force->pair->no_virial_fdotr_compute = 1;
|
||||
|
||||
@ -77,7 +77,7 @@ void FixNHGPU::remap()
|
||||
double oldlo,oldhi;
|
||||
double expfac;
|
||||
|
||||
auto * _noalias const x = (dbl3_t *) atom->x[0];
|
||||
dbl3_t * _noalias const x = (dbl3_t *) atom->x[0];
|
||||
int *mask = atom->mask;
|
||||
int nlocal = atom->nlocal;
|
||||
double *h = domain->h;
|
||||
@ -414,7 +414,7 @@ void FixNHGPU::nh_v_press()
|
||||
return;
|
||||
}
|
||||
|
||||
auto * _noalias const v = (dbl3_t *)atom->v[0];
|
||||
dbl3_t * _noalias const v = (dbl3_t *)atom->v[0];
|
||||
int *mask = atom->mask;
|
||||
int nlocal = atom->nlocal;
|
||||
if (igroup == atom->firstgroup) nlocal = atom->nfirst;
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
Contributing author: Mike Brown (SNL)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "pair_lj_sdk_coul_long_gpu.h"
|
||||
#include "pair_lj_spica_coul_long_gpu.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "domain.h"
|
||||
@ -41,34 +41,34 @@ using namespace LAMMPS_NS;
|
||||
|
||||
// External functions from cuda library for atom decomposition
|
||||
|
||||
int sdkl_gpu_init(const int ntypes, double **cutsq, int **lj_type, double **host_lj1,
|
||||
int spical_gpu_init(const int ntypes, double **cutsq, int **lj_type, double **host_lj1,
|
||||
double **host_lj2, double **host_lj3, double **host_lj4, double **offset,
|
||||
double *special_lj, const int nlocal, const int nall, const int max_nbors,
|
||||
const int maxspecial, const double cell_size, int &gpu_mode, FILE *screen,
|
||||
double **host_cut_ljsq, double host_cut_coulsq, double *host_special_coul,
|
||||
const double qqrd2e, const double g_ewald);
|
||||
void sdkl_gpu_clear();
|
||||
int **sdkl_gpu_compute_n(const int ago, const int inum, const int nall, double **host_x,
|
||||
void spical_gpu_clear();
|
||||
int **spical_gpu_compute_n(const int ago, const int inum, const int nall, double **host_x,
|
||||
int *host_type, double *sublo, double *subhi, tagint *tag, int **nspecial,
|
||||
tagint **special, const bool eflag, const bool vflag, const bool eatom,
|
||||
const bool vatom, int &host_start, int **ilist, int **jnum,
|
||||
const double cpu_time, bool &success, double *host_q, double *boxlo,
|
||||
double *prd);
|
||||
void sdkl_gpu_compute(const int ago, const int inum, const int nall, double **host_x,
|
||||
void spical_gpu_compute(const int ago, const int inum, const int nall, double **host_x,
|
||||
int *host_type, int *ilist, int *numj, int **firstneigh, const bool eflag,
|
||||
const bool vflag, const bool eatom, const bool vatom, int &host_start,
|
||||
const double cpu_time, bool &success, double *host_q, const int nlocal,
|
||||
double *boxlo, double *prd);
|
||||
double sdkl_gpu_bytes();
|
||||
double spical_gpu_bytes();
|
||||
|
||||
#include "lj_sdk_common.h"
|
||||
#include "lj_spica_common.h"
|
||||
|
||||
using namespace LJSDKParms;
|
||||
using namespace LJSPICAParms;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
PairLJSDKCoulLongGPU::PairLJSDKCoulLongGPU(LAMMPS *lmp) :
|
||||
PairLJSDKCoulLong(lmp), gpu_mode(GPU_FORCE)
|
||||
PairLJSPICACoulLongGPU::PairLJSPICACoulLongGPU(LAMMPS *lmp) :
|
||||
PairLJSPICACoulLong(lmp), gpu_mode(GPU_FORCE)
|
||||
{
|
||||
respa_enable = 0;
|
||||
reinitflag = 0;
|
||||
@ -81,14 +81,14 @@ PairLJSDKCoulLongGPU::PairLJSDKCoulLongGPU(LAMMPS *lmp) :
|
||||
free all arrays
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
PairLJSDKCoulLongGPU::~PairLJSDKCoulLongGPU()
|
||||
PairLJSPICACoulLongGPU::~PairLJSPICACoulLongGPU()
|
||||
{
|
||||
sdkl_gpu_clear();
|
||||
spical_gpu_clear();
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairLJSDKCoulLongGPU::compute(int eflag, int vflag)
|
||||
void PairLJSPICACoulLongGPU::compute(int eflag, int vflag)
|
||||
{
|
||||
ev_init(eflag, vflag);
|
||||
|
||||
@ -110,7 +110,7 @@ void PairLJSDKCoulLongGPU::compute(int eflag, int vflag)
|
||||
domain->bbox(domain->sublo_lamda, domain->subhi_lamda, sublo, subhi);
|
||||
}
|
||||
inum = atom->nlocal;
|
||||
firstneigh = sdkl_gpu_compute_n(neighbor->ago, inum, nall, atom->x, atom->type, sublo, subhi,
|
||||
firstneigh = spical_gpu_compute_n(neighbor->ago, inum, nall, atom->x, atom->type, sublo, subhi,
|
||||
atom->tag, atom->nspecial, atom->special, eflag, vflag,
|
||||
eflag_atom, vflag_atom, host_start, &ilist, &numneigh, cpu_time,
|
||||
success, atom->q, domain->boxlo, domain->prd);
|
||||
@ -119,7 +119,7 @@ void PairLJSDKCoulLongGPU::compute(int eflag, int vflag)
|
||||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
sdkl_gpu_compute(neighbor->ago, inum, nall, atom->x, atom->type, ilist, numneigh, firstneigh,
|
||||
spical_gpu_compute(neighbor->ago, inum, nall, atom->x, atom->type, ilist, numneigh, firstneigh,
|
||||
eflag, vflag, eflag_atom, vflag_atom, host_start, cpu_time, success, atom->q,
|
||||
atom->nlocal, domain->boxlo, domain->prd);
|
||||
}
|
||||
@ -142,9 +142,9 @@ void PairLJSDKCoulLongGPU::compute(int eflag, int vflag)
|
||||
init specific to this pair style
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLJSDKCoulLongGPU::init_style()
|
||||
void PairLJSPICACoulLongGPU::init_style()
|
||||
{
|
||||
if (!atom->q_flag) error->all(FLERR, "Pair style lj/sdk/coul/long/gpu requires atom attribute q");
|
||||
if (!atom->q_flag) error->all(FLERR, "Pair style lj/spica/coul/long/gpu requires atom attribute q");
|
||||
|
||||
// Repeat cutsq calculation because done after call to init_style
|
||||
double maxcut = -1.0;
|
||||
@ -177,7 +177,7 @@ void PairLJSDKCoulLongGPU::init_style()
|
||||
if (atom->molecular != Atom::ATOMIC) maxspecial = atom->maxspecial;
|
||||
int mnf = 5e-2 * neighbor->oneatom;
|
||||
int success =
|
||||
sdkl_gpu_init(atom->ntypes + 1, cutsq, lj_type, lj1, lj2, lj3, lj4, offset, force->special_lj,
|
||||
spical_gpu_init(atom->ntypes + 1, cutsq, lj_type, lj1, lj2, lj3, lj4, offset, force->special_lj,
|
||||
atom->nlocal, atom->nlocal + atom->nghost, mnf, maxspecial, cell_size, gpu_mode,
|
||||
screen, cut_ljsq, cut_coulsq, force->special_coul, force->qqrd2e, g_ewald);
|
||||
GPU_EXTRA::check_flag(success, error, world);
|
||||
@ -187,15 +187,15 @@ void PairLJSDKCoulLongGPU::init_style()
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double PairLJSDKCoulLongGPU::memory_usage()
|
||||
double PairLJSPICACoulLongGPU::memory_usage()
|
||||
{
|
||||
double bytes = Pair::memory_usage();
|
||||
return bytes + sdkl_gpu_bytes();
|
||||
return bytes + spical_gpu_bytes();
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
template <int EVFLAG, int EFLAG>
|
||||
void PairLJSDKCoulLongGPU::cpu_compute(int start, int inum, int *ilist, int *numneigh,
|
||||
void PairLJSPICACoulLongGPU::cpu_compute(int start, int inum, int *ilist, int *numneigh,
|
||||
int **firstneigh)
|
||||
{
|
||||
int i, j, ii, jj;
|
||||
@ -307,6 +307,14 @@ void PairLJSDKCoulLongGPU::cpu_compute(int start, int inum, int *ilist, int *num
|
||||
if (EFLAG)
|
||||
evdwl =
|
||||
r6inv * (lj3[itype][jtype] * r6inv - lj4[itype][jtype]) - offset[itype][jtype];
|
||||
|
||||
} else if (ljt == LJ12_5) {
|
||||
const double r5inv = r2inv * r2inv * sqrt(r2inv);
|
||||
const double r7inv = r5inv * r2inv;
|
||||
forcelj = r5inv * (lj1[itype][jtype] * r7inv - lj2[itype][jtype]);
|
||||
if (EFLAG)
|
||||
evdwl =
|
||||
r5inv * (lj3[itype][jtype] * r7inv - lj4[itype][jtype]) - offset[itype][jtype];
|
||||
}
|
||||
|
||||
if (EFLAG) evdwl *= factor_lj;
|
||||
@ -13,21 +13,22 @@
|
||||
|
||||
#ifdef PAIR_CLASS
|
||||
// clang-format off
|
||||
PairStyle(lj/sdk/coul/long/gpu,PairLJSDKCoulLongGPU);
|
||||
PairStyle(lj/spica/coul/long/gpu,PairLJSPICACoulLongGPU);
|
||||
PairStyle(lj/sdk/coul/long/gpu,PairLJSPICACoulLongGPU);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_PAIR_LJ_SDK_COUL_LONG_GPU_H
|
||||
#define LMP_PAIR_LJ_SDK_COUL_LONG_GPU_H
|
||||
#ifndef LMP_PAIR_LJ_SPICA_COUL_LONG_GPU_H
|
||||
#define LMP_PAIR_LJ_SPICA_COUL_LONG_GPU_H
|
||||
|
||||
#include "pair_lj_sdk_coul_long.h"
|
||||
#include "pair_lj_spica_coul_long.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class PairLJSDKCoulLongGPU : public PairLJSDKCoulLong {
|
||||
class PairLJSPICACoulLongGPU : public PairLJSPICACoulLong {
|
||||
public:
|
||||
PairLJSDKCoulLongGPU(LAMMPS *lmp);
|
||||
~PairLJSDKCoulLongGPU() override;
|
||||
PairLJSPICACoulLongGPU(LAMMPS *lmp);
|
||||
~PairLJSPICACoulLongGPU() override;
|
||||
template <int, int> void cpu_compute(int, int, int *, int *, int **);
|
||||
void compute(int, int) override;
|
||||
void init_style() override;
|
||||
@ -15,7 +15,7 @@
|
||||
Contributing author: Mike Brown (SNL)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "pair_lj_sdk_gpu.h"
|
||||
#include "pair_lj_spica_gpu.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "domain.h"
|
||||
@ -32,29 +32,29 @@ using namespace LAMMPS_NS;
|
||||
|
||||
// External functions from cuda library for atom decomposition
|
||||
|
||||
int sdk_gpu_init(const int ntypes, double **cutsq, int **cg_types, double **host_lj1,
|
||||
int spica_gpu_init(const int ntypes, double **cutsq, int **cg_types, double **host_lj1,
|
||||
double **host_lj2, double **host_lj3, double **host_lj4, double **offset,
|
||||
double *special_lj, const int nlocal, const int nall, const int max_nbors,
|
||||
const int maxspecial, const double cell_size, int &gpu_mode, FILE *screen);
|
||||
void sdk_gpu_clear();
|
||||
int **sdk_gpu_compute_n(const int ago, const int inum, const int nall, double **host_x,
|
||||
void spica_gpu_clear();
|
||||
int **spica_gpu_compute_n(const int ago, const int inum, const int nall, double **host_x,
|
||||
int *host_type, double *sublo, double *subhi, tagint *tag, int **nspecial,
|
||||
tagint **special, const bool eflag, const bool vflag, const bool eatom,
|
||||
const bool vatom, int &host_start, int **ilist, int **jnum,
|
||||
const double cpu_time, bool &success);
|
||||
void sdk_gpu_compute(const int ago, const int inum, const int nall, double **host_x, int *host_type,
|
||||
void spica_gpu_compute(const int ago, const int inum, const int nall, double **host_x, int *host_type,
|
||||
int *ilist, int *numj, int **firstneigh, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start, const double cpu_time,
|
||||
bool &success);
|
||||
double sdk_gpu_bytes();
|
||||
double spica_gpu_bytes();
|
||||
|
||||
#include "lj_sdk_common.h"
|
||||
#include "lj_spica_common.h"
|
||||
|
||||
using namespace LJSDKParms;
|
||||
using namespace LJSPICAParms;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
PairLJSDKGPU::PairLJSDKGPU(LAMMPS *lmp) : PairLJSDK(lmp), gpu_mode(GPU_FORCE)
|
||||
PairLJSPICAGPU::PairLJSPICAGPU(LAMMPS *lmp) : PairLJSPICA(lmp), gpu_mode(GPU_FORCE)
|
||||
{
|
||||
respa_enable = 0;
|
||||
reinitflag = 0;
|
||||
@ -67,14 +67,14 @@ PairLJSDKGPU::PairLJSDKGPU(LAMMPS *lmp) : PairLJSDK(lmp), gpu_mode(GPU_FORCE)
|
||||
free all arrays
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
PairLJSDKGPU::~PairLJSDKGPU()
|
||||
PairLJSPICAGPU::~PairLJSPICAGPU()
|
||||
{
|
||||
sdk_gpu_clear();
|
||||
spica_gpu_clear();
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairLJSDKGPU::compute(int eflag, int vflag)
|
||||
void PairLJSPICAGPU::compute(int eflag, int vflag)
|
||||
{
|
||||
ev_init(eflag, vflag);
|
||||
|
||||
@ -97,7 +97,7 @@ void PairLJSDKGPU::compute(int eflag, int vflag)
|
||||
}
|
||||
inum = atom->nlocal;
|
||||
firstneigh =
|
||||
sdk_gpu_compute_n(neighbor->ago, inum, nall, atom->x, atom->type, sublo, subhi, atom->tag,
|
||||
spica_gpu_compute_n(neighbor->ago, inum, nall, atom->x, atom->type, sublo, subhi, atom->tag,
|
||||
atom->nspecial, atom->special, eflag, vflag, eflag_atom, vflag_atom,
|
||||
host_start, &ilist, &numneigh, cpu_time, success);
|
||||
} else {
|
||||
@ -105,7 +105,7 @@ void PairLJSDKGPU::compute(int eflag, int vflag)
|
||||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
sdk_gpu_compute(neighbor->ago, inum, nall, atom->x, atom->type, ilist, numneigh, firstneigh,
|
||||
spica_gpu_compute(neighbor->ago, inum, nall, atom->x, atom->type, ilist, numneigh, firstneigh,
|
||||
eflag, vflag, eflag_atom, vflag_atom, host_start, cpu_time, success);
|
||||
}
|
||||
if (!success) error->one(FLERR, "Insufficient memory on accelerator");
|
||||
@ -127,7 +127,7 @@ void PairLJSDKGPU::compute(int eflag, int vflag)
|
||||
init specific to this pair style
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLJSDKGPU::init_style()
|
||||
void PairLJSPICAGPU::init_style()
|
||||
{
|
||||
|
||||
// Repeat cutsq calculation because done after call to init_style
|
||||
@ -149,7 +149,7 @@ void PairLJSDKGPU::init_style()
|
||||
int maxspecial = 0;
|
||||
if (atom->molecular != Atom::ATOMIC) maxspecial = atom->maxspecial;
|
||||
int mnf = 5e-2 * neighbor->oneatom;
|
||||
int success = sdk_gpu_init(atom->ntypes + 1, cutsq, lj_type, lj1, lj2, lj3, lj4, offset,
|
||||
int success = spica_gpu_init(atom->ntypes + 1, cutsq, lj_type, lj1, lj2, lj3, lj4, offset,
|
||||
force->special_lj, atom->nlocal, atom->nlocal + atom->nghost, mnf,
|
||||
maxspecial, cell_size, gpu_mode, screen);
|
||||
GPU_EXTRA::check_flag(success, error, world);
|
||||
@ -159,15 +159,15 @@ void PairLJSDKGPU::init_style()
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double PairLJSDKGPU::memory_usage()
|
||||
double PairLJSPICAGPU::memory_usage()
|
||||
{
|
||||
double bytes = Pair::memory_usage();
|
||||
return bytes + sdk_gpu_bytes();
|
||||
return bytes + spica_gpu_bytes();
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
template <int EVFLAG, int EFLAG>
|
||||
void PairLJSDKGPU::cpu_compute(int start, int inum, int *ilist, int *numneigh, int **firstneigh)
|
||||
void PairLJSPICAGPU::cpu_compute(int start, int inum, int *ilist, int *numneigh, int **firstneigh)
|
||||
{
|
||||
int i, j, ii, jj, jtype;
|
||||
double xtmp, ytmp, ztmp, delx, dely, delz, evdwl, fpair;
|
||||
@ -228,6 +228,13 @@ void PairLJSDKGPU::cpu_compute(int start, int inum, int *ilist, int *numneigh, i
|
||||
forcelj = r6inv * (lj1[itype][jtype] * r6inv - lj2[itype][jtype]);
|
||||
if (EFLAG)
|
||||
evdwl = r6inv * (lj3[itype][jtype] * r6inv - lj4[itype][jtype]) - offset[itype][jtype];
|
||||
|
||||
} else if (ljt == LJ12_5) {
|
||||
const double r5inv = r2inv * r2inv * sqrt(r2inv);
|
||||
const double r7inv = r5inv * r2inv;
|
||||
forcelj = r5inv * (lj1[itype][jtype] * r7inv - lj2[itype][jtype]);
|
||||
if (EFLAG)
|
||||
evdwl = r5inv * (lj3[itype][jtype] * r7inv - lj4[itype][jtype]) - offset[itype][jtype];
|
||||
} else
|
||||
continue;
|
||||
|
||||
@ -13,21 +13,22 @@
|
||||
|
||||
#ifdef PAIR_CLASS
|
||||
// clang-format off
|
||||
PairStyle(lj/sdk/gpu,PairLJSDKGPU);
|
||||
PairStyle(lj/spica/gpu,PairLJSPICAGPU);
|
||||
PairStyle(lj/sdk/gpu,PairLJSPICAGPU);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_PAIR_LJ_SDK_GPU_H
|
||||
#define LMP_PAIR_LJ_SDK_GPU_H
|
||||
#ifndef LMP_PAIR_LJ_SPICA_GPU_H
|
||||
#define LMP_PAIR_LJ_SPICA_GPU_H
|
||||
|
||||
#include "pair_lj_sdk.h"
|
||||
#include "pair_lj_spica.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class PairLJSDKGPU : public PairLJSDK {
|
||||
class PairLJSPICAGPU : public PairLJSPICA {
|
||||
public:
|
||||
PairLJSDKGPU(LAMMPS *lmp);
|
||||
~PairLJSDKGPU() override;
|
||||
PairLJSPICAGPU(LAMMPS *lmp);
|
||||
~PairLJSPICAGPU() override;
|
||||
template <int, int> void cpu_compute(int, int, int *, int *, int **);
|
||||
void compute(int, int) override;
|
||||
void init_style() override;
|
||||
@ -18,6 +18,7 @@
|
||||
#include "comm.h"
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
#include "group.h"
|
||||
#include "memory.h"
|
||||
#include "modify.h"
|
||||
#include "neigh_list.h"
|
||||
@ -34,7 +35,16 @@ ComputeContactAtom::ComputeContactAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
Compute(lmp, narg, arg),
|
||||
contact(nullptr)
|
||||
{
|
||||
if (narg != 3) error->all(FLERR,"Illegal compute contact/atom command");
|
||||
if (narg != 3 && narg != 4) error->all(FLERR,"Illegal compute contact/atom command");
|
||||
|
||||
jgroup = group->find("all");
|
||||
jgroupbit = group->bitmask[jgroup];
|
||||
if (narg == 4) {
|
||||
group2 = utils::strdup(arg[3]);
|
||||
jgroup = group->find(group2);
|
||||
if (jgroup == -1) error->all(FLERR, "Compute contact/atom group2 ID does not exist");
|
||||
jgroupbit = group->bitmask[jgroup];
|
||||
}
|
||||
|
||||
peratom_flag = 1;
|
||||
size_peratom_cols = 0;
|
||||
@ -115,33 +125,41 @@ void ComputeContactAtom::compute_peratom()
|
||||
int *mask = atom->mask;
|
||||
int nlocal = atom->nlocal;
|
||||
int nall = nlocal + atom->nghost;
|
||||
bool update_i_flag, update_j_flag;
|
||||
|
||||
for (i = 0; i < nall; i++) contact[i] = 0.0;
|
||||
|
||||
for (ii = 0; ii < inum; ii++) {
|
||||
i = ilist[ii];
|
||||
if (mask[i] & groupbit) {
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
radi = radius[i];
|
||||
jlist = firstneigh[i];
|
||||
jnum = numneigh[i];
|
||||
|
||||
for (jj = 0; jj < jnum; jj++) {
|
||||
j = jlist[jj];
|
||||
j &= NEIGHMASK;
|
||||
// Only proceed if i is either part of the compute group or will contribute to contacts
|
||||
if (! (mask[i] & groupbit) && ! (mask[i] & jgroupbit)) continue;
|
||||
|
||||
delx = xtmp - x[j][0];
|
||||
dely = ytmp - x[j][1];
|
||||
delz = ztmp - x[j][2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
radsum = radi + radius[j];
|
||||
radsumsq = radsum*radsum;
|
||||
if (rsq <= radsumsq) {
|
||||
contact[i] += 1.0;
|
||||
contact[j] += 1.0;
|
||||
}
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
radi = radius[i];
|
||||
jlist = firstneigh[i];
|
||||
jnum = numneigh[i];
|
||||
|
||||
for (jj = 0; jj < jnum; jj++) {
|
||||
j = jlist[jj];
|
||||
j &= NEIGHMASK;
|
||||
|
||||
// Only tally for atoms in compute group (groupbit) if neighbor is in group2 (jgroupbit)
|
||||
update_i_flag = (mask[i] & groupbit) && (mask[j] & jgroupbit);
|
||||
update_j_flag = (mask[j] & groupbit) && (mask[i] & jgroupbit);
|
||||
if (! update_i_flag && ! update_j_flag) continue;
|
||||
|
||||
delx = xtmp - x[j][0];
|
||||
dely = ytmp - x[j][1];
|
||||
delz = ztmp - x[j][2];
|
||||
rsq = delx * delx + dely * dely + delz * delz;
|
||||
radsum = radi + radius[j];
|
||||
radsumsq = radsum * radsum;
|
||||
if (rsq <= radsumsq) {
|
||||
if (update_i_flag) contact[i] += 1.0;
|
||||
if (update_j_flag) contact[j] += 1.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,6 +37,10 @@ class ComputeContactAtom : public Compute {
|
||||
|
||||
private:
|
||||
int nmax;
|
||||
|
||||
char *group2;
|
||||
int jgroup, jgroupbit;
|
||||
|
||||
class NeighList *list;
|
||||
double *contact;
|
||||
};
|
||||
|
||||
@ -294,8 +294,8 @@ action pair_lj_gromacs_coul_gromacs_kokkos.cpp pair_lj_gromacs_coul_gromacs.cpp
|
||||
action pair_lj_gromacs_coul_gromacs_kokkos.h pair_lj_gromacs_coul_gromacs.h
|
||||
action pair_lj_gromacs_kokkos.cpp pair_lj_gromacs.cpp
|
||||
action pair_lj_gromacs_kokkos.h pair_lj_gromacs.h
|
||||
action pair_lj_sdk_kokkos.cpp pair_lj_sdk.cpp
|
||||
action pair_lj_sdk_kokkos.h pair_lj_sdk.h
|
||||
action pair_lj_spica_kokkos.cpp pair_lj_spica.cpp
|
||||
action pair_lj_spica_kokkos.h pair_lj_spica.h
|
||||
action pair_meam_kokkos.cpp pair_meam.cpp
|
||||
action pair_meam_kokkos.h pair_meam.h
|
||||
action pair_morse_kokkos.cpp
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "pair_lj_sdk_kokkos.h"
|
||||
#include "pair_lj_spica_kokkos.h"
|
||||
|
||||
#include "atom_kokkos.h"
|
||||
#include "atom_masks.h"
|
||||
@ -26,13 +26,13 @@
|
||||
#include "respa.h"
|
||||
#include "update.h"
|
||||
|
||||
#include "lj_sdk_common.h"
|
||||
#include "lj_spica_common.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace LJSDKParms;
|
||||
using namespace LJSPICAParms;
|
||||
|
||||
#define KOKKOS_CUDA_MAX_THREADS 256
|
||||
#define KOKKOS_CUDA_MIN_BLOCKS 8
|
||||
@ -40,7 +40,7 @@ using namespace LJSDKParms;
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template<class DeviceType>
|
||||
PairLJSDKKokkos<DeviceType>::PairLJSDKKokkos(LAMMPS *lmp) : PairLJSDK(lmp)
|
||||
PairLJSPICAKokkos<DeviceType>::PairLJSPICAKokkos(LAMMPS *lmp) : PairLJSPICA(lmp)
|
||||
{
|
||||
respa_enable = 0;
|
||||
|
||||
@ -54,7 +54,7 @@ PairLJSDKKokkos<DeviceType>::PairLJSDKKokkos(LAMMPS *lmp) : PairLJSDK(lmp)
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template<class DeviceType>
|
||||
PairLJSDKKokkos<DeviceType>::~PairLJSDKKokkos()
|
||||
PairLJSPICAKokkos<DeviceType>::~PairLJSPICAKokkos()
|
||||
{
|
||||
if (copymode) return;
|
||||
|
||||
@ -68,7 +68,7 @@ PairLJSDKKokkos<DeviceType>::~PairLJSDKKokkos()
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template<class DeviceType>
|
||||
void PairLJSDKKokkos<DeviceType>::compute(int eflag_in, int vflag_in)
|
||||
void PairLJSPICAKokkos<DeviceType>::compute(int eflag_in, int vflag_in)
|
||||
{
|
||||
eflag = eflag_in;
|
||||
vflag = vflag_in;
|
||||
@ -112,7 +112,7 @@ void PairLJSDKKokkos<DeviceType>::compute(int eflag_in, int vflag_in)
|
||||
|
||||
// loop over neighbors of my atoms
|
||||
|
||||
EV_FLOAT ev = pair_compute<PairLJSDKKokkos<DeviceType>,void >(this,(NeighListKokkos<DeviceType>*)list);
|
||||
EV_FLOAT ev = pair_compute<PairLJSPICAKokkos<DeviceType>,void >(this,(NeighListKokkos<DeviceType>*)list);
|
||||
|
||||
if (eflag) eng_vdwl += ev.evdwl;
|
||||
if (vflag_global) {
|
||||
@ -141,7 +141,7 @@ void PairLJSDKKokkos<DeviceType>::compute(int eflag_in, int vflag_in)
|
||||
template<class DeviceType>
|
||||
template<bool STACKPARAMS, class Specialisation>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
F_FLOAT PairLJSDKKokkos<DeviceType>::
|
||||
F_FLOAT PairLJSPICAKokkos<DeviceType>::
|
||||
compute_fpair(const F_FLOAT& rsq, const int& i, const int&j, const int& itype, const int& jtype) const {
|
||||
(void) i;
|
||||
(void) j;
|
||||
@ -167,19 +167,25 @@ compute_fpair(const F_FLOAT& rsq, const int& i, const int&j, const int& itype, c
|
||||
const double r6inv = r2inv*r2inv*r2inv;
|
||||
return r6inv*(lj_1*r6inv - lj_2) * r2inv;
|
||||
|
||||
} else if (ljt == LJ12_5) {
|
||||
|
||||
const F_FLOAT r5inv = r2inv*r2inv*sqrt(r2inv);
|
||||
const F_FLOAT r7inv = r5inv*r2inv;
|
||||
return r5inv*(lj_1*r7inv - lj_2) * r2inv;
|
||||
|
||||
}
|
||||
if (ljt!=LJ12_4 && ljt!=LJ9_6 && ljt!=LJ12_6) return 0.0;*/
|
||||
if (ljt!=LJ12_4 && ljt!=LJ9_6 && ljt!=LJ12_6 && ljt!=LJ12_5) return 0.0;*/
|
||||
const F_FLOAT r4inv=r2inv*r2inv;
|
||||
const F_FLOAT r6inv=r2inv*r4inv;
|
||||
const F_FLOAT a = ljt==LJ12_4?r4inv:r6inv;
|
||||
const F_FLOAT b = ljt==LJ12_4?r4inv:(ljt==LJ9_6?1.0/sqrt(r2inv):r2inv);
|
||||
const F_FLOAT a = ljt==LJ12_4?r4inv:(ljt==LJ12_5?r4inv*sqrt(r2inv):r6inv);
|
||||
const F_FLOAT b = ljt==LJ12_4?r4inv:(ljt==LJ9_6?1.0/sqrt(r2inv):(ljt==LJ12_5?r2inv*sqrt(r2inv):r2inv));
|
||||
return a* ( lj_1*r6inv*b - lj_2 * r2inv);
|
||||
}
|
||||
|
||||
template<class DeviceType>
|
||||
template<bool STACKPARAMS, class Specialisation>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
F_FLOAT PairLJSDKKokkos<DeviceType>::
|
||||
F_FLOAT PairLJSPICAKokkos<DeviceType>::
|
||||
compute_evdwl(const F_FLOAT& rsq, const int& i, const int&j, const int& itype, const int& jtype) const {
|
||||
(void) i;
|
||||
(void) j;
|
||||
@ -203,6 +209,11 @@ compute_evdwl(const F_FLOAT& rsq, const int& i, const int&j, const int& itype, c
|
||||
} else if (ljt == LJ12_6) {
|
||||
const double r6inv = r2inv*r2inv*r2inv;
|
||||
return r6inv*(lj_3*r6inv - lj_4) - offset;
|
||||
|
||||
} else if (ljt == LJ12_5) {
|
||||
const F_FLOAT r5inv = r2inv*r2inv*sqrt(r2inv);
|
||||
const F_FLOAT r7inv = r5inv*r2inv;
|
||||
return r5inv*(lj_3*r7inv - lj_4) - offset;
|
||||
} else
|
||||
return 0.0;
|
||||
}
|
||||
@ -212,15 +223,15 @@ compute_evdwl(const F_FLOAT& rsq, const int& i, const int&j, const int& itype, c
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
template<class DeviceType>
|
||||
void PairLJSDKKokkos<DeviceType>::allocate()
|
||||
void PairLJSPICAKokkos<DeviceType>::allocate()
|
||||
{
|
||||
PairLJSDK::allocate();
|
||||
PairLJSPICA::allocate();
|
||||
|
||||
int n = atom->ntypes;
|
||||
memory->destroy(cutsq);
|
||||
memoryKK->create_kokkos(k_cutsq,cutsq,n+1,n+1,"pair:cutsq");
|
||||
d_cutsq = k_cutsq.template view<DeviceType>();
|
||||
k_params = Kokkos::DualView<params_lj**,Kokkos::LayoutRight,DeviceType>("PairLJSDK::params",n+1,n+1);
|
||||
k_params = Kokkos::DualView<params_lj**,Kokkos::LayoutRight,DeviceType>("PairLJSPICA::params",n+1,n+1);
|
||||
params = k_params.template view<DeviceType>();
|
||||
}
|
||||
|
||||
@ -229,11 +240,11 @@ void PairLJSDKKokkos<DeviceType>::allocate()
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
template<class DeviceType>
|
||||
void PairLJSDKKokkos<DeviceType>::settings(int narg, char **arg)
|
||||
void PairLJSPICAKokkos<DeviceType>::settings(int narg, char **arg)
|
||||
{
|
||||
if (narg > 2) error->all(FLERR,"Illegal pair_style command");
|
||||
|
||||
PairLJSDK::settings(1,arg);
|
||||
PairLJSPICA::settings(1,arg);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -241,9 +252,9 @@ void PairLJSDKKokkos<DeviceType>::settings(int narg, char **arg)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
template<class DeviceType>
|
||||
void PairLJSDKKokkos<DeviceType>::init_style()
|
||||
void PairLJSPICAKokkos<DeviceType>::init_style()
|
||||
{
|
||||
PairLJSDK::init_style();
|
||||
PairLJSPICA::init_style();
|
||||
|
||||
// error if rRESPA with inner levels
|
||||
|
||||
@ -270,9 +281,9 @@ void PairLJSDKKokkos<DeviceType>::init_style()
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
template<class DeviceType>
|
||||
double PairLJSDKKokkos<DeviceType>::init_one(int i, int j)
|
||||
double PairLJSPICAKokkos<DeviceType>::init_one(int i, int j)
|
||||
{
|
||||
double cutone = PairLJSDK::init_one(i,j);
|
||||
double cutone = PairLJSPICA::init_one(i,j);
|
||||
|
||||
k_params.h_view(i,j).lj1 = lj1[i][j];
|
||||
k_params.h_view(i,j).lj2 = lj2[i][j];
|
||||
@ -297,9 +308,9 @@ double PairLJSDKKokkos<DeviceType>::init_one(int i, int j)
|
||||
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
template class PairLJSDKKokkos<LMPDeviceType>;
|
||||
template class PairLJSPICAKokkos<LMPDeviceType>;
|
||||
#ifdef LMP_KOKKOS_GPU
|
||||
template class PairLJSDKKokkos<LMPHostType>;
|
||||
template class PairLJSPICAKokkos<LMPHostType>;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -13,31 +13,34 @@
|
||||
|
||||
#ifdef PAIR_CLASS
|
||||
// clang-format off
|
||||
PairStyle(lj/sdk/kk,PairLJSDKKokkos<LMPDeviceType>);
|
||||
PairStyle(lj/sdk/kk/device,PairLJSDKKokkos<LMPDeviceType>);
|
||||
PairStyle(lj/sdk/kk/host,PairLJSDKKokkos<LMPHostType>);
|
||||
PairStyle(lj/spica/kk,PairLJSPICAKokkos<LMPDeviceType>);
|
||||
PairStyle(lj/spica/kk/device,PairLJSPICAKokkos<LMPDeviceType>);
|
||||
PairStyle(lj/spica/kk/host,PairLJSPICAKokkos<LMPHostType>);
|
||||
PairStyle(lj/sdk/kk,PairLJSPICAKokkos<LMPDeviceType>);
|
||||
PairStyle(lj/sdk/kk/device,PairLJSPICAKokkos<LMPDeviceType>);
|
||||
PairStyle(lj/sdk/kk/host,PairLJSPICAKokkos<LMPHostType>);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
// clang-format off
|
||||
#ifndef LMP_PAIR_LJ_SDK_KOKKOS_H
|
||||
#define LMP_PAIR_LJ_SDK_KOKKOS_H
|
||||
#ifndef LMP_PAIR_LJ_SPICA_KOKKOS_H
|
||||
#define LMP_PAIR_LJ_SPICA_KOKKOS_H
|
||||
|
||||
#include "pair_kokkos.h"
|
||||
#include "pair_lj_sdk.h"
|
||||
#include "pair_lj_spica.h"
|
||||
#include "neigh_list_kokkos.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
template<class DeviceType>
|
||||
class PairLJSDKKokkos : public PairLJSDK {
|
||||
class PairLJSPICAKokkos : public PairLJSPICA {
|
||||
public:
|
||||
enum {EnabledNeighFlags=FULL|HALFTHREAD|HALF};
|
||||
enum {COUL_FLAG=0};
|
||||
typedef DeviceType device_type;
|
||||
typedef ArrayTypes<DeviceType> AT;
|
||||
PairLJSDKKokkos(class LAMMPS *);
|
||||
~PairLJSDKKokkos() override;
|
||||
PairLJSPICAKokkos(class LAMMPS *);
|
||||
~PairLJSPICAKokkos() override;
|
||||
|
||||
void compute(int, int) override;
|
||||
|
||||
@ -95,17 +98,17 @@ class PairLJSDKKokkos : public PairLJSDK {
|
||||
int nlocal,nall,eflag,vflag;
|
||||
|
||||
void allocate() override;
|
||||
friend struct PairComputeFunctor<PairLJSDKKokkos,FULL,true>;
|
||||
friend struct PairComputeFunctor<PairLJSDKKokkos,HALF,true>;
|
||||
friend struct PairComputeFunctor<PairLJSDKKokkos,HALFTHREAD,true>;
|
||||
friend struct PairComputeFunctor<PairLJSDKKokkos,FULL,false>;
|
||||
friend struct PairComputeFunctor<PairLJSDKKokkos,HALF,false>;
|
||||
friend struct PairComputeFunctor<PairLJSDKKokkos,HALFTHREAD,false>;
|
||||
friend EV_FLOAT pair_compute_neighlist<PairLJSDKKokkos,FULL,void>(PairLJSDKKokkos*,NeighListKokkos<DeviceType>*);
|
||||
friend EV_FLOAT pair_compute_neighlist<PairLJSDKKokkos,HALF,void>(PairLJSDKKokkos*,NeighListKokkos<DeviceType>*);
|
||||
friend EV_FLOAT pair_compute_neighlist<PairLJSDKKokkos,HALFTHREAD,void>(PairLJSDKKokkos*,NeighListKokkos<DeviceType>*);
|
||||
friend EV_FLOAT pair_compute<PairLJSDKKokkos,void>(PairLJSDKKokkos*,NeighListKokkos<DeviceType>*);
|
||||
friend void pair_virial_fdotr_compute<PairLJSDKKokkos>(PairLJSDKKokkos*);
|
||||
friend struct PairComputeFunctor<PairLJSPICAKokkos,FULL,true>;
|
||||
friend struct PairComputeFunctor<PairLJSPICAKokkos,HALF,true>;
|
||||
friend struct PairComputeFunctor<PairLJSPICAKokkos,HALFTHREAD,true>;
|
||||
friend struct PairComputeFunctor<PairLJSPICAKokkos,FULL,false>;
|
||||
friend struct PairComputeFunctor<PairLJSPICAKokkos,HALF,false>;
|
||||
friend struct PairComputeFunctor<PairLJSPICAKokkos,HALFTHREAD,false>;
|
||||
friend EV_FLOAT pair_compute_neighlist<PairLJSPICAKokkos,FULL,void>(PairLJSPICAKokkos*,NeighListKokkos<DeviceType>*);
|
||||
friend EV_FLOAT pair_compute_neighlist<PairLJSPICAKokkos,HALF,void>(PairLJSPICAKokkos*,NeighListKokkos<DeviceType>*);
|
||||
friend EV_FLOAT pair_compute_neighlist<PairLJSPICAKokkos,HALFTHREAD,void>(PairLJSPICAKokkos*,NeighListKokkos<DeviceType>*);
|
||||
friend EV_FLOAT pair_compute<PairLJSPICAKokkos,void>(PairLJSPICAKokkos*,NeighListKokkos<DeviceType>*);
|
||||
friend void pair_virial_fdotr_compute<PairLJSPICAKokkos>(PairLJSPICAKokkos*);
|
||||
};
|
||||
|
||||
}
|
||||
@ -25,6 +25,7 @@ FixStyle(bond/break,FixBondBreak);
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class FixBondBreak : public Fix {
|
||||
friend class FixSRPREACT;
|
||||
public:
|
||||
FixBondBreak(class LAMMPS *, int, char **);
|
||||
~FixBondBreak() override;
|
||||
|
||||
@ -25,6 +25,7 @@ FixStyle(bond/create,FixBondCreate);
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class FixBondCreate : public Fix {
|
||||
friend class FixSRPREACT;
|
||||
public:
|
||||
FixBondCreate(class LAMMPS *, int, char **);
|
||||
~FixBondCreate() override;
|
||||
|
||||
@ -242,14 +242,39 @@ void FixMDIQM::init()
|
||||
|
||||
reallocate();
|
||||
|
||||
int ierr = MDI_Send_command(">NATOMS", mdicomm);
|
||||
if (ierr) error->all(FLERR, "MDI: >NATOMS command");
|
||||
int n = static_cast<int> (atom->natoms);
|
||||
ierr = MDI_Send(&n, 1, MDI_INT, mdicomm);
|
||||
if (ierr) error->all(FLERR, "MDI: >NATOMS data");
|
||||
int natoms_exists;
|
||||
int ierr = MDI_Check_command_exists("@DEFAULT", ">NATOMS", mdicomm, &natoms_exists);
|
||||
if (ierr) error->all(FLERR, "MDI: >NATOMS command check");
|
||||
if ( natoms_exists ) {
|
||||
|
||||
if (elements) send_elements();
|
||||
else send_types();
|
||||
ierr = MDI_Send_command(">NATOMS", mdicomm);
|
||||
if (ierr) error->all(FLERR, "MDI: >NATOMS command");
|
||||
int n = static_cast<int> (atom->natoms);
|
||||
ierr = MDI_Send(&n, 1, MDI_INT, mdicomm);
|
||||
if (ierr) error->all(FLERR, "MDI: >NATOMS data");
|
||||
|
||||
} else { // confirm that the engine's NATOMS is correct
|
||||
|
||||
ierr = MDI_Send_command("<NATOMS", mdicomm);
|
||||
if (ierr) error->all(FLERR, "MDI: <NATOMS command");
|
||||
int n;
|
||||
ierr = MDI_Recv(&n, 1, MDI_INT, mdicomm);
|
||||
if (ierr) error->all(FLERR, "MDI: <NATOMS data");
|
||||
if ( n != atom->natoms ) error->all(FLERR, "MDI: Engine has the wrong number of atoms, and does not support the >NATOMS command.");
|
||||
|
||||
}
|
||||
|
||||
int elements_exists;
|
||||
int types_exists;
|
||||
ierr = MDI_Check_command_exists("@DEFAULT", ">ELEMENTS", mdicomm, &elements_exists);
|
||||
if (ierr) error->all(FLERR, "MDI: >ELEMENTS command check");
|
||||
ierr = MDI_Check_command_exists("@DEFAULT", ">TYPES", mdicomm, &types_exists);
|
||||
if (ierr) error->all(FLERR, "MDI: >TYPES command check");
|
||||
if ( elements && elements_exists ) {
|
||||
send_elements();
|
||||
} else if ( types_exists ) {
|
||||
send_types();
|
||||
}
|
||||
send_box();
|
||||
}
|
||||
|
||||
@ -502,13 +527,18 @@ void FixMDIQM::send_box()
|
||||
{
|
||||
double cell[9];
|
||||
|
||||
int ierr = MDI_Send_command(">CELL_DISPL", mdicomm);
|
||||
if (ierr) error->all(FLERR, "MDI: >CELL_DISPL command");
|
||||
cell[0] = domain->boxlo[0] * lmp2mdi_length;
|
||||
cell[1] = domain->boxlo[1] * lmp2mdi_length;
|
||||
cell[2] = domain->boxlo[2] * lmp2mdi_length;
|
||||
ierr = MDI_Send(cell, 3, MDI_DOUBLE, mdicomm);
|
||||
if (ierr) error->all(FLERR, "MDI: >CELL_DISPL data");
|
||||
int celldispl_exists;
|
||||
int ierr = MDI_Check_command_exists("@DEFAULT", ">NATOMS", mdicomm, &celldispl_exists);
|
||||
if (ierr) error->all(FLERR, "MDI: >CELL_DISPL command check");
|
||||
if ( celldispl_exists ) {
|
||||
ierr = MDI_Send_command(">CELL_DISPL", mdicomm);
|
||||
if (ierr) error->all(FLERR, "MDI: >CELL_DISPL command");
|
||||
cell[0] = domain->boxlo[0] * lmp2mdi_length;
|
||||
cell[1] = domain->boxlo[1] * lmp2mdi_length;
|
||||
cell[2] = domain->boxlo[2] * lmp2mdi_length;
|
||||
ierr = MDI_Send(cell, 3, MDI_DOUBLE, mdicomm);
|
||||
if (ierr) error->all(FLERR, "MDI: >CELL_DISPL data");
|
||||
}
|
||||
|
||||
ierr = MDI_Send_command(">CELL", mdicomm);
|
||||
if (ierr) error->all(FLERR, "MDI: >CELL command");
|
||||
@ -521,6 +551,10 @@ void FixMDIQM::send_box()
|
||||
cell[6] = domain->xz;
|
||||
cell[7] = domain->yz;
|
||||
cell[8] = domain->boxhi[2] - domain->boxlo[2];
|
||||
|
||||
// convert the cell units to bohr
|
||||
for (int icell = 0; icell < 9; icell++) cell[icell] *= lmp2mdi_length;
|
||||
|
||||
ierr = MDI_Send(cell, 9, MDI_DOUBLE, mdicomm);
|
||||
if (ierr) error->all(FLERR, "MDI: >CELL data");
|
||||
}
|
||||
|
||||
55
src/MISC/Install.sh
Normal file
55
src/MISC/Install.sh
Normal file
@ -0,0 +1,55 @@
|
||||
# Install/Uninstall package files in LAMMPS
|
||||
# mode = 0/1/2 for uninstall/install/update
|
||||
|
||||
mode=$1
|
||||
|
||||
# enforce using portable C locale
|
||||
LC_ALL=C
|
||||
export LC_ALL
|
||||
|
||||
# arg1 = file, arg2 = file it depends on
|
||||
|
||||
action () {
|
||||
if (test $mode = 0) then
|
||||
rm -f ../$1
|
||||
elif (! cmp -s $1 ../$1) then
|
||||
if (test -z "$2" || test -e ../$2) then
|
||||
cp $1 ..
|
||||
if (test $mode = 2) then
|
||||
echo " updating src/$1"
|
||||
fi
|
||||
fi
|
||||
elif (test -n "$2") then
|
||||
if (test ! -e ../$2) then
|
||||
rm -f ../$1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# package files without dependencies
|
||||
action bond_special.cpp
|
||||
action bond_special.h
|
||||
action compute_viscosity_cos.cpp
|
||||
action compute_viscosity_cos.h
|
||||
action fix_accelerate_cos.cpp
|
||||
action fix_accelerate_cos.h
|
||||
action fix_imd.cpp
|
||||
action fix_imd.h
|
||||
action fix_ipi.cpp
|
||||
action fix_ipi.h
|
||||
action fix_srp.cpp
|
||||
action fix_srp.h
|
||||
action pair_agni.cpp
|
||||
action pair_agni.h
|
||||
action pair_list.cpp
|
||||
action pair_list.h
|
||||
action pair_srp.cpp
|
||||
action pair_srp.h
|
||||
action pair_tracker.cpp
|
||||
action pair_tracker.h
|
||||
|
||||
# package files with dependencies
|
||||
action pair_srp_react.cpp fix_bond_break.h
|
||||
action pair_srp_react.h fix_bond_break.h
|
||||
action fix_srp_react.cpp fix_bond_break.h
|
||||
action fix_srp_react.h fix_bond_break.h
|
||||
@ -68,6 +68,8 @@ FixSRP::FixSRP(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
|
||||
btype = -1;
|
||||
bptype = -1;
|
||||
|
||||
pair_name = "srp";
|
||||
|
||||
// zero
|
||||
for (int i = 0; i < atom->nmax; i++)
|
||||
for (int m = 0; m < 2; m++)
|
||||
@ -101,15 +103,11 @@ int FixSRP::setmask()
|
||||
|
||||
void FixSRP::init()
|
||||
{
|
||||
if (force->pair_match("hybrid",1) == nullptr && force->pair_match("hybrid/overlay",1) == nullptr)
|
||||
error->all(FLERR,"Cannot use pair srp without pair_style hybrid");
|
||||
if (!force->pair_match("^hybrid",0))
|
||||
error->all(FLERR,"Cannot use pair {} without pair_style hybrid", pair_name);
|
||||
|
||||
int has_rigid = 0;
|
||||
for (int i = 0; i < modify->nfix; i++)
|
||||
if (utils::strmatch(modify->fix[i]->style,"^rigid")) ++has_rigid;
|
||||
|
||||
if (has_rigid > 0)
|
||||
error->all(FLERR,"Pair srp is not compatible with rigid fixes.");
|
||||
if (modify->get_fix_by_style("^rigid").size() > 0)
|
||||
error->all(FLERR,"Pair {} is not compatible with rigid fixes.", pair_name);
|
||||
|
||||
if ((bptype < 1) || (bptype > atom->ntypes))
|
||||
error->all(FLERR,"Illegal bond particle type");
|
||||
@ -118,11 +116,10 @@ void FixSRP::init()
|
||||
// because this fix's pre_exchange() creates per-atom data structure
|
||||
// that data must be current for atom migration to carry it along
|
||||
|
||||
for (int i = 0; i < modify->nfix; i++) {
|
||||
if (modify->fix[i] == this) break;
|
||||
if (modify->fix[i]->pre_exchange_migrate)
|
||||
error->all(FLERR,"Fix SRP comes after a fix which "
|
||||
"migrates atoms in pre_exchange");
|
||||
for (auto ifix : modify->get_fix_list()) {
|
||||
if (ifix == this) break;
|
||||
if (ifix->pre_exchange_migrate)
|
||||
error->all(FLERR,"Fix {} comes after a fix which migrates atoms in pre_exchange", style);
|
||||
}
|
||||
|
||||
// setup neigh exclusions for diff atom types
|
||||
@ -274,8 +271,8 @@ void FixSRP::setup_pre_force(int /*zz*/)
|
||||
|
||||
// stop if cutghost is insufficient
|
||||
if (cutneighmax_srp > cutghostmin)
|
||||
error->all(FLERR,"Communication cutoff too small for fix srp. "
|
||||
"Need {:.8}, current {:.8}", cutneighmax_srp, cutghostmin);
|
||||
error->all(FLERR,"Communication cutoff too small for fix {}. "
|
||||
"Need {:.8}, current {:.8}", style, cutneighmax_srp, cutghostmin);
|
||||
|
||||
// assign tags for new atoms, update map
|
||||
atom->tag_extend();
|
||||
@ -345,11 +342,11 @@ void FixSRP::pre_exchange()
|
||||
if (atom->type[ii] != bptype) continue;
|
||||
|
||||
i = atom->map(static_cast<tagint>(array[ii][0]));
|
||||
if (i < 0) error->all(FLERR,"Fix SRP failed to map atom");
|
||||
if (i < 0) error->all(FLERR,"Fix {} failed to map atom", style);
|
||||
i = domain->closest_image(ii,i);
|
||||
|
||||
j = atom->map(static_cast<tagint>(array[ii][1]));
|
||||
if (j < 0) error->all(FLERR,"Fix SRP failed to map atom");
|
||||
if (j < 0) error->all(FLERR,"Fix {} failed to map atom", style);
|
||||
j = domain->closest_image(ii,j);
|
||||
|
||||
// position of bond particle ii
|
||||
|
||||
@ -54,9 +54,10 @@ class FixSRP : public Fix {
|
||||
|
||||
double **array;
|
||||
|
||||
private:
|
||||
protected:
|
||||
int btype;
|
||||
int bptype;
|
||||
std::string pair_name;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
145
src/MISC/fix_srp_react.cpp
Normal file
145
src/MISC/fix_srp_react.cpp
Normal file
@ -0,0 +1,145 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
Contributing author: Vaibhav Palkar (Kuksenok Lab, Clemson University)
|
||||
based on the pair srp code by Timothy Sirk (ARL)
|
||||
|
||||
This pair style interfaces the pair style srp with the stochastic reaction
|
||||
fixes bond/break and bond/create by updating pseudo beads corresponding to
|
||||
bonds as bond breaking and formation takes place. This is useful in
|
||||
simulation of reactions in polymers with soft potentials such as DPD.
|
||||
|
||||
See the doc page for pair_style srp/react command for usage instructions.
|
||||
|
||||
There is an example script for this package in examples/PACKAGES/srp_react/.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "fix_srp_react.h"
|
||||
|
||||
#include "modify.h"
|
||||
#include "neighbor.h"
|
||||
|
||||
#include "fix_bond_break.h"
|
||||
#include "fix_bond_create.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace FixConst;
|
||||
|
||||
// clang-format on
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixSRPREACT::FixSRPREACT(LAMMPS *lmp, int narg, char **arg) :
|
||||
FixSRP(lmp, narg, arg), f_bb(nullptr), idbreak(nullptr), f_bc(nullptr), idcreate(nullptr)
|
||||
{
|
||||
pair_name = "srp/react";
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixSRPREACT::~FixSRPREACT()
|
||||
{
|
||||
// free memory
|
||||
delete[] idbreak;
|
||||
delete[] idcreate;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
int FixSRPREACT::setmask()
|
||||
{
|
||||
int mask = 0;
|
||||
mask |= PRE_FORCE;
|
||||
mask |= PRE_EXCHANGE;
|
||||
mask |= POST_RUN;
|
||||
mask |= POST_NEIGHBOR;
|
||||
|
||||
return mask;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void FixSRPREACT::init()
|
||||
{
|
||||
FixSRP::init();
|
||||
|
||||
// find fix bond break
|
||||
if (idbreak) f_bb = (FixBondBreak *) modify->get_fix_by_id(idbreak);
|
||||
|
||||
// find fix bond create
|
||||
if (idcreate) f_bc = (FixBondCreate *) modify->get_fix_by_id(idcreate);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
rebuild bond particle array
|
||||
------------------------------------------------------------------------- */
|
||||
void FixSRPREACT::post_neighbor()
|
||||
{
|
||||
// store ncalls as it is reset in fix srp setup pre force
|
||||
int ncalls = neighbor->ncalls;
|
||||
|
||||
if (f_bb) {
|
||||
if (f_bb->breakcount) {
|
||||
setup_pre_force(0);
|
||||
|
||||
//reset break count before exiting
|
||||
// not reseting breakcount would lead to redundant rebuilds
|
||||
f_bb->breakcount = 0;
|
||||
|
||||
// count additional call during setup_pre_force
|
||||
neighbor->ncalls = ncalls + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (f_bc) {
|
||||
if (f_bc->createcount) {
|
||||
setup_pre_force(0);
|
||||
|
||||
//reset create count before exiting
|
||||
// not reseting createcount would lead to redundant rebuilds
|
||||
f_bc->createcount = 0;
|
||||
|
||||
// count additional call during setup_pre_force
|
||||
neighbor->ncalls = ncalls + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
interface with pair class
|
||||
in addition to bond type and bond particle type,
|
||||
pair srp react sets id of either fix bond break or bond create
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
int FixSRPREACT::modify_param(int /*narg*/, char **arg)
|
||||
{
|
||||
if (strcmp(arg[0], "btype") == 0) {
|
||||
btype = utils::inumeric(FLERR, arg[1], false, lmp);
|
||||
return 2;
|
||||
}
|
||||
if (strcmp(arg[0], "bptype") == 0) {
|
||||
bptype = utils::inumeric(FLERR, arg[1], false, lmp);
|
||||
return 2;
|
||||
}
|
||||
if (strcmp(arg[0], "bond/break") == 0) {
|
||||
idbreak = utils::strdup(arg[1]);
|
||||
return 2;
|
||||
}
|
||||
if (strcmp(arg[0], "bond/create") == 0) {
|
||||
idcreate = utils::strdup(arg[1]);
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
44
src/MISC/fix_srp_react.h
Normal file
44
src/MISC/fix_srp_react.h
Normal file
@ -0,0 +1,44 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
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 FIX_CLASS
|
||||
// clang-format off
|
||||
FixStyle(SRPREACT,FixSRPREACT);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_FIX_SRP_REACT_H
|
||||
#define LMP_FIX_SRP_REACT_H
|
||||
|
||||
#include "fix_srp.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class FixSRPREACT : public FixSRP {
|
||||
public:
|
||||
FixSRPREACT(class LAMMPS *, int, char **);
|
||||
~FixSRPREACT() override;
|
||||
int setmask() override;
|
||||
void init() override;
|
||||
void post_neighbor() override;
|
||||
int modify_param(int, char **) override;
|
||||
|
||||
private:
|
||||
class FixBondBreak *f_bb;
|
||||
char *idbreak;
|
||||
class FixBondCreate *f_bc;
|
||||
char *idcreate;
|
||||
};
|
||||
} // namespace LAMMPS_NS
|
||||
#endif
|
||||
#endif
|
||||
@ -33,7 +33,6 @@ Please contact Timothy Sirk for questions (tim.sirk@us.army.mil).
|
||||
#include "comm.h"
|
||||
#include "domain.h"
|
||||
#include "error.h"
|
||||
#include "fix.h"
|
||||
#include "fix_srp.h"
|
||||
#include "force.h"
|
||||
#include "memory.h"
|
||||
@ -84,7 +83,7 @@ PairSRP::PairSRP(LAMMPS *lmp) : Pair(lmp), fix_id(nullptr)
|
||||
// will be invoked before other fixes that migrate atoms
|
||||
// this is checked for in FixSRP
|
||||
|
||||
f_srp = dynamic_cast<FixSRP *>( modify->add_fix(fmt::format("{:02d}_FIX_SRP all SRP",srp_instance)));
|
||||
f_srp = dynamic_cast<FixSRP *>(modify->add_fix(fmt::format("{:02d}_FIX_SRP all SRP", srp_instance)));
|
||||
++srp_instance;
|
||||
}
|
||||
|
||||
@ -126,7 +125,7 @@ PairSRP::~PairSRP()
|
||||
}
|
||||
|
||||
// check nfix in case all fixes have already been deleted
|
||||
if (modify->nfix) modify->delete_fix(f_srp->id);
|
||||
if (modify->nfix && modify->get_fix_by_id(f_srp->id)!=nullptr) modify->delete_fix(f_srp->id);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -439,7 +438,7 @@ void PairSRP::coeff(int narg, char **arg)
|
||||
void PairSRP::init_style()
|
||||
{
|
||||
if (!force->newton_pair)
|
||||
error->all(FLERR,"PairSRP: Pair srp requires newton pair on");
|
||||
error->all(FLERR,"Pair srp requires newton pair on");
|
||||
|
||||
// verify that fix SRP is still defined and has not been changed.
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ class PairSRP : public Pair {
|
||||
void write_restart_settings(FILE *) override;
|
||||
void read_restart_settings(FILE *) override;
|
||||
|
||||
private:
|
||||
protected:
|
||||
inline void onetwoexclude(int *&, int &, int *&, int *&, int **&);
|
||||
inline void remapBonds(int &);
|
||||
void allocate();
|
||||
|
||||
230
src/MISC/pair_srp_react.cpp
Normal file
230
src/MISC/pair_srp_react.cpp
Normal file
@ -0,0 +1,230 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
Contributing author: Vaibhav Palkar (Kuksenok Lab, Clemson University)
|
||||
based on the pair srp code by Timothy Sirk (ARL)
|
||||
|
||||
This pair style interfaces the pair style srp with the stochastic reaction
|
||||
fixes bond/break and bond/create by updating pseudo beads corresponding to
|
||||
bonds as bond breaking and formation takes place. This is useful in
|
||||
simulation of reactions in polymers with soft potentials such as DPD.
|
||||
|
||||
See the doc page for pair_style srp/react command for usage instructions.
|
||||
|
||||
There is an example script for this package in examples/PACKAGES/srp_react/.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "pair_srp_react.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "citeme.h"
|
||||
#include "comm.h"
|
||||
#include "error.h"
|
||||
#include "fix_srp_react.h"
|
||||
#include "force.h"
|
||||
#include "memory.h"
|
||||
#include "modify.h"
|
||||
#include "neigh_list.h"
|
||||
#include "neighbor.h"
|
||||
#include "output.h"
|
||||
#include "thermo.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
static const char cite_srpreact[] =
|
||||
"@Article{palkar2022\n"
|
||||
" author = {Palkar, Vaibhav and Kuksenok, Olga},\n"
|
||||
" title = {Controlling Degradation and Erosion of Polymer Networks: Insights from Mesoscale Modeling},\n"
|
||||
" journal = {J. Phys. Chem. B},\n"
|
||||
" year = {2022},\n"
|
||||
" volume = {126},\n"
|
||||
" pages = {336-346}\n"
|
||||
"}\n\n";
|
||||
|
||||
static int srp_instance = 0;
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
constructor
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
PairSRPREACT::PairSRPREACT(LAMMPS *lmp) :
|
||||
PairSRP(lmp), idbreak(nullptr), idcreate(nullptr), bond_break(false), bond_create(false)
|
||||
{
|
||||
|
||||
if (lmp->citeme) lmp->citeme->add(cite_srpreact);
|
||||
|
||||
// pair srp/react has its own fix, hence delete fix srp instance
|
||||
// created in the constructor of pair srp
|
||||
for (auto ifix : modify->get_fix_by_style("SRP"))
|
||||
modify->delete_fix(ifix->id);
|
||||
|
||||
// similar to fix SRP, create fix SRP REACT instance here with unique fix id
|
||||
f_srp = (FixSRPREACT *) modify->add_fix(fmt::format("{:02d}_FIX_SRP_REACT all SRPREACT",srp_instance));
|
||||
++srp_instance;
|
||||
}
|
||||
|
||||
PairSRPREACT::~PairSRPREACT()
|
||||
{
|
||||
delete[] idbreak;
|
||||
delete[] idcreate;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
global settings
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairSRPREACT::settings(int narg, char **arg)
|
||||
{
|
||||
if (narg < 3 || narg > 8)
|
||||
error->all(FLERR,"Illegal pair_style command");
|
||||
|
||||
if (atom->tag_enable == 0)
|
||||
error->all(FLERR,"Pair_style srp/react requires atom IDs");
|
||||
|
||||
cut_global = utils::numeric(FLERR,arg[0],false,lmp);
|
||||
// wildcard
|
||||
if (strcmp(arg[1],"*") == 0) {
|
||||
btype = 0;
|
||||
} else {
|
||||
btype = utils::inumeric(FLERR,arg[1],false,lmp);
|
||||
if ((btype > atom->nbondtypes) || (btype <= 0))
|
||||
error->all(FLERR,"Illegal pair_style command");
|
||||
}
|
||||
|
||||
// settings
|
||||
midpoint = false;
|
||||
min = false;
|
||||
|
||||
if (strcmp(arg[2],"min") == 0) min = true;
|
||||
else if (strcmp(arg[2],"mid") == 0) midpoint = true;
|
||||
else
|
||||
error->all(FLERR,"Illegal pair_style command");
|
||||
|
||||
// default for bond/break and bond/create settings
|
||||
bond_create=false;
|
||||
bond_break=false;
|
||||
idbreak = nullptr;
|
||||
idcreate= nullptr;
|
||||
|
||||
// find whether id is of bond/break or bond/create
|
||||
const char *reactid = arg[3];
|
||||
if (utils::strmatch(modify->get_fix_by_id(reactid)->style,"^bond/break")) {
|
||||
bond_break = true;
|
||||
idbreak = utils::strdup(reactid);
|
||||
} else if (utils::strmatch(modify->get_fix_by_id(reactid)->style,"^bond/create")) {
|
||||
bond_create = true;
|
||||
idcreate = utils::strdup(reactid);
|
||||
} else error->all(FLERR,"Illegal pair_style command");
|
||||
|
||||
int iarg = 4;
|
||||
// default exclude 1-2
|
||||
// scaling for 1-2, etc not supported
|
||||
exclude = 1;
|
||||
|
||||
// use last atom type by default for bond particles
|
||||
bptype = atom->ntypes;
|
||||
|
||||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg],"exclude") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal pair srp command");
|
||||
exclude = utils::logical(FLERR, arg[iarg+1], false, lmp);
|
||||
if (min && !exclude) error->all(FLERR,"Illegal exclude option in pair srp command");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"bptype") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal pair srp command");
|
||||
bptype = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if ((bptype < 1) || (bptype > atom->ntypes))
|
||||
error->all(FLERR,"Illegal bond particle type for srp");
|
||||
iarg += 2;
|
||||
} else error->all(FLERR,"Illegal pair srp command");
|
||||
}
|
||||
|
||||
// reset cutoffs if explicitly set
|
||||
if (allocated) {
|
||||
int i,j;
|
||||
for (i = 1; i <= bptype; i++)
|
||||
for (j = i; j <= bptype; j++)
|
||||
if (setflag[i][j]) cut[i][j] = cut_global;
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
init specific to this pair style
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairSRPREACT::init_style()
|
||||
{
|
||||
if (!force->newton_pair)
|
||||
error->all(FLERR,"Pair srp/react requires newton pair on");
|
||||
|
||||
// verify that fix SRP is still defined and has not been changed.
|
||||
|
||||
if (strcmp(f_srp->style,"SRPREACT") != 0)
|
||||
error->all(FLERR,"Fix SRPREACT has been changed unexpectedly");
|
||||
|
||||
if (comm->me == 0)
|
||||
utils::logmesg(lmp,"Using type {} for bond particles\n",bptype);
|
||||
|
||||
// set bond and bond particle types in fix srp
|
||||
// bonds of this type will be represented by bond particles
|
||||
// if bond type is 0, then all bonds have bond particles
|
||||
// btype = bond type
|
||||
|
||||
char c0[20];
|
||||
char* arg0[2];
|
||||
sprintf(c0, "%d", btype);
|
||||
arg0[0] = (char *) "btype";
|
||||
arg0[1] = c0;
|
||||
f_srp->modify_params(2, arg0);
|
||||
|
||||
// bptype = bond particle type
|
||||
sprintf(c0, "%d", bptype);
|
||||
arg0[0] = (char *) "bptype";
|
||||
arg0[1] = c0;
|
||||
f_srp->modify_params(2, arg0);
|
||||
|
||||
// if using fix bond/break, set id of fix bond/break in fix srp
|
||||
// idbreak = id of fix bond break
|
||||
if (bond_break) {
|
||||
sprintf(c0, "%s", idbreak);
|
||||
arg0[0] = (char *) "bond/break";
|
||||
arg0[1] = c0;
|
||||
f_srp->modify_params(2, arg0);
|
||||
}
|
||||
|
||||
// if using fix bond/create, set id of fix bond/create in fix srp
|
||||
// idcreate = id of fix bond break
|
||||
if (bond_create) {
|
||||
sprintf(c0, "%s", idcreate);
|
||||
arg0[0] = (char *) "bond/create";
|
||||
arg0[1] = c0;
|
||||
f_srp->modify_params(2, arg0);
|
||||
}
|
||||
|
||||
// bond particles do not contribute to energy or virial
|
||||
// bond particles do not belong to group all
|
||||
// but thermo normalization is by nall
|
||||
// therefore should turn off normalization
|
||||
char *arg1[2];
|
||||
arg1[0] = (char *) "norm";
|
||||
arg1[1] = (char *) "no";
|
||||
output->thermo->modify_params(2, arg1);
|
||||
if (comm->me == 0) error->message(FLERR,"Thermo normalization turned off by pair srp/react");
|
||||
|
||||
neighbor->request(this,instance_me);
|
||||
}
|
||||
41
src/MISC/pair_srp_react.h
Normal file
41
src/MISC/pair_srp_react.h
Normal file
@ -0,0 +1,41 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
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(srp/react,PairSRPREACT);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_PAIR_SRP_REACT_H
|
||||
#define LMP_PAIR_SRP_REACT_H
|
||||
|
||||
#include "pair_srp.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class PairSRPREACT : public PairSRP {
|
||||
public:
|
||||
PairSRPREACT(class LAMMPS *);
|
||||
~PairSRPREACT() override;
|
||||
void settings(int, char **) override;
|
||||
void init_style() override;
|
||||
|
||||
private:
|
||||
char *idbreak;
|
||||
char *idcreate;
|
||||
bool bond_create, bond_break;
|
||||
};
|
||||
} // namespace LAMMPS_NS
|
||||
#endif
|
||||
#endif
|
||||
@ -235,8 +235,8 @@ void ComputeGrid::set_grid_local()
|
||||
|
||||
double ComputeGrid::memory_usage()
|
||||
{
|
||||
double nbytes = size_array_rows * size_array_cols * sizeof(double); // grid
|
||||
nbytes += size_array_rows * size_array_cols * sizeof(double); // gridall
|
||||
nbytes += size_array_cols * ngridlocal * sizeof(double); // gridlocal
|
||||
double nbytes = (double) size_array_rows * size_array_cols * sizeof(double); // grid
|
||||
nbytes += (double) size_array_rows * size_array_cols * sizeof(double); // gridall
|
||||
nbytes += (double) size_array_cols * ngridlocal * sizeof(double); // gridlocal
|
||||
return nbytes;
|
||||
}
|
||||
|
||||
@ -265,6 +265,6 @@ void ComputeGridLocal::assign_coords()
|
||||
|
||||
double ComputeGridLocal::memory_usage()
|
||||
{
|
||||
int nbytes = size_local_rows * size_local_cols * sizeof(double); // gridlocal
|
||||
double nbytes = (double) size_local_rows * size_local_cols * sizeof(double); // gridlocal
|
||||
return nbytes;
|
||||
}
|
||||
|
||||
@ -292,7 +292,7 @@ void ComputeSNAGrid::compute_array()
|
||||
}
|
||||
}
|
||||
|
||||
memset(&grid[0][0], 0, size_array_rows * size_array_cols * sizeof(double));
|
||||
memset(&grid[0][0], 0, sizeof(double) * size_array_rows * size_array_cols);
|
||||
|
||||
for (int iz = nzlo; iz <= nzhi; iz++)
|
||||
for (int iy = nylo; iy <= nyhi; iy++)
|
||||
|
||||
@ -58,7 +58,7 @@ PACKAGE = \
|
||||
bpm \
|
||||
brownian \
|
||||
cg-dna \
|
||||
cg-sdk \
|
||||
cg-spica \
|
||||
class2 \
|
||||
colloid \
|
||||
colvars \
|
||||
@ -154,7 +154,7 @@ PACKMOST = \
|
||||
bpm \
|
||||
brownian \
|
||||
cg-dna \
|
||||
cg-sdk \
|
||||
cg-spica \
|
||||
class2 \
|
||||
colloid \
|
||||
coreshell \
|
||||
|
||||
@ -17,32 +17,32 @@
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "omp_compat.h"
|
||||
#include "angle_sdk_omp.h"
|
||||
#include "angle_spica_omp.h"
|
||||
#include <cmath>
|
||||
#include "atom.h"
|
||||
#include "neighbor.h"
|
||||
|
||||
#include "comm.h"
|
||||
#include "force.h"
|
||||
#include "lj_sdk_common.h"
|
||||
#include "lj_spica_common.h"
|
||||
|
||||
#include "suffix.h"
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace LJSDKParms;
|
||||
using namespace LJSPICAParms;
|
||||
|
||||
#define SMALL 0.001
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
AngleSDKOMP::AngleSDKOMP(class LAMMPS *lmp)
|
||||
: AngleSDK(lmp), ThrOMP(lmp,THR_ANGLE)
|
||||
AngleSPICAOMP::AngleSPICAOMP(class LAMMPS *lmp)
|
||||
: AngleSPICA(lmp), ThrOMP(lmp,THR_ANGLE)
|
||||
{
|
||||
suffix_flag |= Suffix::OMP;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void AngleSDKOMP::compute(int eflag, int vflag)
|
||||
void AngleSPICAOMP::compute(int eflag, int vflag)
|
||||
{
|
||||
ev_init(eflag,vflag);
|
||||
|
||||
@ -81,7 +81,7 @@ void AngleSDKOMP::compute(int eflag, int vflag)
|
||||
}
|
||||
|
||||
template <int EVFLAG, int EFLAG, int NEWTON_BOND>
|
||||
void AngleSDKOMP::eval(int nfrom, int nto, ThrData * const thr)
|
||||
void AngleSPICAOMP::eval(int nfrom, int nto, ThrData * const thr)
|
||||
{
|
||||
int i1,i2,i3,n,type;
|
||||
double delx1,dely1,delz1,delx2,dely2,delz2,delx3,dely3,delz3;
|
||||
@ -171,6 +171,13 @@ void AngleSDKOMP::eval(int nfrom, int nto, ThrData * const thr)
|
||||
|
||||
f13 = r6inv*(lj1[type1][type3]*r6inv - lj2[type1][type3]);
|
||||
if (EFLAG) e13 = r6inv*(lj3[type1][type3]*r6inv - lj4[type1][type3]);
|
||||
|
||||
} else if (ljt == LJ12_5) {
|
||||
const double r5inv = r2inv*r2inv*sqrt(r2inv);
|
||||
const double r7inv = r5inv*r2inv;
|
||||
|
||||
f13 = r5inv*(lj1[type1][type3]*r7inv - lj2[type1][type3]);
|
||||
if (EFLAG) e13 = r5inv*(lj3[type1][type3]*r7inv - lj4[type1][type3]);
|
||||
}
|
||||
|
||||
// make sure energy is 0.0 at the cutoff.
|
||||
@ -17,22 +17,23 @@
|
||||
|
||||
#ifdef ANGLE_CLASS
|
||||
// clang-format off
|
||||
AngleStyle(sdk/omp,AngleSDKOMP);
|
||||
AngleStyle(spica/omp,AngleSPICAOMP);
|
||||
AngleStyle(sdk/omp,AngleSPICAOMP);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_ANGLE_SDK_OMP_H
|
||||
#define LMP_ANGLE_SDK_OMP_H
|
||||
#ifndef LMP_ANGLE_SPICA_OMP_H
|
||||
#define LMP_ANGLE_SPICA_OMP_H
|
||||
|
||||
#include "angle_sdk.h"
|
||||
#include "angle_spica.h"
|
||||
#include "thr_omp.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class AngleSDKOMP : public AngleSDK, public ThrOMP {
|
||||
class AngleSPICAOMP : public AngleSPICA, public ThrOMP {
|
||||
|
||||
public:
|
||||
AngleSDKOMP(class LAMMPS *lmp);
|
||||
AngleSPICAOMP(class LAMMPS *lmp);
|
||||
void compute(int, int) override;
|
||||
|
||||
private:
|
||||
@ -13,8 +13,8 @@
|
||||
Contributing author: Axel Kohlmeyer (Temple U)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "pair_lj_sdk_coul_long_omp.h"
|
||||
#include "lj_sdk_common.h"
|
||||
#include "pair_lj_spica_coul_long_omp.h"
|
||||
#include "lj_spica_common.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
@ -26,11 +26,11 @@
|
||||
|
||||
#include "omp_compat.h"
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace LJSDKParms;
|
||||
using namespace LJSPICAParms;
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
PairLJSDKCoulLongOMP::PairLJSDKCoulLongOMP(LAMMPS *lmp) :
|
||||
PairLJSDKCoulLong(lmp), ThrOMP(lmp, THR_PAIR)
|
||||
PairLJSPICACoulLongOMP::PairLJSPICACoulLongOMP(LAMMPS *lmp) :
|
||||
PairLJSPICACoulLong(lmp), ThrOMP(lmp, THR_PAIR)
|
||||
{
|
||||
suffix_flag |= Suffix::OMP;
|
||||
respa_enable = 0;
|
||||
@ -38,7 +38,7 @@ PairLJSDKCoulLongOMP::PairLJSDKCoulLongOMP(LAMMPS *lmp) :
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairLJSDKCoulLongOMP::compute(int eflag, int vflag)
|
||||
void PairLJSPICACoulLongOMP::compute(int eflag, int vflag)
|
||||
{
|
||||
ev_init(eflag,vflag);
|
||||
|
||||
@ -78,7 +78,7 @@ void PairLJSDKCoulLongOMP::compute(int eflag, int vflag)
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template <int EVFLAG, int EFLAG, int NEWTON_PAIR>
|
||||
void PairLJSDKCoulLongOMP::eval_thr(int iifrom, int iito, ThrData * const thr)
|
||||
void PairLJSPICACoulLongOMP::eval_thr(int iifrom, int iito, ThrData * const thr)
|
||||
{
|
||||
|
||||
const auto * _noalias const x = (dbl3_t *) atom->x[0];
|
||||
@ -195,6 +195,15 @@ void PairLJSDKCoulLongOMP::eval_thr(int iifrom, int iito, ThrData * const thr)
|
||||
if (EFLAG)
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r6inv
|
||||
- lj4[itype][jtype]) - offset[itype][jtype];
|
||||
|
||||
} else if (ljt == LJ12_5) {
|
||||
const double r5inv = r2inv*r2inv*sqrt(r2inv);
|
||||
const double r7inv = r5inv*r2inv;
|
||||
forcelj = r5inv*(lj1[itype][jtype]*r7inv
|
||||
- lj2[itype][jtype]);
|
||||
if (EFLAG)
|
||||
evdwl = r5inv*(lj3[itype][jtype]*r7inv
|
||||
- lj4[itype][jtype]) - offset[itype][jtype];
|
||||
}
|
||||
|
||||
if (sbindex) {
|
||||
@ -228,10 +237,10 @@ void PairLJSDKCoulLongOMP::eval_thr(int iifrom, int iito, ThrData * const thr)
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double PairLJSDKCoulLongOMP::memory_usage()
|
||||
double PairLJSPICACoulLongOMP::memory_usage()
|
||||
{
|
||||
double bytes = memory_usage_thr();
|
||||
bytes += PairLJSDKCoulLong::memory_usage();
|
||||
bytes += PairLJSPICACoulLong::memory_usage();
|
||||
|
||||
return bytes;
|
||||
}
|
||||
@ -17,22 +17,23 @@
|
||||
|
||||
#ifdef PAIR_CLASS
|
||||
// clang-format off
|
||||
PairStyle(lj/sdk/coul/long/omp,PairLJSDKCoulLongOMP);
|
||||
PairStyle(lj/spica/coul/long/omp,PairLJSPICACoulLongOMP);
|
||||
PairStyle(lj/sdk/coul/long/omp,PairLJSPICACoulLongOMP);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_PAIR_LJ_SDK_COUL_LONG_OMP_H
|
||||
#define LMP_PAIR_LJ_SDK_COUL_LONG_OMP_H
|
||||
#ifndef LMP_PAIR_LJ_SPICA_COUL_LONG_OMP_H
|
||||
#define LMP_PAIR_LJ_SPICA_COUL_LONG_OMP_H
|
||||
|
||||
#include "pair_lj_sdk_coul_long.h"
|
||||
#include "pair_lj_spica_coul_long.h"
|
||||
#include "thr_omp.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class PairLJSDKCoulLongOMP : public PairLJSDKCoulLong, public ThrOMP {
|
||||
class PairLJSPICACoulLongOMP : public PairLJSPICACoulLong, public ThrOMP {
|
||||
|
||||
public:
|
||||
PairLJSDKCoulLongOMP(class LAMMPS *);
|
||||
PairLJSPICACoulLongOMP(class LAMMPS *);
|
||||
|
||||
void compute(int, int) override;
|
||||
double memory_usage() override;
|
||||
@ -14,8 +14,8 @@
|
||||
This style is a simplified re-implementation of the CG/CMM pair style
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "pair_lj_sdk_coul_msm_omp.h"
|
||||
#include "lj_sdk_common.h"
|
||||
#include "pair_lj_spica_coul_msm_omp.h"
|
||||
#include "lj_spica_common.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
@ -29,11 +29,11 @@
|
||||
|
||||
#include "omp_compat.h"
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace LJSDKParms;
|
||||
using namespace LJSPICAParms;
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
PairLJSDKCoulMSMOMP::PairLJSDKCoulMSMOMP(LAMMPS *lmp) :
|
||||
PairLJSDKCoulMSM(lmp), ThrOMP(lmp, THR_PAIR)
|
||||
PairLJSPICACoulMSMOMP::PairLJSPICACoulMSMOMP(LAMMPS *lmp) :
|
||||
PairLJSPICACoulMSM(lmp), ThrOMP(lmp, THR_PAIR)
|
||||
{
|
||||
suffix_flag |= Suffix::OMP;
|
||||
respa_enable = 0;
|
||||
@ -41,7 +41,7 @@ PairLJSDKCoulMSMOMP::PairLJSDKCoulMSMOMP(LAMMPS *lmp) :
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairLJSDKCoulMSMOMP::compute(int eflag, int vflag)
|
||||
void PairLJSPICACoulMSMOMP::compute(int eflag, int vflag)
|
||||
{
|
||||
if (force->kspace->scalar_pressure_flag)
|
||||
error->all(FLERR,"Must use 'kspace_modify pressure/scalar no' "
|
||||
@ -85,7 +85,7 @@ void PairLJSDKCoulMSMOMP::compute(int eflag, int vflag)
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template <int EVFLAG, int EFLAG, int NEWTON_PAIR>
|
||||
void PairLJSDKCoulMSMOMP::eval_msm_thr(int iifrom, int iito, ThrData * const thr)
|
||||
void PairLJSPICACoulMSMOMP::eval_msm_thr(int iifrom, int iito, ThrData * const thr)
|
||||
{
|
||||
|
||||
const double * const * const x = atom->x;
|
||||
@ -194,6 +194,15 @@ void PairLJSDKCoulMSMOMP::eval_msm_thr(int iifrom, int iito, ThrData * const thr
|
||||
if (EFLAG)
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r6inv
|
||||
- lj4[itype][jtype]) - offset[itype][jtype];
|
||||
|
||||
} else if (ljt == LJ12_5) {
|
||||
const double r5inv = r2inv*r2inv*sqrt(r2inv);
|
||||
const double r7inv = r5inv*r2inv;
|
||||
forcelj = r5inv*(lj1[itype][jtype]*r7inv
|
||||
- lj2[itype][jtype]);
|
||||
if (EFLAG)
|
||||
evdwl = r5inv*(lj3[itype][jtype]*r7inv
|
||||
- lj4[itype][jtype]) - offset[itype][jtype];
|
||||
}
|
||||
|
||||
if (sbindex) {
|
||||
@ -227,10 +236,10 @@ void PairLJSDKCoulMSMOMP::eval_msm_thr(int iifrom, int iito, ThrData * const thr
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double PairLJSDKCoulMSMOMP::memory_usage()
|
||||
double PairLJSPICACoulMSMOMP::memory_usage()
|
||||
{
|
||||
double bytes = memory_usage_thr();
|
||||
bytes += PairLJSDKCoulMSM::memory_usage();
|
||||
bytes += PairLJSPICACoulMSM::memory_usage();
|
||||
|
||||
return bytes;
|
||||
}
|
||||
@ -17,22 +17,23 @@
|
||||
|
||||
#ifdef PAIR_CLASS
|
||||
// clang-format off
|
||||
PairStyle(lj/sdk/coul/msm/omp,PairLJSDKCoulMSMOMP);
|
||||
PairStyle(lj/spica/coul/msm/omp,PairLJSPICACoulMSMOMP);
|
||||
PairStyle(lj/sdk/coul/msm/omp,PairLJSPICACoulMSMOMP);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_PAIR_LJ_SDK_COUL_MSM_OMP_H
|
||||
#define LMP_PAIR_LJ_SDK_COUL_MSM_OMP_H
|
||||
#ifndef LMP_PAIR_LJ_SPICA_COUL_MSM_OMP_H
|
||||
#define LMP_PAIR_LJ_SPICA_COUL_MSM_OMP_H
|
||||
|
||||
#include "pair_lj_sdk_coul_msm.h"
|
||||
#include "pair_lj_spica_coul_msm.h"
|
||||
#include "thr_omp.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class PairLJSDKCoulMSMOMP : public PairLJSDKCoulMSM, public ThrOMP {
|
||||
class PairLJSPICACoulMSMOMP : public PairLJSPICACoulMSM, public ThrOMP {
|
||||
|
||||
public:
|
||||
PairLJSDKCoulMSMOMP(class LAMMPS *);
|
||||
PairLJSPICACoulMSMOMP(class LAMMPS *);
|
||||
|
||||
void compute(int, int) override;
|
||||
double memory_usage() override;
|
||||
@ -14,8 +14,8 @@
|
||||
This style is a simplified re-implementation of the CG/CMM pair style
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "pair_lj_sdk_omp.h"
|
||||
#include "lj_sdk_common.h"
|
||||
#include "pair_lj_spica_omp.h"
|
||||
#include "lj_spica_common.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
@ -27,12 +27,12 @@
|
||||
|
||||
#include "omp_compat.h"
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace LJSDKParms;
|
||||
using namespace LJSPICAParms;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
PairLJSDKOMP::PairLJSDKOMP(LAMMPS *lmp) :
|
||||
PairLJSDK(lmp), ThrOMP(lmp, THR_PAIR)
|
||||
PairLJSPICAOMP::PairLJSPICAOMP(LAMMPS *lmp) :
|
||||
PairLJSPICA(lmp), ThrOMP(lmp, THR_PAIR)
|
||||
{
|
||||
suffix_flag |= Suffix::OMP;
|
||||
respa_enable = 0;
|
||||
@ -40,7 +40,7 @@ PairLJSDKOMP::PairLJSDKOMP(LAMMPS *lmp) :
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairLJSDKOMP::compute(int eflag, int vflag)
|
||||
void PairLJSPICAOMP::compute(int eflag, int vflag)
|
||||
{
|
||||
ev_init(eflag,vflag);
|
||||
|
||||
@ -80,7 +80,7 @@ void PairLJSDKOMP::compute(int eflag, int vflag)
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template <int EVFLAG, int EFLAG, int NEWTON_PAIR>
|
||||
void PairLJSDKOMP::eval_thr(int iifrom, int iito, ThrData * const thr)
|
||||
void PairLJSPICAOMP::eval_thr(int iifrom, int iito, ThrData * const thr)
|
||||
{
|
||||
int i,j,ii,jj,jtype;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair;
|
||||
@ -153,6 +153,15 @@ void PairLJSDKOMP::eval_thr(int iifrom, int iito, ThrData * const thr)
|
||||
if (EFLAG)
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r6inv
|
||||
- lj4[itype][jtype]) - offset[itype][jtype];
|
||||
|
||||
} else if (ljt == LJ12_5) {
|
||||
const double r5inv = r2inv*r2inv*sqrt(r2inv);
|
||||
const double r7inv = r5inv*r2inv;
|
||||
forcelj = r5inv*(lj1[itype][jtype]*r7inv
|
||||
- lj2[itype][jtype]);
|
||||
if (EFLAG)
|
||||
evdwl = r5inv*(lj3[itype][jtype]*r7inv
|
||||
- lj4[itype][jtype]) - offset[itype][jtype];
|
||||
} else continue;
|
||||
|
||||
fpair = factor_lj*forcelj*r2inv;
|
||||
@ -179,10 +188,10 @@ void PairLJSDKOMP::eval_thr(int iifrom, int iito, ThrData * const thr)
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double PairLJSDKOMP::memory_usage()
|
||||
double PairLJSPICAOMP::memory_usage()
|
||||
{
|
||||
double bytes = memory_usage_thr();
|
||||
bytes += PairLJSDK::memory_usage();
|
||||
bytes += PairLJSPICA::memory_usage();
|
||||
|
||||
return bytes;
|
||||
}
|
||||
@ -17,22 +17,23 @@
|
||||
|
||||
#ifdef PAIR_CLASS
|
||||
// clang-format off
|
||||
PairStyle(lj/sdk/omp,PairLJSDKOMP);
|
||||
PairStyle(lj/spica/omp,PairLJSPICAOMP);
|
||||
PairStyle(lj/sdk/omp,PairLJSPICAOMP);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_PAIR_LJ_SDK_OMP_H
|
||||
#define LMP_PAIR_LJ_SDK_OMP_H
|
||||
#ifndef LMP_PAIR_LJ_SPICA_OMP_H
|
||||
#define LMP_PAIR_LJ_SPICA_OMP_H
|
||||
|
||||
#include "pair_lj_sdk.h"
|
||||
#include "pair_lj_spica.h"
|
||||
#include "thr_omp.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class PairLJSDKOMP : public PairLJSDK, public ThrOMP {
|
||||
class PairLJSPICAOMP : public PairLJSPICA, public ThrOMP {
|
||||
|
||||
public:
|
||||
PairLJSDKOMP(class LAMMPS *);
|
||||
PairLJSPICAOMP(class LAMMPS *);
|
||||
|
||||
void compute(int, int) override;
|
||||
double memory_usage() override;
|
||||
@ -1042,7 +1042,7 @@ void ThrOMP::ev_tally_thr(Angle * const angle, const int i, const int j, const i
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
tally energy and virial from 1-3 repulsion of SDK angle into accumulators
|
||||
tally energy and virial from 1-3 repulsion of SPICA angle into accumulators
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void ThrOMP::ev_tally13_thr(Angle * const angle, const int i1, const int i3,
|
||||
|
||||
@ -51,6 +51,30 @@ lmpinstalledpkgs.h
|
||||
lmpgitversion.h
|
||||
mliap_model_python_couple.cpp
|
||||
mliap_model_python_couple.h
|
||||
# renamed on 11 July 2022
|
||||
lj_sdk_common.h
|
||||
angle_sdk.cpp
|
||||
pair_lj_sdk.cpp
|
||||
pair_lj_sdk_coul_msm.cpp
|
||||
pair_lj_sdk_coul_long.h
|
||||
pair_lj_sdk_coul_msm.h
|
||||
angle_sdk.h
|
||||
pair_lj_sdk.h
|
||||
pair_lj_sdk_coul_long.cpp
|
||||
pair_lj_sdk_kokkos.h
|
||||
pair_lj_sdk_kokkos.cpp
|
||||
pair_lj_sdk_gpu.cpp
|
||||
pair_lj_sdk_gpu.h
|
||||
pair_lj_sdk_coul_long_gpu.cpp
|
||||
pair_lj_sdk_coul_long_gpu.h
|
||||
pair_lj_sdk_omp.h
|
||||
pair_lj_sdk_coul_msm_omp.cpp
|
||||
pair_lj_sdk_coul_long_omp.h
|
||||
angle_sdk_omp.cpp
|
||||
pair_lj_sdk_omp.cpp
|
||||
pair_lj_sdk_coul_msm_omp.h
|
||||
pair_lj_sdk_coul_long_omp.cpp
|
||||
angle_sdk_omp.h
|
||||
# removed on 8 April 2022
|
||||
fix_client_md.cpp
|
||||
fix_client_md.h
|
||||
|
||||
@ -289,9 +289,9 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) :
|
||||
char *str = utils::strdup(&arg[iarg][2]);
|
||||
var_id[NEVERY][rxn] = input->variable->find(str);
|
||||
if (var_id[NEVERY][rxn] < 0)
|
||||
error->all(FLERR,"Bond/react: Variable name does not exist");
|
||||
error->all(FLERR,"Fix bond/react: Variable name does not exist");
|
||||
if (!input->variable->equalstyle(var_id[NEVERY][rxn]))
|
||||
error->all(FLERR,"Bond/react: Variable is not equal-style");
|
||||
error->all(FLERR,"Fix bond/react: Variable is not equal-style");
|
||||
var_flag[NEVERY][rxn] = 1;
|
||||
delete [] str;
|
||||
} else {
|
||||
@ -305,9 +305,9 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) :
|
||||
char *str = utils::strdup(&arg[iarg][2]);
|
||||
var_id[RMIN][rxn] = input->variable->find(str);
|
||||
if (var_id[RMIN][rxn] < 0)
|
||||
error->all(FLERR,"Bond/react: Variable name does not exist");
|
||||
error->all(FLERR,"Fix bond/react: Variable name does not exist");
|
||||
if (!input->variable->equalstyle(var_id[RMIN][rxn]))
|
||||
error->all(FLERR,"Bond/react: Variable is not equal-style");
|
||||
error->all(FLERR,"Fix bond/react: Variable is not equal-style");
|
||||
double cutoff = input->variable->compute_equal(var_id[RMIN][rxn]);
|
||||
cutsq[rxn][0] = cutoff*cutoff;
|
||||
var_flag[RMIN][rxn] = 1;
|
||||
@ -324,9 +324,9 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) :
|
||||
char *str = utils::strdup(&arg[iarg][2]);
|
||||
var_id[RMAX][rxn] = input->variable->find(str);
|
||||
if (var_id[RMAX][rxn] < 0)
|
||||
error->all(FLERR,"Bond/react: Variable name does not exist");
|
||||
error->all(FLERR,"Fix bond/react: Variable name does not exist");
|
||||
if (!input->variable->equalstyle(var_id[RMAX][rxn]))
|
||||
error->all(FLERR,"Bond/react: Variable is not equal-style");
|
||||
error->all(FLERR,"Fix bond/react: Variable is not equal-style");
|
||||
double cutoff = input->variable->compute_equal(var_id[RMAX][rxn]);
|
||||
cutsq[rxn][1] = cutoff*cutoff;
|
||||
var_flag[RMAX][rxn] = 1;
|
||||
@ -359,9 +359,9 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) :
|
||||
char *str = utils::strdup(&arg[iarg+1][2]);
|
||||
var_id[PROB][rxn] = input->variable->find(str);
|
||||
if (var_id[PROB][rxn] < 0)
|
||||
error->all(FLERR,"Bond/react: Variable name does not exist");
|
||||
error->all(FLERR,"Fix bond/react: Variable name does not exist");
|
||||
if (!input->variable->equalstyle(var_id[PROB][rxn]))
|
||||
error->all(FLERR,"Bond/react: Variable is not equal-style");
|
||||
error->all(FLERR,"Fix bond/react: Variable is not equal-style");
|
||||
fraction[rxn] = input->variable->compute_equal(var_id[PROB][rxn]);
|
||||
var_flag[PROB][rxn] = 1;
|
||||
delete [] str;
|
||||
@ -397,7 +397,7 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) :
|
||||
if (strcmp(arg[iarg+1],"no") == 0) custom_charges_fragid[rxn] = -1; //default
|
||||
else {
|
||||
custom_charges_fragid[rxn] = atom->molecules[unreacted_mol[rxn]]->findfragment(arg[iarg+1]);
|
||||
if (custom_charges_fragid[rxn] < 0) error->one(FLERR,"Bond/react: Molecule fragment for "
|
||||
if (custom_charges_fragid[rxn] < 0) error->one(FLERR,"Fix bond/react: Molecule fragment for "
|
||||
"'custom_charges' keyword does not exist");
|
||||
}
|
||||
iarg += 2;
|
||||
@ -407,7 +407,7 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) :
|
||||
if (strcmp(arg[iarg+1],"off") == 0) molecule_keyword[rxn] = OFF; //default
|
||||
else if (strcmp(arg[iarg+1],"inter") == 0) molecule_keyword[rxn] = INTER;
|
||||
else if (strcmp(arg[iarg+1],"intra") == 0) molecule_keyword[rxn] = INTRA;
|
||||
else error->one(FLERR,"Bond/react: Illegal option for 'molecule' keyword");
|
||||
else error->one(FLERR,"Fix bond/react: Illegal option for 'molecule' keyword");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"modify_create") == 0) {
|
||||
if (iarg++ > narg) error->all(FLERR,"Illegal fix bond/react command: "
|
||||
@ -419,7 +419,7 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) :
|
||||
if (strcmp(arg[iarg+1],"all") == 0) modify_create_fragid[rxn] = -1; //default
|
||||
else {
|
||||
modify_create_fragid[rxn] = atom->molecules[reacted_mol[rxn]]->findfragment(arg[iarg+1]);
|
||||
if (modify_create_fragid[rxn] < 0) error->one(FLERR,"Bond/react: Molecule fragment for "
|
||||
if (modify_create_fragid[rxn] < 0) error->one(FLERR,"Fix bond/react: Molecule fragment for "
|
||||
"'modify_create' keyword does not exist");
|
||||
}
|
||||
iarg += 2;
|
||||
@ -477,9 +477,9 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) :
|
||||
read(i);
|
||||
fclose(fp);
|
||||
if (ncreate == 0 && onemol->natoms != twomol->natoms)
|
||||
error->all(FLERR,"Bond/react: Reaction templates must contain the same number of atoms");
|
||||
error->all(FLERR,"Fix bond/react: Reaction templates must contain the same number of atoms");
|
||||
else if (ncreate > 0 && onemol->natoms + ncreate != twomol->natoms)
|
||||
error->all(FLERR,"Bond/react: Incorrect number of created atoms");
|
||||
error->all(FLERR,"Fix bond/react: Incorrect number of created atoms");
|
||||
iatomtype[i] = onemol->type[ibonding[i]-1];
|
||||
jatomtype[i] = onemol->type[jbonding[i]-1];
|
||||
find_landlocked_atoms(i);
|
||||
@ -507,7 +507,7 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) :
|
||||
delete [] files;
|
||||
|
||||
if (atom->molecular != Atom::MOLECULAR)
|
||||
error->all(FLERR,"Bond/react: Cannot use fix bond/react with non-molecular systems");
|
||||
error->all(FLERR,"Fix bond/react: Cannot use fix bond/react with non-molecular systems");
|
||||
|
||||
// check if bonding atoms are 1-2, 1-3, or 1-4 bonded neighbors
|
||||
// if so, we don't need non-bonded neighbor list
|
||||
@ -799,7 +799,7 @@ void FixBondReact::init()
|
||||
for (int i = 0; i < nreacts; i++) {
|
||||
if (!utils::strmatch(force->pair_style,"^hybrid"))
|
||||
if (force->pair == nullptr || cutsq[i][1] > force->pair->cutsq[iatomtype[i]][jatomtype[i]])
|
||||
error->all(FLERR,"Bond/react: Fix bond/react cutoff is longer than pairwise cutoff");
|
||||
error->all(FLERR,"Fix bond/react: Fix bond/react cutoff is longer than pairwise cutoff");
|
||||
}
|
||||
|
||||
// need a half neighbor list, built every Nevery steps
|
||||
@ -1357,7 +1357,7 @@ void FixBondReact::superimpose_algorithm()
|
||||
// let's go ahead and catch the simplest of hangs
|
||||
//if (hang_catch > onemol->natoms*4)
|
||||
if (hang_catch > atom->nlocal*30) {
|
||||
error->one(FLERR,"Bond/react: Excessive iteration of superimpose algorithm. "
|
||||
error->one(FLERR,"Fix bond/react: Excessive iteration of superimpose algorithm. "
|
||||
"Please check that all pre-reaction template atoms are linked to an initiator atom, "
|
||||
"via at least one path that does not involve edge atoms.");
|
||||
}
|
||||
@ -1482,7 +1482,7 @@ void FixBondReact::make_a_guess()
|
||||
|
||||
for (int i = 0; i < nxspecial[atom->map(glove[pion][1])][0]; i++) {
|
||||
if (atom->map(xspecial[atom->map(glove[pion][1])][i]) < 0) {
|
||||
error->one(FLERR,"Bond/react: Fix bond/react needs ghost atoms from further away"); // parallel issues.
|
||||
error->one(FLERR,"Fix bond/react: Fix bond/react needs ghost atoms from further away"); // parallel issues.
|
||||
}
|
||||
if (i_limit_tags[(int)atom->map(xspecial[atom->map(glove[pion][1])][i])] != 0) {
|
||||
status = GUESSFAIL;
|
||||
@ -1593,7 +1593,7 @@ void FixBondReact::check_a_neighbor()
|
||||
|
||||
//another check for ghost atoms. perhaps remove the one in make_a_guess
|
||||
if (atom->map(glove[(int)onemol_xspecial[pion][neigh]-1][1]) < 0) {
|
||||
error->one(FLERR,"Bond/react: Fix bond/react needs ghost atoms from further away");
|
||||
error->one(FLERR,"Fix bond/react: Fix bond/react needs ghost atoms from further away");
|
||||
}
|
||||
|
||||
for (int j = 0; j < onemol_nxspecial[onemol_xspecial[pion][neigh]-1][0]; j++) {
|
||||
@ -1645,7 +1645,7 @@ void FixBondReact::check_a_neighbor()
|
||||
|
||||
//another check for ghost atoms. perhaps remove the one in make_a_guess
|
||||
if (atom->map(glove[(int)onemol_xspecial[pion][neigh]-1][1]) < 0) {
|
||||
error->one(FLERR,"Bond/react: Fix bond/react needs ghost atoms from further away");
|
||||
error->one(FLERR,"Fix bond/react: Fix bond/react needs ghost atoms from further away");
|
||||
}
|
||||
|
||||
for (int ii = 0; ii < onemol_nxspecial[onemol_xspecial[pion][neigh]-1][0]; ii++) {
|
||||
@ -1687,7 +1687,7 @@ void FixBondReact::crosscheck_the_neighbor()
|
||||
glove[onemol_xspecial[pion][trace]-1][0] == 0) {
|
||||
|
||||
if (avail_guesses == MAXGUESS) {
|
||||
error->warning(FLERR,"Bond/react: Fix bond/react failed because MAXGUESS set too small. ask developer for info");
|
||||
error->warning(FLERR,"Fix bond/react: Fix bond/react failed because MAXGUESS set too small. ask developer for info");
|
||||
status = GUESSFAIL;
|
||||
return;
|
||||
}
|
||||
@ -1724,17 +1724,7 @@ void FixBondReact::inner_crosscheck_loop()
|
||||
|
||||
int num_choices = 0;
|
||||
for (int i = 0; i < nfirst_neighs; i++) {
|
||||
|
||||
int already_assigned = 0;
|
||||
for (int j = 0; j < onemol->natoms; j++) {
|
||||
if (glove[j][1] == xspecial[atom->map(glove[pion][1])][i]) {
|
||||
already_assigned = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (already_assigned == 0 &&
|
||||
type[(int)atom->map(xspecial[atom->map(glove[pion][1])][i])] == onemol->type[(int)onemol_xspecial[pion][neigh]-1]) {
|
||||
if (type[(int)atom->map(xspecial[atom->map(glove[pion][1])][i])] == onemol->type[(int)onemol_xspecial[pion][neigh]-1]) {
|
||||
if (num_choices > 5) { // here failed because too many identical first neighbors. but really no limit if situation arises
|
||||
status = GUESSFAIL;
|
||||
return;
|
||||
@ -1748,15 +1738,32 @@ void FixBondReact::inner_crosscheck_loop()
|
||||
// ...actually, avail_guesses should never be zero here anyway
|
||||
if (guess_branch[avail_guesses-1] == 0) guess_branch[avail_guesses-1] = num_choices;
|
||||
|
||||
//std::size_t size = sizeof(tag_choices) / sizeof(tag_choices[0]);
|
||||
std::sort(tag_choices, tag_choices + num_choices); //, std::greater<int>());
|
||||
glove[onemol_xspecial[pion][neigh]-1][0] = onemol_xspecial[pion][neigh];
|
||||
glove[onemol_xspecial[pion][neigh]-1][1] = tag_choices[guess_branch[avail_guesses-1]-1];
|
||||
guess_branch[avail_guesses-1]--;
|
||||
std::sort(tag_choices, tag_choices + num_choices);
|
||||
for (int i = guess_branch[avail_guesses-1]-1; i >= 0; i--) {
|
||||
int already_assigned = 0;
|
||||
for (int j = 0; j < onemol->natoms; j++) {
|
||||
if (glove[j][1] == tag_choices[i]) {
|
||||
already_assigned = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (already_assigned == 1) {
|
||||
guess_branch[avail_guesses-1]--;
|
||||
if (guess_branch[avail_guesses-1] == 0) {
|
||||
status = REJECT;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
glove[onemol_xspecial[pion][neigh]-1][0] = onemol_xspecial[pion][neigh];
|
||||
glove[onemol_xspecial[pion][neigh]-1][1] = tag_choices[i];
|
||||
guess_branch[avail_guesses-1]--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//another check for ghost atoms. perhaps remove the one in make_a_guess
|
||||
if (atom->map(glove[(int)onemol_xspecial[pion][neigh]-1][1]) < 0) {
|
||||
error->one(FLERR,"Bond/react: Fix bond/react needs ghost atoms from further away");
|
||||
error->one(FLERR,"Fix bond/react: Fix bond/react needs ghost atoms from further away");
|
||||
}
|
||||
|
||||
if (guess_branch[avail_guesses-1] == 0) avail_guesses--;
|
||||
@ -2110,7 +2117,8 @@ get per-atom variable names used by custom constraint
|
||||
|
||||
void FixBondReact::customvarnames()
|
||||
{
|
||||
int pos,pos1,pos2,pos3,prev3;
|
||||
std::size_t pos,pos1,pos2,pos3;
|
||||
int prev3;
|
||||
std::string varstr,argstr,varid;
|
||||
|
||||
// search all constraints' varstr for special 'rxn' functions
|
||||
@ -2124,19 +2132,19 @@ void FixBondReact::customvarnames()
|
||||
prev3 = -1;
|
||||
while (true) {
|
||||
// find next reaction special function occurrence
|
||||
pos1 = INT_MAX;
|
||||
pos1 = std::string::npos;
|
||||
for (int i = 0; i < nrxnfunction; i++) {
|
||||
pos = varstr.find(rxnfunclist[i],prev3+1);
|
||||
if (pos == std::string::npos) continue;
|
||||
if (pos < pos1) pos1 = pos;
|
||||
}
|
||||
if (pos1 == INT_MAX) break;
|
||||
if (pos1 == std::string::npos) break;
|
||||
|
||||
pos2 = varstr.find("(",pos1);
|
||||
pos3 = varstr.find(")",pos2);
|
||||
if (pos2 == std::string::npos || pos3 == std::string::npos)
|
||||
error->all(FLERR,"Bond/react: Illegal rxn function syntax\n");
|
||||
prev3 = pos3;
|
||||
error->all(FLERR,"Fix bond/react: Illegal rxn function syntax\n");
|
||||
prev3 = (int)pos3;
|
||||
argstr = varstr.substr(pos2+1,pos3-pos2-1);
|
||||
argstr.erase(remove_if(argstr.begin(), argstr.end(), isspace), argstr.end()); // remove whitespace
|
||||
pos2 = argstr.find(",");
|
||||
@ -2181,15 +2189,15 @@ void FixBondReact::get_customvars()
|
||||
}
|
||||
for (int i = 0; i < ncustomvars; i++) {
|
||||
varid = customvarstrs[i];
|
||||
if (varid.substr(0,2) != "v_") error->all(FLERR,"Bond/react: Reaction special function variable "
|
||||
if (varid.substr(0,2) != "v_") error->all(FLERR,"Fix bond/react: Reaction special function variable "
|
||||
"name should begin with 'v_'");
|
||||
varid = varid.substr(2);
|
||||
int ivar = input->variable->find(varid.c_str());
|
||||
if (ivar < 0)
|
||||
error->all(FLERR,"Bond/react: Reaction special function variable "
|
||||
error->all(FLERR,"Fix bond/react: Reaction special function variable "
|
||||
"name does not exist");
|
||||
if (!input->variable->atomstyle(ivar))
|
||||
error->all(FLERR,"Bond/react: Reaction special function must "
|
||||
error->all(FLERR,"Fix bond/react: Reaction special function must "
|
||||
"reference an atom-style variable");
|
||||
|
||||
input->variable->compute_atom(ivar,igroup,tempvvec,1,0);
|
||||
@ -2204,7 +2212,8 @@ evaulate expression for variable constraint
|
||||
|
||||
double FixBondReact::custom_constraint(const std::string& varstr)
|
||||
{
|
||||
int pos,pos1,pos2,pos3,irxnfunc;
|
||||
std::size_t pos,pos1,pos2,pos3;
|
||||
int irxnfunc;
|
||||
int prev3 = -1;
|
||||
double val;
|
||||
std::string argstr,varid,fragid,evlcat;
|
||||
@ -2213,7 +2222,7 @@ double FixBondReact::custom_constraint(const std::string& varstr)
|
||||
// search varstr for special 'rxn' functions
|
||||
while (true) {
|
||||
// find next reaction special function occurrence
|
||||
pos1 = INT_MAX;
|
||||
pos1 = std::string::npos;
|
||||
for (int i = 0; i < nrxnfunction; i++) {
|
||||
pos = varstr.find(rxnfunclist[i],prev3+1);
|
||||
if (pos == std::string::npos) continue;
|
||||
@ -2222,13 +2231,13 @@ double FixBondReact::custom_constraint(const std::string& varstr)
|
||||
irxnfunc = i;
|
||||
}
|
||||
}
|
||||
if (pos1 == INT_MAX) break;
|
||||
if (pos1 == std::string::npos) break;
|
||||
|
||||
fragid = "all"; // operate over entire reaction site by default
|
||||
pos2 = varstr.find("(",pos1);
|
||||
pos3 = varstr.find(")",pos2);
|
||||
if (pos2 == std::string::npos || pos3 == std::string::npos)
|
||||
error->one(FLERR,"Bond/react: Illegal rxn function syntax\n");
|
||||
error->one(FLERR,"Fix bond/react: Illegal rxn function syntax\n");
|
||||
evlstr.push_back(varstr.substr(prev3+1,pos1-(prev3+1)));
|
||||
prev3 = pos3;
|
||||
argstr = varstr.substr(pos2+1,pos3-pos2-1);
|
||||
@ -2267,13 +2276,13 @@ double FixBondReact::rxnfunction(const std::string& rxnfunc, const std::string&
|
||||
// variable name should always be found, at this point
|
||||
// however, let's double check for completeness
|
||||
if (ivar < 0)
|
||||
error->one(FLERR,"Bond/react: Reaction special function variable "
|
||||
error->one(FLERR,"Fix bond/react: Reaction special function variable "
|
||||
"name does not exist");
|
||||
|
||||
int ifrag = -1;
|
||||
if (fragid != "all") {
|
||||
ifrag = onemol->findfragment(fragid.c_str());
|
||||
if (ifrag < 0) error->one(FLERR,"Bond/react: Molecule fragment "
|
||||
if (ifrag < 0) error->one(FLERR,"Fix bond/react: Molecule fragment "
|
||||
"in reaction special function does not exist");
|
||||
}
|
||||
|
||||
@ -2420,13 +2429,11 @@ void FixBondReact::find_landlocked_atoms(int myrxn)
|
||||
// bad molecule templates check
|
||||
// if atoms change types, but aren't landlocked, that's bad
|
||||
for (int i = 0; i < twomol->natoms; i++) {
|
||||
if (create_atoms[i][myrxn] == 0) {
|
||||
if (twomol->type[i] != onemol->type[equivalences[i][1][myrxn]-1] && landlocked_atoms[i][myrxn] == 0) {
|
||||
char str[128];
|
||||
snprintf(str,128,"Bond/react: Atom type affected by reaction %s too close to template edge",rxn_name[myrxn]);
|
||||
error->all(FLERR,str);
|
||||
}
|
||||
}
|
||||
if ((create_atoms[i][myrxn] == 0) &&
|
||||
(twomol->type[i] != onemol->type[equivalences[i][1][myrxn]-1]) &&
|
||||
(landlocked_atoms[i][myrxn] == 0))
|
||||
error->all(FLERR, "Fix bond/react: Atom type affected by reaction {} is too close "
|
||||
"to template edge", rxn_name[myrxn]);
|
||||
}
|
||||
|
||||
// additionally, if a bond changes type, but neither involved atom is landlocked, bad
|
||||
@ -2441,25 +2448,19 @@ void FixBondReact::find_landlocked_atoms(int myrxn)
|
||||
int onemol_batom;
|
||||
for (int m = 0; m < onemol->num_bond[onemol_atomi-1]; m++) {
|
||||
onemol_batom = onemol->bond_atom[onemol_atomi-1][m];
|
||||
if (onemol_batom == equivalences[twomol_atomj-1][1][myrxn]) {
|
||||
if (twomol->bond_type[i][j] != onemol->bond_type[onemol_atomi-1][m]) {
|
||||
char str[128];
|
||||
snprintf(str,128,"Bond/react: Bond type affected by reaction %s too close to template edge",rxn_name[myrxn]);
|
||||
error->all(FLERR,str);
|
||||
}
|
||||
}
|
||||
if ((onemol_batom == equivalences[twomol_atomj-1][1][myrxn]) &&
|
||||
(twomol->bond_type[i][j] != onemol->bond_type[onemol_atomi-1][m]))
|
||||
error->all(FLERR, "Fix bond/react: Bond type affected by reaction {} is "
|
||||
"too close to template edge",rxn_name[myrxn]);
|
||||
}
|
||||
if (newton_bond) {
|
||||
int onemol_atomj = equivalences[twomol_atomj-1][1][myrxn];
|
||||
for (int m = 0; m < onemol->num_bond[onemol_atomj-1]; m++) {
|
||||
onemol_batom = onemol->bond_atom[onemol_atomj-1][m];
|
||||
if (onemol_batom == equivalences[i][1][myrxn]) {
|
||||
if (twomol->bond_type[i][j] != onemol->bond_type[onemol_atomj-1][m]) {
|
||||
char str[128];
|
||||
snprintf(str,128,"Bond/react: Bond type affected by reaction %s too close to template edge",rxn_name[myrxn]);
|
||||
error->all(FLERR,str);
|
||||
}
|
||||
}
|
||||
if ((onemol_batom == equivalences[i][1][myrxn]) &&
|
||||
(twomol->bond_type[i][j] != onemol->bond_type[onemol_atomj-1][m]))
|
||||
error->all(FLERR, "Fix bond/react: Bond type affected by reaction {} is "
|
||||
"too close to template edge",rxn_name[myrxn]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2474,7 +2475,7 @@ void FixBondReact::find_landlocked_atoms(int myrxn)
|
||||
int ii = reverse_equiv[i][1][myrxn] - 1;
|
||||
for (int j = 0; j < twomol_nxspecial[ii][0]; j++) {
|
||||
if (delete_atoms[equivalences[twomol_xspecial[ii][j]-1][1][myrxn]-1][myrxn] == 0) {
|
||||
error->all(FLERR,"Bond/react: A deleted atom cannot remain bonded to an atom that is not deleted");
|
||||
error->all(FLERR,"Fix bond/react: A deleted atom cannot remain bonded to an atom that is not deleted");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2483,20 +2484,18 @@ void FixBondReact::find_landlocked_atoms(int myrxn)
|
||||
// also, if atoms change number of bonds, but aren't landlocked, that could be bad
|
||||
if (me == 0)
|
||||
for (int i = 0; i < twomol->natoms; i++) {
|
||||
if (create_atoms[i][myrxn] == 0) {
|
||||
if (twomol_nxspecial[i][0] != onemol_nxspecial[equivalences[i][1][myrxn]-1][0] && landlocked_atoms[i][myrxn] == 0) {
|
||||
char str[128];
|
||||
snprintf(str,128,"Bond/react: Atom affected by reaction %s too close to template edge",rxn_name[myrxn]);
|
||||
error->warning(FLERR,str);
|
||||
if ((create_atoms[i][myrxn] == 0) &&
|
||||
(twomol_nxspecial[i][0] != onemol_nxspecial[equivalences[i][1][myrxn]-1][0]) &&
|
||||
(landlocked_atoms[i][myrxn] == 0))
|
||||
error->warning(FLERR, "Fix bond/react: Atom affected by reaction {} is too close "
|
||||
"to template edge",rxn_name[myrxn]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// finally, if a created atom is not landlocked, bad!
|
||||
for (int i = 0; i < twomol->natoms; i++) {
|
||||
if (create_atoms[i][myrxn] == 1 && landlocked_atoms[i][myrxn] == 0) {
|
||||
error->one(FLERR,"Bond/react: Created atom too close to template edge");
|
||||
error->one(FLERR,"Fix bond/react: Created atom too close to template edge");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2904,6 +2903,11 @@ void FixBondReact::update_everything()
|
||||
int nmark = nlocal;
|
||||
memory->create(mark,nmark,"bond/react:mark");
|
||||
for (int i = 0; i < nmark; i++) mark[i] = 0;
|
||||
|
||||
// flag used to delete special interactions
|
||||
int *delflag;
|
||||
memory->create(delflag,atom->maxspecial,"bond/react:delflag");
|
||||
|
||||
tagint *tag = atom->tag;
|
||||
AtomVec *avec = atom->avec;
|
||||
|
||||
@ -3029,62 +3033,68 @@ void FixBondReact::update_everything()
|
||||
// very nice and easy to completely overwrite special bond info for landlocked atoms
|
||||
for (int i = 0; i < update_num_mega; i++) {
|
||||
rxnID = update_mega_glove[0][i];
|
||||
onemol = atom->molecules[unreacted_mol[rxnID]];
|
||||
twomol = atom->molecules[reacted_mol[rxnID]];
|
||||
for (int j = 0; j < twomol->natoms; j++) {
|
||||
int jj = equivalences[j][1][rxnID]-1;
|
||||
if (atom->map(update_mega_glove[jj+1][i]) < nlocal && atom->map(update_mega_glove[jj+1][i]) >= 0) {
|
||||
int ilocal = atom->map(update_mega_glove[jj+1][i]);
|
||||
if (ilocal < nlocal && ilocal >= 0) {
|
||||
if (landlocked_atoms[j][rxnID] == 1) {
|
||||
for (int k = 0; k < 3; k++) {
|
||||
nspecial[atom->map(update_mega_glove[jj+1][i])][k] = twomol->nspecial[j][k];
|
||||
nspecial[ilocal][k] = twomol->nspecial[j][k];
|
||||
}
|
||||
for (int p = 0; p < twomol->nspecial[j][2]; p++) {
|
||||
special[atom->map(update_mega_glove[jj+1][i])][p] = update_mega_glove[equivalences[twomol->special[j][p]-1][1][rxnID]][i];
|
||||
special[ilocal][p] = update_mega_glove[equivalences[twomol->special[j][p]-1][1][rxnID]][i];
|
||||
}
|
||||
}
|
||||
// now delete and replace landlocked atoms from non-landlocked atoms' special info
|
||||
// delete 1-2, 1-3, 1-4 specials individually. only delete if special exists in pre-reaction template
|
||||
if (landlocked_atoms[j][rxnID] == 0) {
|
||||
for (int k = nspecial[atom->map(update_mega_glove[jj+1][i])][2]-1; k > -1; k--) {
|
||||
for (int p = 0; p < twomol->natoms; p++) {
|
||||
int pp = equivalences[p][1][rxnID]-1;
|
||||
if (p!=j && special[atom->map(update_mega_glove[jj+1][i])][k] == update_mega_glove[pp+1][i]
|
||||
&& landlocked_atoms[p][rxnID] == 1) {
|
||||
for (int n = k; n < nspecial[atom->map(update_mega_glove[jj+1][i])][2]-1; n++) {
|
||||
special[atom->map(update_mega_glove[jj+1][i])][n] = special[atom->map(update_mega_glove[jj+1][i])][n+1];
|
||||
int ispec, fspec, imolspec, fmolspec, nspecdel[3];
|
||||
for (int k = 0; k < 3; k++) nspecdel[k] = 0;
|
||||
for (int k = 0; k < atom->maxspecial; k++) delflag[k] = 0;
|
||||
for (int specn = 0; specn < 3; specn++) {
|
||||
if (specn == 0) {
|
||||
imolspec = 0;
|
||||
ispec = 0;
|
||||
} else {
|
||||
imolspec = onemol->nspecial[jj][specn-1];
|
||||
ispec = nspecial[ilocal][specn-1];
|
||||
}
|
||||
fmolspec = onemol->nspecial[jj][specn];
|
||||
fspec = nspecial[ilocal][specn];
|
||||
for (int k = ispec; k < fspec; k++) {
|
||||
for (int p = imolspec; p < fmolspec; p++) {
|
||||
if (update_mega_glove[onemol->special[jj][p]][i] == special[ilocal][k]) {
|
||||
delflag[k] = 1;
|
||||
for (int m = 2; m >= specn; m--) nspecdel[m]++;
|
||||
break;
|
||||
}
|
||||
if (k+1 > nspecial[atom->map(update_mega_glove[jj+1][i])][1]) {
|
||||
nspecial[atom->map(update_mega_glove[jj+1][i])][2]--;
|
||||
} else if (k+1 > nspecial[atom->map(update_mega_glove[jj+1][i])][0]) {
|
||||
nspecial[atom->map(update_mega_glove[jj+1][i])][1]--;
|
||||
nspecial[atom->map(update_mega_glove[jj+1][i])][2]--;
|
||||
} else {
|
||||
nspecial[atom->map(update_mega_glove[jj+1][i])][0]--;
|
||||
nspecial[atom->map(update_mega_glove[jj+1][i])][1]--;
|
||||
nspecial[atom->map(update_mega_glove[jj+1][i])][2]--;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
int incr = 0;
|
||||
for (int k = 0; k < nspecial[ilocal][2]; k++)
|
||||
if (delflag[k] == 0) special[ilocal][incr++] = special[ilocal][k];
|
||||
for (int m = 0; m < 3; m++) nspecial[ilocal][m] -= nspecdel[m];
|
||||
// now reassign from reacted template
|
||||
for (int k = 0; k < twomol->nspecial[j][2]; k++) {
|
||||
if (landlocked_atoms[twomol->special[j][k]-1][rxnID] == 1) {
|
||||
if (k > twomol->nspecial[j][1] - 1) {
|
||||
insert_num = nspecial[atom->map(update_mega_glove[jj+1][i])][2]++;
|
||||
} else if (k > twomol->nspecial[j][0] - 1) {
|
||||
insert_num = nspecial[atom->map(update_mega_glove[jj+1][i])][1]++;
|
||||
nspecial[atom->map(update_mega_glove[jj+1][i])][2]++;
|
||||
} else {
|
||||
insert_num = nspecial[atom->map(update_mega_glove[jj+1][i])][0]++;
|
||||
nspecial[atom->map(update_mega_glove[jj+1][i])][1]++;
|
||||
nspecial[atom->map(update_mega_glove[jj+1][i])][2]++;
|
||||
}
|
||||
if (nspecial[atom->map(update_mega_glove[jj+1][i])][2] > atom->maxspecial)
|
||||
error->one(FLERR,"Bond/react special bond generation overflow");
|
||||
for (int n = nspecial[atom->map(update_mega_glove[jj+1][i])][2]-1; n > insert_num; n--) {
|
||||
special[atom->map(update_mega_glove[jj+1][i])][n] = special[atom->map(update_mega_glove[jj+1][i])][n-1];
|
||||
}
|
||||
special[atom->map(update_mega_glove[jj+1][i])][insert_num] = update_mega_glove[equivalences[twomol->special[j][k]-1][1][rxnID]][i];
|
||||
if (k > twomol->nspecial[j][1] - 1) {
|
||||
insert_num = nspecial[ilocal][2]++;
|
||||
} else if (k > twomol->nspecial[j][0] - 1) {
|
||||
insert_num = nspecial[ilocal][1]++;
|
||||
nspecial[ilocal][2]++;
|
||||
} else {
|
||||
insert_num = nspecial[ilocal][0]++;
|
||||
nspecial[ilocal][1]++;
|
||||
nspecial[ilocal][2]++;
|
||||
}
|
||||
if (nspecial[ilocal][2] > atom->maxspecial)
|
||||
error->one(FLERR,"Fix bond/react special bond generation overflow");
|
||||
for (int n = nspecial[ilocal][2]-1; n > insert_num; n--) {
|
||||
special[ilocal][n] = special[ilocal][n-1];
|
||||
}
|
||||
special[ilocal][insert_num] = update_mega_glove[equivalences[twomol->special[j][k]-1][1][rxnID]][i];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3173,7 +3183,7 @@ void FixBondReact::update_everything()
|
||||
dynamic_cast<FixBondHistory *>(ihistory)->check_cache(atom->map(update_mega_glove[jj+1][i]), insert_num);
|
||||
num_bond[atom->map(update_mega_glove[jj+1][i])]++;
|
||||
if (num_bond[atom->map(update_mega_glove[jj+1][i])] > atom->bond_per_atom)
|
||||
error->one(FLERR,"Bond/react topology/atom exceed system topology/atom");
|
||||
error->one(FLERR,"Fix bond/react topology/atom exceed system topology/atom");
|
||||
delta_bonds++;
|
||||
}
|
||||
}
|
||||
@ -3253,7 +3263,7 @@ void FixBondReact::update_everything()
|
||||
angle_atom3[atom->map(update_mega_glove[jj+1][i])][insert_num] = update_mega_glove[equivalences[twomol->angle_atom3[j][p]-1][1][rxnID]][i];
|
||||
num_angle[atom->map(update_mega_glove[jj+1][i])]++;
|
||||
if (num_angle[atom->map(update_mega_glove[jj+1][i])] > atom->angle_per_atom)
|
||||
error->one(FLERR,"Bond/react topology/atom exceed system topology/atom");
|
||||
error->one(FLERR,"Fix bond/react topology/atom exceed system topology/atom");
|
||||
delta_angle++;
|
||||
}
|
||||
}
|
||||
@ -3336,7 +3346,7 @@ void FixBondReact::update_everything()
|
||||
dihedral_atom4[atom->map(update_mega_glove[jj+1][i])][insert_num] = update_mega_glove[equivalences[twomol->dihedral_atom4[j][p]-1][1][rxnID]][i];
|
||||
num_dihedral[atom->map(update_mega_glove[jj+1][i])]++;
|
||||
if (num_dihedral[atom->map(update_mega_glove[jj+1][i])] > atom->dihedral_per_atom)
|
||||
error->one(FLERR,"Bond/react topology/atom exceed system topology/atom");
|
||||
error->one(FLERR,"Fix bond/react topology/atom exceed system topology/atom");
|
||||
delta_dihed++;
|
||||
}
|
||||
}
|
||||
@ -3419,7 +3429,7 @@ void FixBondReact::update_everything()
|
||||
improper_atom4[atom->map(update_mega_glove[jj+1][i])][insert_num] = update_mega_glove[equivalences[twomol->improper_atom4[j][p]-1][1][rxnID]][i];
|
||||
num_improper[atom->map(update_mega_glove[jj+1][i])]++;
|
||||
if (num_improper[atom->map(update_mega_glove[jj+1][i])] > atom->improper_per_atom)
|
||||
error->one(FLERR,"Bond/react topology/atom exceed system topology/atom");
|
||||
error->one(FLERR,"Fix bond/react topology/atom exceed system topology/atom");
|
||||
delta_imprp++;
|
||||
}
|
||||
}
|
||||
@ -3480,6 +3490,7 @@ void FixBondReact::update_everything()
|
||||
}
|
||||
}
|
||||
memory->destroy(mark);
|
||||
memory->destroy(delflag);
|
||||
|
||||
MPI_Allreduce(&ndelone,&ndel,1,MPI_INT,MPI_SUM,world);
|
||||
|
||||
@ -3590,7 +3601,7 @@ int FixBondReact::insert_atoms(tagint **my_mega_glove, int iupdate)
|
||||
int ipre = equivalences[j][1][rxnID]-1; // equiv pre-reaction template index
|
||||
if (!create_atoms[j][rxnID] && !delete_atoms[ipre][rxnID]) {
|
||||
if (atom->map(my_mega_glove[ipre+1][iupdate]) < 0) {
|
||||
printf("WARNING: eligible atoms skipped for created-atoms fit on %d\n",me);
|
||||
error->warning(FLERR," eligible atoms skipped for created-atoms fit on rank {}\n",me);
|
||||
continue;
|
||||
}
|
||||
iatom = atom->map(my_mega_glove[ipre+1][iupdate]);
|
||||
@ -3793,7 +3804,7 @@ void FixBondReact::read(int myrxn)
|
||||
|
||||
// skip 1st line of file
|
||||
eof = fgets(line,MAXLINE,fp);
|
||||
if (eof == nullptr) error->one(FLERR,"Bond/react: Unexpected end of superimpose file");
|
||||
if (eof == nullptr) error->one(FLERR,"Fix bond/react: Unexpected end of superimpose file");
|
||||
|
||||
// read header lines
|
||||
// skip blank lines or lines that start with "#"
|
||||
@ -3814,7 +3825,7 @@ void FixBondReact::read(int myrxn)
|
||||
else if (strstr(line,"equivalences")) {
|
||||
sscanf(line,"%d",&nequivalent);
|
||||
if (nequivalent != onemol->natoms)
|
||||
error->one(FLERR,"Bond/react: Number of equivalences in map file must "
|
||||
error->one(FLERR,"Fix bond/react: Number of equivalences in map file must "
|
||||
"equal number of atoms in reaction templates");
|
||||
}
|
||||
else if (strstr(line,"deleteIDs")) sscanf(line,"%d",&ndelete);
|
||||
@ -3838,16 +3849,16 @@ void FixBondReact::read(int myrxn)
|
||||
while (strlen(keyword)) {
|
||||
if (strcmp(keyword,"InitiatorIDs") == 0 || strcmp(keyword,"BondingIDs") == 0) {
|
||||
if (strcmp(keyword,"BondingIDs") == 0)
|
||||
if (me == 0) error->warning(FLERR,"Bond/react: The BondingIDs section title has been deprecated. Please use InitiatorIDs instead.");
|
||||
if (me == 0) error->warning(FLERR,"Fix bond/react: The BondingIDs section title has been deprecated. Please use InitiatorIDs instead.");
|
||||
bondflag = 1;
|
||||
readline(line);
|
||||
sscanf(line,"%d",&ibonding[myrxn]);
|
||||
if (ibonding[myrxn] > onemol->natoms)
|
||||
error->one(FLERR,"Bond/react: Invalid template atom ID in map file");
|
||||
error->one(FLERR,"Fix bond/react: Invalid template atom ID in map file");
|
||||
readline(line);
|
||||
sscanf(line,"%d",&jbonding[myrxn]);
|
||||
if (jbonding[myrxn] > onemol->natoms)
|
||||
error->one(FLERR,"Bond/react: Invalid template atom ID in map file");
|
||||
error->one(FLERR,"Fix bond/react: Invalid template atom ID in map file");
|
||||
} else if (strcmp(keyword,"EdgeIDs") == 0) {
|
||||
EdgeIDs(line, myrxn);
|
||||
} else if (strcmp(keyword,"Equivalences") == 0) {
|
||||
@ -3861,7 +3872,7 @@ void FixBondReact::read(int myrxn)
|
||||
ChiralCenters(line, myrxn);
|
||||
} else if (strcmp(keyword,"Constraints") == 0) {
|
||||
ReadConstraints(line, myrxn);
|
||||
} else error->one(FLERR,"Bond/react: Unknown section in map file");
|
||||
} else error->one(FLERR,"Fix bond/react: Unknown section in map file");
|
||||
|
||||
parse_keyword(1,line,keyword);
|
||||
|
||||
@ -3869,7 +3880,7 @@ void FixBondReact::read(int myrxn)
|
||||
|
||||
// error check
|
||||
if (bondflag == 0 || equivflag == 0)
|
||||
error->all(FLERR,"Bond/react: Map file missing InitiatorIDs or Equivalences section\n");
|
||||
error->all(FLERR,"Fix bond/react: Map file missing InitiatorIDs or Equivalences section\n");
|
||||
}
|
||||
|
||||
void FixBondReact::EdgeIDs(char *line, int myrxn)
|
||||
@ -3881,7 +3892,7 @@ void FixBondReact::EdgeIDs(char *line, int myrxn)
|
||||
readline(line);
|
||||
sscanf(line,"%d",&tmp);
|
||||
if (tmp > onemol->natoms)
|
||||
error->one(FLERR,"Bond/react: Invalid template atom ID in map file");
|
||||
error->one(FLERR,"Fix bond/react: Invalid template atom ID in map file");
|
||||
edge[tmp-1][myrxn] = 1;
|
||||
}
|
||||
}
|
||||
@ -3894,7 +3905,7 @@ void FixBondReact::Equivalences(char *line, int myrxn)
|
||||
readline(line);
|
||||
sscanf(line,"%d %d",&tmp1,&tmp2);
|
||||
if (tmp1 > onemol->natoms || tmp2 > twomol->natoms)
|
||||
error->one(FLERR,"Bond/react: Invalid template atom ID in map file");
|
||||
error->one(FLERR,"Fix bond/react: Invalid template atom ID in map file");
|
||||
//equivalences is-> clmn 1: post-reacted, clmn 2: pre-reacted
|
||||
equivalences[tmp2-1][0][myrxn] = tmp2;
|
||||
equivalences[tmp2-1][1][myrxn] = tmp1;
|
||||
@ -3911,7 +3922,7 @@ void FixBondReact::DeleteAtoms(char *line, int myrxn)
|
||||
readline(line);
|
||||
sscanf(line,"%d",&tmp);
|
||||
if (tmp > onemol->natoms)
|
||||
error->one(FLERR,"Bond/react: Invalid template atom ID in map file");
|
||||
error->one(FLERR,"Fix bond/react: Invalid template atom ID in map file");
|
||||
delete_atoms[tmp-1][myrxn] = 1;
|
||||
}
|
||||
}
|
||||
@ -3943,17 +3954,17 @@ void FixBondReact::ChiralCenters(char *line, int myrxn)
|
||||
readline(line);
|
||||
sscanf(line,"%d",&tmp);
|
||||
if (tmp > onemol->natoms)
|
||||
error->one(FLERR,"Bond/react: Invalid template atom ID in map file");
|
||||
error->one(FLERR,"Fix bond/react: Invalid template atom ID in map file");
|
||||
chiral_atoms[tmp-1][0][myrxn] = 1;
|
||||
if (onemol->xflag == 0)
|
||||
error->one(FLERR,"Bond/react: Molecule template 'Coords' section required for chiralIDs keyword");
|
||||
error->one(FLERR,"Fix bond/react: Molecule template 'Coords' section required for chiralIDs keyword");
|
||||
if ((int) onemol_nxspecial[tmp-1][0] != 4)
|
||||
error->one(FLERR,"Bond/react: Chiral atoms must have exactly four first neighbors");
|
||||
error->one(FLERR,"Fix bond/react: Chiral atoms must have exactly four first neighbors");
|
||||
for (int j = 0; j < 4; j++) {
|
||||
for (int k = j+1; k < 4; k++) {
|
||||
if (onemol->type[onemol_xspecial[tmp-1][j]-1] ==
|
||||
onemol->type[onemol_xspecial[tmp-1][k]-1])
|
||||
error->one(FLERR,"Bond/react: First neighbors of chiral atoms must be of mutually different types");
|
||||
error->one(FLERR,"Fix bond/react: First neighbors of chiral atoms must be of mutually different types");
|
||||
}
|
||||
}
|
||||
// record order of atom types, and coords
|
||||
@ -3979,7 +3990,7 @@ void FixBondReact::ReadConstraints(char *line, int myrxn)
|
||||
for (int i = 0; i < nconstraints[myrxn]; i++) {
|
||||
readline(line);
|
||||
// find left parentheses, add to constraintstr, and update line
|
||||
for (int j = 0; j < strlen(line); j++) {
|
||||
for (int j = 0; j < (int)strlen(line); j++) {
|
||||
if (line[j] == '(') strcat(constraintstr[myrxn],"(");
|
||||
if (isalpha(line[j])) {
|
||||
line = line + j;
|
||||
@ -3998,7 +4009,7 @@ void FixBondReact::ReadConstraints(char *line, int myrxn)
|
||||
while (lptr[0] != ' ') lptr++; // skip second 'word'
|
||||
}
|
||||
// find right parentheses
|
||||
for (int j = 0; j < strlen(lptr); j++)
|
||||
for (int j = 0; j < (int)strlen(lptr); j++)
|
||||
if (lptr[j] == ')') strcat(constraintstr[myrxn],")");
|
||||
// find logic symbols, and trim line via ptr
|
||||
if ((ptr = strstr(lptr,"&&"))) {
|
||||
@ -4059,14 +4070,14 @@ void FixBondReact::ReadConstraints(char *line, int myrxn)
|
||||
constraints[i][myrxn].id[0] = -1; // optional molecule fragment
|
||||
if (isalpha(strargs[0][0])) {
|
||||
int ifragment = onemol->findfragment(strargs[0]);
|
||||
if (ifragment < 0) error->one(FLERR,"Bond/react: Molecule fragment does not exist");
|
||||
if (ifragment < 0) error->one(FLERR,"Fix bond/react: Molecule fragment does not exist");
|
||||
else constraints[i][myrxn].id[0] = ifragment;
|
||||
}
|
||||
} else if (strcmp(constraint_type,"custom") == 0) {
|
||||
constraints[i][myrxn].type = CUSTOM;
|
||||
std::vector<std::string> args = utils::split_words(line);
|
||||
constraints[i][myrxn].str = args[1];
|
||||
} else error->one(FLERR,"Bond/react: Illegal constraint type in 'Constraints' section of map file");
|
||||
} else error->one(FLERR,"Fix bond/react: Illegal constraint type in 'Constraints' section of map file");
|
||||
}
|
||||
strcat(constraintstr[myrxn],")"); // close boolean constraint logic string
|
||||
delete [] constraint_type;
|
||||
@ -4083,12 +4094,12 @@ void FixBondReact::readID(char *strarg, int iconstr, int myrxn, int i)
|
||||
if (isalpha(strarg[0])) {
|
||||
constraints[iconstr][myrxn].idtype[i] = FRAG; // fragment vs. atom ID flag
|
||||
int ifragment = onemol->findfragment(strarg);
|
||||
if (ifragment < 0) error->one(FLERR,"Bond/react: Molecule fragment does not exist");
|
||||
if (ifragment < 0) error->one(FLERR,"Fix bond/react: Molecule fragment does not exist");
|
||||
constraints[iconstr][myrxn].id[i] = ifragment;
|
||||
} else {
|
||||
constraints[iconstr][myrxn].idtype[i] = ATOM; // fragment vs. atom ID flag
|
||||
int iatom = atoi(strarg);
|
||||
if (iatom > onemol->natoms) error->one(FLERR,"Bond/react: Invalid template atom ID in map file");
|
||||
if (iatom > onemol->natoms) error->one(FLERR,"Fix bond/react: Invalid template atom ID in map file");
|
||||
constraints[iconstr][myrxn].id[i] = iatom;
|
||||
}
|
||||
}
|
||||
@ -4096,11 +4107,7 @@ void FixBondReact::readID(char *strarg, int iconstr, int myrxn, int i)
|
||||
void FixBondReact::open(char *file)
|
||||
{
|
||||
fp = fopen(file,"r");
|
||||
if (fp == nullptr) {
|
||||
char str[128];
|
||||
snprintf(str,128,"Bond/react: Cannot open map file %s",file);
|
||||
error->one(FLERR,str);
|
||||
}
|
||||
if (fp == nullptr) error->one(FLERR, "Fix bond/react: Cannot open map file {}",file);
|
||||
}
|
||||
|
||||
void FixBondReact::readline(char *line)
|
||||
@ -4111,7 +4118,7 @@ void FixBondReact::readline(char *line)
|
||||
else n = strlen(line) + 1;
|
||||
}
|
||||
MPI_Bcast(&n,1,MPI_INT,0,world);
|
||||
if (n == 0) error->all(FLERR,"Bond/react: Unexpected end of map file");
|
||||
if (n == 0) error->all(FLERR,"Fix bond/react: Unexpected end of map file");
|
||||
MPI_Bcast(line,n,MPI_CHAR,0,world);
|
||||
}
|
||||
|
||||
|
||||
@ -334,13 +334,15 @@ int DumpVTK::count()
|
||||
|
||||
// un-choose if not in region
|
||||
|
||||
auto region = domain->get_region_by_id(idregion);
|
||||
if (region) {
|
||||
region->prematch();
|
||||
double **x = atom->x;
|
||||
for (i = 0; i < nlocal; i++)
|
||||
if (choose[i] && region->match(x[i][0],x[i][1],x[i][2]) == 0)
|
||||
choose[i] = 0;
|
||||
if (idregion) {
|
||||
auto region = domain->get_region_by_id(idregion);
|
||||
if (region) {
|
||||
region->prematch();
|
||||
double **x = atom->x;
|
||||
for (i = 0; i < nlocal; i++)
|
||||
if (choose[i] && region->match(x[i][0],x[i][1],x[i][2]) == 0)
|
||||
choose[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// un-choose if any threshold criterion isn't met
|
||||
|
||||
@ -1151,7 +1151,8 @@ void Dump::modify_params(int narg, char **arg)
|
||||
}
|
||||
}
|
||||
if ((icol < 0) || (icol >= (int)keyword_user.size()))
|
||||
error->all(FLERR, "Illegal thermo_modify command");
|
||||
error->all(FLERR, "Incorrect dump_modify arguments: {} {} {}",
|
||||
arg[iarg], arg[iarg+1], arg[iarg+2]);
|
||||
keyword_user[icol] = arg[iarg+2];
|
||||
iarg += 3;
|
||||
}
|
||||
|
||||
@ -34,9 +34,9 @@ using namespace LAMMPS_NS;
|
||||
|
||||
DumpLocal::DumpLocal(LAMMPS *lmp, int narg, char **arg) :
|
||||
Dump(lmp, narg, arg),
|
||||
label(nullptr), vtype(nullptr), vformat(nullptr), columns(nullptr), field2index(nullptr),
|
||||
argindex(nullptr), id_compute(nullptr), compute(nullptr), id_fix(nullptr), fix(nullptr),
|
||||
pack_choice(nullptr)
|
||||
label(nullptr), vtype(nullptr), vformat(nullptr), columns(nullptr), columns_default(nullptr),
|
||||
field2index(nullptr), argindex(nullptr), id_compute(nullptr), compute(nullptr),
|
||||
id_fix(nullptr), fix(nullptr), pack_choice(nullptr)
|
||||
{
|
||||
if (narg == 5) error->all(FLERR,"No dump local arguments specified");
|
||||
|
||||
@ -87,25 +87,30 @@ DumpLocal::DumpLocal(LAMMPS *lmp, int narg, char **arg) :
|
||||
// setup format strings
|
||||
|
||||
vformat = new char*[size_one];
|
||||
std::string fdefault;
|
||||
std::string cols;
|
||||
|
||||
for (int i = 0; i < size_one; i++) {
|
||||
if (vtype[i] == Dump::INT) fdefault += "%d ";
|
||||
else if (vtype[i] == Dump::DOUBLE) fdefault += "%g ";
|
||||
if (vtype[i] == Dump::INT) cols += "%d ";
|
||||
else if (vtype[i] == Dump::DOUBLE) cols += "%g ";
|
||||
vformat[i] = nullptr;
|
||||
}
|
||||
format_default = utils::strdup(fdefault);
|
||||
cols.resize(cols.size()-1);
|
||||
format_default = utils::strdup(cols);
|
||||
|
||||
format_column_user = new char*[size_one];
|
||||
for (int i = 0; i < size_one; i++) format_column_user[i] = nullptr;
|
||||
|
||||
// setup column string
|
||||
|
||||
std::string cols;
|
||||
cols.clear();
|
||||
keyword_user.resize(nfield);
|
||||
for (int iarg = 0; iarg < nfield; iarg++) {
|
||||
key2col[earg[iarg]] = iarg;
|
||||
keyword_user[iarg].clear();
|
||||
if (cols.size()) cols += " ";
|
||||
cols += earg[iarg];
|
||||
cols += " ";
|
||||
}
|
||||
columns = utils::strdup(cols);
|
||||
columns_default = utils::strdup(cols);
|
||||
|
||||
// setup default label string
|
||||
|
||||
@ -143,6 +148,7 @@ DumpLocal::~DumpLocal()
|
||||
delete[] format_column_user;
|
||||
|
||||
delete[] columns;
|
||||
delete[] columns_default;
|
||||
delete[] label;
|
||||
}
|
||||
|
||||
@ -150,6 +156,19 @@ DumpLocal::~DumpLocal()
|
||||
|
||||
void DumpLocal::init_style()
|
||||
{
|
||||
// assemble ITEMS: column string from defaults and user values
|
||||
|
||||
delete[] columns;
|
||||
std::string combined;
|
||||
int icol = 0;
|
||||
for (auto item : utils::split_words(columns_default)) {
|
||||
if (combined.size()) combined += " ";
|
||||
if (keyword_user[icol].size()) combined += keyword_user[icol];
|
||||
else combined += item;
|
||||
++icol;
|
||||
}
|
||||
columns = utils::strdup(combined);
|
||||
|
||||
if (sort_flag && sortcol == 0)
|
||||
error->all(FLERR,"Dump local cannot sort by atom ID");
|
||||
|
||||
|
||||
@ -37,7 +37,8 @@ class DumpLocal : public Dump {
|
||||
int *vtype; // type of each vector (INT, DOUBLE)
|
||||
char **vformat; // format string for each vector element
|
||||
|
||||
char *columns; // column labels
|
||||
char *columns; // column labels
|
||||
char *columns_default;
|
||||
|
||||
int nfield; // # of keywords listed by user
|
||||
|
||||
|
||||
@ -77,7 +77,7 @@ vstore(nullptr), astore(nullptr), rbuf(nullptr)
|
||||
else if (narg == 6) arrayflag = 1;
|
||||
else tensorflag = 1;
|
||||
nvalues = n2*n3;
|
||||
nbytes = n2*n3 * sizeof(double);
|
||||
nbytes = nvalues * sizeof(double);
|
||||
}
|
||||
|
||||
vstore = nullptr;
|
||||
@ -194,7 +194,7 @@ void FixStore::write_restart(FILE *fp)
|
||||
rbuf[0] = n1;
|
||||
rbuf[1] = n2;
|
||||
if (vecflag) memcpy(&rbuf[2],vstore,n1*sizeof(double));
|
||||
else if (arrayflag) memcpy(&rbuf[2],&astore[0][0],n1*n2*sizeof(double));
|
||||
else if (arrayflag) memcpy(&rbuf[2],&astore[0][0],sizeof(double)*n1*n2);
|
||||
|
||||
int n = n1*n2 + 2;
|
||||
if (comm->me == 0) {
|
||||
@ -391,8 +391,8 @@ int FixStore::size_restart(int /*nlocal*/)
|
||||
|
||||
double FixStore::memory_usage()
|
||||
{
|
||||
double bytes = 0.0;
|
||||
if (flavor == GLOBAL) bytes += n1*n2 * sizeof(double);
|
||||
if (flavor == PERATOM) bytes += atom->nmax*n2*n3 * sizeof(double);
|
||||
double bytes = (double) n1 * n2;
|
||||
if (flavor == GLOBAL) bytes *= sizeof(double);
|
||||
if (flavor == PERATOM) bytes *= atom->nmax * sizeof(double);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
@ -19,8 +19,8 @@
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class Pair : protected Pointers {
|
||||
friend class AngleSDK;
|
||||
friend class AngleSDKOMP;
|
||||
friend class AngleSPICA;
|
||||
friend class AngleSPICAOMP;
|
||||
friend class BondQuartic;
|
||||
friend class BondQuarticOMP;
|
||||
friend class DihedralCharmm;
|
||||
|
||||
@ -33,9 +33,9 @@ using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
PairHybrid::PairHybrid(LAMMPS *lmp) : Pair(lmp),
|
||||
styles(nullptr), keywords(nullptr), multiple(nullptr), nmap(nullptr),
|
||||
map(nullptr), special_lj(nullptr), special_coul(nullptr), compute_tally(nullptr), cutmax_style(nullptr)
|
||||
PairHybrid::PairHybrid(LAMMPS *lmp) :
|
||||
Pair(lmp), styles(nullptr), cutmax_style(nullptr), keywords(nullptr), multiple(nullptr),
|
||||
nmap(nullptr), map(nullptr), special_lj(nullptr), special_coul(nullptr), compute_tally(nullptr)
|
||||
{
|
||||
nstyles = 0;
|
||||
|
||||
|
||||
@ -2561,9 +2561,14 @@ double Variable::collapse_tree(Tree *tree)
|
||||
arg2 = collapse_tree(tree->second);
|
||||
if (tree->first->type != VALUE || tree->second->type != VALUE) return 0.0;
|
||||
tree->type = VALUE;
|
||||
double delta = update->ntimestep - update->beginstep;
|
||||
if (delta != 0.0) delta /= update->endstep - update->beginstep;
|
||||
tree->value = arg1 + delta*(arg2-arg1);
|
||||
if (update->whichflag == 0) {
|
||||
tree->value = arg1;
|
||||
} else {
|
||||
double delta = update->ntimestep - update->beginstep;
|
||||
if ((delta != 0.0) && (update->beginstep != update->endstep))
|
||||
delta /= update->endstep - update->beginstep;
|
||||
tree->value = arg1 + delta*(arg2-arg1);
|
||||
}
|
||||
return tree->value;
|
||||
}
|
||||
|
||||
@ -2730,7 +2735,7 @@ double Variable::collapse_tree(Tree *tree)
|
||||
tree->extra[0]->type != VALUE) return 0.0;
|
||||
tree->type = VALUE;
|
||||
if (arg3 == 0.0)
|
||||
error->one(FLERR,"Invalid math function in variable formula");
|
||||
error->one(FLERR,"Invalid swiggle(x,y,z) function in variable formula: z must be > 0");
|
||||
double delta = update->ntimestep - update->beginstep;
|
||||
double omega = 2.0*MY_PI/arg3;
|
||||
tree->value = arg1 + arg2*sin(omega*delta*update->dt);
|
||||
@ -2745,7 +2750,7 @@ double Variable::collapse_tree(Tree *tree)
|
||||
tree->extra[0]->type != VALUE) return 0.0;
|
||||
tree->type = VALUE;
|
||||
if (arg3 == 0.0)
|
||||
error->one(FLERR,"Invalid math function in variable formula");
|
||||
error->one(FLERR,"Invalid cwiggle(x,y,z) function in variable formula: z must be > 0");
|
||||
double delta = update->ntimestep - update->beginstep;
|
||||
double omega = 2.0*MY_PI/arg3;
|
||||
tree->value = arg1 + arg2*(1.0-cos(omega*delta*update->dt));
|
||||
@ -2935,9 +2940,14 @@ double Variable::eval_tree(Tree *tree, int i)
|
||||
if (tree->type == RAMP) {
|
||||
arg1 = eval_tree(tree->first,i);
|
||||
arg2 = eval_tree(tree->second,i);
|
||||
double delta = update->ntimestep - update->beginstep;
|
||||
if (delta != 0.0) delta /= update->endstep - update->beginstep;
|
||||
arg = arg1 + delta*(arg2-arg1);
|
||||
if (update->whichflag == 0) {
|
||||
arg = arg1;
|
||||
} else {
|
||||
double delta = update->ntimestep - update->beginstep;
|
||||
if ((delta != 0.0) && (update->beginstep != update->endstep))
|
||||
delta /= update->endstep - update->beginstep;
|
||||
arg = arg1 + delta*(arg2-arg1);
|
||||
}
|
||||
return arg;
|
||||
}
|
||||
|
||||
@ -3054,7 +3064,7 @@ double Variable::eval_tree(Tree *tree, int i)
|
||||
arg2 = eval_tree(tree->second,i);
|
||||
arg3 = eval_tree(tree->extra[0],i);
|
||||
if (arg3 == 0.0)
|
||||
error->one(FLERR,"Invalid math function in variable formula");
|
||||
error->one(FLERR,"Invalid swiggle(x,y,z) function in variable formula: z must be > 0");
|
||||
double delta = update->ntimestep - update->beginstep;
|
||||
double omega = 2.0*MY_PI/arg3;
|
||||
arg = arg1 + arg2*sin(omega*delta*update->dt);
|
||||
@ -3066,7 +3076,7 @@ double Variable::eval_tree(Tree *tree, int i)
|
||||
arg2 = eval_tree(tree->second,i);
|
||||
arg3 = eval_tree(tree->extra[0],i);
|
||||
if (arg3 == 0.0)
|
||||
error->one(FLERR,"Invalid math function in variable formula");
|
||||
error->one(FLERR,"Invalid cwiggle(x,y,z) function in variable formula: z must be > 0");
|
||||
double delta = update->ntimestep - update->beginstep;
|
||||
double omega = 2.0*MY_PI/arg3;
|
||||
arg = arg1 + arg2*(1.0-cos(omega*delta*update->dt));
|
||||
@ -3445,14 +3455,17 @@ int Variable::math_function(char *word, char *contents, Tree **tree, Tree **tree
|
||||
} else if (strcmp(word,"ramp") == 0) {
|
||||
if (narg != 2)
|
||||
print_var_error(FLERR,"Invalid math function in variable formula",ivar);
|
||||
if (update->whichflag == 0)
|
||||
print_var_error(FLERR,"Cannot use ramp in variable formula between runs",ivar);
|
||||
if (tree) newtree->type = RAMP;
|
||||
else {
|
||||
double delta = update->ntimestep - update->beginstep;
|
||||
if (delta != 0.0) delta /= update->endstep - update->beginstep;
|
||||
double value = value1 + delta*(value2-value1);
|
||||
argstack[nargstack++] = value;
|
||||
if (update->whichflag == 0) {
|
||||
argstack[nargstack++] = value1;
|
||||
} else {
|
||||
double delta = update->ntimestep - update->beginstep;
|
||||
if ((delta != 0.0) && (update->beginstep != update->endstep))
|
||||
delta /= update->endstep - update->beginstep;
|
||||
double value = value1 + delta*(value2-value1);
|
||||
argstack[nargstack++] = value;
|
||||
}
|
||||
}
|
||||
|
||||
} else if (strcmp(word,"stagger") == 0) {
|
||||
@ -3610,9 +3623,9 @@ int Variable::math_function(char *word, char *contents, Tree **tree, Tree **tree
|
||||
|
||||
} else if (strcmp(word,"vdisplace") == 0) {
|
||||
if (narg != 2)
|
||||
print_var_error(FLERR,"Invalid math function in variable formula",ivar);
|
||||
if (update->whichflag == 0)
|
||||
print_var_error(FLERR,"Cannot use vdisplace in variable formula between runs",ivar);
|
||||
print_var_error(FLERR,"Invalid vdisplace function in variable formula: must have 2 arguments",ivar);
|
||||
if (modify->get_fix_by_style("dt/reset").size() > 0)
|
||||
print_var_error(FLERR,"Must not use vdisplace(x,y) function with fix dt/reset",ivar);
|
||||
if (tree) newtree->type = VDISPLACE;
|
||||
else {
|
||||
double delta = update->ntimestep - update->beginstep;
|
||||
@ -3622,13 +3635,13 @@ int Variable::math_function(char *word, char *contents, Tree **tree, Tree **tree
|
||||
|
||||
} else if (strcmp(word,"swiggle") == 0) {
|
||||
if (narg != 3)
|
||||
print_var_error(FLERR,"Invalid math function in variable formula",ivar);
|
||||
if (update->whichflag == 0)
|
||||
print_var_error(FLERR,"Cannot use swiggle in variable formula between runs",ivar);
|
||||
if (tree) newtree->type = CWIGGLE;
|
||||
print_var_error(FLERR,"Invalid swiggle function in variable formula: must have 3 arguments",ivar);
|
||||
if (modify->get_fix_by_style("dt/reset").size() > 0)
|
||||
print_var_error(FLERR,"Must not use swiggle(x,y,z) function with fix dt/reset",ivar);
|
||||
if (tree) newtree->type = SWIGGLE;
|
||||
else {
|
||||
if (values[0] == 0.0)
|
||||
print_var_error(FLERR,"Invalid math function in variable formula",ivar);
|
||||
print_var_error(FLERR,"Invalid swiggle(x,y,z) function in variable formula: z must be > 0",ivar);
|
||||
double delta = update->ntimestep - update->beginstep;
|
||||
double omega = 2.0*MY_PI/values[0];
|
||||
double value = value1 + value2*sin(omega*delta*update->dt);
|
||||
@ -3637,13 +3650,13 @@ int Variable::math_function(char *word, char *contents, Tree **tree, Tree **tree
|
||||
|
||||
} else if (strcmp(word,"cwiggle") == 0) {
|
||||
if (narg != 3)
|
||||
print_var_error(FLERR,"Invalid math function in variable formula",ivar);
|
||||
if (update->whichflag == 0)
|
||||
print_var_error(FLERR,"Cannot use cwiggle in variable formula between runs",ivar);
|
||||
print_var_error(FLERR,"Invalid cwiggle function in variable formula: must have 3 arguments",ivar);
|
||||
if (modify->get_fix_by_style("dt/reset").size() > 0)
|
||||
print_var_error(FLERR,"Must not use cwiggle(x,y,z) function with fix dt/reset",ivar);
|
||||
if (tree) newtree->type = CWIGGLE;
|
||||
else {
|
||||
if (values[0] == 0.0)
|
||||
print_var_error(FLERR,"Invalid math function in variable formula",ivar);
|
||||
print_var_error(FLERR,"Invalid cwiggle(x,y,z) function in variable formula: z must be > 0",ivar);
|
||||
double delta = update->ntimestep - update->beginstep;
|
||||
double omega = 2.0*MY_PI/values[0];
|
||||
double value = value1 + value2*(1.0-cos(omega*delta*update->dt));
|
||||
|
||||
Reference in New Issue
Block a user