Unverified Commit d63f3d87 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer Committed by GitHub
Browse files

Merge pull request #2292 from akohlmey/warning-no-mixing-data-file

Print warning when writing PairCoeff section in data file may not sufficiently reproduce all pair coefficients
parents dae2cb26 0d38a141
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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);
+1 −0
Original line number Diff line number Diff line
@@ -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

+3 −0
Original line number Diff line number Diff line
@@ -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) {