From 97ba95f30e653021786ad16c382379f33f29abcc Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 5 Oct 2021 10:36:25 -0400 Subject: [PATCH] fix a couple more bugs like in 5246cedda6ab551d201fe36dc4e51206076bfb20 --- src/INTERLAYER/pair_drip.cpp | 3 ++- src/INTERLAYER/pair_ilp_graphene_hbn.cpp | 25 ++++++++++--------- .../pair_kolmogorov_crespi_full.cpp | 25 +++++++++---------- 3 files changed, 27 insertions(+), 26 deletions(-) diff --git a/src/INTERLAYER/pair_drip.cpp b/src/INTERLAYER/pair_drip.cpp index b9a4d1f05b..85b50ba170 100644 --- a/src/INTERLAYER/pair_drip.cpp +++ b/src/INTERLAYER/pair_drip.cpp @@ -58,6 +58,7 @@ PairDRIP::PairDRIP(LAMMPS *lmp) : Pair(lmp) { single_enable = 0; restartinfo = 0; + one_coeff = 1; manybody_flag = 1; centroidstressflag = CENTROID_NOTAVAIL; unit_convert_flag = utils::get_supported_conversions(utils::ENERGY); @@ -258,7 +259,7 @@ void PairDRIP::read_file(char *filename) int n = -1; for (int m = 0; m < nparams; m++) { if (i == params[m].ielement && j == params[m].jelement) { - if (n >= 0) error->all(FLERR, "Potential file has duplicate entry"); + if (n >= 0) error->all(FLERR, "DRIP potential file has duplicate entry"); n = m; } } diff --git a/src/INTERLAYER/pair_ilp_graphene_hbn.cpp b/src/INTERLAYER/pair_ilp_graphene_hbn.cpp index 6f07d1dc1c..632bb6ae70 100644 --- a/src/INTERLAYER/pair_ilp_graphene_hbn.cpp +++ b/src/INTERLAYER/pair_ilp_graphene_hbn.cpp @@ -142,8 +142,8 @@ void PairILPGrapheneHBN::allocate() void PairILPGrapheneHBN::settings(int narg, char **arg) { if (narg < 1 || narg > 2) error->all(FLERR, "Illegal pair_style command"); - if (strcmp(force->pair_style, "hybrid/overlay") != 0) - error->all(FLERR, "ERROR: requires hybrid/overlay pair_style"); + if (!utils::strmatch(force->pair_style, "^hybrid/overlay")) + error->all(FLERR, "Pair style ilp/graphene/hbn must be used as sub-style with hybrid/overlay"); cut_global = utils::numeric(FLERR, arg[0], false, lmp); if (narg == 2) tap_flag = utils::numeric(FLERR, arg[1], false, lmp); @@ -273,16 +273,17 @@ void PairILPGrapheneHBN::read_file(char *filename) nparams++; } - - MPI_Bcast(&nparams, 1, MPI_INT, 0, world); - MPI_Bcast(&maxparam, 1, MPI_INT, 0, world); - - if (comm->me != 0) { - params = (Param *) memory->srealloc(params, maxparam * sizeof(Param), "pair:params"); - } - - MPI_Bcast(params, maxparam * sizeof(Param), MPI_BYTE, 0, world); } + + MPI_Bcast(&nparams, 1, MPI_INT, 0, world); + MPI_Bcast(&maxparam, 1, MPI_INT, 0, world); + + if (comm->me != 0) { + params = (Param *) memory->srealloc(params, maxparam * sizeof(Param), "pair:params"); + } + + MPI_Bcast(params, maxparam * sizeof(Param), MPI_BYTE, 0, world); + memory->destroy(elem2param); memory->destroy(cutILPsq); memory->create(elem2param, nelements, nelements, "pair:elem2param"); @@ -292,7 +293,7 @@ void PairILPGrapheneHBN::read_file(char *filename) int n = -1; for (int m = 0; m < nparams; m++) { if (i == params[m].ielement && j == params[m].jelement) { - if (n >= 0) error->all(FLERR, "ILP Potential file has duplicate entry"); + if (n >= 0) error->all(FLERR, "ILP potential file has duplicate entry"); n = m; } } diff --git a/src/INTERLAYER/pair_kolmogorov_crespi_full.cpp b/src/INTERLAYER/pair_kolmogorov_crespi_full.cpp index f724b4d819..a107ed29a0 100644 --- a/src/INTERLAYER/pair_kolmogorov_crespi_full.cpp +++ b/src/INTERLAYER/pair_kolmogorov_crespi_full.cpp @@ -34,7 +34,6 @@ #include "neigh_request.h" #include "neighbor.h" #include "potential_file_reader.h" -#include "tokenizer.h" #include #include @@ -142,8 +141,8 @@ void PairKolmogorovCrespiFull::allocate() void PairKolmogorovCrespiFull::settings(int narg, char **arg) { if (narg < 1 || narg > 2) error->all(FLERR, "Illegal pair_style command"); - if (strcmp(force->pair_style, "hybrid/overlay") != 0) - error->all(FLERR, "ERROR: requires hybrid/overlay pair_style"); + if (!utils::strmatch(force->pair_style, "^hybrid/overlay")) + error->all(FLERR, "Pair style kolmogorov/crespi/full must be used as sub-style with hybrid/overlay"); cut_global = utils::numeric(FLERR, arg[0], false, lmp); if (narg == 2) tap_flag = utils::numeric(FLERR, arg[1], false, lmp); @@ -270,17 +269,17 @@ void PairKolmogorovCrespiFull::read_file(char *filename) nparams++; } - - MPI_Bcast(&nparams, 1, MPI_INT, 0, world); - MPI_Bcast(&maxparam, 1, MPI_INT, 0, world); - - if (comm->me != 0) { - params = (Param *) memory->srealloc(params, maxparam * sizeof(Param), "pair:params"); - } - - MPI_Bcast(params, maxparam * sizeof(Param), MPI_BYTE, 0, world); } + MPI_Bcast(&nparams, 1, MPI_INT, 0, world); + MPI_Bcast(&maxparam, 1, MPI_INT, 0, world); + + if (comm->me != 0) { + params = (Param *) memory->srealloc(params, maxparam * sizeof(Param), "pair:params"); + } + + MPI_Bcast(params, maxparam * sizeof(Param), MPI_BYTE, 0, world); + memory->destroy(elem2param); memory->destroy(cutKCsq); memory->create(elem2param, nelements, nelements, "pair:elem2param"); @@ -290,7 +289,7 @@ void PairKolmogorovCrespiFull::read_file(char *filename) int n = -1; for (int m = 0; m < nparams; m++) { if (i == params[m].ielement && j == params[m].jelement) { - if (n >= 0) error->all(FLERR, "KC Potential file has duplicate entry"); + if (n >= 0) error->all(FLERR, "KC potential file has duplicate entry"); n = m; } }