diff --git a/src/pair.cpp b/src/pair.cpp index 432680b324..db9792cdbc 100644 --- a/src/pair.cpp +++ b/src/pair.cpp @@ -86,6 +86,7 @@ Pair::Pair(LAMMPS *lmp) : Pointers(lmp) manybody_flag = 0; offset_flag = 0; mix_flag = GEOMETRIC; + mixed_flag = 1; tail_flag = 0; etail = ptail = etail_ij = ptail_ij = 0.0; ncoultablebits = 12; @@ -251,10 +252,12 @@ void Pair::init() cutforce = 0.0; etail = ptail = 0.0; + mixed_flag = 1; double cut; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { + if ((i != j) && setflag[i][j]) mixed_flag = 0; cut = init_one(i,j); cutsq[i][j] = cutsq[j][i] = cut*cut; cutforce = MAX(cutforce,cut); diff --git a/src/pair.h b/src/pair.h index 0664e97462..00f433233e 100644 --- a/src/pair.h +++ b/src/pair.h @@ -105,6 +105,7 @@ class Pair : protected Pointers { int allocated; // 0/1 = whether arrays are allocated // public so external driver can check int compute_flag; // 0 if skip compute() + int mixed_flag; // 1 if all itype != jtype coeffs are from mixing enum{GEOMETRIC,ARITHMETIC,SIXTHPOWER}; // mixing options diff --git a/src/write_data.cpp b/src/write_data.cpp index 511552cf69..d549d8bf77 100644 --- a/src/write_data.cpp +++ b/src/write_data.cpp @@ -303,6 +303,9 @@ void WriteData::force_fields() { if (force->pair && force->pair->writedata) { if (pairflag == II) { + if ((comm->me == 0) && (force->pair->mixed_flag == 0)) + error->warning(FLERR,"Not all mixed pair coeffs generated from mixing. " + "Use write_data with 'pair ij' option to store all pair coeffs."); fmt::print(fp,"\nPair Coeffs # {}\n\n", force->pair_style); force->pair->write_data(fp); } else if (pairflag == IJ) {