Commit 8fa0700d authored by Steve Plimpton's avatar Steve Plimpton
Browse files

add warning to fix bond/create

parent 7b8498fa
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -33,7 +33,8 @@ using namespace FixConst;

FixBondBreak::FixBondBreak(LAMMPS *lmp, int narg, char **arg) :
  Fix(lmp, narg, arg),
  partner(NULL), finalpartner(NULL), distsq(NULL), probability(NULL), broken(NULL), copy(NULL), random(NULL)
  partner(NULL), finalpartner(NULL), distsq(NULL), probability(NULL), 
  broken(NULL), copy(NULL), random(NULL)
{
  if (narg < 6) error->all(FLERR,"Illegal fix bond/break command");

+14 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#include "respa.h"
#include "atom.h"
#include "force.h"
#include "modify.h"
#include "pair.h"
#include "comm.h"
#include "neighbor.h"
@@ -216,6 +217,19 @@ void FixBondCreate::init()
  if (force->pair == NULL || cutsq > force->pair->cutsq[iatomtype][jatomtype])
    error->all(FLERR,"Fix bond/create cutoff is longer than pairwise cutoff");

  // warn if more than one fix bond/create or also a fix bond/break
  // because this fix stores per-atom state in bondcount
  //   if other fixes create/break bonds, this fix will not know about it

  int count = 0;
  for (int i = 0; i < modify->nfix; i++) {
    if (strcmp(modify->fix[i]->style,"bond/create") == 0) count++;
    if (strcmp(modify->fix[i]->style,"bond/break") == 0) count++;
  }
  if (count > 1 && me == 0) 
    error->warning(FLERR,"Fix bond/create is used multiple times "
                   " or with fix bond/break - may not work as expected");

  // enable angle/dihedral/improper creation if atype/dtype/itype
  //   option was used and a force field has been specified