diff --git a/doc/src/pair_e3b.rst b/doc/src/pair_e3b.rst index 87b052eb3d..f88a5331b9 100644 --- a/doc/src/pair_e3b.rst +++ b/doc/src/pair_e3b.rst @@ -50,8 +50,9 @@ Examples pair_style hybrid/overlay e3b 1 lj/cut/tip4p/long 1 2 1 1 0.15 8.5 pair_coeff * * e3b preset 2011 - labelmap atom 1 C 2 H 3 O 4 N 5 OW 6 HW pair_style e3b OW + labelmap atom 1 C 2 H 3 O 4 N 5 OW 6 HW + pair_coeff * * Ea 35.85 Eb -240.2 Ec 449.3 E2 108269.9 K3 1.907 K2 4.872 Rc3 5.2 Rc2 5.2 Rs 5.0 bondL 0.9572 Used in example input script: @@ -105,6 +106,11 @@ atom type is inferred from the ordering of the atoms. Each water molecule must have consecutive IDs with the oxygen first. This pair style does not test that this criteria is met. +.. note:: + + If using type labels, the type labels must be defined before calling + the :doc:`pair_coeff ` command. + The *pair_coeff* command must have at least one keyword/value pair, as described above. The *preset* keyword sets the potential parameters to the values used in :ref:`(Tainter 2011) ` or diff --git a/doc/src/pair_srp.rst b/doc/src/pair_srp.rst index d2b50185ee..b1c3c140d3 100644 --- a/doc/src/pair_srp.rst +++ b/doc/src/pair_srp.rst @@ -23,7 +23,7 @@ Syntax .. parsed-literal:: - *bptype* value = atom type for bond particles + *bptype* value = atom type (numeric or type label) for bond particles *exclude* value = *yes* or *no* Examples @@ -121,6 +121,11 @@ is used. between atom type *bptype* and all other types of atoms. An error will be flagged if :doc:`pair_style hybrid ` is not used. +.. note:: + + If using type labels, the type labels must be defined before calling + the :doc:`pair_coeff ` command. + The optional *exclude* keyword determines if forces are computed between first neighbor (directly connected) bonds. For a setting of *no*, first neighbor forces are computed; for *yes* they are not diff --git a/src/EXTRA-PAIR/pair_e3b.cpp b/src/EXTRA-PAIR/pair_e3b.cpp index 227bc4cd52..e62249025a 100644 --- a/src/EXTRA-PAIR/pair_e3b.cpp +++ b/src/EXTRA-PAIR/pair_e3b.cpp @@ -373,7 +373,7 @@ void PairE3B::allocateE3B() void PairE3B::settings(int narg, char **arg) { if (narg != 1) error->all(FLERR, "Illegal pair_style command"); - typeO = utils::expand_type_int(FLERR, arg[0], Atom::ATOM, lmp); + typeO_str = arg[0]; } /* ---------------------------------------------------------------------- @@ -387,6 +387,8 @@ void PairE3B::coeff(int narg, char **arg) //1=* 2=* 3/4=1st keyword/value if (narg < 4) error->all(FLERR, "There must be at least one keyword given to pair_coeff"); + typeO = utils::expand_type_int(FLERR, typeO_str, Atom::ATOM, lmp); + // clear setflag since coeff() called once with I,J = * * int n = atom->ntypes; for (int i = 1; i <= n; i++) diff --git a/src/EXTRA-PAIR/pair_e3b.h b/src/EXTRA-PAIR/pair_e3b.h index c61bb10798..e5a3293dbb 100644 --- a/src/EXTRA-PAIR/pair_e3b.h +++ b/src/EXTRA-PAIR/pair_e3b.h @@ -36,6 +36,7 @@ class PairE3B : public Pair { protected: //potential parameters + std::string typeO_str; int typeO; double ea, eb, ec; //three body energies double k3; //three body exponential decay (units inverse length) diff --git a/src/MISC/pair_srp.cpp b/src/MISC/pair_srp.cpp index 14237fd711..c75613b08a 100644 --- a/src/MISC/pair_srp.cpp +++ b/src/MISC/pair_srp.cpp @@ -353,9 +353,7 @@ void PairSRP::settings(int narg, char **arg) if (strcmp(arg[1],"*") == 0) { btype = 0; } else { - btype = utils::expand_type_int(FLERR, arg[1], Atom::BOND, lmp); - if ((btype > atom->nbondtypes) || (btype <= 0)) - error->all(FLERR,"Illegal pair_style command"); + btype_str = arg[1]; } // settings @@ -383,20 +381,10 @@ void PairSRP::settings(int narg, char **arg) 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"); + bptype_str = arg[iarg+1]; 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; - } } /* ---------------------------------------------------------------------- @@ -409,6 +397,22 @@ void PairSRP::coeff(int narg, char **arg) error->all(FLERR,"PairSRP: Incorrect args for pair coeff"); if (!allocated) allocate(); + btype = utils::expand_type_int(FLERR, btype_str, Atom::BOND, lmp); + if ((btype > atom->nbondtypes) || (btype <= 0)) + error->all(FLERR,"Illegal pair_style command"); + + bptype = utils::expand_type_int(FLERR, bptype_str, Atom::ATOM, lmp); + if ((bptype < 1) || (bptype > atom->ntypes)) + error->all(FLERR,"Illegal bond particle type for srp"); + + // 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; + } + // set ij bond-bond cutoffs int ilo, ihi, jlo, jhi; utils::bounds(FLERR,arg[0], 1, bptype, ilo, ihi, error); diff --git a/src/MISC/pair_srp.h b/src/MISC/pair_srp.h index 3fb1563728..159e3fbbfe 100644 --- a/src/MISC/pair_srp.h +++ b/src/MISC/pair_srp.h @@ -51,6 +51,7 @@ class PairSRP : public Pair { double **a0; double **srp; double cut_global; + std::string bptype_str, btype_str; int bptype; int btype; class Fix *f_srp;