Recheck existence of pair style in init

This commit is contained in:
Julien Devemy 2019-07-02 16:13:20 +02:00
parent 350d8f5812
commit 9984cbc99a
2 changed files with 16 additions and 1 deletions

View File

@ -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

View File

@ -50,6 +50,7 @@ class ComputePressure : public Compute {
private:
char *pstyle;
int nsub;
};
}