From ba27ecf6102b17d1f92037e488effbcad279cd77 Mon Sep 17 00:00:00 2001 From: rohskopf Date: Mon, 3 Oct 2022 11:53:41 -0600 Subject: [PATCH] Add optional full flag to pair_zero --- src/pair_zero.cpp | 30 ++++++++++++++++++++++++++++-- src/pair_zero.h | 2 ++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/pair_zero.cpp b/src/pair_zero.cpp index 83505edd35..e253cd2aa5 100644 --- a/src/pair_zero.cpp +++ b/src/pair_zero.cpp @@ -21,6 +21,8 @@ #include "comm.h" #include "error.h" #include "memory.h" +#include "neigh_list.h" +#include "neighbor.h" #include @@ -34,6 +36,7 @@ PairZero::PairZero(LAMMPS *lmp) : Pair(lmp) writedata = 1; single_enable = 1; respa_enable = 1; + fullneighflag = 0; } /* ---------------------------------------------------------------------- */ @@ -85,12 +88,23 @@ void PairZero::allocate() void PairZero::settings(int narg, char **arg) { - if ((narg != 1) && (narg != 2)) error->all(FLERR, "Illegal pair_style command"); + if ((narg != 1) && (narg != 2) && (narg != 3)) error->all(FLERR, "Illegal pair_style command"); cut_global = utils::numeric(FLERR, arg[0], false, lmp); - if (narg == 2) { + + if (narg == 2){ if (strcmp("nocoeff", arg[1]) == 0) coeffflag = 0; + else if(strcmp("full", arg[1]) == 0) + fullneighflag = 1; + else + error->all(FLERR, "Illegal pair_style command"); + } + else if (narg == 3) { + if (strcmp("nocoeff", arg[1]) == 0 || strcmp("nocoeff", arg[2]) == 0) + coeffflag = 0; + else if(strcmp("full", arg[1]) == 0 || strcmp("full", arg[2]) == 0) + fullneighflag = 1; else error->all(FLERR, "Illegal pair_style command"); } @@ -134,6 +148,18 @@ void PairZero::coeff(int narg, char **arg) if (count == 0) error->all(FLERR, "Incorrect args for pair coefficients"); } +/* ---------------------------------------------------------------------- + init specific to this pair style +------------------------------------------------------------------------- */ + +void PairZero::init_style() +{ + if (fullneighflag == 0) + neighbor->add_request(this, NeighConst::REQ_DEFAULT); + else + neighbor->add_request(this, NeighConst::REQ_FULL); +} + /* ---------------------------------------------------------------------- init for one type pair i,j and corresponding j,i ------------------------------------------------------------------------- */ diff --git a/src/pair_zero.h b/src/pair_zero.h index 03b6d096a1..10102f1cad 100644 --- a/src/pair_zero.h +++ b/src/pair_zero.h @@ -42,6 +42,7 @@ class PairZero : public Pair { void compute_outer(int, int) override; void settings(int, char **) override; void coeff(int, char **) override; + void init_style() override; double init_one(int, int) override; void write_restart(FILE *) override; void read_restart(FILE *) override; @@ -55,6 +56,7 @@ class PairZero : public Pair { double cut_global; double **cut; int coeffflag; + int fullneighflag; // 0 for half list, 1 for full list virtual void allocate(); };