From 9984cbc99a371665d933e974bb0c84e66c720846 Mon Sep 17 00:00:00 2001 From: Julien Devemy Date: Tue, 2 Jul 2019 16:13:20 +0200 Subject: [PATCH] Recheck existence of pair style in init --- src/compute_pressure.cpp | 16 +++++++++++++++- src/compute_pressure.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/compute_pressure.cpp b/src/compute_pressure.cpp index d586b7d953..2f412c23a0 100644 --- a/src/compute_pressure.cpp +++ b/src/compute_pressure.cpp @@ -87,7 +87,7 @@ ComputePressure::ComputePressure(LAMMPS *lmp, int narg, char **arg) : pstyle = new char[n]; strcpy(pstyle,arg[iarg++]); - int nsub = 0; + nsub = 0; if (narg > iarg) { if (isdigit(arg[iarg][0])) { @@ -166,6 +166,20 @@ void ComputePressure::init() temperature = modify->compute[icompute]; } + // recheck if pair style with and without suffix exists + + if (pairhybridflag) { + pairhybrid = (Pair *) force->pair_match(pstyle,1,nsub); + if (!pairhybrid && lmp->suffix) { + strcat(pstyle,"/"); + strcat(pstyle,lmp->suffix); + pairhybrid = (Pair *) force->pair_match(pstyle,1,nsub); + } + + if (!pairhybrid) + error->all(FLERR,"Unrecognized pair style in compute pressure command"); + } + // detect contributions to virial // vptr points to all virial[6] contributions diff --git a/src/compute_pressure.h b/src/compute_pressure.h index 76a4066179..8d0ec4aa04 100644 --- a/src/compute_pressure.h +++ b/src/compute_pressure.h @@ -50,6 +50,7 @@ class ComputePressure : public Compute { private: char *pstyle; + int nsub; }; }