diff --git a/doc/src/pair_coul.rst b/doc/src/pair_coul.rst index 6372838620..7ae7809fd7 100644 --- a/doc/src/pair_coul.rst +++ b/doc/src/pair_coul.rst @@ -145,10 +145,10 @@ Examples pair_style tip4p/long 1 2 7 8 0.15 10.0 pair_coeff * * + pair_style tip4p/cut OW HW HW-OW HW-OW-HW 0.15 12.0 labelmap atom 1 OW 2 HW labelmap bond 1 HW-OW labelmap angle 1 HW-OW-HW - pair_style tip4p/cut OW HW HW-OW HW-OW-HW 0.15 12.0 pair_coeff * * Description @@ -320,6 +320,11 @@ Coulombic solver (Ewald or PPPM). atom. For example, if the atom ID of an O atom in a TIP4P water molecule is 500, then its 2 H atoms must have IDs 501 and 502. +.. note:: + + If using type labels, the type labels must be defined before calling + the :doc:`pair_coeff ` command. + See the :doc:`Howto tip4p ` page for more information on how to use the TIP4P pair styles and lists of parameters to set. Note that the neighbor list cutoff for Coulomb interactions is @@ -394,9 +399,10 @@ Restrictions """""""""""" The *coul/long*, *coul/msm*, *coul/streitz*, and *tip4p/long* styles are -part of the KSPACE package. The *coul/cut/global* and *coul/exclude* are -part of the EXTRA-PAIR package. A pair style is only enabled if LAMMPS was -built with its corresponding package. See the :doc:`Build package ` +part of the KSPACE package. The *coul/cut/global*, *coul/exclude* styles are +part of the EXTRA-PAIR package. The *tip4p/cut* style is part of the MOLECULE +package. A pair style is only enabled if LAMMPS was built with its +corresponding package. See the :doc:`Build package ` doc page for more info. Related commands diff --git a/doc/src/pair_fep_soft.rst b/doc/src/pair_fep_soft.rst index a3659499bd..9fbf2d49d4 100644 --- a/doc/src/pair_fep_soft.rst +++ b/doc/src/pair_fep_soft.rst @@ -161,10 +161,12 @@ Examples pair_coeff * * 0.155 3.1536 1.0 pair_coeff 1 1 0.155 3.1536 1.0 9.5 + pair_style lj/cut/tip4p/long/soft OW HW HW-OW HW-OW-HW 0.15 2.0 0.5 10.0 9.8 labelmap atom 1 OW 2 HW labelmap bond 1 HW-OW labelmap angle 1 HW-OW-HW - pair_style lj/cut/tip4p/long/soft OW HW HW-OW HW-OW-HW 0.15 2.0 0.5 10.0 9.8 + pair_coeff * * 0.155 3.1536 1.0 + pair_coeff OW OW 0.155 3.1536 1.0 9.5 pair_style lj/charmm/coul/long 2.0 0.5 10.0 8.0 10.0 pair_style lj/charmm/coul/long 2.0 0.5 10.0 8.0 10.0 9.0 @@ -280,6 +282,11 @@ TIP4P water model and before the cutoffs. The activation parameter lambda is supplied as an argument of the :doc:`pair_coeff ` command, after epsilon and sigma and before the optional cutoffs. +.. note:: + + If using type labels, the type labels must be defined before calling + the :doc:`pair_coeff ` command. + Style *lj/charmm/coul/long/soft* implements a soft-core version of the modified 12-6 LJ potential used in CHARMM and documented in the :doc:`pair_style lj/charmm/coul/long ` style. In the soft version the parameters diff --git a/doc/src/pair_lj_cut_tip4p.rst b/doc/src/pair_lj_cut_tip4p.rst index 90fd3f8fd8..cc9b328021 100644 --- a/doc/src/pair_lj_cut_tip4p.rst +++ b/doc/src/pair_lj_cut_tip4p.rst @@ -55,10 +55,12 @@ Examples pair_coeff * * 100.0 3.0 pair_coeff 1 1 100.0 3.5 9.0 + pair_style lj/cut/tip4p/long OW HW HW-OW HW-OW-HW 0.15 12.0 labelmap atom 1 OW 2 HW labelmap bond 1 HW-OW labelmap angle 1 HW-OW-HW - pair_style lj/cut/tip4p/long OW HW HW-OW HW-OW-HW 0.15 12.0 + pair_coeff * * 100.0 3.0 + pair_coeff OW OW 100.0 3.5 9.0 Description """"""""""" @@ -86,6 +88,11 @@ with a long-range Coulombic solver (Ewald or PPPM). atom. For example, if the atom ID of an O atom in a TIP4P water molecule is 500, then its 2 H atoms must have IDs 501 and 502. +.. note:: + + If using type labels, the type labels must be defined before calling + the :doc:`pair_coeff ` command. + See the :doc:`Howto tip4p ` page for more information on how to use the TIP4P pair styles and lists of parameters to set. Note that the neighbor list cutoff for Coulomb interactions is diff --git a/doc/src/pair_lj_long.rst b/doc/src/pair_lj_long.rst index 8ed927f932..61336e79a1 100644 --- a/doc/src/pair_lj_long.rst +++ b/doc/src/pair_lj_long.rst @@ -66,10 +66,12 @@ Examples pair_coeff * * 100.0 3.0 pair_coeff 1 1 100.0 3.5 9.0 + pair_style lj/long/tip4p/long long long OW HW HW-OW HW-OW-HW 0.15 12.0 labelmap atom 1 OW 2 HW labelmap bond 1 HW-OW labelmap angle 1 HW-OW-HW - pair_style lj/long/tip4p/long long long OW HW HW-OW HW-OW-HW 0.15 12.0 + pair_coeff * * 100.0 3.0 + pair_coeff OW OW 100.0 3.5 9.0 Description """"""""""" @@ -118,6 +120,11 @@ massless charge site are specified as pair_style arguments. atom. For example, if the atom ID of an O atom in a TIP4P water molecule is 500, then its 2 H atoms must have IDs 501 and 502. +.. note:: + + If using type labels, the type labels must be defined before calling + the :doc:`pair_coeff ` command. + See the :doc:`Howto tip4p ` page for more information on how to use the TIP4P pair style. Note that the neighbor list cutoff for Coulomb interactions is effectively extended diff --git a/src/FEP/pair_lj_cut_tip4p_long_soft.cpp b/src/FEP/pair_lj_cut_tip4p_long_soft.cpp index 62ee64f1bd..8a5618fc58 100644 --- a/src/FEP/pair_lj_cut_tip4p_long_soft.cpp +++ b/src/FEP/pair_lj_cut_tip4p_long_soft.cpp @@ -408,10 +408,10 @@ void PairLJCutTIP4PLongSoft::settings(int narg, char **arg) { if (narg < 9 || narg > 10) error->all(FLERR,"Illegal pair_style command"); - typeO = utils::expand_type_int(FLERR, arg[0], Atom::ATOM, lmp); - typeH = utils::expand_type_int(FLERR, arg[1], Atom::ATOM, lmp); - typeB = utils::expand_type_int(FLERR, arg[2], Atom::BOND, lmp); - typeA = utils::expand_type_int(FLERR, arg[3], Atom::ANGLE, lmp); + typeO_str = arg[0]; + typeH_str = arg[1]; + typeB_str = arg[2]; + typeA_str = arg[3]; qdist = utils::numeric(FLERR, arg[4], false, lmp); nlambda = utils::numeric(FLERR, arg[5], false, lmp); alphalj = utils::numeric(FLERR, arg[6], false, lmp); @@ -431,6 +431,22 @@ void PairLJCutTIP4PLongSoft::settings(int narg, char **arg) } } +/* ---------------------------------------------------------------------- + set coeffs for one or more type pairs +------------------------------------------------------------------------- */ + +void PairLJCutTIP4PLongSoft::coeff(int narg, char **arg) +{ + // set atom types from pair_style command + + typeO = utils::expand_type_int(FLERR, typeO_str, Atom::ATOM, lmp); + typeH = utils::expand_type_int(FLERR, typeH_str, Atom::ATOM, lmp); + typeB = utils::expand_type_int(FLERR, typeB_str, Atom::BOND, lmp); + typeA = utils::expand_type_int(FLERR, typeA_str, Atom::ANGLE, lmp); + + PairLJCutCoulLongSoft::coeff(narg, arg); +} + /* ---------------------------------------------------------------------- init specific to this pair style ------------------------------------------------------------------------- */ diff --git a/src/FEP/pair_lj_cut_tip4p_long_soft.h b/src/FEP/pair_lj_cut_tip4p_long_soft.h index 3d54376a20..7bbf2e36d3 100644 --- a/src/FEP/pair_lj_cut_tip4p_long_soft.h +++ b/src/FEP/pair_lj_cut_tip4p_long_soft.h @@ -30,6 +30,7 @@ class PairLJCutTIP4PLongSoft : public PairLJCutCoulLongSoft { ~PairLJCutTIP4PLongSoft() override; void compute(int, int) override; void settings(int, char **) override; + void coeff(int, char **) override; void init_style() override; double init_one(int, int) override; void write_restart_settings(FILE *fp) override; @@ -38,6 +39,7 @@ class PairLJCutTIP4PLongSoft : public PairLJCutCoulLongSoft { double memory_usage() override; protected: + std::string typeH_str, typeO_str, typeA_str, typeB_str; int typeH, typeO; // atom types of TIP4P water H and O atoms int typeA, typeB; // angle and bond types of TIP4P water double alpha; // geometric constraint parameter for TIP4P diff --git a/src/FEP/pair_tip4p_long_soft.cpp b/src/FEP/pair_tip4p_long_soft.cpp index 44dd9552d2..19ff545ba8 100644 --- a/src/FEP/pair_tip4p_long_soft.cpp +++ b/src/FEP/pair_tip4p_long_soft.cpp @@ -376,10 +376,10 @@ void PairTIP4PLongSoft::settings(int narg, char **arg) { if (narg != 8) error->all(FLERR,"Illegal pair_style command"); - typeO = utils::expand_type_int(FLERR, arg[0], Atom::ATOM, lmp); - typeH = utils::expand_type_int(FLERR, arg[1], Atom::ATOM, lmp); - typeB = utils::expand_type_int(FLERR, arg[2], Atom::BOND, lmp); - typeA = utils::expand_type_int(FLERR, arg[3], Atom::ANGLE, lmp); + typeO_str = arg[0]; + typeH_str = arg[1]; + typeB_str = arg[2]; + typeA_str = arg[3]; qdist = utils::numeric(FLERR, arg[4], false, lmp); nlambda = utils::numeric(FLERR, arg[5], false, lmp); @@ -388,6 +388,22 @@ void PairTIP4PLongSoft::settings(int narg, char **arg) cut_coul = utils::numeric(FLERR, arg[7], false, lmp); } +/* ---------------------------------------------------------------------- + set coeffs for one or more type pairs +------------------------------------------------------------------------- */ + +void PairTIP4PLongSoft::coeff(int narg, char **arg) +{ + // set atom types from pair_style command + + typeO = utils::expand_type_int(FLERR, typeO_str, Atom::ATOM, lmp); + typeH = utils::expand_type_int(FLERR, typeH_str, Atom::ATOM, lmp); + typeB = utils::expand_type_int(FLERR, typeB_str, Atom::BOND, lmp); + typeA = utils::expand_type_int(FLERR, typeA_str, Atom::ANGLE, lmp); + + PairCoulLongSoft::coeff(narg, arg); +} + /* ---------------------------------------------------------------------- init specific to this pair style ------------------------------------------------------------------------- */ diff --git a/src/FEP/pair_tip4p_long_soft.h b/src/FEP/pair_tip4p_long_soft.h index af30d77b05..b503f610fb 100644 --- a/src/FEP/pair_tip4p_long_soft.h +++ b/src/FEP/pair_tip4p_long_soft.h @@ -30,6 +30,7 @@ class PairTIP4PLongSoft : public PairCoulLongSoft { ~PairTIP4PLongSoft() override; void compute(int, int) override; void settings(int, char **) override; + void coeff(int, char **) override; void init_style() override; double init_one(int, int) override; void write_restart_settings(FILE *fp) override; @@ -38,6 +39,7 @@ class PairTIP4PLongSoft : public PairCoulLongSoft { double memory_usage() override; protected: + std::string typeH_str, typeO_str, typeA_str, typeB_str; int typeH, typeO; // atom types of TIP4P water H and O atoms int typeA, typeB; // angle and bond types of TIP4P water double alpha; // geometric constraint parameter for TIP4P diff --git a/src/MOLECULE/pair_lj_cut_tip4p_cut.cpp b/src/MOLECULE/pair_lj_cut_tip4p_cut.cpp index 899768082b..2119cfeb4e 100644 --- a/src/MOLECULE/pair_lj_cut_tip4p_cut.cpp +++ b/src/MOLECULE/pair_lj_cut_tip4p_cut.cpp @@ -426,10 +426,10 @@ void PairLJCutTIP4PCut::settings(int narg, char **arg) { if (narg < 6 || narg > 7) error->all(FLERR,"Illegal pair_style command"); - typeO = utils::expand_type_int(FLERR, arg[0], Atom::ATOM, lmp); - typeH = utils::expand_type_int(FLERR, arg[1], Atom::ATOM, lmp); - typeB = utils::expand_type_int(FLERR, arg[2], Atom::BOND, lmp); - typeA = utils::expand_type_int(FLERR, arg[3], Atom::ANGLE, lmp); + typeO_str = arg[0]; + typeH_str = arg[1]; + typeB_str = arg[2]; + typeA_str = arg[3]; qdist = utils::numeric(FLERR, arg[4], false, lmp); cut_lj_global = utils::numeric(FLERR, arg[5], false, lmp); @@ -457,6 +457,13 @@ void PairLJCutTIP4PCut::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); if (!allocated) allocate(); + // set atom types from pair_style command + + typeO = utils::expand_type_int(FLERR, typeO_str, Atom::ATOM, lmp); + typeH = utils::expand_type_int(FLERR, typeH_str, Atom::ATOM, lmp); + typeB = utils::expand_type_int(FLERR, typeB_str, Atom::BOND, lmp); + typeA = utils::expand_type_int(FLERR, typeA_str, Atom::ANGLE, lmp); + int ilo,ihi,jlo,jhi; utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); diff --git a/src/MOLECULE/pair_lj_cut_tip4p_cut.h b/src/MOLECULE/pair_lj_cut_tip4p_cut.h index 75769274a8..a30845274a 100644 --- a/src/MOLECULE/pair_lj_cut_tip4p_cut.h +++ b/src/MOLECULE/pair_lj_cut_tip4p_cut.h @@ -50,6 +50,7 @@ class PairLJCutTIP4PCut : public Pair { double **epsilon, **sigma; double **lj1, **lj2, **lj3, **lj4, **offset; + std::string typeH_str, typeO_str, typeA_str, typeB_str; int typeH, typeO; // atom types of TIP4P water H and O atoms int typeA, typeB; // angle and bond types of TIP4P water double alpha; // geometric constraint parameter for TIP4P diff --git a/src/MOLECULE/pair_tip4p_cut.cpp b/src/MOLECULE/pair_tip4p_cut.cpp index d8d657850a..a2031074f6 100644 --- a/src/MOLECULE/pair_tip4p_cut.cpp +++ b/src/MOLECULE/pair_tip4p_cut.cpp @@ -375,10 +375,10 @@ void PairTIP4PCut::settings(int narg, char **arg) { if (narg != 6) error->all(FLERR,"Illegal pair_style command"); - typeO = utils::expand_type_int(FLERR, arg[0], Atom::ATOM, lmp); - typeH = utils::expand_type_int(FLERR, arg[1], Atom::ATOM, lmp); - typeB = utils::expand_type_int(FLERR, arg[2], Atom::BOND, lmp); - typeA = utils::expand_type_int(FLERR, arg[3], Atom::ANGLE, lmp); + typeO_str = arg[0]; + typeH_str = arg[1]; + typeB_str = arg[2]; + typeA_str = arg[3]; qdist = utils::numeric(FLERR, arg[4], false, lmp); cut_coul = utils::numeric(FLERR, arg[5], false, lmp); @@ -396,6 +396,13 @@ void PairTIP4PCut::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); if (!allocated) allocate(); + // set atom types from pair_style command + + typeO = utils::expand_type_int(FLERR, typeO_str, Atom::ATOM, lmp); + typeH = utils::expand_type_int(FLERR, typeH_str, Atom::ATOM, lmp); + typeB = utils::expand_type_int(FLERR, typeB_str, Atom::BOND, lmp); + typeA = utils::expand_type_int(FLERR, typeA_str, Atom::ANGLE, lmp); + int ilo,ihi,jlo,jhi; utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); diff --git a/src/MOLECULE/pair_tip4p_cut.h b/src/MOLECULE/pair_tip4p_cut.h index 73dced7432..e7baeeaa2f 100644 --- a/src/MOLECULE/pair_tip4p_cut.h +++ b/src/MOLECULE/pair_tip4p_cut.h @@ -45,6 +45,7 @@ class PairTIP4PCut : public Pair { double cut_coul, cut_coulsq; double cut_coulsqplus; // extended value for cut_coulsq + std::string typeH_str, typeO_str, typeA_str, typeB_str; int typeH, typeO; // atom types of TIP4P water H and O atoms int typeA, typeB; // angle and bond types of TIP4P water double alpha; // geometric constraint parameter for TIP4P