From f1ee46cc6467fbd53f1027f027b3145c516fc9e9 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer <akohlmey@gmail.com> Date: Thu, 19 Apr 2018 18:24:19 -0400 Subject: [PATCH] add check to require atom attribute molecule to avoid segfaults, when it is missing --- src/USER-MISC/pair_coul_shield.cpp | 2 ++ src/USER-MISC/pair_ilp_graphene_hbn.cpp | 4 +++- src/USER-MISC/pair_kolmogorov_crespi_full.cpp | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/USER-MISC/pair_coul_shield.cpp b/src/USER-MISC/pair_coul_shield.cpp index 0f7852163c..8df172dc66 100644 --- a/src/USER-MISC/pair_coul_shield.cpp +++ b/src/USER-MISC/pair_coul_shield.cpp @@ -231,6 +231,8 @@ void PairCoulShield::init_style() { if (!atom->q_flag) error->all(FLERR,"Pair style coul/shield requires atom attribute q"); + if (!atom->molecule_flag) + error->all(FLERR,"Pair style coul/shield requires atom attribute molecule"); neighbor->request(this,instance_me); } diff --git a/src/USER-MISC/pair_ilp_graphene_hbn.cpp b/src/USER-MISC/pair_ilp_graphene_hbn.cpp index 02c33c7e86..51b3ac9654 100644 --- a/src/USER-MISC/pair_ilp_graphene_hbn.cpp +++ b/src/USER-MISC/pair_ilp_graphene_hbn.cpp @@ -636,7 +636,9 @@ void PairILPGrapheneHBN::calc_normal() void PairILPGrapheneHBN::init_style() { if (force->newton_pair == 0) - error->all(FLERR,"Pair style ILP requires newton pair on"); + error->all(FLERR,"Pair style ilp/graphene/hbn requires newton pair on"); + if (!atom->molecule_flag) + error->all(FLERR,"Pair style ilp/graphene/hbn requires atom attribute molecule"); // need a full neighbor list, including neighbors of ghosts diff --git a/src/USER-MISC/pair_kolmogorov_crespi_full.cpp b/src/USER-MISC/pair_kolmogorov_crespi_full.cpp index a7eebe0b3f..fa42a31f22 100644 --- a/src/USER-MISC/pair_kolmogorov_crespi_full.cpp +++ b/src/USER-MISC/pair_kolmogorov_crespi_full.cpp @@ -640,7 +640,9 @@ void PairKolmogorovCrespiFull::calc_normal() void PairKolmogorovCrespiFull::init_style() { if (force->newton_pair == 0) - error->all(FLERR,"Pair style KC requires newton pair on"); + error->all(FLERR,"Pair style kolmolgorov/crespi/full requires newton pair on"); + if (!atom->molecule_flag) + error->all(FLERR,"Pair style kolmolgorov/crespi/full requires atom attribute molecule"); // need a full neighbor list, including neighbors of ghosts -- GitLab