Commit e51720a2 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

add code to detect inconistent use of AIREBO/REBO potential files

parent dcffeb54
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ pair_style airebo/morse 3.0
pair_coeff * * ../potentials/CH.airebo-m H C :pre

pair_style rebo
pair_coeff * * ../potentials/CH.airebo H C :pre
pair_coeff * * ../potentials/CH.rebo H C :pre

[Description:]

@@ -57,7 +57,8 @@ The {rebo} pair style computes the Reactive Empirical Bond Order (REBO)
Potential of "(Brenner)"_#Brenner. Note that this is the so-called
2nd generation REBO from 2002, not the original REBO from 1990.
As discussed below, 2nd generation REBO is closely related to the
initial AIREBO; it is just a subset of the potential energy terms.
initial AIREBO; it is just a subset of the potential energy terms
with a few slightly different parameters

The AIREBO potential consists of three terms:

@@ -113,12 +114,12 @@ various dihedral angle preferences in hydrocarbon configurations.
:line

Only a single pair_coeff command is used with the {airebo}, {airebo}
or {rebo} style which specifies an AIREBO or AIREBO-M potential file
with parameters for C and H.  Note that the {rebo} style in LAMMPS
uses the same AIREBO-formatted potential file.  These are mapped to
LAMMPS atom types by specifying N additional arguments after the
filename in the pair_coeff command, where N is the number of LAMMPS
atom types:
or {rebo} style which specifies an AIREBO, REBO, or AIREBO-M potential
file with parameters for C and H.  Note that as of LAMMPS version
15 November 2018 the {rebo} style in LAMMPS uses its own potential
file (CH.rebo).  These are mapped to LAMMPS atom types by specifying
N additional arguments after the filename in the pair_coeff command,
where N is the number of LAMMPS atom types:

filename
N element names = mapping of AIREBO elements to atom types :ul
+30 −5
Original line number Diff line number Diff line
@@ -49,7 +49,8 @@ using namespace MathSpecial;

/* ---------------------------------------------------------------------- */

PairAIREBO::PairAIREBO(LAMMPS *lmp) : Pair(lmp)
PairAIREBO::PairAIREBO(LAMMPS *lmp)
  : Pair(lmp), variant(AIREBO)
{
  single_enable = 0;
  restartinfo = 0;
@@ -3368,14 +3369,38 @@ void PairAIREBO::read_file(char *filename)
    FILE *fp = force->open_potential(filename);
    if (fp == NULL) {
      char str[128];
      if (morseflag)
        snprintf(str,128,"Cannot open AIREBO-M potential file %s",filename);
      else
      switch (variant) {

      case AIREBO:
        snprintf(str,128,"Cannot open AIREBO potential file %s",filename);
        break;

      case REBO_2:
        snprintf(str,128,"Cannot open REBO2 potential file %s",filename);
        break;

      case AIREBO_M:
        snprintf(str,128,"Cannot open AIREBO-M potential file %s",filename);
        break;

      default:
        snprintf(str,128,"Unknown REBO style variant %d",variant);
      }
      error->one(FLERR,str);
    }

    // skip initial comment lines
    // skip initial comment line and check for potential file style identifier comment

    fgets(s,MAXLINE,fp);
    fgets(s,MAXLINE,fp);

    if (((variant == AIREBO) && (strncmp(s,"# AIREBO ",9) != 0))
        || ((variant == REBO_2) && (strncmp(s,"# REBO2 ",8) != 0))
        || ((variant == AIREBO_M) && (strncmp(s,"# AIREBO-M ",11) != 0))) {
      error->one(FLERR,"Potential file does not match AIREBO/REBO style variant");
    }

    // skip remaining comments

    while (1) {
      fgets(s,MAXLINE,fp);
+4 −2
Original line number Diff line number Diff line
@@ -38,10 +38,12 @@ class PairAIREBO : public Pair {
  double init_one(int, int);
  double memory_usage();

  enum { AIREBO, REBO_2, AIREBO_M }; // for telling class variants apart in shared code

protected:
  int *map;                        // 0 (C), 1 (H), or -1 (NULL) for each type

  int me;
  int me,variant;
  int ljflag,torflag;              // 0/1 if LJ/Morse,torsion terms included
  int morseflag;                   // 1 if Morse instead of LJ for non-bonded

+3 −1
Original line number Diff line number Diff line
@@ -19,7 +19,9 @@ using namespace LAMMPS_NS;

/* ---------------------------------------------------------------------- */

PairAIREBOMorse::PairAIREBOMorse(LAMMPS *lmp) : PairAIREBO(lmp) {}
PairAIREBOMorse::PairAIREBOMorse(LAMMPS *lmp) : PairAIREBO(lmp) {
  variant = AIREBO_M;
}

/* ----------------------------------------------------------------------
   global settings
+3 −1
Original line number Diff line number Diff line
@@ -18,7 +18,9 @@ using namespace LAMMPS_NS;

/* ---------------------------------------------------------------------- */

PairREBO::PairREBO(LAMMPS *lmp) : PairAIREBO(lmp) {}
PairREBO::PairREBO(LAMMPS *lmp) : PairAIREBO(lmp) {
  variant = REBO_2;
}

/* ----------------------------------------------------------------------
   global settings