Merge pull request from lammps/fix-bond-create-warn

add warning to fix bond/create
This commit is contained in:
Axel Kohlmeyer 2020-01-11 18:49:17 -05:00 committed by GitHub
commit 0c1157362a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 36 additions and 1 deletions

View File

@ -195,6 +195,12 @@ Doc page with :doc:`ERROR messages <Errors_messages>`
*Fix SRD walls overlap but fix srd overlap not set*
You likely want to set this in your input script.
* Fix bond/create is used multiple times or with fix bond/break - may not work as expected*
When using fix bond/create multiple times or in combination with
fix bond/break, the individual fix instances do not share information
about changes they made at the same time step and thus it may result
in unexpected behavior.
*Fix bond/swap will ignore defined angles*
See the doc page for fix bond/swap for more info on this
restriction.

View File

@ -239,6 +239,13 @@ will be truncated to attempt to prevent the bond from blowing up. :dd
You likely want to set this in your input script. :dd
{ Fix bond/create is used multiple times or with fix bond/break - may not work as expected} :dt
When using fix bond/create multiple times or in combination with
fix bond/break, the individual fix instances do not share information
about changes they made at the same time step and thus it may result
in unexpected behavior. :dd
{Fix bond/swap will ignore defined angles} :dt
See the doc page for fix bond/swap for more info on this

View File

@ -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");

View File

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

View File

@ -170,4 +170,11 @@ See the read_data command for info on setting the "extra special per
atom" header value to allow for additional special values to be
stored.
W: Fix bond/create is used multiple times or with fix bond/break - may not work as expected
When using fix bond/create multiple times or in combination with
fix bond/break, the individual fix instances do not share information
about changes they made at the same time step and thus it may result
in unexpected behavior.
*/